content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
""" 5. Faa um programa que receba do usurio um arquivo texto e um caracter. Mostre na tela quantas vezes aquele caractere ocorre dentro do arquivo. """ arquivo=open('CursoUdemyPython/exercicios/Lista6/arq.txt') texto=arquivo.read() carac=input('Informe um caractere: ') ca=0 for c in texto: if(c == carac): ca+=1 arquivo.close() print(f"Foi identificado {ca} deste caractere")
[ 37811, 642, 13, 376, 7252, 23781, 1430, 64, 8358, 1407, 7012, 466, 39954, 952, 23781, 610, 421, 23593, 2420, 78, 304, 23781, 1097, 7321, 13, 4042, 260, 12385, 256, 10304, 198, 40972, 292, 1569, 12271, 257, 4188, 293, 1097, 529, 567, 2...
2.327381
168
#--------------------------------------------------------- # Superset specific config #--------------------------------------------------------- ROW_LIMIT = 5000 SUPERSET_WEBSERVER_PORT = 8088 #--------------------------------------------------------- #--------------------------------------------------------- # Flask App Builder configuration #--------------------------------------------------------- # Your App secret key SECRET_KEY = '\2\1ulan123456\1\2\e\y\y\h' # The SQLAlchemy connection string to your database backend # This connection defines the path to the database that stores your # superset metadata (slices, connections, tables, dashboards, ...). # Note that the connection information to connect to the datasources # you want to explore are managed directly in the web UI #SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://superset:superset@localhost:5432/superset' # ------------------------------ # GLOBALS FOR APP Builder # ------------------------------ # Uncomment to setup Your App name APP_NAME = 'Insights' # Uncomment to setup an App icon APP_ICON = '/static/assets/images/qmatic_insights-logo.png' # Extract and use X-Forwarded-For/X-Forwarded-Proto headers? ENABLE_PROXY_FIX = True ENABLE_JAVASCRIPT_CONTROLS = True ''' import os from flask_appbuilder.security.manager import AUTH_OID, AUTH_REMOTE_USER, AUTH_DB, AUTH_LDAP, AUTH_OAUTH basedir = os.path.abspath(os.path.dirname(__file__)) SUPERSET_WORKERS = 8 CSRF_ENABLED = True AUTH_TYPE = AUTH_OAUTH AUTH_USER_REGISTRATION = False AUTH_USER_REGISTRATION_ROLE = "Gamma" #"Public" OAUTH_PROVIDERS = [ { 'name': 'google', 'icon': 'fa-google', 'token_key': 'access_token', 'remote_app': { 'base_url': 'https://www.googleapis.com/oauth2/v2/', 'request_token_params': { 'scope': 'email profile' }, 'request_token_url': None, 'access_token_url': 'https://accounts.google.com/o/oauth2/token', 'authorize_url': 'https://accounts.google.com/o/oauth2/auth', 'consumer_key': '996225546131-1qd2alfrrp1scf6gvkeg63mg2ku85lka.apps.googleusercontent.com', 'consumer_secret': '3fxwT-a8YA1akyuUYFfakMCz' } }, { 'name': 'slatest.qmaticcloud.com', 'icon': 'fa-google', 'token_key': 'access_token', 'remote_app': { #'base_url': 'https://slatest.qmaticcloud.com/oauth2server/oauth/', 'base_url': None, 'request_token_params': { 'scope': 'user_info', 'state': '123' }, 'request_token_url': None, 'access_token_url': 'https://slatest.qmaticcloud.com/oauth2server/oauth/token', 'authorize_url': 'https://slatest.qmaticcloud.com/oauth2server/oauth/authorize', 'consumer_key': 'businessintelligence', 'consumer_secret': 'fSmI0K1uSvnORBk3' } }, { 'name': 'msdemo.qmatic.cloud', 'icon': 'fa-google', 'token_key': 'access_token', 'remote_app': { 'base_url': None, 'request_token_params': { 'scope': 'user_info', 'state': '123' }, 'request_token_url': None, 'access_token_url': 'https://msdemo.qmatic.cloud/oauth2server/oauth/token', 'authorize_url': 'https://msdemo.qmatic.cloud/oauth2server/oauth/authorize', 'consumer_key': 'businessintelligence', 'consumer_secret': 'fSmI0K1uSvnORBk3' } } ] '''
[ 2, 43801, 12, 198, 2, 5200, 364, 316, 2176, 4566, 198, 2, 43801, 12, 198, 49, 3913, 62, 43, 3955, 2043, 796, 23336, 198, 198, 40331, 4877, 2767, 62, 8845, 4462, 1137, 5959, 62, 15490, 796, 41241, 23, 198, 2, 43801, 12, 198, 198, ...
2.212664
1,674
import argparse import cv2 import re import numpy as np import string import PIL import os,glob import ntpath import time import matplotlib.pyplot as plt from PIL import Image from yad2k.models.keras_yolo import (preprocess_true_boxes, yolo_body, yolo_eval, yolo_head, yolo_loss) from yad2k.utils.draw_boxes import draw_boxes from retrain_yolo import (create_model,get_classes) import keras.backend as K from crnn.train_crnn import create_crnn_model from crnn.crnn_data_gen import * char_list = string.ascii_letters+string.digits YOLO_ANCHORS = np.array( ((0.57273, 0.677385), (1.87446, 2.06253), (3.33843, 5.47434), (7.88282, 3.52778), (9.77052, 9.16828))) class_names=['plate','no-plate']
[ 11748, 1822, 29572, 198, 11748, 269, 85, 17, 198, 11748, 302, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 4731, 198, 11748, 350, 4146, 198, 11748, 28686, 11, 4743, 672, 198, 11748, 299, 83, 6978, 198, 11748, 640, 198, 11748, 2603, ...
2.321875
320
""" =================================================================== Plot time-frequency representations on topographies for MEG sensors =================================================================== Both induced power and phase locking values are displayed. """ print(__doc__) # Authors: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu> # Denis Engemann <d.engemann@fz-juelich.de> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import fiff from mne.time_frequency import induced_power from mne.viz import plot_topo_power, plot_topo_phase_lock from mne.datasets import sample data_path = sample.data_path() raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif' event_fname = data_path + '/MEG/sample/sample_audvis_raw-eve.fif' event_id, tmin, tmax = 1, -0.2, 0.5 # Setup for reading the raw data raw = fiff.Raw(raw_fname) events = mne.read_events(event_fname) include = [] raw.info['bads'] += ['MEG 2443', 'EEG 053'] # bads + 2 more # picks MEG gradiometers picks = fiff.pick_types(raw.info, meg='grad', eeg=False, eog=True, stim=False, include=include, exclude='bads') epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks, baseline=(None, 0), reject=dict(grad=4000e-13, eog=150e-6)) data = epochs.get_data() # as 3D matrix layout = mne.find_layout(epochs.info, 'meg') ############################################################################### # Calculate power and phase locking value frequencies = np.arange(7, 30, 3) # define frequencies of interest n_cycles = frequencies / float(7) # different number of cycle per frequency Fs = raw.info['sfreq'] # sampling in Hz decim = 3 power, phase_lock = induced_power(data, Fs=Fs, frequencies=frequencies, n_cycles=n_cycles, n_jobs=1, use_fft=False, decim=decim, zero_mean=True) ############################################################################### # Prepare topography plots, set baseline correction parameters baseline = (None, 0) # set the baseline for induced power mode = 'ratio' # set mode for baseline rescaling ############################################################################### # Show topography of power. title = 'Induced power - MNE sample data' plot_topo_power(epochs, power, frequencies, layout, baseline=baseline, mode=mode, decim=decim, vmin=0., vmax=14, title=title) plt.show() ############################################################################### # Show topography of phase locking value (PLV) mode = None # no baseline rescaling for PLV title = 'Phase locking value - MNE sample data' plot_topo_phase_lock(epochs, phase_lock, frequencies, layout, baseline=baseline, mode=mode, decim=decim, title=title) plt.show()
[ 37811, 198, 23926, 18604, 198, 43328, 640, 12, 35324, 24612, 319, 1353, 41480, 329, 337, 7156, 15736, 198, 23926, 18604, 198, 198, 10265, 18268, 1176, 290, 7108, 22656, 3815, 389, 9066, 13, 198, 37811, 198, 4798, 7, 834, 15390, 834, 8, ...
2.883884
999
import bluetooth import sys, os import subprocess as sp import datetime from pushBulletForBluetooth import pushNotification from makeReminderforBluetooth import Reminder import csv if __name__ == "__main__": main()
[ 11748, 48208, 16271, 220, 198, 11748, 25064, 11, 28686, 198, 11748, 850, 14681, 355, 599, 198, 11748, 4818, 8079, 198, 6738, 4574, 33481, 1616, 1890, 38676, 16271, 1330, 4574, 3673, 2649, 198, 6738, 787, 8413, 5540, 1640, 38676, 16271, 13...
3.393939
66
appendMe = '\nNew bit of information' appendFile = open('example.txt','a') appendFile.write(appendMe) appendFile.close()
[ 33295, 5308, 796, 705, 59, 77, 3791, 1643, 286, 1321, 6, 201, 198, 201, 198, 33295, 8979, 796, 1280, 10786, 20688, 13, 14116, 41707, 64, 11537, 201, 198, 33295, 8979, 13, 13564, 7, 33295, 5308, 8, 201, 198, 33295, 8979, 13, 19836, 3...
2.822222
45
from kafka import KafkaProducer TOPIC_NAME = 'items' KAFKA_SERVER = 'localhost:9092' producer = KafkaProducer(bootstrap_servers=KAFKA_SERVER) producer.send(TOPIC_NAME, b'Test Message!!!') producer.flush()
[ 6738, 479, 1878, 4914, 1330, 46906, 11547, 2189, 628, 198, 35222, 2149, 62, 20608, 796, 705, 23814, 6, 198, 42, 8579, 25123, 62, 35009, 5959, 796, 705, 36750, 25, 44675, 17, 6, 198, 198, 18230, 2189, 796, 46906, 11547, 2189, 7, 18769,...
2.64557
79
from datetime import datetime import myfitnesspal import sqlite_utils import click from . import utils
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 11748, 616, 69, 3659, 18596, 198, 11748, 44161, 578, 62, 26791, 198, 11748, 3904, 198, 6738, 764, 1330, 3384, 4487, 628, 198 ]
3.62069
29
import numpy as np
[ 11748, 299, 32152, 355, 45941, 628 ]
3.333333
6
import pluginpackageRENAME import preload import os if __name__ == "__main__": preload.preload() app = pluginpackageRENAME.app app.static_folder = os.path.join(os.getcwd(), "html") app.run()
[ 11748, 13877, 26495, 49, 1677, 10067, 198, 11748, 662, 2220, 198, 11748, 28686, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 662, 2220, 13, 3866, 2220, 3419, 198, 220, 220, 220, 598, 796, 1387...
2.54878
82
import matplotlib.pyplot as plt import numpy as np import math import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import json from scipy.interpolate import interp1d from data_utils import * #draw_curve() # (y_pred + 1.9600 * sigma)[::-1]]), # alpha=.5, fc='b', ec='None', label='95% confidence interval') #draw_uncerntainy_curve() # (y_pred + 1.9600 * sigma)[::-1]]), # alpha=.5, fc='b', ec='None', label='95% confidence interval') #draw_SLU_uncerntainy_curve() #draw_curve() compute_score()
[ 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 10688, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 629, 541, 88, ...
2.204461
269
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.AoiInfoDTO import AoiInfoDTO from alipay.aop.api.domain.ItemStoreDTO import ItemStoreDTO
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 33918, 198, 198, 6738, 435, 541, 323, 13, 64, 404, 13, 15042, 13, 9979, 415, 13, 22973, 34184, 1187, 1330, 163...
2.483871
93
import subprocess import time import logging import os import signal log = logging.getLogger(__name__)
[ 11748, 850, 14681, 198, 11748, 640, 198, 11748, 18931, 198, 11748, 28686, 198, 11748, 6737, 628, 198, 6404, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 628 ]
3.483871
31
# drones/serializers.py file from rest_framework import serializers from drones.models import DroneCategory, Drone, Pilot, Competition from django.contrib.auth.models import User import drones.views
[ 2, 15382, 14, 46911, 11341, 13, 9078, 2393, 198, 6738, 1334, 62, 30604, 1330, 11389, 11341, 198, 6738, 15382, 13, 27530, 1330, 38959, 27313, 11, 38959, 11, 21697, 11, 27348, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, ...
3.942308
52
import learnables.py # cration d'un objet Calamous
[ 201, 198, 11748, 2193, 2977, 13, 9078, 201, 198, 201, 198, 2, 1067, 341, 288, 6, 403, 26181, 316, 2199, 10877, 201 ]
2.545455
22
import random import matplotlib.pyplot as plt import numpy as np from scipy import stats ############################ STATS input data ################################################ def return_nan_percentage(input_data): """ prints percentage of nan values in max. 3D sized array Parameters ---------- input_array : array max 3D array Returns ------- None """ total_size = input_data.size nan_sum = np.isnan(input_data).sum() perc = float(nan_sum / total_size) print("percentage of nan values inside dataset is: %.2f" % float(perc) + " %") # #4D example: # for i in Training_data: # return_nan_percentage(i) # for i in Training_data_germany: # describe_with_stats(i) ############################ Derive Labels ############################################### # back to xarray with: # label_xarray = xr.DataArray(output_3D_array, dims=['time', 'latitude', 'longitude'] ) # to turn list output into a 3D array use: # TODO: returns list of 2D arrays now, try to return 3D x array to save as net cdf -SEE BELOW # TODO: write test # #Example: # #create data subset of 10 of a data xarray # data_10 = data[0:10] #first 10 items to test # print(data.shape) # #call function with a threshod of 10 # output_array = binary_image_classification(data_10, T=0.5) # #show one image of the masked output images # plt.imshow(output_array[0], origin = 'lower') # #might need to change 'lower' to 'upper" # TODO: def save_plots_from_3Darray( input_array, OUTPUT_PATH, title="drought mask figure Nr:", show_plots=True ): """ saves pngs and/or prints images from 3Darrays as png files Parameters ---------- input_xarray : array 3-D input array in the format [num_samples, height, width] title: str title of the plots, number will be added according to iteration index show_plots: boolean determines if plots will be displayed as output or not Returns ------- None """ for k in range(len(input_array[0])): fig = input_array[k].plot() plt.title(title + str(k)) plt.axis("equal") plt.title("drought mask for SMI, month " + str(k)) if show_plots: plt.show() fig.figure.savefig(OUTPUT_PATH + title + str(k) + ".png", dpi=100) print(OUTPUT_PATH + "drought_mask_" + str(k) + ".png") ############################ class imbalance ###################################### # option 1, faster, combine these 2 fcts (recommended): # print(hide_random_values(0)) # option 2, combine these 2 fcts: def get_indices(dataset, value=0): """dataset = str(), 2D-array value = int(), value to print the indices for""" result = np.where(dataset == value) print("Tuple of arrays returned : ", result) # zip the 2 arrays (array 1: rows, array 2: columns) to get the exact coordinates listOfCoordinates = list(zip(result[0], result[1])) # iterate over the list of coordinates # for cord in listOfCoordinates: # print(cord) print(len(listOfCoordinates)) return listOfCoordinates def reduce_class_size(input_array, indices_list, T=0.78, value=int(-1)): """set entries in array to value=x, randomly and within set percentage of array list = list, list of indices (2D) T = int() , percentage to be modified returns: """ output_array = np.copy(input_array) # determine the percentage of the array that will be modified len_modifier = int(len(indices_list) * T) # select percentage T randomly from the list random_coords = random.sample(listOfCoordinates, len_modifier) # print(random_coords[:10]) # set selected entries to value print("selected indices will be set to " + str(value)) for i in random_coords: # print(labels_reshaped[i]) output_array[i] == value return output_array
[ 11748, 4738, 198, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 629, 541, 88, 1330, 9756, 628, 198, 14468, 7804, 4242, 37889, 5128, 1366, 1303, 29113, 7804, 4242, 21017, 628...
2.752107
1,424
print(decode_output())
[ 628, 198, 198, 4798, 7, 12501, 1098, 62, 22915, 28955, 198 ]
2.454545
11
#!/usr/bin/env python # # This is the library for Grove Base Hat. # # Button Base Class # ''' ## License The MIT License (MIT) Grove Base Hat for the Raspberry Pi, used to connect grove sensors. Copyright (C) 2018 Seeed Technology Co.,Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. '''
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 201, 198, 2, 201, 198, 2, 770, 318, 262, 5888, 329, 24144, 7308, 10983, 13, 201, 198, 2, 201, 198, 2, 20969, 7308, 5016, 201, 198, 2, 201, 198, 201, 198, 7061, 6, 201, 198, 2235, 1378...
3.482667
375
# Reverse a linked list # Developer: Murillo Grubler # https://www.hackerrank.com/challenges/reverse-a-linked-list/problem # Time complexity of reverse function: O(n) # Complete the reverse function below. # # For your reference: # # SinglyLinkedListNode: # int data # SinglyLinkedListNode next # def reverse(head): ln = SinglyLinkedListNode(head.data) temp_node = head.next while temp_node: next_ln = ln ln = SinglyLinkedListNode(temp_node.data) ln.next = next_ln temp_node = temp_node.next return ln if __name__ == '__main__': tests = int(input()) for tests_itr in range(tests): llist_count = int(input()) llist = SinglyLinkedList() for _ in range(llist_count): llist_item = int(input()) llist.insert_node(llist_item) result = reverse(llist.head) while result: print (result.data, end=' ') result = result.next
[ 2, 31849, 257, 6692, 1351, 198, 2, 23836, 25, 5921, 16111, 1902, 549, 1754, 198, 2, 3740, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 36747, 34120, 14, 50188, 12, 64, 12, 25614, 12, 4868, 14, 45573, 198, 2, 3862, 13357, 286, 95...
2.283019
424
import os from PIL import Image import random from functools import wraps from flask import jsonify from flask_jwt_extended import get_current_user from .artpiece import Artpiece from .exceptions import InvalidUsage from web.extensions import cache #decorator to require admin_acccess for a route """ Return a list of images in the 'gallery' folder and their descriptions Output is list of tuples (image_location, image_description) output list is in random order for random display order every time """
[ 11748, 28686, 198, 6738, 350, 4146, 1330, 7412, 198, 11748, 4738, 198, 6738, 1257, 310, 10141, 1330, 27521, 198, 6738, 42903, 1330, 33918, 1958, 198, 6738, 42903, 62, 73, 46569, 62, 2302, 1631, 1330, 651, 62, 14421, 62, 7220, 198, 6738,...
3.930769
130
import spconv import torch from torch import nn
[ 11748, 599, 42946, 198, 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 628, 628, 628 ]
3.533333
15
#!/usr/bin/env python # # Copyright (c) 2013 In-Q-Tel, Inc/Lab41, 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 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import fnmatch, os, sys, time, uuid from pymongo import MongoClient if __name__ == "__main__": start_time = time.time() args = get_args() input, server, port, database, collection = process_args(args) m_server, m_database, m_collection = mongo_server(server, port, database, collection) process_doc(input, m_server, m_database, m_collection) print "Took",time.time() - start_time,"seconds to complete."
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 220, 220, 15069, 357, 66, 8, 2211, 554, 12, 48, 12, 33317, 11, 3457, 14, 17822, 3901, 11, 1439, 6923, 33876, 13, 198, 2, 198, 2, 220, 220, 49962, 739, 262, 24843, 1378...
3.148256
344
import copy import logging import math import torch from torch import nn logger = logging.getLogger('global')
[ 11748, 4866, 198, 11748, 18931, 198, 11748, 10688, 198, 198, 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 198, 198, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 10786, 20541, 11537, 628, 628, 628, 198 ]
3.371429
35
# This Python file uses the following encoding: utf-8 import os; import sys; import urllib.request; from bs4 import BeautifulSoup; import wikipedia from PyQt5.QtWebEngineWidgets import *; from PyQt5.QtGui import QIcon; from PyQt5.QtWidgets import *; from PyQt5.QtNetwork import QNetworkProxy if __name__ == "__main__": app = QApplication([]) AudioFile().show() sys.exit(app.exec_())
[ 2, 770, 11361, 2393, 3544, 262, 1708, 21004, 25, 3384, 69, 12, 23, 198, 198, 11748, 28686, 26, 1330, 25064, 26, 1330, 2956, 297, 571, 13, 25927, 26, 422, 275, 82, 19, 1330, 23762, 50, 10486, 26, 1330, 47145, 11151, 198, 6738, 9485, ...
2.783217
143
__author__ = 'petriau' import requests # for HTTP requests from bs4 import BeautifulSoup # for HTML parsing url_SBM_FinanceProgress = 'http://sbm.gov.in/sbmreport/Report/Financial/SBM_StateReleaseAllocationincludingUnapproved.aspx' # Function to return HTML parsed with BeautifulSoup from a POST request URL and parameters. listTest = [['__EVENTARGUMENT',''],['__EVENTTARGET', 'ctl00$ContentPlaceHolder1$rptr_state$ctl03$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XxYDBQ9jdGwwMCRpY29uX3dvcmQFEGN0bDAwJGljb25fZXhjZWwFEmN0bDAwJGljb25fcHJpbnRlcqLkin/PLgDvwcsQ6/a18eF5HbFe"] ] paramDictionary = {key: str(value) for key, value in listTest} def merge_two_dicts(x, y): '''Given two dicts, merge them into a new dict as a shallow copy.''' z = x.copy() z.update(y) return z postParams = { # '__EVENTARGUMENT': '', # '__EVENTTARGET': 'ctl00$ContentPlaceHolder1$rptr_state$ctl03$lnkbtn_stName', # '__EVENTVALIDATION': "/wEWTAL2js/IBwLq6fiEBwK4qJKGBgL7uLfDBQLMho26CAKkvMv0BAKrp/OzCAKzzOWcCQLfxNm+CQLZ25fbDALc9b7CDALYxrzSBgLK5tedAQLJrc6KBwLD2Nb1DwKAz9S2BQLD2JrzAgKAz/jyBAKUlKjOAgKvk9PyBQKUlOzLBQKvk5ewAQKNhuujBAK2ocCIDQKNhq+hBwK2oaT3BwLW5PDOBwLdiLPJCQLW5LTMCgLdiPeGBQLPqct8AqCWu5oDAs+pj/oDAqCW/9cOArTAhacLArv/sNsBArTAyaQOArv/1JcBApnX36oFAtbopuwKApnXo6gIAtbo6qkGAv7tmdUPAvHRnK0JAv7t3dICAvHRgJwEAtuMv40FAoTehsMOAtuMg4sIAoTeyoAKAtTR8eIFAquz5dgPAtTRhc0LAquz+e4CAs3DtJABAoKu9fINAs3DyPoGAoKuibEHAp7/hZEKAuGFkd0CAp7/mfsPAuGFpfMFApfxyL4FAriAoXcCl/HcqAsCuIC1tQoC4M/OkQ8Cv46O1Q0C4M/i+wQCv46iawLZlNH1CQKqnLrXDQLZlJXzDAKqnM5tAr6ri/gNAsWF0MkLUJ4OhBgatkYSQhamBAvcsSVIgC8=", # '__VIEWSTATE': "/wEPDwUKMTQwNTE3ODMyMg9kFgJmD2QWAgIDD2QWBAIfDw8WBB4EVGV4dAVMPHNwYW4gY2xhc3M9ImdseXBoaWNvbiBnbHlwaGljb24tY2lyY2xlLWFycm93LWxlZnQiPjwvc3B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gxNjY1NS45MwcxNzI3LjgxBzY2NDYuMTkHODM3NC4wMAU1MC4yOAgxNDkyOC4xMgc4MjgxLjkzZAIhD2QWAgICDxUKCS04ODYyNy40NQkzNTQyNTcuOTMFNzYuODQJMjY1NzA3LjM0CDQ2OTE3LjY3CDUxOTEwLjk5CDk4ODI4LjY3BTM3LjE5CTIxODc4OS42NAkxNjY4NzguNjRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYDBQ9jdGwwMCRpY29uX3dvcmQFEGN0bDAwJGljb25fZXhjZWwFEmN0bDAwJGljb25fcHJpbnRlcqLkin/PLgDvwcsQ6/a18eF5HbFe", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl01$hfd_StateId':"26", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl02$hfd_StateId':"1", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl03$hfd_StateId':"2", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl04$hfd_StateId':"3", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl05$hfd_StateId':"4", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl06$hfd_StateId':"34", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl07$hfd_StateId':"28", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl08$hfd_StateId':"5", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl09$hfd_StateId':"6", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl10$hfd_StateId':"7", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl11$hfd_StateId':"8", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl12$hfd_StateId':"9", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl13$hfd_StateId':"35", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl14$hfd_StateId':"10", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl15$hfd_StateId':"11", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl16$hfd_StateId':"12", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl17$hfd_StateId':"13", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl18$hfd_StateId':"14", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl19$hfd_StateId':"15", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl20$hfd_StateId':"16", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl21$hfd_StateId':"17", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl22$hfd_StateId':"18", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl23$hfd_StateId':"32", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl24$hfd_StateId':"19", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl25$hfd_StateId':"20", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl26$hfd_StateId':"21", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl27$hfd_StateId':"22", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl28$hfd_StateId':"36", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl29$hfd_StateId':"23", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl30$hfd_StateId':"24", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl31$hfd_StateId':"33", 'ctl00$ContentPlaceHolder1$rptr_cen$ctl32$hfd_StateId':"25" } p = merge_two_dicts(postParams, paramDictionary) componentPage = parsePOSTResponse(url_SBM_FinanceProgress, p) print(componentPage) x = 'what'
[ 834, 9800, 834, 796, 705, 6449, 380, 559, 6, 198, 11748, 7007, 220, 1303, 329, 14626, 7007, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 220, 1303, 329, 11532, 32096, 198, 198, 6371, 62, 50, 12261, 62, 37, 14149, 32577, 796, 705,...
1.401421
11,681
b=listprimenumber(100) print b count=3 for x in range(len(b)-count): sum=0 for y in range(count): sum+=b[x+y] if sum in b: print sum #if b[x+0]+b[x+1]+b[x+2] in b: # print b[x],b[x+1],b[x+2]
[ 65, 28, 4868, 1050, 19027, 4494, 7, 3064, 8, 201, 198, 4798, 275, 201, 198, 9127, 28, 18, 201, 198, 201, 198, 1640, 2124, 287, 2837, 7, 11925, 7, 65, 13219, 9127, 2599, 201, 198, 220, 220, 220, 2160, 28, 15, 201, 198, 220, 220, ...
1.662069
145
__author__ = 'ferrard' # --------------------------------------------------------------- # Imports # --------------------------------------------------------------- import scipy as sp import random import time # --------------------------------------------------------------- # Class - Graph # --------------------------------------------------------------- # --------------------------------------------------------------- # Main # --------------------------------------------------------------- def main(): random.seed() g = WalkableGraph('ghana.txt') g.print() print() print("Let's do some walking") k = 1000 g.random_walk("CapeCoast", k, 0) # g.probs_after_k_steps(k) if __name__ == '__main__': main()
[ 834, 9800, 834, 796, 705, 2232, 81, 446, 6, 198, 198, 2, 20368, 1783, 24305, 198, 2, 1846, 3742, 198, 2, 20368, 1783, 24305, 198, 198, 11748, 629, 541, 88, 355, 599, 198, 11748, 4738, 198, 11748, 640, 198, 198, 2, 20368, 1783, 243...
4.059459
185
from flask import Flask, render_template, request app = Flask(__name__) if __name__ == '__main__': app.run()
[ 6738, 42903, 1330, 46947, 11, 8543, 62, 28243, 11, 2581, 198, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 598, 13, 5143, 3419, 198 ]
2.809524
42
""" Django settings for spartify project. Generated by 'django-admin startproject' using Django 2.2.12. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os from dotenv import load_dotenv load_dotenv() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = int(os.environ.get("DEBUG", default=1)) ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS",'').split(" ") + ['*', '192.168.43.72', '192.168.0.53', '0.0.0.0'] AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'social_core.backends.spotify.SpotifyOAuth2', ) AUTH_USER_MODEL = 'backend.User' SOCIAL_AUTH_USER_MODEL = 'backend.User' # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'channels', 'social_django', 'backend', 'lobby' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'backend.middlewares.ApiMiddleware', ] ROOT_URLCONF = 'spartify.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'spartify.wsgi.application' ASGI_APPLICATION = 'spartify.routing.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': { "ENGINE": os.environ.get("SQL_ENGINE", "django.db.backends.sqlite3"), "NAME": os.environ.get("SQL_DATABASE", os.path.join(BASE_DIR, "db.sqlite3")), "USER": os.environ.get("SQL_USER", "user"), "PASSWORD": os.environ.get("SQL_PASSWORD", "password"), "HOST": os.environ.get("SQL_HOST", "localhost"), "PORT": os.environ.get("SQL_PORT", "5432"), } } # Password validation # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) STATIC_URL = 'staticfiles/' STATIC_ROOT = os.path.join(BASE_DIR, STATIC_URL) SOCIAL_AUTH_SPOTIFY_KEY = os.environ['SOCIAL_AUTH_SPOTIFY_KEY'] SOCIAL_AUTH_SPOTIFY_SECRET = os.environ['SOCIAL_AUTH_SPOTIFY_SECRET'] SOCIAL_AUTH_URL_NAMESPACE = 'social' SOCIAL_AUTH_SPOTIFY_SCOPE = ['user-read-email','user-read-private', 'user-read-playback-state', 'user-modify-playback-state'] # SOCIAL_AUTH_LOGIN_REDIRECT_URL = 'http://{}/complete/spotify/' % os.getenv('HOST') LOGIN_REDIRECT_URL = 'dashboard' LOGIN_URL = 'login' DEFAULT_AUTO_FIELD='django.db.models.AutoField' SOCIAL_AUTH_PIPELINE = ( 'social_core.pipeline.social_auth.social_details', 'social_core.pipeline.social_auth.social_uid', 'social_core.pipeline.social_auth.auth_allowed', 'social_core.pipeline.social_auth.social_user', 'social_core.pipeline.user.get_username', 'social_core.pipeline.user.create_user', 'social_core.pipeline.social_auth.associate_user', 'social_core.pipeline.social_auth.load_extra_data', 'social_core.pipeline.user.user_details', 'backend.pipeline.save_access_token', #save token on login, ) QUEUE_SESSION_ID = 'queue' SESSION_EXPIRE_AT_BROWSER_CLOSE = 15 LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'api_formatter': { 'format': '{username} -- {endpoint} -- {status_code:d}: {message}', 'style': '{', }, 'lobby_formatter': { 'format': '{id}--{username}: {message} -- {asctime}', 'style': '{', }, }, 'handlers': { 'api_errors': { 'class': 'logging.FileHandler', 'filename': 'logs/api_errors.log', 'formatter': 'api_formatter', 'level': 'ERROR', }, }, 'loggers':{ 'backend': { 'handlers': ['api_errors'], }, }, } REDIS_HOST = os.environ.get("REDIS_HOST", '127.0.0.1') REDIS_PORT = 6379 REDIS_DB = 0 CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels_redis.core.RedisChannelLayer', "CONFIG": { "hosts": [(REDIS_HOST, REDIS_PORT)], }, } }
[ 37811, 198, 35, 73, 14208, 6460, 329, 599, 433, 1958, 1628, 13, 198, 198, 8645, 515, 416, 705, 28241, 14208, 12, 28482, 923, 16302, 6, 1262, 37770, 362, 13, 17, 13, 1065, 13, 198, 198, 1890, 517, 1321, 319, 428, 2393, 11, 766, 198...
2.237151
2,724
#!/usr/bin/env python # # tdwggeo2csv.py # # Description: convert TDWG plant distribution files out of the box to a single # CSV file # # TODO: should create new id's for each entry and have a tdwg_code for # each so we can maintain as much data as possbible # TODO: we should probably include the original text files in bauble # and run the conversion script on build # TODO: add a notes column to geography so we carry over the extra # geography data(kew regions, notes, etc.) and so that we can add # notes to them in bauble import codecs import os import re from optparse import OptionParser # l1 - Continent, tblLevel1.txt, UTF-8 # l2 - Region, tblLevel2.txt, UTF-8 # l3 - BotanicalCountry, tblLevel4, ISO-8859-15 # l4 - BaseUnit, tblLevel4.txt, ISO-8859-15 # gazette (places), tblGazette.txt, ISO-8859-15 parser = OptionParser() parser.add_option('-d', '--directory', dest='directory', help='directory of WGS txt files', metavar='DIR') (options, args) = parser.parse_args() if not options.directory: parser.error('directory required') cwd, _dummy = os.path.split(__file__) src_dir = options.directory # converted rows organized by tdwg_code so we can resolve parents converted_rows = {} id_ctr = 1 if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 41560, 86, 70, 469, 78, 17, 40664, 13, 9078, 198, 2, 198, 2, 12489, 25, 10385, 13320, 54, 38, 4618, 6082, 3696, 503, 286, 262, 3091, 284, 257, 2060, 198, 2, 44189, 239...
2.902715
442
#!/usr/bin/python """ Program to read and parse haproxylogs to put them in shape to upload to DataLogger The input date schould be sorted by date, and finished the uploaded data will immediately split into TimeseriesArray, so no further data of this day could be appended """ import os import sys import gzip import logging logging.basicConfig(level=logging.DEBUG) import datetime import zlib import requests import StringIO import argparse # own modules from datalogger import DataLoggerWeb as DataLoggerWeb import tilak_haproxylog def generate_datalogger_csv(logdir, datestring, keys, values, ts_keyname): """ create CSV like file with StringIO """ if datestring == datetime.date.today().isoformat(): logging.error("todays Logs are actually written and cannot used in datalogger") return headers = [ts_keyname, ] + list(keys) + list(values) linebuffer = [] linebuffer.append("\t".join(headers)) filename = os.path.join(logdir, "haproxylog_%s.gz" % datestring) logging.info("parsing file %s", filename) try: parser = parser_generator(keys, values, gzip.open(filename, "rb")) for line in aggregator(keys, values, ts_keyname, parser): linebuffer.append(line) except IOError as exc: logging.exception(exc) return StringIO.StringIO("\n".join(linebuffer)) def datestring_to_date(datestring): """ convert string in format YYYY-MM-DD into date object """ year, month, day = datestring.split("-") date = datetime.date(year=int(year), month=int(month), day=int(day)) return date def main(): """ what do you think, what main should do """ yesterday_datestring = (datetime.date.today() - datetime.timedelta(1)).isoformat() parser = argparse.ArgumentParser(description='generate TimeseriesArrays on local backend') parser.add_argument('--url', default="https://datalogger-api.tirol-kliniken.cc/DataLogger", help="url of DataLogger Webapplication") parser.add_argument('--logdir', default="/data1/haproxy_daily/", help="directory where to find day sorted haproxylogs") parser.add_argument("-b", '--back', help="how many days back from now") parser.add_argument("-s", '--startdate', help="start date in isoformat YYY-MM-DD") parser.add_argument("-e", '--enddate', default=yesterday_datestring, help="stop date in isoformat YYY-MM-DD") parser.add_argument("-q", '--quiet', action='store_true', help="set to loglevel ERROR") parser.add_argument("-v", '--verbose', action='store_true', help="set to loglevel DEBUG") args = parser.parse_args() if args.quiet is True: logging.getLogger("").setLevel(logging.ERROR) if args.verbose is True: logging.getLogger("").setLevel(logging.DEBUG) if (args.back is not None) == (args.startdate is not None): logging.error("option -b and -e are mutual exclusive, use only one") sys.exit(1) startdate = None if args.back is not None: startdate = (datetime.date.today() - datetime.timedelta(int(args.back))).isoformat() elif args.startdate is not None: startdate = args.startdate else: logging.error("you have to provide either -b or -s") sys.exit(1) # lets get started datalogger = DataLoggerWeb(args.url) project = "haproxy" tablename = "http_host" baseurl = "%s/upload_raw_file/" % args.url logdir = args.logdir # where to find haproxy logs keys = ("http_host", ) values = ("bytes_read", "rsp_1xx", "rsp_2xx", "rsp_3xx", "rsp_4xx", "rsp_5xx", "rsp_other", "srv_queue", "backend_queue", "actconn", "feconn", "beconn", "srv_conn", "retries", "tq", "tw", "tc", "tr", "tt", "hits") ts_keyname = "ts" for datestring in datewalk(startdate, args.enddate): caches = datalogger.get_caches(project, tablename, datestring) if caches["tsa"]["raw"] is not None: logging.info("Skipping this datestring, raw data is already available") continue try: stringio = generate_datalogger_csv(logdir, datestring, keys, values, ts_keyname) #upload data files = {'myfile': stringio} url = "/".join((baseurl, project, tablename, datestring)) logging.info("calling %s", url) response = requests.post(url, files=files) print response.content except StandardError as exc: logging.error("Exception on file datestring %si, skipping this date", datestring) except zlib.error as exc: logging.error(exc) if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 37811, 198, 15167, 284, 1100, 290, 21136, 387, 1676, 87, 2645, 18463, 284, 1234, 606, 287, 5485, 284, 9516, 284, 6060, 11187, 1362, 198, 464, 5128, 3128, 5513, 426, 307, 23243, 416, 3128, 11,...
2.576214
1,791
from enum import Enum
[ 6738, 33829, 1330, 2039, 388, 628, 628, 628, 198 ]
3.111111
9
import pandas as pd from sklearn.linear_model import LogisticRegression import mlflow import mlflow.sklearn import flask model_path = "models/logit_games_v1" model = mlflow.sklearn.load_model(model_path) app = flask.Flask(__name__) data = {"success": False} params = flask.request.args if "G1" in params.keys(): new_row = { "G1": params.get("G1"),"G2": params.get("G2"), "G3": params.get("G3"),"G4": params.get("G4"), "G5": params.get("G5"),"G6": params.get("G6"), "G7": params.get("G7"),"G8": params.get("G8"), "G9": params.get("G9"),"G10":params.get("G10")} new_x = pd.DataFrame.from_dict(new_row, orient = "index").transpose() data["response"] = str(model.predict_proba(new_x)[0][1]) data["success"] = True return flask.jsonify(data) if __name__ == '__main__': app.run(host='0.0.0.0')
[ 11748, 19798, 292, 355, 279, 67, 198, 6738, 1341, 35720, 13, 29127, 62, 19849, 1330, 5972, 2569, 8081, 2234, 198, 11748, 285, 1652, 9319, 198, 11748, 285, 1652, 9319, 13, 8135, 35720, 198, 11748, 42903, 198, 19849, 62, 6978, 796, 366, ...
2.424615
325
"""Handles websockets and asynchronous endpoints provided by Tornado instead of Django, but use the Django model framework for a database ORM. """ import datetime import functools import json import logging import tornado.escape from tornado.ioloop import IOLoop import tornado.web import tornado.websocket from django.db.models.signals import post_save from django.dispatch import receiver from django.utils import timezone from rest_framework.authtoken.models import Token from rest_framework.utils import model_meta from brewery.models import AssetSensor from brewery.models import RecipeInstance from brewery.models import TimeSeriesDataPoint from brewery.serializers import TimeSeriesDataPointSerializer from joulia.random import random_string from tornado_sockets.views.django import DjangoAuthenticatedWebSocketHandler LOGGER = logging.getLogger(__name__) def new_data(self, parsed_message): """Handles a new data point request. Args: parsed_message: Data received from websocket. """ LOGGER.debug('New data received from %s: %s.', self.get_current_user(), parsed_message) data = parsed_message data["source"] = self.source_id serializer = TimeSeriesDataPointSerializer(data=data) serializer.is_valid(raise_exception=True) serializer.save()
[ 37811, 12885, 829, 2639, 11603, 290, 39354, 886, 13033, 2810, 416, 48970, 2427, 198, 1659, 37770, 11, 475, 779, 262, 37770, 2746, 9355, 329, 257, 6831, 6375, 44, 13, 198, 37811, 198, 198, 11748, 4818, 8079, 198, 11748, 1257, 310, 10141,...
3.133028
436
from models import Base, engine Base.metadata.create_all(engine)
[ 198, 6738, 4981, 1330, 7308, 11, 3113, 198, 14881, 13, 38993, 13, 17953, 62, 439, 7, 18392, 8, 198 ]
3.473684
19
#!/usr/bin/env python3 """ DFaker Model Based on the dfaker model: https://github.com/dfaker """ from keras.initializers import RandomNormal from keras.layers import Input from lib.model.nn_blocks import Conv2DOutput, UpscaleBlock, ResidualBlock from .original import Model as OriginalModel, KerasModel
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 36323, 3110, 9104, 198, 220, 220, 220, 13403, 319, 262, 47764, 3110, 2746, 25, 3740, 1378, 12567, 13, 785, 14, 7568, 3110, 37227, 628, 198, 6738, 41927, 292, 13, 36733, 1134...
3.344086
93
# encoding: utf-8 """ @author: gallupliu @contact: gallup-liu@hotmail.com @version: 1.0 @license: Apache Licence @file: train.py @time: 2018/3/5 22:58 """ import tensorflow as tf from classify.dataset import data_utils from sklearn.model_selection import train_test_split from classify.model import TextCNN if __name__ == "__main__": text,labels = data_utils.loadfile('./data_with_label.csv') word2idx, vocab = data_utils.load_embedding('./dataset/test_cut.txt', './dataset/wiki_50.model') ids = data_utils.get_sentence_ids(text, word2idx) train_ids,test_ids,train_labels,test_labels = train_test_split(ids,labels,test_size=0.1) # print(len(text),type(text)) # max_length = count_length(text) # print(max_length) # train_word2vec() # print(type(text)) # print(list(word2idx.keys())) # dataset = tf.data.Dataset.from_tensor_slices((ids, train_labels)) # iterator = dataset.make_initializable_iterator() # next_element = iterator.get_next() train_dataset = dataset_input_fn(train_ids, train_labels, 100) val_dataset = dataset_input_fn(train_ids, train_labels, 100) iterator = tf.data.Iterator.from_structure(train_dataset.output_types,train_dataset.output_shapes) next_element,labels = iterator.get_next() train_iterator_init_op = iterator.make_initializer(train_dataset) val_iterator_init_op = iterator.make_initializer(val_dataset) with tf.Session() as sess: # sess.run(iterator.initializer) # print(sess.run(next_element)) model = TextCNN(next_element,labels,vocab,120,3,[1,2,3,5],512) sess.run(tf.global_variables_initializer()) # _,acc,loss = sess.run([model.train_op,model.accuracy,model.loss]) # print(acc,loss) for _ in range(10): # sess.run(train_iterator_init_op) feed_dict = {model.dropout_keep_prob:1.0} while True: try: _, acc, loss = sess.run([model.train_op, model.accuracy, model.loss],feed_dict=feed_dict) print(acc,loss) # print(sess.run(next_element),sess.run(labels)) except tf.errors.OutOfRangeError: break
[ 2, 21004, 25, 3384, 69, 12, 23, 198, 37811, 198, 31, 9800, 25, 7976, 84, 489, 16115, 198, 31, 32057, 25, 7976, 929, 12, 4528, 84, 31, 8940, 4529, 13, 785, 198, 198, 31, 9641, 25, 352, 13, 15, 198, 31, 43085, 25, 24843, 10483, ...
2.212451
1,012
from django.urls import path from .views import FollowStatsViews, AuthorFollowViews urlpatterns = [ # /authors/followers/ or ../following/ path("<str:follow_state>/", FollowStatsViews.as_view(), name="follows"), # /authors/<author_username>/follow path("<str:username>/follow/", AuthorFollowViews.as_view(), name="follow") ]
[ 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 198, 6738, 764, 33571, 1330, 7281, 29668, 7680, 82, 11, 6434, 7155, 7680, 82, 198, 198, 6371, 33279, 82, 796, 685, 198, 220, 220, 220, 1303, 1220, 41617, 14, 27780, 364, 14, 393, 11485, ...
2.85
120
from cone.app import get_root from cone.app import security from cone.app import testing from cone.app.browser.login import login_view from cone.app.browser.login import logout_view from cone.tile import render_tile from cone.tile.tests import TileTestCase from webob.response import Response from webob.exc import HTTPFound
[ 6738, 27763, 13, 1324, 1330, 651, 62, 15763, 198, 6738, 27763, 13, 1324, 1330, 2324, 198, 6738, 27763, 13, 1324, 1330, 4856, 198, 6738, 27763, 13, 1324, 13, 40259, 13, 38235, 1330, 17594, 62, 1177, 198, 6738, 27763, 13, 1324, 13, 4025...
3.747126
87
from tkinter import *
[ 6738, 256, 74, 3849, 1330, 1635 ]
3.5
6
# workaround static linked python from julia.api import Julia __julia__ = Julia(compiled_modules=False) import os import sys import subprocess from .wrappers import apply script_dir = os.path.dirname(os.path.realpath(__file__)) def install(): """ Install Julia packages required for yao-framework. """ subprocess.check_call(['julia', os.path.join(script_dir, 'install.jl')])
[ 2, 46513, 9037, 6692, 21015, 198, 6738, 474, 43640, 13, 15042, 1330, 22300, 198, 834, 73, 43640, 834, 796, 22300, 7, 5589, 3902, 62, 18170, 28, 25101, 8, 198, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 850, 14681, 198, 198, 673...
2.992424
132
# TODO: Generalize this with the discordutil module, factor out oauth import logging from urllib.parse import urlencode import requests import json from flask import request, redirect, session from creds import get_creds from config import config from sessionutil import invalidate_session # TODO: this should be cached until expiration # The server can reuse this for API requests # TODO: factor this out with discord auth to oauth..auth
[ 2, 16926, 46, 25, 3611, 1096, 428, 351, 262, 36446, 22602, 8265, 11, 5766, 503, 267, 18439, 198, 198, 11748, 18931, 198, 6738, 2956, 297, 571, 13, 29572, 1330, 2956, 11925, 8189, 198, 11748, 7007, 198, 11748, 33918, 198, 198, 6738, 42...
3.982143
112
#!/usr/bin/python3 """transliteration of Kim Asendorf's pixel sorting script""" from copy import copy from random import random, gauss from PIL import Image from numpy import int32 from argparse import ArgumentParser # PROGRAM CONSTANTS # rgb(103, 105, 128) BLACK_VALUE = int32(-10000000) # rgb(164, 114, 128) WHITE_VALUE = int32((255 << 24) + (230 << 16) + (230 << 8) + 230) BRIGHTNESS_VALUE = int32(30) # PIXEL CONVERSION FUNCTIONS def get_pixel_value(pixel): """rgb pixel to int32 processing representation""" return(int32((((255 << 8) | pixel[0]) << 8 | pixel[1]) << 8 | pixel[2])) def get_pixel_brightness(pixel): """rgb pixel to brightness value""" return(max((pixel[0], pixel[1], pixel[2])) / 255 * 100) # PIXEL FINDING FUNCTIONS def get_next_satisfying(vector, starting_position, condition_fun): """find next pixel in the vector after starting position that satisfies the condition (boolean) return -1 if not found""" position = starting_position while(position < len(vector) and not(condition_fun(vector[position]))): position += 1 if(position == (len(vector) - 1) and not(condition_fun(vector[position]))): position = - 1 return(position) # black mode def get_next_black(vector, starting_position): """next black pixel""" condition = lambda x: int32(get_pixel_value(x)) > BLACK_VALUE return get_next_satisfying(vector, starting_position, condition) def get_next_not_black(vector, starting_position): """next non black pixel""" condition = lambda x: int32(get_pixel_value(x)) < BLACK_VALUE return get_next_satisfying(vector, starting_position, condition) # bright mode def get_next_bright(vector, starting_position): """next bright pixel""" condition = lambda x: int32(get_pixel_brightness(x)) < BRIGHTNESS_VALUE return get_next_satisfying(vector, starting_position, condition) def get_next_dark(vector, starting_position): """next dark pixel""" condition = lambda x: int32(get_pixel_brightness(x)) > BRIGHTNESS_VALUE return get_next_satisfying(vector, starting_position, condition) # white mode def get_next_white(vector, starting_position): """next white pixel""" condition = lambda x: int32(get_pixel_value(x)) < WHITE_VALUE return get_next_satisfying(vector, starting_position, condition) def get_next_not_white(vector, starting_position): """next not white pixel""" condition = lambda x: int32(get_pixel_value(x)) > WHITE_VALUE return get_next_satisfying(vector, starting_position, condition) FIND_FUNCTIONS = ((get_next_black, get_next_not_black), # black (get_next_bright, get_next_dark), # bright (get_next_white, get_next_not_white)) # white # PIXEL SORTING FUNCTIONS def sort_pixels(vector, mode=0, find=FIND_FUNCTIONS): """sort pixel in the given vector""" assert(mode in (0, 1, 2)), "invalid use case" vector = copy(vector) position = 0 pos_end = None while(position < len(vector)): if((position == -1) or (pos_end == -1)): break position = find[mode][0](vector, position) pos_end = find[mode][1](vector, position) vector[position:pos_end] = sorted(vector[position:pos_end], key=lambda x: get_pixel_value(x)) position = pos_end + 1 return(vector) # IMAGE TRANSFORMATIONS def to_vectors(rgb_image, row_or_col): """rgb image -> list of lists of RGB tuples""" assert(rgb_image.mode == "RGB"), "must be a RGB image""" assert(row_or_col in (0, 1)), "row = 0, col = 1" vectors = [] x_size, y_size = rgb_image.size if(row_or_col == 0): for y_coord in range(0, y_size): row = [] for x_coord in range(0, x_size): row.append(rgb_image.getpixel((x_coord, y_coord))) vectors.append(row) else: for x_coord in range(0, x_size): col = [] for y_coord in range(0, y_size): col.append(rgb_image.getpixel((x_coord, y_coord))) vectors.append(col) return(vectors) # COMPLETE FUNCTIONS def sort_image(image, row_or_col, mode=0, prob=1, avg_band_size=1): """input: (rgb image, row or column, sort mode, probability of sorting, average band size for sorting) output: sorted out image)""" x_size, y_size = image.size sigma = avg_band_size / 4 vectors = to_vectors(image, row_or_col) new_vectors = [] position = 0 while(position < len(vectors)): if(random() < prob): # calculate the indices of the rows to sort to_sort = [] coarseness = int(gauss(avg_band_size, sigma)) for index in range(position, position + coarseness): if(index >= len(vectors)): break else: to_sort.append(index) for index in to_sort: new_vectors.append(sort_pixels(vectors[index], mode)) position += coarseness else: new_vectors.append(vectors[position]) position += 1 new_image = [] if(row_or_col == 0): for vector in new_vectors: for (red, green, blue) in vector: new_image.append(int(red)) new_image.append(int(green)) new_image.append(int(blue)) else: for i in range(0, y_size): for vector in new_vectors: (red, green, blue) = vector[i] new_image.append(int(red)) new_image.append(int(green)) new_image.append(int(blue)) return(Image.fromstring('RGB', (x_size, y_size), bytes(new_image))) __all__ = ["sort_image"] if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("-i", dest="input_image_file", required=True, type=str, help="input") parser.add_argument("-o", dest="output_image_file", required=True, type=str, help="output") args = parser.parse_args() image = Image.open(args.input_image_file) sort_image(image, 0).save(args.output_image_file)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 198, 37811, 7645, 17201, 341, 286, 6502, 1081, 18738, 69, 338, 17465, 29407, 4226, 37811, 198, 198, 6738, 4866, 1330, 4866, 198, 6738, 4738, 1330, 4738, 11, 31986, 1046, 198, 6738, 350, 4146, ...
2.379722
2,594
import pandas as pd from preprocessing import preprocess from wordclouds import wordcloud, find_by_word from sentiment_analysis import calculate_sentiment, find_by_sentiment import nltk import os import tempfile from topic_modelling import lda_topic_model, show_topics, show_example_sentences_by_topic os.environ["MPLCONFIGDIR"] = tempfile.gettempdir() nltk.download('punkt') nltk.download('stopwords') pd.set_option('display.max_columns', None) ##################################################### # READING THE DATA # ##################################################### # In this tutorial we will mostly deal with comma separated files (CSV) (similar to the structure of Excel files). Each line of the file is a data record. Each record consists of one or more fields, separated by commas. Check here for more information https://en.wikipedia.org/wiki/Comma-separated_values # reads the file named "students_eng.csv". # If you want to read a different file you need to (1) upload it in replit and (2) change "students_eng.csv" to the name of the newly uploaded file. Here we use the Pandas library ("pd") to read our file and in return we get a Pandas Dataframe. For faster processing and experimentation you can also select different subsets of the file's content through the nrows parameter -> number of lines to read. students_data = pd.read_csv("data/students_eng.csv") # With the next line you can print the data you just read and see how a Pandas Dataframe looks like (seems quite similar to Excel) print(students_data.head(3)) # As you can see the data is separated in columns. Let's see how we can get the data from a specific column. The following line allows us to get only the data inside the column named "students_needs". Other options are: study_programme, degree_programme, planned_grad_year, today_feeling, physical_health, student_needs, students_sugg_to_improve_wellbeing students_data = students_data['student_needs'] ################################################# # TEXT PREPROCESSING # ################################################# # Here we will pre-process our entire text collection. # First, we need to merge all the different lines of the "comments" into one big corpus, so that we can later analyze it. corpus = students_data.to_list() print(corpus[0:5]) # Then we need to "preprocess" our text. To do so we use the following line of code (more details on what happens under the hood could be found in the "preprocessing.py" file - feel free to take a look at it). # The following code: makes all words lowercase, create word tokens, removes stopwords, punctuations, and digits, and reduces inflected words to their word stem (stemming).Feel free to experiment by turning any of the following values from True to False. In addition, you can add extra words which you do not want to include in your analysis by adding them within the extra_stopwords brackets e.g. extra_stopwords=["people"] would remove the word people from everywhere in the document. Hint: don't forget to use the quotes! # tokens = [preprocess(sentence, lower=True, rem_punc=True, word_tokenization=True, rem_numb=True, rem_stopwords=True, stem=True, extra_stopwords = []) for sentence in students_data.to_list()] # print(tokens) ############################################# # WORD FREQUENCIES # ############################################# # Word frequencies calculation is the most basic tool in text processing yet it gives a comprehensive picture of the content in your text collection. One the most ways to visualize word frequencies is WordCloud (which you've already seen if you opened Voyant) # This function needs two things from you: # 1. tokens -- the result of our preprocessing step # 2. the name of the picture it will generate and save to your directory # 3. Number of words to show # wordcloud(words = tokens, name_of_output = 'wordcloud', num = 10) # Text processing often requires working with examples, because words are often contextual and it is difficult to understand what is happening in your text collection. For this purpose, you can find documents by pieces of texts. # This function needs two things from you: # 1. tokens -- the result of our preprocessing step (it will look for examples in this collection) # 2. a word or a phrase the text should include # test = find_by_word(tokens, 'studi') #print(test) ############################################# # Sentiment analysis # ############################################# # The aim of sentiment analysis is to calculate how emotional your texts are and what is the valence of these texts. In our example we use VADER (Valence Aware Dictionary and sEntiment Reasoner) but you can find other various sentiment analysis tools in the internet. # VADER calculated how positive, neutral, and negative a text is. It also calculates a compound score which considers all three metrics to give you a precise measurement of the sentiment. # This function requires only the preprocessed collection of texts # sent_result = calculate_sentiment(tokens) # print(sent_result) # Now, when the sentiment scores are calculated, you can find the most interesting texts by looking at the documents with highest scores (in this example, we look at the 5 most positive documents). # This function requires three things: # 1. The result of sentiment calculation # 2. What score you're interested in # 3. Number of examples you want to get # res = find_by_sentiment(df_with_scores = sent_result, score_type = 'pos', num_of_examples = 5) # print(res) ############################################# # TOPIC MODELING # ############################################# # num_of_topics = 4 # word_num_per_topic = 5 # lda_model = lda_topic_model(tokens, topic_num=num_of_topics) # show_topics(lda_model, word_num_per_topic ) # Check examples assigned to a particular topic #### # num_of_examples = 5 # show_example_sentences_by_topic(corpus, tokens, lda_model, word_num_per_topic,topic_to_check=1, num_of_examp_to_show = num_of_examples)
[ 11748, 19798, 292, 355, 279, 67, 198, 6738, 662, 36948, 1330, 662, 14681, 198, 6738, 1573, 17721, 82, 1330, 1573, 17721, 11, 1064, 62, 1525, 62, 4775, 198, 6738, 15598, 62, 20930, 1330, 15284, 62, 34086, 3681, 11, 1064, 62, 1525, 62, ...
3.618406
1,706
import copy from finetune.errors import FinetuneError from finetune.target_models.classifier import Classifier, ClassificationPipeline from finetune.target_models.regressor import Regressor, RegressionPipeline from finetune.base import BaseModel
[ 11748, 4866, 198, 198, 6738, 957, 316, 1726, 13, 48277, 1330, 4463, 316, 1726, 12331, 198, 6738, 957, 316, 1726, 13, 16793, 62, 27530, 13, 4871, 7483, 1330, 5016, 7483, 11, 40984, 47, 541, 4470, 198, 6738, 957, 316, 1726, 13, 16793, ...
3.637681
69
from exceptions import ValueError
[ 6738, 13269, 1330, 11052, 12331, 198 ]
5.666667
6
# Copyright (c) 2020-2021 Matematyka dla Ciekawych wiata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org> # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. try: clipData except NameError: clipData = [] clipData += [ { 'section': 'wywietlanie plikw\n z podziaem na strony' }, { 'console': [ [0.070374, "o", eduMovie.clear + eduMovie.prompt()], [1.067533, "o", "m"], [1.259512, "o", "a"], [1.41949, "o", "n"], [1.611479, "o", " "], [1.92349, "o", "m"], [2.115325, "o", "a"], [2.243465, "o", "n"], [2.435497, "o", " "], [3.475488, "o", "\r\n"], [3.54519, "o", "\u001b[?1049h\u001b[22;0;0t\u001b[?1h\u001b=\r"], [3.585094, "o", "MAN(1) Manual pager utils MAN(1)\u001b[m\r\n\u001b[m\r\n\u001b[1mNAME\u001b[0m\u001b[m\r\n man - an interface to the on-line reference manuals\u001b[m\r\n\u001b[m\r\n\u001b[1mSYNOPSIS\u001b[0m\u001b[m\r\n \u001b[1mman\u001b[0m [\u001b[1m-C\u001b[0m \u001b[4mfile\u001b[24m] [\u001b[1m-d\u001b[0m] [\u001b[1m-D\u001b[0m] [\u001b[1m--warnings\u001b[0m[=\u001b[4mwarnings\u001b[24m]] [\u001b[1m-R\u001b[0m \u001b[4mencoding\u001b[24m] [\u001b[1m-L\u001b[0m \u001b[4mlo\u001b[24m\u001b[m\r\n \u001b[4mcale\u001b[24m] [\u001b[1m-m\u001b[0m \u001b[4msystem\u001b[24m[,...]] [\u001b[1m-M\u001b[0m \u001b[4mpath\u001b[24m] [\u001b[1m-S\u001b[0m \u001b[4mlist\u001b[24m] [\u001b[1m-e\u001b[0m \u001b[4mextension\u001b[24m] [\u001b[1m-i\u001b[0m|\u001b[1m-I\u001b[0m]\u001b[m\r\n [\u001b[1m--regex\u001b[0m|\u001b[1m--wildcard\u001b[0m] [\u001b[1m--names-only\u001b[0m] [\u001b[1m-a\u001b[0m] [\u001b[1m-u\u001b[0m] [\u001b[1m--no-subpages\u001b[0m] [\u001b[1m-P\u001b[0m\u001b[m\r\n \u001b[4mpager\u001b[24m] [\u001b[1m-r\u001b[0m \u001b[4mprompt\u001b[24m] [\u001b[1m-7\u001b[0m] [\u001b[1m-E\u001b[0m \u001b[4mencoding\u001b[24m] [\u001b[1m--no-hyphenation\u001b[0m] [\u001b[1m--no-justifi\u001b[0m\u001b[m\r\n \u001b[1mcation\u001b[0m] [\u001b[1m-p\u001b[0m \u001b[4mstring\u001b[24m] [\u001b[1m-t\u001b[0m] [\u001b[1m-T\u001b[0m[\u001b[4mdevice\u001b[24m]] [\u001b[1m-H\u001b[0m[\u001b[4mbrowser\u001b[24m]] [\u001b[1m-X\u001b[0m[\u001b[4mdpi\u001b[24m]] [\u001b[1m-Z\u001b[0m]\u001b[m\r\n [[\u001b["], [3.585479, "o", "4msection\u001b"], [3.585788, "o", "[24m] \u001b[4mpage\u001b[24m[.\u001b[4msection\u001b[24m] ...] ...\u001b[m\r\n \u001b[1mman\u001b[0m \u001b[1m-k\u001b[0m [\u001b[4mapropos\u001b[24m \u001b[4moptions\u001b[24m] \u001b[4mregexp\u001b[24m ...\u001b[m\r\n \u001b[1mman\u001b[0m \u001b[1m-K\u001b[0m [\u001b[1m-w\u001b[0m|\u001b[1m-W\u001b[0m] [\u001b[1m-S\u001b[0m \u001b[4mlist\u001b[24m] [\u001b[1m-i\u001b[0m|\u001b[1m-I\u001b[0m] [\u001b[1m--regex\u001b[0m] [\u001b[4msection\u001b[24m] \u001b[4mterm\u001b[24m ...\u001b[m\r\n \u001b[1mman\u001b[0m \u001b[1m-f\u001b[0m [\u001b[4mwhatis\u001b[24m \u001b[4moptions\u001b[24m] \u001b[4mpage\u001b[24m ...\u001b[m\r\n \u001b[1mman\u001b[0m \u001b[1m-l\u001b[0m [\u001b[1m-C\u001b[0m \u001b[4mfile\u001b[24m] [\u001b[1m-d\u001b[0m] [\u001b[1m-D\u001b[0m] [\u001b[1m--warnings\u001b[0m[=\u001b[4mwarnings\u001b[24m]] [\u001b[1m-R\u001b[0m \u001b[4mencoding\u001b[24m] [\u001b[1m-L\u001b[0m\u001b[m\r\n \u001b[4mlocale\u001b[24m] [\u001b[1m-P\u001b[0m \u001b[4mpager\u001b[24m] [\u001b[1m-r\u001b[0m \u001b[4mprompt\u001b[24m] [\u001b[1m-7\u001b[0m] [\u001b[1m-E\u001b[0m \u001b[4mencoding\u001b[24m] [\u001b[1m-p\u001b[0m \u001b[4mstring\u001b[24m] [\u001b[1m-t\u001b[0m]\u001b[m\r\n [\u001b[1m-T\u001b[0m[\u001b[4mdevice\u001b[24m]] [\u001b[1m-H\u001b[0m[\u001b[4mbrowser\u001b[24m]] [\u001b[1m-X\u001b[0m[\u001b[4mdpi\u001b[24m]] [\u001b[1m-Z\u001b[0m] \u001b[4mfile\u001b[24m ...\u001b[m\r\n \u001b[1mman\u001b[0m \u001b[1m-w\u001b[0m|\u001b[1m-W\u001b[0m [\u001b[1m-C\u001b[0m \u001b[4mfile\u001b[24m] [\u001b[1m-d\u001b[0m] [\u001b[1m-D\u001b[0m] \u001b[4mpage\u001b[24m ...\u001b[m\r\n \u001b[1mman\u001b[0m \u001b[1m-c\u001b[0m [\u001b[1m"], [3.586087, "o", "-C\u001b[0m \u001b[4mfile\u001b[24m] [\u001b[1m-d\u001b[0m] [\u001b[1m-D\u001b[0m] \u001b[4mpage\u001b[24m ...\u001b[m\r\n \u001b[1mman\u001b[0m [\u001b[1m-?V\u001b[0m]\u001b[m\r\n\u001b[m\r\n\u001b[1mDESCRIPTION\u001b[0m\u001b[m\r\n\u001b[7m Manual page man(1) line 1 (press h for help or q to quit)\u001b[27m\u001b[K"], [5.099652, "o", "\r\u001b[K"], [5.100412, "o", " \u001b[1mman\u001b[0m is the system's manual pager. Each \u001b[4mpage\u001b[24m argument given to \u001b[1mman\u001b[0m is\u001b[m\r\n normally the name of a program, utility or function. The \u001b[4mmanual\u001b[24m \u001b[4mpage\u001b[24m\u001b[m\r\n associated with each of these arguments is then found and displayed. A\u001b[m\r\n \u001b[4msection\u001b[24m, if provided, will direct \u001b[1mman\u001b[0m to look only in that \u001b[4msection\u001b[24m of\u001b[m\r\n the manual. The default action is to search in all of the available\u001b[m\r\n \u001b[4msections\u001b[24m following a pre-defined order (\"1 n l 8 3 2 3posix 3pm 3perl\u001b[m\r\n 3am 5 4 9 6 7\" by default, unless overridden by the \u001b[1mSECTION\u001b[0m directive\u001b[m\r\n in \u001b[4m/etc/manpath.config\u001b[24m), and to show only the first \u001b[4mpage\u001b[24m found, even if\u001b[m\r\n \u001b[4mpage\u001b[24m exists in several \u001b[4msections\u001b[24m.\u001b[m\r\n\u001b[m\r\n The table below shows the \u001b[4msection\u001b[24m numbers of the manual followed by the\u001b[m\r\n types of pages they contain.\u001b[m\r\n\u001b[m\r\n 1 Executable programs or shell commands\u001b[m\r"], [5.10077, "o", "\n 2 System calls (functions provided by the kernel)\u001b[m\r\n 3 Library calls (functions within program libraries)\u001b[m\r\n 4 Special files (usually found in \u001b[4m/dev\u001b[24m)\u001b[m\r\n 5 File formats and conventions eg \u001b[4m/etc/passwd\u001b[24m\u001b[m\r\n 6 Games\u001b[m\r\n 7 Miscellaneous (including macro packages and conventions), e.g.\u001b[m\r\n \u001b[1mman\u001b[0m(7), \u001b[1mgroff\u001b[0m(7)\u001b[m\r\n 8 System administration commands (usually only for root)\u001b[m\r\n 9 Kernel routines [Non standard]\u001b[m\r\n\u001b[7m Manual page man(1) line 24 (press h for help or q to quit)\u001b[27m\u001b[K"], [10.259702, "o", "\r\u001b[K"], [10.260051, "o", "\u001b[m\r\n A manual \u001b[4mpage\u001b[24m consists of several sections.\u001b[m\r\n\u001b[m\r\n Conventional section names include \u001b[1mNAME\u001b[0m, \u001b[1mSYNOPSIS\u001b[0m, \u001b[1mCONFIGURATION\u001b[0m, \u001b[1mDE\u001b[0m\u001b[m\r\n \u001b[1mSCRIPTION\u001b[0m, \u001b[1mOPTIONS\u001b[0m, \u001b[1mEXIT\u001b[0m \u001b[1mSTATUS\u001b[0m, \u001b[1mRETURN\u001b[0m \u001b[1mVALUE\u001b[0m, \u001b[1mERRORS\u001b[0m, \u001b[1mENVIRONMENT\u001b[0m,\u001b[m\r\n"], [10.260674, "o", " \u001b[1mFILES\u001b[0m, \u001b[1mVERSIONS\u001b[0m, \u001b[1mCONFORMING\u001b[0m \u001b[1mTO\u001b[0m, \u001b[1mNOTES\u001b[0m, \u001b[1mBUGS\u001b[0m, \u001b[1mEXAMPLE\u001b[0m, \u001b[1mAUTHORS\u001b[0m, and\u001b[m\r\n \u001b[1mSEE\u001b[0m \u001b[1mALSO\u001b[0m.\u001b[m\r\n\u001b[m\r\n The following conventions apply to the \u001b[1mSYNOPSIS\u001b[0m section and can be used\u001b[m\r\n as a guide in other sections.\u001b[m\r\n\u001b[m\r\n \u001b[1mbold\u001b[0m \u001b[1mtext\u001b[0m type exactly as shown.\u001b[m\r\n \u001b[4mitalic\u001b[24m \u001b[4mtext\u001b[24m replace with appropriate argument.\u001b[m\r\n [\u001b[1m-abc\u001b[0m] any or all arguments within [ ] are optional.\u001b[m\r\n \u001b[1m-a\u001b[0m|\u001b[1m-b\u001b[0m options delimited by | cannot be used together.\u001b[m\r\n\u001b[m\r\n"], [10.261539, "o", " \u001b[4margument\u001b[24m ... \u001b[4margument\u001b[24m is repeatable.\u001b[m\r\n [\u001b[4mexpression\u001b[24m] ... entire \u001b[4mexpression\u001b[24m within [ ] is repeatable.\u001b[m\r\n\u001b[m\r\n Exact rendering may vary depending on the output device. For instance,\u001b[m\r\n man will usually not be able to render italics when running in a termi\u001b[m\r\n nal, and will typically use underlined or coloured text instead.\u001b[m\r\n\u001b[m\r\n\u001b[7m Manual page man(1) line 47 (press h for help or q to quit)\u001b[27m\u001b[K"], ["search + 0.467738", "o", "\r\u001b[K/"], ["search + 2.427696", "o", "\u001b[Km\bm"], ["search + 2.811736", "o", "\u001b[Ka\ba"], ["search + 3.187628", "o", "\u001b[Kn\bn"], ["search + 4.835791", "o", "\r\u001b[K"], ["search + 4.838372", "o", "\u001b[1;1H\u001b[m\r\n\u001b[2;1H A manual \u001b[4mpage\u001b[24m consists of several sections.\u001b[m\r\n\u001b[3;1H\u001b[m\r\n\u001b[4;1H Conventional section names include \u001b[1mNAME\u001b[0m, \u001b[1mSYNOPSIS\u001b[0m, \u001b[1mCONFIGURATION\u001b[0m, \u001b[1mDE\u001b[0m\u001b[m\r\n\u001b[5;1H \u001b[1mSCRIPTION\u001b[0m, \u001b[1mOPTIONS\u001b[0m, \u001b[1mEXIT\u001b[0m \u001b[1mSTATUS\u001b[0m, \u001b[1mRETURN\u001b[0m \u001b[1mVALUE\u001b[0m, \u001b[1mERRORS\u001b[0m, \u001b[1mENVIRONMENT\u001b[0m,\u001b[m\r\n\u001b[6;1H \u001b[1mFILES\u001b[0m, \u001b[1mVERSIONS\u001b[0m, \u001b[1mCONFORMING\u001b[0m \u001b[1mTO\u001b[0m, \u001b[1mNOTES\u001b[0m, \u001b[1mBUGS\u001b[0m, \u001b[1mEXAMPLE\u001b[0m, \u001b[1mAUTHORS\u001b[0m, and\u001b[m\r\n\u001b[7;1H \u001b[1mSEE\u001b[0m \u001b[1mALSO\u001b[0m.\u001b[m\r\n\u001b[8;1H\u001b[m\r\n\u001b[9;1H The following conventions apply to the \u001b[1mSYNOPSIS\u001b[0m section and can be used\u001b[m\r\n\u001b[10;1H as a guide in other sections.\u001b[m\r\n\u001b[11;1H\u001b[m\r\n\u001b[12;1H \u001b[1mbold\u001b[0m \u001b[1mtext\u001b[0m type exactly as shown.\u001b[m\r\n\u001b[13;1H \u001b[4mitalic\u001b[24m \u001b[4mtext\u001b[24m replace with appropriate argument.\u001b[m\r\n\u001b[14;1H [\u001b[1m-abc\u001b[0m] any or all arguments within [ ] are optional.\u001b[m\r\n\u001b[15;1H \u001b[1m-a\u001b[0m|\u001b[1m-b\u001b[0m"], ["search + 4.838671", "o", " "], ["search + 4.840168", "o", " options delimited by | cannot be used together.\u001b[m\r\n\u001b[16;1H\u001b[m\r\n\u001b[17;1H \u001b[4margument\u001b[24m ... \u001b[4margument\u001b[24m is repeatable.\u001b[m\r\n\u001b[18;1H [\u001b[4mexpression\u001b[24m] ... entire \u001b[4mexpression\u001b[24m within [ ] is repeatable.\u001b[m\r\n\u001b[19;1H\u001b[m\r\n\u001b[20;1H Exact rendering may vary depending on the output device. For instance,\u001b[m\r\n\u001b[21;1H man will usually not be able to render italics when running in a termi\u001b[m\r\n\u001b[22;1H nal, and will typically use underlined or coloured text instead.\u001b[m\r\n\u001b[23;1H\u001b[m\r\n\u001b[24;1H\u001b[1;1H\u001b[m\r\n\u001b[2;1H A \u001b[7mman\u001b[27mual \u001b[4mpage\u001b[24m consists of several sections.\u001b[m\r\n\u001b[3;1H\u001b[m\r\n\u001b[4;1H Conventional section names include \u001b[1mNAME\u001b[0m, \u001b[1mSYNOPSIS\u001b[0m, \u001b[1mCONFIGURATION\u001b[0m, \u001b[1mDE\u001b[0m\u001b[m\r\n\u001b[5;1H \u001b[1mSCRIPTION\u001b[0m, \u001b[1mOPTIONS\u001b[0m, \u001b[1mEXIT\u001b[0m \u001b[1mSTATUS\u001b[0m, \u001b[1mRETURN\u001b[0m \u001b[1mVALUE\u001b[0m, \u001b[1mERRORS\u001b[0m, \u001b[1mENVIRONMENT\u001b[0m,\u001b[m\r\n\u001b[6;1H \u001b[1mFILES\u001b[0m, \u001b[1mVERSIONS\u001b[0m, \u001b[1mCONFORMING\u001b[0m \u001b[1mTO\u001b[0m, \u001b[1mNOTES\u001b[0m, \u001b[1mBUGS\u001b[0m, "], ["search + 4.840432", "o", " \u001b[1mEXAMPLE\u001b"], ["search + 4.841096", "o", "[0m, \u001b[1mAUTHORS\u001b[0m, and\u001b[m\r\n\u001b[7;1H \u001b[1mSEE\u001b[0m \u001b[1mALSO\u001b[0m.\u001b[m\r\n\u001b[8;1H\u001b[m\r\n\u001b[9;1H The following conventions apply to the \u001b[1mSYNOPSIS\u001b[0m section and can be used\u001b[m\r\n\u001b[10;1H as a guide in other sections.\u001b[m\r\n\u001b[11;1H\u001b[m\r\n\u001b[12;1H \u001b[1mbold\u001b[0m \u001b[1mtext\u001b[0m type exactly as shown.\u001b[m\r\n\u001b[13;1H \u001b[4mitalic\u001b[24m \u001b[4mtext\u001b[24m replace with appropriate argument.\u001b[m\r\n\u001b[14;1H [\u001b[1m-abc\u001b[0m] any or all arguments within [ ] are optional.\u001b[m\r\n\u001b[15;1H \u001b[1m-a\u001b[0m|\u001b[1m-b\u001b[0m options delimited by | cannot be used together.\u001b[m\r\n\u001b[16;1H\u001b[m\r\n\u001b[17;1H \u001b[4margument\u001b[24m ... \u001b[4margument\u001b[24m is repeatable.\u001b[m\r\n\u001b[18;1H [\u001b[4mexpression\u001b[24m] ... entire \u001b[4mexpression\u001b[24m within [ ] is repeatable.\u001b[m\r\n\u001b[19;1H\u001b[m\r\n\u001b[20;1H Exact rendering may vary depending on the output device. For instance,\u001b[m\r\n\u001b[21;1H \u001b[7mman\u001b[27m will usually not be able to render italics when running in a termi\u001b[m\r\n\u001b[22;1H nal, and will ty"], ["search + 4.841183", "o", "pically use und"], ["search + 4.842076", "o", "erlined or coloured text instead.\u001b[m\r\n\u001b[23;1H\u001b[m\r\n\u001b[24;1H The com\u001b[7mman\u001b[27md or function illustration is a pattern that should match all\u001b[m\r\n\u001b[7m Manual page man(1) line 48 (press h for help or q to quit)\u001b[27m\u001b[K"], ["search + 9.491816", "o", "\r\u001b[K/\r\u001b[K"], ["search + 9.492785", "o", " possible invocations. In some cases it is advisable to illustrate sev\u001b[m\r\n eral exclusive invocations as is shown in the \u001b[1mSYNOPSIS\u001b[0m section of this\u001b[m\r\n \u001b[7mman\u001b[27mual page.\u001b[m\r\n\u001b[m\r\n\u001b[1mEXAMPLES\u001b[0m\u001b[m\r\n \u001b[1m\u001b[7mman\u001b[27m\u001b[0m \u001b[4mls\u001b[24m\u001b[m\r\n Display the \u001b[7mman\u001b[27mual page for the \u001b[4mitem\u001b[24m (program) \u001b[4mls\u001b[24m.\u001b[m\r\n\u001b[m\r\n \u001b[1m\u001b[7mman\u001b[27m\u001b[0m \u001b[4m\u001b[7mman\u001b[27m\u001b[24m.\u001b[4m7\u001b[24m\u001b[m\r\n Display the \u001b[7mman\u001b[27mual page for macro package \u001b[4m\u001b[7mman\u001b[27m\u001b[24m from section \u001b[4m7\u001b[24m.\u001b[m\r\n\u001b[m\r\n \u001b[1m\u001b[7mman\u001b[27m\u001b[0m \u001b[1m-a\u001b[0m \u001b[4mintro\u001b[24m\u001b[m\r\n Display, in succession, all of the available \u001b[4mintro\u001b[24m \u001b[7mman\u001b[27mual pages\u001b[m\r\n contained within the \u001b[7mman\u001b[27mual. It is possible to quit between suc\u001b[m\r\n cessive displays or skip any of them.\u001b[m\r\n\u001b[m\r\n \u001b[1m\u001b[7mman\u001b[27m\u001b[0m \u001b[1m-t\u001b[0m \u001b[4malias\u001b[24m | \u001b[4mlpr\u001b[24m \u001b[4m-Pps\u001b[24m\u001b[m\r\n Format the \u001b[7mman\u001b[27mual page referenced by `\u001b[4mali"], ["search + 9.493205", "o", "as\u001b[24m', usually a shell \u001b[7mman\u001b[27m\u001b[m\r\n ual page, into the default \u001b[1mtroff\u001b[0m or \u001b[1mgroff\u001b[0m format and pipe it to the\u001b[m\r\n\u001b[7m Manual page man(1) line 67 (press h for help or q to quit)\u001b[27m\u001b[K"], ["search + 10.755837", "o", "\r\u001b[K/\r\u001b[K"], ["search + 10.75625", "o", " printer named \u001b[4mps\u001b[24m. The default output for \u001b[1mgroff\u001b[0m is usually Post\u001b[m\r\n Script. \u001b[1m\u001b[7mman\u001b[27m\u001b[0m \u001b[1m--help\u001b[0m should advise as to which processor is bound to\u001b[m\r\n the \u001b[1m-t\u001b[0m option.\u001b[m\r\n\u001b[7m Manual page man(1) line 70 (press h for help or q to quit)\u001b[27m\u001b[K"], ["search + 11.707833", "o", "\r\u001b[K/\r\u001b[K"], ["search + 11.708289", "o", "\u001b[m\r\n \u001b[1m\u001b[7mman\u001b[27m\u001b[0m \u001b[1m-l\u001b[0m \u001b[1m-T\u001b[0m\u001b[4mdvi\u001b[24m \u001b[4m./foo.1x.gz\u001b[24m \u001b[1m>\u001b[0m \u001b[4m./foo.1x.dvi\u001b[24m\u001b[m\r\n This com\u001b[7mman\u001b[27md will decompress and format the nroff source \u001b[7mman\u001b[27mual\u001b[m\r\n\u001b[7m Manual page man(1) line 73 (press h for help or q to quit)\u001b[27m\u001b[K"], ["search + 12.75573", "o", "\r\u001b[K/\r\u001b[K"], ["search + 12.75613", "o", " page \u001b[4m./foo.1x.gz\u001b[24m into a \u001b[1mdevice\u001b[0m \u001b[1mindependent\u001b[0m \u001b[1m(dvi)\u001b[0m file. The redi\u001b[m\r\n rection is necessary as the \u001b[1m-T\u001b[0m flag causes output to be directed to\u001b[m\r\n \u001b[1mstdout\u001b[0m with no pager. The output could be viewed with a program\u001b[m\r\n\u001b[7m Manual page man(1) line 76 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 0.547791", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], ["up + 0.54827", "o", "\u001b[KA\bA\r\u001b[K"], ["up + 0.548773", "o", "\u001b[H\u001bM\u001b[1mEXAMPLES\u001b[0m\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 75 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 1.339862", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], ["up + 1.340289", "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bM\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 74 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 2.035805", "o", "\r\u001b[K \u001b[KESC\b\b\bESC"], ["up + 2.036168", "o", "\u001b[KO\bO\u001b[KA\bA\r\u001b[K\u001b[H\u001bM \u001b[7mman\u001b[27mual page.\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 73 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 2.827918", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], ["up + 2.82833", "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bM eral exclusive invocations as is shown in the \u001b[1mSYNOPSIS\u001b[0m section of this\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 72 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 3.459969", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], ["up + 3.46038", "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bM possible invocations. In some cases it is advisable to illustrate sev\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 71 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 4.059878", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], ["up + 4.060296", "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bM The com\u001b[7mman\u001b[27md or function illustration is a pattern that should match all\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 70 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 4.731672", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], ["up + 4.73192", "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bM\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 69 (press h for help or q to quit)\u001b[27m\u001b[K"], ["up + 5.331857", "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO\u001b[KA\bA\r\u001b[K"], ["up + 5.332293", "o", "\u001b[H\u001bM nal, and will typically use underlined or coloured text instead.\u001b[m\r\n\u001b[24;1H\r\u001b[K\u001b[7m Manual page man(1) line 68 (press h for help or q to quit)\u001b[27m\u001b[K"], ], 'text' : [ # EKRAN: man - przewijnaie stron 'Zapewne zauwaylimy e dokumentacj man przegldalimy ekran po ekranie, <m> natomiast informacje wypisywane przez wywoanie komendy <m> z opcj help wypisyway si hurtem na ekran. <m>' 'Dzieje si tak dlatego e polecenie man korzysta z programu <m> nazywanego pagerem do podziau tekstu na strony. <m>' 'Rol t zazwyczaj peni more lub less a kolejne strony <m> mona wywietla z uyciem spacji. <mark name="search" />' # EKRAN: man - wyszukiwanie 'Oba te programy pozwalaj take na wyszukiwanie z uyciem ukonika, <m> rozpoczynajcego wprowadzenie szukanego tekstu <m> i klawisza n do wyszukania kolejnego wystpienia. <m>' 'Natomiast zakoczenie dziaania odbywa si za pomoc klawisza q. <m>' 'Zarwno taki sposb wyszukiwania jak te zamykania programu <m> jest wart zapamitania, gdy jest czsto spotykan konwencj. <mark name="up" />' # EKRAN: man - przewijnaie w gre linia po linii 'Less jest bardziej rozbudowany ni more i pozwala take na <m> przewijanie linia po linii, przewijanie w obu kierunkach <m> z uyciem strzaek oraz page up i page down, <m> a take wyszukiwanie wstecz z uyciem shift n <m>' ] }, { 'console': [ [0.058688, "o", eduMovie.clear + eduMovie.prompt()], [0.69478, "o", "l"], [0.886743, "o", "e"], [1.142775, "o", "s"], [1.294708, "o", "s"], [1.454712, "o", " "], [1.678724, "o", "/"], [1.838742, "o", "e"], [2.086702, "o", "t"], [2.452806, "o", "c/"], [2.94277, "o", "p"], [3.478765, "o", "a"], [3.702748, "o", "s"], [3.940034, "o", "\u0007swd"], [4.270745, "o", "\r\n"], [4.279067, "o", "\u001b[?1049h\u001b[22;0;0t\u001b[?1h\u001b=\r"], [4.279456, "o", "root:x:0:0:root:/root:/bin/bash\r\ndaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\r\nbin:x:2:2:bin:/bin:/usr/sbin/nologin\r\nsys:x:3:3:sys:/dev:/usr/sbin/nologin\r\nsync:x:4:65534:sync:/bin:/bin/sync\r\ngames:x:5:60:games:/usr/games:/usr/sbin/nologin\r\nman:x:6:12:man:/var/cache/man:/usr/sbin/nologin\r\nlp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin\r\nmail:x:8:8:mail:/var/mail:/usr/sbin/nologin\r\nnews:x:9:9:news:/var/spool/news:/usr/sbin/nologin\r\nuucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin\r\nproxy:x:13:13:proxy:/bin:/usr/sbin/nologin\r\nwww-data:x:33:33:www-data:/var/www:/usr/sbin/nologin\r\nbackup:x:34:34:backup:/var/backups:/usr/sbin/nologin\r\nlist:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin\r\nirc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin\r\ngnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologi \bn\r\nnobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin\r\nrrp:x:1000:1000:Robert Paciorek,,,:/rrp:/bin/bash"], [4.27982, "o", "\r\nmessagebus:x:101:104::/var/run/dbus:/bin/false\r\nsshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin\r\nsystemd-timesync:x:103:111:systemd Time Synchronization,,,:/run/systemd:/bin/fal \b\u001b[7m/etc/passwd\u001b[27m\u001b[K"], [5.254821, "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], [5.255221, "o", "\u001b[KB\bB\r\u001b[Kse\r\n:\u001b[K"], [5.638786, "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], [5.639159, "o", "\u001b[KB\bB\r\u001b[Ksystemd-network:x:105:113:systemd Network Management,,,:/run/systemd/netif:/bin/ \b:\u001b[K"], [6.83884, "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], [6.839274, "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bMdaemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\r\n\u001b[24;1H\r\u001b[K:\u001b[K"], [7.126802, "o", "\r\u001b[K \u001b[KESC\b\b\bESC\u001b[KO\bO"], [7.127176, "o", "\u001b[KA\bA\r\u001b[K\u001b[H\u001bMroot:x:0:0:root:/root:/bin/bash\r\n\u001b[24;1H\r\u001b[K:\u001b[K"], ], 'text' : [ 'Polecenia te mog by take uyte do wywietlania plikw, <m> a take, dziki przekierowaniom strumieni, <m> do podziau na strony outputu innych polece. <m>' ] }, ]
[ 2, 15069, 357, 66, 8, 12131, 12, 1238, 2481, 6550, 368, 265, 88, 4914, 288, 5031, 327, 494, 74, 707, 88, 354, 45967, 1045, 357, 4023, 1378, 66, 494, 74, 23368, 13, 291, 76, 13, 15532, 13, 489, 34729, 198, 2, 15069, 357, 66, 8, ...
1.768943
13,910
#!/usr/bin/env python # -*- coding: utf-8 -*- import codecs import os from setuptools import setup gh_run_number = os.environ.get("BUILD_NUMBER", None) build_number = None if gh_run_number is None or gh_run_number == "" else gh_run_number version = '0.2.2' setup( name='pytest-snowflake_bdd', version=f"{version}-{build_number}" if build_number else version, author='Tilak Patidar', author_email='tilakpatidar@gmail.com', maintainer='Tilak Patidar', maintainer_email='tilakpatidar@gmail.com', license='MIT', url='https://github.com/tilakpatidar/pytest-snowflake_bdd', description='Setup test data and run tests on snowflake in BDD style!', long_description=read('README.rst'), py_modules=['pytest_snowflake_bdd'], python_requires='>=3.6.7', install_requires=['pytest>=6.2.0', 'pytest-bdd>=3.2.1', 'snowflake-sqlalchemy>=1.3.2', 'SQLAlchemy>=1.4.27', \ 'pandas>=0.25.3', 'python-dateutil>=2.8.2'], tests_require=[ 'tox', ], classifiers=[ 'Development Status :: 4 - Beta', 'Framework :: Pytest', 'Intended Audience :: Developers', 'Topic :: Software Development :: Testing', 'Topic :: Database', 'Topic :: Software Development :: Testing :: BDD', 'Programming Language :: Python', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Framework :: Pytest', 'Operating System :: OS Independent', 'License :: OSI Approved :: MIT License', ], packages=["pytest_snowflake_bdd"], entry_points={ 'pytest11': [ 'pytest-snowflake-bdd = pytest_snowflake_bdd.plugin', ], }, )
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 40481, 82, 198, 11748, 28686, 198, 198, 6738, 900, 37623, 10141, 1330, 9058, 628, 198, 198, 456, 62, 5143, ...
2.372289
830
# SPDX-License-Identifier: Apache-2.0 # Copyright 2020 Nokia import pytest import logging import os from onapsdk.dmaap.dmaap import Dmaap logging.basicConfig(level=os.environ.get("LOGLEVEL", "DEBUG"))
[ 2, 30628, 55, 12, 34156, 12, 33234, 7483, 25, 24843, 12, 17, 13, 15, 198, 2, 15069, 12131, 26182, 198, 11748, 12972, 9288, 198, 11748, 18931, 198, 11748, 28686, 198, 198, 6738, 319, 1686, 34388, 13, 67, 2611, 499, 13, 67, 2611, 499,...
2.833333
72
# Generated by Django 2.2.8 on 2020-03-25 13:50 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 23, 319, 12131, 12, 3070, 12, 1495, 1511, 25, 1120, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
import numpy as np import torch from utils.helpers import process_state, device def make_epsilon_greedy_policy(estimator, nA): """ :param estimator: model that returns q values for a given statem/action pair :param nA: number of actions in the environment :return: A function that takes in a state and an epsilon and returns probs for each action in the form of a numpy array of length nA """ def policy_fn(state, epsilon): """ :param state: tensor of b x 1 x 84 x 84 :param epsilon: :return: action probabilities, of size b x nA """ A = torch.ones(nA) * epsilon / nA state = torch.from_numpy(state).float().to(device).unsqueeze(0) / 255.0 q_vals = estimator.forward(state) best_action = torch.argmax(q_vals, dim=0).unsqueeze(-1) # b A[best_action] += (1.0 - epsilon) return A return policy_fn
[ 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 198, 6738, 3384, 4487, 13, 16794, 364, 1330, 1429, 62, 5219, 11, 3335, 198, 198, 4299, 787, 62, 538, 18217, 261, 62, 16694, 4716, 62, 30586, 7, 395, 320, 1352, 11, 299, 32, 2599, 198...
2.421053
380
__name__ = 'onsets' __version__ = '1.5.1' __package__ = 'phonotactics' # imports #some import machinery checking and manipulations... #import sys #import os #from os import path #if '__file__' in dir(): # __mod_path = path.dirname(__file__) # if __mod_path not in sys.path: # sys.path.append(__mod_path) # __pack_path = path.dirname(__mod_path) # if __pack_path not in sys.path: # sys.path.append(__pack_path) from coventreiya.utils.ver import ver from coventreiya.utils.ver import gen_ver from coventreiya.utils.ver import Version_Registry from coventreiya.phonotactics.abc import abc ######################################################## # # # Generating the Onsets # # ################################################################################ # # Version Information Control & UnExported [but Versioned] Object Instantiation # # __versions = Version_Registry( Onsets() ) ################################################################################### # # Getting/Setting the default/current version... # ################################################################################### # # The original default version -- used for the(now obsolete and removed) # "default" gen_*_ functions and the pre-generated lists... # Note: the *COMPATABILITY_ONLY* default gen_*_ functions will self-update to # accomidate resets (they call into *THE_CURRENT_VERSION_OBJECT*!!) # the PRE-GENERATED LISTS will not be updated at all.. # Note: VERSION 2_0: the *OLD* gen_*_ functions no longer self-update as # they are now directly linked to version 1.5.1 only. # # from ver_1_5_1 import * # __versions.current(gen_ver(1,5,1))
[ 201, 198, 201, 198, 834, 3672, 834, 796, 705, 684, 1039, 6, 201, 198, 834, 9641, 834, 796, 705, 16, 13, 20, 13, 16, 6, 201, 198, 834, 26495, 834, 796, 705, 746, 261, 313, 529, 873, 6, 201, 198, 201, 198, 2, 17944, 201, 198, ...
2.828346
635
# -*- coding: utf-8 -*- # Copyright (c) 2019, Aptitudetech and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document
[ 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 357, 66, 8, 13130, 11, 317, 457, 26331, 316, 3055, 290, 20420, 198, 2, 1114, 5964, 1321, 11, 3387, 766, 5964, 13, 14116, 198, 198, 6738, 11593, 37443, ...
3.217949
78
from collections import deque T = int(input()) for t in range(T): n = int(input()) lengths = deque(map(int, input().split())) top = max(lengths) while len(lengths) > 0: left = lengths[0] right = lengths[-1] if (right >= left) and (right <= top): top = right lengths.pop() elif (left >= right) and (left <= top): top = left lengths.popleft() else: break if len(lengths) == 0: print("YES") else: print("NO")
[ 6738, 17268, 1330, 390, 4188, 198, 198, 51, 796, 493, 7, 15414, 28955, 198, 1640, 256, 287, 2837, 7, 51, 2599, 198, 197, 77, 796, 493, 7, 15414, 28955, 198, 197, 13664, 82, 796, 390, 4188, 7, 8899, 7, 600, 11, 5128, 22446, 35312, ...
2.326316
190
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
[ 2220, 7203, 31, 65, 41319, 62, 31391, 1003, 31391, 14, 11249, 62, 4299, 82, 14, 260, 7501, 25, 4023, 13, 65, 48274, 1600, 366, 4023, 62, 17474, 4943, 628 ]
2.413793
29
import stokepy as sp import numpy as np # instantiate class fmc = sp.FiniteMarkovChain() # create initial distribution vector phi = np.array([0, 0, 1, 0, 0]) # generate Markov chain with no boundary conditions fmc.gen_from_params(phi, p = 0.6, num_states = 5, dim = 1) # apply boundary condition: absorbing, reflecting, semi-reflecting # only works for 1 dimension Markov chains at the moment fmc.apply_boundary_condition(condition='absorbing') # choose solution method like Matrix Multiplication Evolution matrx_mult_evo = sp.MatrixMultiplicationEvolution(fmc, phi, steps = 2000,\ rec_class_states = []) # run the solution matrx_mult_evo.run() # get data from the run average_distribution = matrx_mult_evo.pi tpdf = matrx_mult_evo.tpdf absorption_proportions = matrx_mult_evo.absorption_proportions apbrc = matrx_mult_evo.recurrent_class_absorbed_proportions mean_absorption_time = matrx_mult_evo.mean_absorption_time # plot absorption tiems for recurrent classes matrx_mult_evo.plot_absorption()
[ 11748, 336, 2088, 9078, 355, 599, 198, 11748, 299, 32152, 355, 45941, 198, 198, 2, 9113, 9386, 1398, 198, 69, 23209, 796, 599, 13, 37, 9504, 9704, 709, 35491, 3419, 198, 198, 2, 2251, 4238, 6082, 15879, 198, 34846, 796, 45941, 13, 1...
2.645477
409
import doctest import sys import unittest import r2dto from tests.test_acceptance import AcceptanceTests from tests.test_base_serializer import BaseSerializerTests __all__ = ["doctest", "sys", "unittest", "r2dto", "AcceptanceTests", "BaseSerializerTests"] try: import pep8 except ImportError: print("WARNING: pep8 not installed. Style will not be checked and therefore your build may fail when integrated" "with the main branch.") pep8 = None PEP8_SOURCES = [ "r2dto/__init__.py", "r2dto/base.py", "r2dto/fields.py", "r2dto/validators.py", "tests/__init__.py", "tests/__main__.py", "tests/test_acceptance.py", "tests/test_base_serializer.py", ] if __name__ == "__main__": if pep8 is not None: sg = pep8.StyleGuide(max_line_length=120) res = sg.check_files(PEP8_SOURCES) if res.total_errors != 0: print("pep8 failed") sys.exit(1) doctest_ctx = { "Serializer": r2dto.Serializer, "fields": r2dto.fields, "ValidationError": r2dto.ValidationError, } results = doctest.testfile("../README.md", globs=doctest_ctx) if results.failed != 0: sys.exit(1) unittest.main()
[ 11748, 10412, 395, 198, 11748, 25064, 198, 11748, 555, 715, 395, 198, 198, 11748, 374, 17, 67, 1462, 198, 6738, 5254, 13, 9288, 62, 13635, 590, 1330, 21699, 590, 51, 3558, 198, 6738, 5254, 13, 9288, 62, 8692, 62, 46911, 7509, 1330, ...
2.21519
553
""" Module that defines the interface between the `manager` (i.e Django) and the `broker` (i.e. RabbitMQ). Defines three functions involved in a job's lifecycle: - `dispatch_job` - send a job to a queue - `update_job` - update the status of a job by checking it's (intermediate) result - `check_job` - for a parent job, trigger any child jobs, and / or update it's status - `cancel_job` - remove job from the queue, or terminate it if already started """ import datetime import logging import time from celery import Celery, signature from celery.result import AsyncResult from django.conf import settings from django.core.exceptions import PermissionDenied from django.utils import timezone from jobs.models import Job, JobMethod, JobStatus, Queue, Worker logger = logging.getLogger(__name__) # Setup the Celery app app = Celery("manager", broker=settings.BROKER_URL, backend=settings.CACHE_URL) app.conf.update( # By default Celery will keep on trying to connect to the broker forever # This overrides that. Initially try again immediately, then add 0.5 seconds for each # subsequent try (with a maximum of 3 seconds). # See https://github.com/celery/celery/issues/4296 broker_transport_options={ "max_retries": 10, "interval_start": 0, "interval_step": 0.5, "interval_max": 3, }, # Needed to ensure STARTED state is emitted task_track_started=True, ) def dispatch_job(job: Job) -> Job: """ Send a job to a queue. Decides which queue a job should be sent to and sends it. The queue can depend upon both the project and the account (either the account that the project is linked to, or the default account of the job creator). """ if not JobMethod.is_member(job.method): raise ValueError("Unknown job method '{}'".format(job.method)) if job.method in settings.JOB_METHODS_STAFF_ONLY and ( not job.creator or not job.creator.is_staff ): raise PermissionDenied if JobMethod.is_compound(job.method): children = job.children.all().order_by("id") if len(children) == 0: # If there are no children (e.g. a pull job for a project with no sources) # then job is immediately finished job.runtime = 0 job.is_active = False job.status = JobStatus.SUCCESS.value else: if job.method == JobMethod.parallel.value: # Dispatch all child jobs simultaneously for child in children: dispatch_job(child) else: # Dispatch the first child; subsequent children # will be status WAITING and will get dispatched later # on update of the parent. for index, child in enumerate(children): if index == 0: dispatch_job(child) else: child.is_active = True child.status = JobStatus.WAITING.value child.save() job.is_active = True job.status = JobStatus.DISPATCHED.value else: # Find queues that have active workers on them # order by descending priority queues = list( Queue.objects.filter( workers__in=Worker.objects.filter( # Has not finished finished__isnull=True, # Has been updated in the last x minutes updated__gte=timezone.now() - datetime.timedelta(minutes=15), ), ).order_by("priority") ) # Fallback to the default Stencila queue # Apart from anything else having this fallback is useful in development # because if means that the `overseer` service does not need to be running # in order keep track of the numbers of workers listening on each queue # (during development `worker`s listen to the default queue) if len(queues) == 0: logger.warning("No queues found with active workers") queue, _ = Queue.get_or_create( account_name="stencila", queue_name="default" ) else: if job.creator is None or job.project is None: # Jobs created by anonymous users go on the lowest # priority queue priority = 1 else: # The priority of other jobs is determined by the # account tier of the project priority = job.project.account.tier.id queue = queues[min(len(queues), priority) - 1] # Add the job's project id, key and secrets to it's kwargs. # Doing this here ensures it is done for all jobs # and avoids putting the secrets in the job's `params` field. kwargs = dict(**job.params) if job.params else {} kwargs["project"] = job.project.id if job.project else None kwargs["key"] = job.key kwargs["secrets"] = job.secrets # Send the job to the queue task = signature( job.method, kwargs=kwargs, queue=queue.name, task_id=str(job.id), app=app, ) task.apply_async() job.queue = queue job.is_active = True job.status = JobStatus.DISPATCHED.value job.save() return job def update_job(job: Job, data={}, force: bool = False) -> Job: """ Update a job. This method is triggered by a PATCH request from the `overseer` service. It updates the status, and other fields of the job, and if the job has a parent, updates it's status too. See https://stackoverflow.com/a/38267978 for important considerations in using AsyncResult. """ # Avoid unnecessary update if not job.is_active and not force: return job was_active = job.is_active if JobMethod.is_compound(job.method): # Update the status of compound jobs based on children status = job.status is_active = False all_previous_succeeded = True any_previous_failed = False for child in job.get_children(): # If the child has a 'higher' status then update the # status of the compound job status = JobStatus.highest([status, child.status]) # If the child is still waiting then... if child.status == JobStatus.WAITING.value: # If all previous have succeeded, dispatch it if all_previous_succeeded: dispatch_job(child) # If any previous have failed, cancel it elif any_previous_failed: cancel_job(child) if child.status != JobStatus.SUCCESS.value: all_previous_succeeded = False if child.status == JobStatus.FAILURE.value: any_previous_failed = True # If the child is still active then the compound job is active if child.is_active: is_active = True job.is_active = is_active job.status = JobStatus.RUNNING.value if is_active else status else: status = data.get("status") assert status # Do not do anything if the new status is lower rank than the # existing status. This can exist for example when a job is # terminated (the SUCCESS state is sent after TERMINATED) if JobStatus.rank(status) < JobStatus.rank(job.status): return job # Update fields sent by `overseer` service, including `status` for key, value in data.items(): setattr(job, key, value) # If job succeeded then get the result if we haven't already if status == JobStatus.SUCCESS.value and job.result is None: response = None attempts = 0 while not response and attempts < 5: try: response = async_result().get(timeout=30) except Exception: # Catch all errors, but log them. Occasional # errors encountered in prod include ResponseError and TimeoutError logger.warning( "Error getting async result", exc_info=True, extra=dict(id=job.id, method=job.method, attempts=attempts), ) time.sleep(1) attempts += 1 if response: job.result = response.get("result") job.log = response.get("log") else: logger.error( "Unable to get async result", extra=dict(id=job.id, method=job.method, attempts=attempts), ) job.status = JobStatus.FAILURE.value job.error = dict( type="RuntimeError", message="Unable to get result of job" ) # If job failed then get the error # For FAILURE, `info` is the raised Exception elif status == JobStatus.FAILURE.value: info = async_result().info if info: job.error = dict(type=type(info).__name__, message=str(info)) # If the job has just ended then mark it as inactive if JobStatus.has_ended(status): job.is_active = False # If the job is no longer active clear its secrets and run its callback if was_active and not job.is_active: job.secrets = None job.run_callback() # Save before updating parent (and then this again) job.save() # If the job has a parent then update it too if job.parent: update_job(job.parent) return job def cancel_job(job: Job) -> Job: """ Cancel a job. This uses Celery's terminate options which will kill the worker child process. This is not normally recommended but in this case is OK because there is only one task per process. See `worker/worker.py` for the reasoning for using `SIGUSR1`. See https://docs.celeryproject.org/en/stable/userguide/workers.html#revoke-revoking-tasks """ if job.is_active: if JobMethod.is_compound(job.method): for child in job.children.all(): cancel_job(child) else: app.control.revoke(str(job.id), terminate=True, signal="SIGUSR1") job.status = JobStatus.CANCELLED.value job.is_active = False job.secrets = None job.save() return job
[ 37811, 198, 26796, 326, 15738, 262, 7071, 1022, 262, 4600, 37153, 63, 357, 72, 13, 68, 37770, 8, 290, 262, 4600, 7957, 6122, 63, 357, 72, 13, 68, 13, 25498, 49215, 737, 198, 198, 7469, 1127, 1115, 5499, 2950, 287, 257, 1693, 338, ...
2.302603
4,610
"""Data loading/munging utilities. This will need to leverage a lot of existing stuff (e.g. numpy.genfromtxt)... """ import logging
[ 37811, 6601, 11046, 14, 76, 2150, 278, 20081, 13, 198, 198, 1212, 481, 761, 284, 16094, 257, 1256, 286, 4683, 3404, 198, 7, 68, 13, 70, 13, 299, 32152, 13, 5235, 6738, 14116, 26513, 198, 37811, 198, 11748, 18931, 628, 628 ]
3.317073
41
#!/bin/python # coding: utf-8 import argparse import time import collections import os import sys import torch import torch.nn from torch.autograd import Variable import torch.nn as nn import numpy as np from models_grad import RNN, GRU from models_grad import make_model as TRANSFORMER parser = argparse.ArgumentParser(description='PyTorch Penn Treebank Language Modeling') # Arguments you may need to set to run different experiments in 4.1 & 4.2. parser.add_argument('--data', type=str, default='data', help='location of the data corpus') parser.add_argument('--model', type=str, default='TRANSFORMER', help='type of recurrent net (RNN, GRU, TRANSFORMER)') parser.add_argument('--optimizer', type=str, default='SGD_LR_SCHEDULE', help='optimization algo to use; SGD, SGD_LR_SCHEDULE, ADAM') parser.add_argument('--seq_len', type=int, default=35, help='number of timesteps over which BPTT is performed') parser.add_argument('--batch_size', type=int, default=20, help='size of one minibatch') parser.add_argument('--initial_lr', type=float, default=20.0, help='initial learning rate') parser.add_argument('--hidden_size', type=int, default=512, help='size of hidden layers. IMPORTANT: for the transformer\ this must be a multiple of 16.') parser.add_argument('--save_best', action='store_true', help='save the model for the best validation performance') parser.add_argument('--num_layers', type=int, default=2, help='number of hidden layers in RNN/GRU, or number of transformer blocks in TRANSFORMER') # Other hyperparameters you may want to tune in your exploration parser.add_argument('--emb_size', type=int, default=200, help='size of word embeddings') parser.add_argument('--num_epochs', type=int, default=40, help='number of epochs to stop after') parser.add_argument('--dp_keep_prob', type=float, default=0.35, help='dropout *keep* probability. drop_prob = 1-dp_keep_prob \ (dp_keep_prob=1 means no dropout)') # Arguments that you may want to make use of / implement more code for parser.add_argument('--debug', action='store_true') parser.add_argument('--save_dir', type=str, default='', help='path to save the experimental config, logs, model \ This is automatically generated based on the command line \ arguments you pass and only needs to be set if you want a \ custom dir name') parser.add_argument('--evaluate', action='store_true', help="use this flag to run on the test set. Only do this \ ONCE for each model setting, and only after you've \ completed ALL hyperparameter tuning on the validation set.\ Note we are not requiring you to do this.") # DO NOT CHANGE THIS (setting the random seed makes experiments deterministic, # which helps for reproducibility) parser.add_argument('--seed', type=int, default=1111, help='random seed') args = parser.parse_args() argsdict = args.__dict__ argsdict['code_file'] = sys.argv[0] # Use the model, optimizer, and the flags passed to the script to make the # name for the experimental dir print("\n########## Setting Up Experiment ######################") flags = [flag.lstrip('--') for flag in sys.argv[1:]] current_script_path = os.path.dirname(os.path.realpath(__file__)) experiment_path = os.path.join(os.path.sep, current_script_path, args.save_dir, '_'.join([argsdict['model'], argsdict['optimizer']] + flags)) # Increment a counter so that previous results with the same args will not # be overwritten. Comment out the next four lines if you only want to keep # the most recent results. i = 0 while os.path.exists(experiment_path + "_" + str(i)): i += 1 experiment_path = experiment_path + "_" + str(i) # Creates an experimental directory and dumps all the args to a text file os.makedirs(experiment_path) print("\nPutting log in %s" % experiment_path) argsdict['save_dir'] = experiment_path with open(os.path.join(experiment_path, 'exp_config.txt'), 'w') as f: for key in sorted(argsdict): f.write(key+' '+str(argsdict[key])+'\n') # Set the random seed manually for reproducibility. torch.manual_seed(args.seed) # Use the GPU if you have one if torch.cuda.is_available(): print("Using the GPU") device = torch.device("cuda") else: print("WARNING: You are about to run on cpu, and this will likely run out \ of memory. \n You can try setting batch_size=1 to reduce memory usage") device = torch.device("cpu") ############################################################################### # # DATA LOADING & PROCESSING # ############################################################################### # HELPER FUNCTIONS # Processes the raw data from text files # Yields minibatches of data # LOAD DATA print('Loading data from '+args.data) raw_data = ptb_raw_data(data_path=args.data) train_data, valid_data, test_data, word_to_id, id_2_word = raw_data vocab_size = len(word_to_id) print(' vocabulary size: {}'.format(vocab_size)) ############################################################################### # # MODEL SETUP # ############################################################################### # NOTE ============================================== # This is where your model code will be called. You may modify this code # if required for your implementation, but it should not typically be necessary, # and you must let the TAs know if you do so. if args.model == 'RNN': print("seq_length", args.seq_len) print("batch_size", args.batch_size) model = RNN(emb_size=args.emb_size, hidden_size=args.hidden_size, seq_len=args.seq_len, batch_size=args.batch_size, vocab_size=vocab_size, num_layers=args.num_layers, dp_keep_prob=args.dp_keep_prob) elif args.model == 'GRU': model = GRU(emb_size=args.emb_size, hidden_size=args.hidden_size, seq_len=args.seq_len, batch_size=args.batch_size, vocab_size=vocab_size, num_layers=args.num_layers, dp_keep_prob=args.dp_keep_prob) elif args.model == 'TRANSFORMER': if args.debug: # use a very small model model = TRANSFORMER(vocab_size=vocab_size, n_units=16, n_blocks=2) else: # Note that we're using num_layers and hidden_size to mean slightly # different things here than in the RNNs. # Also, the Transformer also has other hyper-parameters # (such as the number of attention heads) which can change it's behavior. model = TRANSFORMER(vocab_size=vocab_size, n_units=args.hidden_size, n_blocks=args.num_layers, dropout=1.-args.dp_keep_prob) # these 3 attributes don't affect the Transformer's computations; # they are only used in run_epoch model.batch_size = args.batch_size model.seq_len = args.seq_len model.vocab_size = vocab_size else: print("Model type not recognized.") model = model.to(device) # LOSS FUNCTION loss_fn = nn.CrossEntropyLoss() if args.optimizer == 'ADAM': optimizer = torch.optim.Adam(model.parameters(), lr=args.initial_lr) # LEARNING RATE SCHEDULE lr = args.initial_lr lr_decay_base = 1 / 1.15 m_flat_lr = 14.0 # we will not touch lr for the first m_flat_lr epochs ############################################################################### # # DEFINE COMPUTATIONS FOR PROCESSING ONE EPOCH # ############################################################################### def repackage_hidden(h): """ Wraps hidden states in new Tensors, to detach them from their history. This prevents Pytorch from trying to backpropagate into previous input sequences when we use the final hidden states from one mini-batch as the initial hidden states for the next mini-batch. Using the final hidden states in this way makes sense when the elements of the mini-batches are actually successive subsequences in a set of longer sequences. This is the case with the way we've processed the Penn Treebank dataset. """ if isinstance(h, Variable): return h.detach_() else: return tuple(repackage_hidden(v) for v in h) def run_epoch(model, data): """ One epoch of training/validation (depending on flag is_train). """ model.eval() state_dict = torch.load('saved_model.pt', map_location="cpu") model.load_state_dict(state_dict) total_loss = np.zeros(model.seq_len) steps = 0 # LOOP THROUGH MINI BATCHES for step, (x, y) in enumerate(ptb_iterator(data, model.batch_size, model.seq_len)): steps += 1 if args.model != 'TRANSFORMER': hidden = model.init_hidden() hidden = hidden.to(device) if args.model == 'TRANSFORMER': batch = Batch(torch.from_numpy(x).long().to(device)) model.zero_grad() outputs = model.forward(batch.data, batch.mask).transpose(1, 0) # print ("outputs.shape", outputs.shape) else: inputs = torch.from_numpy(x.astype(np.int64)).transpose(0, 1).contiguous().to(device)#.cuda() model.zero_grad() hidden = repackage_hidden(hidden) outputs, hidden = model(inputs, hidden) targets = torch.from_numpy(y.astype(np.int64)).transpose(0, 1).contiguous().to(device)#.cuda() total_loss += np.array([loss_fn(outputs[i], targets[i]).item() for i in range(len(outputs))]) total_loss /= float(steps) print(total_loss) ############################################################################### # # RUN MAIN LOOP (TRAIN AND VAL) # ############################################################################### print("\n########## Running Main Loop ##########################") # Gradient compute num_epochs = 1 # MAIN LOOP for epoch in range(num_epochs): # RUN MODEL ON VALID DATA run_epoch(model, valid_data)
[ 2, 48443, 8800, 14, 29412, 198, 2, 19617, 25, 3384, 69, 12, 23, 198, 198, 11748, 1822, 29572, 198, 11748, 640, 198, 11748, 17268, 198, 11748, 28686, 198, 11748, 25064, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 198, 6738, 28034, ...
2.691943
3,798
import FWCore.ParameterSet.Config as cms run3_nanoAOD_devel = cms.Modifier()
[ 11748, 48849, 14055, 13, 36301, 7248, 13, 16934, 355, 269, 907, 198, 198, 5143, 18, 62, 77, 5733, 32, 3727, 62, 2934, 626, 796, 269, 907, 13, 5841, 7483, 3419, 198 ]
2.516129
31
# IDLEX EXTENSION ## """ ## Copyright(C) 2011-2012 The Board of Trustees of the University of Illinois. ## All rights reserved. ## ## Developed by: Roger D. Serwy ## University of Illinois ## ## Permission is hereby granted, free of charge, to any person obtaining ## a copy of this software and associated documentation files (the ## "Software"), to deal with the Software without restriction, including ## without limitation the rights to use, copy, modify, merge, publish, ## distribute, sublicense, and/or sell copies of the Software, and to ## permit persons to whom the Software is furnished to do so, subject to ## the following conditions: ## ## + Redistributions of source code must retain the above copyright ## notice, this list of conditions and the following disclaimers. ## + Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimers in the ## documentation and/or other materials provided with the distribution. ## + Neither the names of Roger D. Serwy, the University of Illinois, nor ## the names of its contributors may be used to endorse or promote ## products derived from this Software without specific prior written ## permission. ## ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ## IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ## ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ## CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH ## THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. ## ## ## ## ## Clear Window Extension ## ## About: ## ## It provides "Clear Shell Window" under "Options" ## with ability to undo. ## ## Part of Issue 6143 ## ## """ config_extension_def = """ [ClearWindow] enable=1 enable_editor=0 enable_shell=1 [ClearWindow_cfgBindings] clear-window=<Control-Key-l> """ jn = lambda x,y: '%i.%i' % (x,y) # join integers to text coordinates sp = lambda x: tuple(map(int, x.split('.'))) # convert tkinter Text coordinate to a line and column tuple import sys import re from idlelib.UndoDelegator import DeleteCommand ansi_re = re.compile(r'\x01?\x1b\[(.*?)m\x02?')
[ 2, 4522, 2538, 55, 27489, 16938, 2849, 198, 2235, 220, 220, 220, 37227, 198, 2235, 220, 220, 220, 15069, 7, 34, 8, 2813, 12, 6999, 383, 5926, 286, 9870, 2841, 286, 262, 2059, 286, 9486, 13, 198, 2235, 220, 220, 220, 1439, 2489, 10...
3.100376
797
GPIO_CON_1_BUT_1 = 10 GPIO_CON_1_BUT_2 = 9 GPIO_CON_2_BUT_1 = 11 GPIO_CON_2_BUT_2 = 14 GPIO_BUZZER = 15
[ 16960, 9399, 62, 10943, 62, 16, 62, 47526, 62, 16, 796, 838, 198, 16960, 9399, 62, 10943, 62, 16, 62, 47526, 62, 17, 796, 860, 198, 16960, 9399, 62, 10943, 62, 17, 62, 47526, 62, 16, 796, 1367, 198, 16960, 9399, 62, 10943, 62, 1...
1.704918
61
#!/bin/python # -*- coding: utf-8 -*- '''''' import sys from ctrls.Tester import Tester from models.exampleModel import exampleModel if __name__ == '__main__': sys.exit(main())
[ 2, 48443, 8800, 14, 29412, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 39115, 7061, 198, 198, 11748, 25064, 198, 6738, 269, 2213, 7278, 13, 51, 7834, 1330, 309, 7834, 198, 6738, 4981, 13, 20688, 17633, ...
2.628571
70
from tempfile import TemporaryDirectory from typing import Any, Dict, Tuple import datasets import flair import numpy as np import pytest import torch from flair.data import Corpus from numpy import typing as nptyping from embeddings.data.data_loader import HuggingFaceDataLoader from embeddings.data.dataset import HuggingFaceDataset from embeddings.pipeline.evaluation_pipeline import ( FlairSequenceLabelingEvaluationPipeline, ModelEvaluationPipeline, ) from embeddings.pipeline.preprocessing_pipeline import PreprocessingPipeline from embeddings.transformation.flair_transformation.column_corpus_transformation import ( ColumnCorpusTransformation, ) from embeddings.transformation.flair_transformation.downsample_corpus_transformation import ( DownsampleFlairCorpusTransformation, ) from embeddings.transformation.flair_transformation.split_sample_corpus_transformation import ( SampleSplitsFlairCorpusTransformation, ) from embeddings.utils.flair_corpus_persister import FlairConllPersister def test_sequence_labeling_preprocessing_pipeline( result_path: "TemporaryDirectory[str]", embedding_name: str, ner_dataset_name: str, hidden_size: int, task_train_kwargs: Dict[str, int], sequence_labeling_preprocessing_pipeline: Tuple[ PreprocessingPipeline[str, datasets.DatasetDict, Corpus], "TemporaryDirectory[str]" ], sequence_labeling_evaluation_pipeline: Tuple[ ModelEvaluationPipeline[str, Corpus, Dict[str, nptyping.NDArray[Any]], Dict[str, Any]], "TemporaryDirectory[str]", ], ) -> None: flair.set_seed(441) flair.device = torch.device("cpu") preprocessing_pipeline, path = sequence_labeling_preprocessing_pipeline preprocessing_pipeline.run() evaluation_pipeline, _ = sequence_labeling_evaluation_pipeline result = evaluation_pipeline.run() np.testing.assert_almost_equal( result["seqeval__mode_None__scheme_None"]["overall_accuracy"], 0.7881773 ) np.testing.assert_almost_equal(result["seqeval__mode_None__scheme_None"]["overall_f1"], 0) path.cleanup()
[ 6738, 20218, 7753, 1330, 46042, 43055, 198, 6738, 19720, 1330, 4377, 11, 360, 713, 11, 309, 29291, 198, 198, 11748, 40522, 198, 11748, 37457, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 12972, 9288, 198, 11748, 28034, 198, 6738, 37457...
2.820375
746
# Prosz zaimplementowa funkcj, ktra otrzymuje na wejciu posortowan niemalejco tablic A # o rozmiarze n oraz liczb x i sprawdza, czy x wystpuje w A. Jeli tak, to zwraca najmniejszy indeks, # pod ktrym x wystpuje. T = [0, 1, 2, 3, 4, 5, 5, 5, 6] for i in range(len(T)): print(i, binary_search(T, 0, len(T) - 1, T[i]))
[ 2, 27631, 89, 1976, 1385, 26908, 8455, 46212, 66, 73, 11, 479, 9535, 267, 2213, 89, 4948, 84, 18015, 12385, 356, 73, 979, 84, 1426, 419, 45197, 37628, 10144, 73, 1073, 7400, 677, 317, 198, 2, 267, 686, 89, 11632, 283, 2736, 299, 3...
2.006211
161
import re, io, os, sys from nltk import word_tokenize from argparse import ArgumentParser # Allow package level imports in module script_dir = os.path.dirname(os.path.realpath(__file__)) lib = os.path.abspath(script_dir + os.sep + "..") sys.path.append(lib) from conll_reader import space_join, text2conllu if __name__ == "__main__": p = ArgumentParser() p.add_argument("-f", "--file", default=None, help="file to tokenize") p.add_argument("-l", "--lang", default="eng", help="language 3 letter code", choices=["eng", "spa", "fra", "deu", "eus", "nld", "rus", "por", "zho", "tur"]) opts = p.parse_args() infile = opts.file lang = opts.lang # Run test sentencer = RuleBasedSplitter(lang=lang) if infile is None: # Some default test tokens if no file provided if lang == "zho": tokens = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', "", '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] elif lang == "nld": tokens = ['Een', 'ieder', 'heeft', 'recht', 'op', 'onderwijs', ';', 'het', 'onderwijs', 'zal', 'kosteloos', 'zijn,', 'althans', 'wat', 'het', 'lager', 'en', 'basisonderwijs', 'betreft', '.', 'Het', 'lager', 'onderwijs', 'zal', 'verplicht', 'zijn', '.', 'Ambachtsonderwijs', 'en', 'beroepsopleiding', 'zullen', 'algemeen', 'beschikbaar', 'worden', 'gesteld', '.', 'Hoger', 'onderwijs', 'zal', 'openstaan', 'voor', 'een', 'ieder,', 'die', 'daartoe', 'de', 'begaafdheid', 'bezit', '.', 'Het', 'onderwijs', 'zal', 'gericht', 'zijn', 'op', 'de', 'volle', 'ontwikkeling', 'van', 'de', 'menselijke', 'persoonlijkheid', 'en', 'op', 'de', 'versterking', 'van', 'de', 'eerbied', 'voor', 'de', 'rechten', 'van', 'de', 'mens', 'en', 'de', 'fundamentele', 'vrijheden', '.'] else: tokens = ['Introduction', 'Research', 'has', 'shown', 'examples', '.', 'But', 'we', 'need', 'more', '.'] else: text = io.open(infile, encoding="utf8").read() tokens = word_tokenize(text) sent_starts = sentencer.predict(tokens) print([(tok, boundary) for tok, boundary in (zip(tokens, sent_starts))])
[ 11748, 302, 11, 33245, 11, 28686, 11, 25064, 198, 6738, 299, 2528, 74, 1330, 1573, 62, 30001, 1096, 198, 6738, 1822, 29572, 1330, 45751, 46677, 198, 2, 22507, 5301, 1241, 17944, 287, 8265, 198, 12048, 62, 15908, 796, 28686, 13, 6978, ...
2.223273
1,057
""" Contributors can be viewed at: http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/trunk/CONTRIBUTORS.txt $LicenseInfo:firstyear=2008&license=apachev2$ Copyright 2009, Linden Research, Inc. Licensed under the Apache License, Version 2.0. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 or in http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/LICENSE.txt $/LicenseInfo$ """ # standard python libs import unittest from binascii import unhexlify #related # pyogp from pyogp.lib.client.appearance import * from pyogp.lib.client.settings import Settings from pyogp.lib.client.agent import Agent from pyogp.lib.client.region import Region from pyogp.lib.base.datatypes import * # pyogp messaging from pyogp.lib.base.message.udpdeserializer import UDPMessageDeserializer # pyogp tests import pyogp.lib.base.tests.config def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() suite.addTest(makeSuite(TestAppearance)) return suite
[ 198, 37811, 198, 37146, 669, 460, 307, 9569, 379, 25, 198, 4023, 1378, 21370, 77, 13, 12227, 6042, 13, 785, 14, 21370, 77, 14, 75, 521, 268, 14, 42068, 14, 11528, 14, 9078, 519, 79, 14, 8019, 14, 8692, 14, 2213, 2954, 14, 10943, ...
2.73057
386
from enum import Enum from typing import List, Optional from pydantic import BaseModel, HttpUrl
[ 6738, 33829, 1330, 2039, 388, 198, 6738, 19720, 1330, 7343, 11, 32233, 198, 198, 6738, 279, 5173, 5109, 1330, 7308, 17633, 11, 367, 29281, 28165, 628, 628 ]
3.703704
27
import pytest from wtforms.validators import symbol_required from wtforms.validators import ValidationError
[ 11748, 12972, 9288, 198, 198, 6738, 266, 83, 23914, 13, 12102, 2024, 1330, 6194, 62, 35827, 198, 6738, 266, 83, 23914, 13, 12102, 2024, 1330, 3254, 24765, 12331, 628, 198 ]
3.7
30
# using the input() function message = input("Tell me something, and I'll repeat it!") print(message)
[ 2, 1262, 262, 5128, 3419, 2163, 198, 198, 20500, 796, 5128, 7203, 24446, 502, 1223, 11, 290, 314, 1183, 9585, 340, 2474, 8, 198, 4798, 7, 20500, 8 ]
3.642857
28
from src.Node import Node from src.Nodes import Block from src.SymbolTable import SymbolTable
[ 6738, 12351, 13, 19667, 1330, 19081, 198, 6738, 12351, 13, 45, 4147, 1330, 9726, 198, 6738, 12351, 13, 13940, 23650, 10962, 1330, 38357, 10962, 198 ]
3.76
25
"""Get information about this package.""" def info(system): """Get information about this package.""" import googledevices.utils.const as package print("Projectname: ", package.NAME) print("Version: ", package.VERSION) print("GitHub link: ", package.URLS.get("github")) print("PyPi link: ", package.URLS.get("pypi")) print("Maintainers:") for maintainer in package.MAINTAINERS: print(" ", maintainer.get("name"), "(", maintainer.get("github"), ")") print("") if system: import platform print("") print("System: ", platform.system()) print("Version: ", platform.version()) print("Python version: ", platform.python_version())
[ 37811, 3855, 1321, 546, 428, 5301, 526, 15931, 628, 198, 4299, 7508, 7, 10057, 2599, 198, 220, 220, 220, 37227, 3855, 1321, 546, 428, 5301, 526, 15931, 198, 220, 220, 220, 1330, 467, 519, 992, 1990, 1063, 13, 26791, 13, 9979, 355, 5...
2.57931
290
arr = [1, 0, -2, 5, -4, 1, 9, -2] print(check(arr))
[ 198, 3258, 796, 685, 16, 11, 657, 11, 532, 17, 11, 642, 11, 532, 19, 11, 352, 11, 860, 11, 532, 17, 60, 220, 198, 4798, 7, 9122, 7, 3258, 4008, 198 ]
1.6875
32
#! /usr/bin/env python import argparse import pandas as pd import numpy as np if __name__ == '__main__': main()
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 1822, 29572, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 628, 628, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, ...
2.541667
48
# 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, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from abc import ABC, abstractmethod from typing import List, Optional import numpy as np from pet.utils import InputFeatures, InputExample, PLMInputFeatures, GenerativeInputFeatures, GenerativeInputExample from pet.pvp import PVPS, PVP
[ 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13789, 13, 198, 2, 921, 743, 7330, 257, 4866, 286, 262, 13789, 379, 198, 2,...
3.843902
205
# test __init__ file
[ 2, 1332, 11593, 15003, 834, 2393, 198 ]
3
7
import re PREFIX = {} NSMAP = {} OIM_COMMON_RESERVED_PREFIXES = {} OIM_COMMON_RESERVED_PREFIX_MAP = {} buildPrefixMaps() LINK_RESERVED_URI_MAP = { "_": LinkGroup.default, "footnote": LinkType.footnote, "explanatoryFact": LinkType.explanatoryFact, }
[ 11748, 302, 198, 198, 47, 31688, 10426, 796, 23884, 198, 8035, 33767, 796, 23884, 198, 46, 3955, 62, 9858, 27857, 62, 19535, 1137, 53, 1961, 62, 47, 31688, 10426, 1546, 796, 23884, 198, 46, 3955, 62, 9858, 27857, 62, 19535, 1137, 53, ...
2.226891
119
try: from .helpers import config, management, xp, spam except ImportError: import helpers.config, helpers.management, helpers.xp, helpers.spam import time import discord from discord.ext import commands from discord.commands import slash_command
[ 28311, 25, 198, 220, 220, 220, 422, 764, 16794, 364, 1330, 4566, 11, 4542, 11, 36470, 11, 18084, 198, 16341, 17267, 12331, 25, 198, 220, 220, 220, 1330, 49385, 13, 11250, 11, 49385, 13, 27604, 11, 49385, 13, 42372, 11, 49385, 13, 27...
3.695652
69
import logging import os import subprocess import sys import yaml files_dir = "" # --- General util commands --- # --- File and path handling commands ---
[ 11748, 18931, 198, 11748, 28686, 198, 11748, 850, 14681, 198, 11748, 25064, 198, 198, 11748, 331, 43695, 198, 198, 16624, 62, 15908, 796, 13538, 628, 198, 2, 11420, 3611, 7736, 9729, 11420, 628, 628, 198, 2, 11420, 9220, 290, 3108, 9041...
3.630435
46
# -*- coding: utf-8 -*- import re import calendar import datetime, time from datetime import timedelta import urllib.request import requests, json from http.cookiejar import CookieJar from bs4 import BeautifulSoup import numpy as np import pandas as pd from pandas import DataFrame import pandas.io.sql as pdsql from matplotlib import dates import sqlite3 DATABASE = '..\\DATA\\mymoneybot.sqlite' if __name__ == "__main__": # - build_fundamental_data()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 302, 198, 11748, 11845, 198, 198, 11748, 4818, 8079, 11, 640, 198, 6738, 4818, 8079, 1330, 28805, 12514, 198, 11748, 2956, 297, 571, 13, 25927, 198, 11748, 7007, ...
2.896341
164
import csv import os import math import logging import traceback import requests import sys from collections import namedtuple from optparse import make_option from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.management.base import BaseCommand from django.db import connection from django.db import transaction from django.utils import timezone from apps.cowry_docdata.adapters import WebDirectDocDataDirectDebitPaymentAdapter from apps.cowry_docdata.exceptions import DocDataPaymentException from apps.cowry_docdata.models import DocDataPaymentOrder from apps.fund.models import RecurringDirectDebitPayment, Order, OrderStatuses, Donation, OrderItem from apps.projects.models import Project, ProjectPhases from ...mails import mail_monthly_donation_processed_notification logger = logging.getLogger(__name__) # # Run with: # ./manage.py process_monthly_donations -v 2 --settings=bluebottle.settings.local (or .production etc.) # def update_last_donation(donation, remaining_amount, popular_projects): """ Updates the last donation with the remaining amount of the payment. If the donation is more than the project needs, the project will be filled and the balance will be used to fill the popular projects recursively. """ project = Project.objects.get(id=donation.project_id) # Base case. if project.projectcampaign.money_donated + remaining_amount <= project.projectcampaign.money_asked or \ len(popular_projects) == 0: # The remaining amount won't fill up the project or we have no more projects to try. We're done. logger.debug(u"Donation is less than project '{0}' needs. No further adjustments are needed.".format(project.title)) donation.amount = remaining_amount donation.donation_type = Donation.DonationTypes.recurring donation.save() return # Recursive case. else: # Fill up the project. logger.debug(u"Donation is more than project '{0}' needs. Filling up project and creating new donation.".format(project.title)) donation.amount = project.projectcampaign.money_asked - project.projectcampaign.money_donated donation.donation_type = Donation.DonationTypes.recurring donation.save() # Create a new Donation and recursively update it with the remaining amount. ct = ContentType.objects.get_for_model(donation) order = OrderItem.objects.get(content_type=ct, content_object=donation) new_project = popular_projects.pop(0) new_donation = Donation.objects.create(user=donation.user, project=new_project, amount=0, currency='EUR', donation_type=Donation.DonationTypes.recurring) OrderItem.objects.create(content_object=new_donation, order=order) update_last_donation(new_donation, remaining_amount - donation.amount, popular_projects) def create_recurring_order(user, projects, order=None): """ Creates a recurring Order with donations to the supplied projects. """ if not order: order = Order.objects.create(status=OrderStatuses.recurring, user=user, recurring=True) for p in projects: project = Project.objects.get(id=p.id) if project.phase == ProjectPhases.campaign: donation = Donation.objects.create(user=user, project=project, amount=0, currency='EUR', donation_type=Donation.DonationTypes.recurring) OrderItem.objects.create(content_object=donation, order=order) return order def correct_donation_amounts(popular_projects, recurring_order, recurring_payment): """ Divides the total amount for the monthly donation across all projects. This method deals with the case of a donation filling up a project. """ remaining_amount = recurring_payment.amount num_donations = recurring_order.donations.count() amount_per_project = math.floor(recurring_payment.amount / num_donations) donations = recurring_order.donations for i in range(0, num_donations - 1): donation = donations[i] project = Project.objects.get(id=donation.project_id) if project.projectcampaign.money_donated + amount_per_project > project.projectcampaign.money_asked: donation.amount = project.projectcampaign.money_asked - project.projectcampaign.money_donated else: donation.amount = amount_per_project donation.donation_type = Donation.DonationTypes.recurring donation.save() remaining_amount -= donation.amount # Update the last donation with the remaining amount. update_last_donation(donations[num_donations - 1], remaining_amount, popular_projects) def set_order_created_datetime(recurring_order, order_created_datetime): """ Uses custom SQL to set the created time of Order to a consistent value. """ db_table = recurring_order._meta.db_table pk_name = recurring_order._meta.pk.name logger.debug("Setting created and updated to {0} on Order {1}.".format(order_created_datetime, recurring_order.id)) cursor = connection.cursor() sql_statement = "UPDATE {0} SET created = '{1}' WHERE {2} = {3}".format(db_table, order_created_datetime, pk_name, recurring_order.pk) cursor.execute(sql_statement) sql_statement = "UPDATE {0} SET updated = '{1}' WHERE {2} = {3}".format(db_table, order_created_datetime, pk_name, recurring_order.pk) cursor.execute(sql_statement) transaction.commit_unless_managed() def process_monthly_donations(recurring_payments_queryset, send_email): """ The starting point for creating DocData payments for the monthly donations. """ recurring_donation_errors = [] RecurringDonationError = namedtuple('RecurringDonationError', 'recurring_payment error_message') skipped_recurring_payments = [] SkippedRecurringPayment = namedtuple('SkippedRecurringPayment', 'recurring_payment orders') donation_count = 0 # The adapter is used after the recurring Order and donations have been adjusted. It's created here so that we can # reuse it to process all recurring donations. webdirect_payment_adapter = WebDirectDocDataDirectDebitPaymentAdapter() # A consistent created time to use for the created recurring Orders. order_created_datetime = timezone.now() # Fixed lists of the popular projects. popular_projects_all = list(Project.objects.filter(phase=ProjectPhases.campaign).order_by('-popularity')) top_three_projects = popular_projects_all[:3] popular_projects_rest = popular_projects_all[3:] logger.info("Config: Using these projects as 'Top Three':") for project in top_three_projects: logger.info(" {0}".format(project.title)) # The main loop that processes each monthly donation. for recurring_payment in recurring_payments_queryset: top_three_donation = False user_selected_projects = [] # Skip payment if there has been a recurring Order recently. ten_days_ago = timezone.now() + timezone.timedelta(days=-10) recent_closed_recurring_orders = Order.objects.filter(user=recurring_payment.user, status=OrderStatuses.closed, recurring=True, updated__gt=ten_days_ago) if recent_closed_recurring_orders.count() > 0: skipped_recurring_payments.append(SkippedRecurringPayment(recurring_payment, list(recent_closed_recurring_orders))) logger.warn( "Skipping '{0}' because it looks like it has been processed recently with one of these Orders:".format( recurring_payment)) for closed_order in recent_closed_recurring_orders: logger.warn(" Order Number: {0}".format(closed_order.order_number)) continue # Check if there is a monthly shopping cart (Order status is 'recurring') for this recurring_payment user. try: recurring_order = Order.objects.get(user=recurring_payment.user, status=OrderStatuses.recurring) logger.debug("Using existing recurring Order for user: {0}.".format(recurring_payment.user)) except Order.DoesNotExist: # There is no monthly shopping cart. The user is supporting the top three projects so we need to create an # Order with Donations for the top three projects. logger.debug("Creating new 'Top Three' recurring Order for user {0}.".format(recurring_payment.user)) recurring_order = create_recurring_order(recurring_payment.user, top_three_projects) top_three_donation = True except Order.MultipleObjectsReturned: error_message = "Multiple Orders with status 'recurring' returned for '{0}'. Not processing this recurring donation.".format( recurring_payment) logger.error(error_message) recurring_donation_errors.append(RecurringDonationError(recurring_payment, error_message)) continue # Check if we're above the DocData minimum for direct debit. if recurring_payment.amount < 113: # Cleanup the Order if there's an error. if top_three_donation: recurring_order.delete() error_message = "Payment amount for '{0}' is less than the DocData minimum for direct debit (113). Skipping.".format( recurring_payment) logger.error(error_message) recurring_donation_errors.append(RecurringDonationError(recurring_payment, error_message)) continue # Remove donations to projects that are no longer in the campaign phase. for donation in recurring_order.donations: project = Project.objects.get(id=donation.project.id) if project.phase != ProjectPhases.campaign: ctype = ContentType.objects.get_for_model(donation) order_item = OrderItem.objects.get(object_id=donation.id, content_type=ctype) order_item.delete() donation.delete() if recurring_order.donations.count() > 0: # There are donations in the recurring Order and we need to redistribute / correct the donation amounts. # Save a copy of the projects that have been selected by the user so that the monthly shopping cart can # recreated after the payment has been successfully started. for donation in recurring_order.donations: user_selected_projects.append(donation.project) correct_donation_amounts(popular_projects_all, recurring_order, recurring_payment) else: # There are no donations in the recurring Order so we need to create a monthly shopping cart to support the # top three projects and redistribute / correct the donation amounts. create_recurring_order(recurring_payment.user, top_three_projects, recurring_order) if recurring_order.donations.count() == 0: logger.debug("The top three donations are full. Using next three projects for top three.") top_three_projects = popular_projects_rest[:3] popular_projects_rest = popular_projects_rest[3:] create_recurring_order(recurring_payment.user, top_three_projects, recurring_order) correct_donation_amounts(popular_projects_rest, recurring_order, recurring_payment) top_three_donation = True # At this point the order should be correctly setup and ready for the DocData payment. if top_three_donation: donation_type_message = "supporting the 'Top Three' projects" else: donation_type_message = "with {0} donations".format(recurring_order.donations.count()) logger.info("Starting payment for '{0}' {1}.".format(recurring_payment, donation_type_message)) # Safety check to ensure the modifications to the donations in the recurring result in an Order total that # matches the RecurringDirectDebitPayment. if recurring_payment.amount != recurring_order.total: # Cleanup the Order if there's an error. if top_three_donation: recurring_order.delete() error_message = "RecurringDirectDebitPayment amount: {0} does not equal recurring Order amount: {1} for '{2}'. Not processing this recurring donation.".format( recurring_payment.amount, recurring_order.total, recurring_payment) logger.error(error_message) recurring_donation_errors.append(RecurringDonationError(recurring_payment, error_message)) continue # Check if the IBAN / BIC is stored correctly on the RecurringDirectDebitPayment. if recurring_payment.iban == '' or recurring_payment.bic == '' or \ not recurring_payment.iban.endswith(recurring_payment.account) or \ recurring_payment.bic[:4] != recurring_payment.iban[4:8]: # Cleanup the Order if there's an error. if top_three_donation: recurring_order.delete() error_message = "Cannot create payment because the IBAN and/or BIC are not available." logger.error(error_message) recurring_donation_errors.append(RecurringDonationError(recurring_payment, error_message)) continue # Create and fill in the DocDataPaymentOrder. payment = DocDataPaymentOrder() payment.order = recurring_order payment.payment_method_id = 'dd-webdirect' payment.amount = recurring_payment.amount payment.currency = recurring_payment.currency payment.customer_id = recurring_payment.user.id payment.email = recurring_payment.user.email # Use the recurring payment name (bank account name) to set the first and last name if they're not set. if not recurring_payment.user.first_name: if ' ' in recurring_payment.name: payment.first_name = recurring_payment.name.split(' ')[0] else: payment.first_name = recurring_payment.name else: payment.first_name = recurring_payment.user.first_name if not recurring_payment.user.last_name: if ' ' in recurring_payment.name: payment.last_name = recurring_payment.name[recurring_payment.name.index(' ') + 1:] else: payment.last_name = recurring_payment.name else: payment.last_name = recurring_payment.user.last_name # Try to use the address from the profile if it's set. address = recurring_payment.user.address if not address: # Cleanup the Order if there's an error. if top_three_donation: recurring_order.delete() error_message = "Cannot create a payment for '{0}' because user does not have an address set.".format(recurring_payment) logger.error(error_message) recurring_donation_errors.append(RecurringDonationError(recurring_payment, error_message)) continue # Set a default value for the pieces of the address that we don't have. unknown_value = u'Unknown' if not address.line1: logger.warn("User '{0}' does not have their street and street number set. Using '{1}'.".format(recurring_payment.user, unknown_value)) payment.address = unknown_value else: payment.address = address.line1 if not address.city: logger.warn("User '{0}' does not have their city set. Using '{1}'.".format(recurring_payment.user, unknown_value)) payment.city = unknown_value else: payment.city = address.city if not address.postal_code: logger.warn("User '{0}' does not have their postal code set. Using '{1}'.".format(recurring_payment.user, unknown_value)) payment.postal_code = unknown_value else: payment.postal_code = address.postal_code # Assume the Netherlands when country not set. if address.country: payment.country = address.country.alpha2_code else: payment.country = 'NL' # Try to use the language from the User settings if it's set. if recurring_payment.user.primary_language: payment.language = recurring_payment.user.primary_language[:2] # Cut off locale. else: payment.language = 'nl' payment.save() # Start the WebDirect payment. try: webdirect_payment_adapter.create_remote_payment_order(payment) except DocDataPaymentException as e: # Cleanup the Order if there's an error. if top_three_donation: recurring_order.delete() error_message = "Problem creating remote payment order." logger.error(error_message) recurring_donation_errors.append( RecurringDonationError(recurring_payment, "{0} {1}".format(error_message, e.message))) continue else: recurring_order.status = OrderStatuses.closed recurring_order.save() try: webdirect_payment_adapter.start_payment(payment, recurring_payment) except DocDataPaymentException as e: # Cleanup the Order if there's an error. if top_three_donation: recurring_order.delete() else: recurring_order.status = OrderStatuses.recurring recurring_order.save() error_message = "Problem starting payment." logger.error(error_message) recurring_donation_errors.append( RecurringDonationError(recurring_payment, "{0} {1}".format(error_message, e.message))) continue logger.debug("Payment for '{0}' started.".format(recurring_payment)) donation_count += 1 # Send an email to the user. if send_email: mail_monthly_donation_processed_notification(recurring_payment, recurring_order) # Create a new recurring Order (monthly shopping cart) for donations that are not to the 'Top Three'. if not top_three_donation and len(user_selected_projects) > 0: new_recurring_order = create_recurring_order(recurring_payment.user, user_selected_projects) # Adjust donation amounts in a simple way for the recurring Order (the monthly donations shopping cart). num_donations = new_recurring_order.donations.count() amount_per_project = math.floor(recurring_payment.amount / num_donations) donations = new_recurring_order.donations for i in range(0, num_donations - 1): donation = donations[i] donation.amount = amount_per_project donation.donation_type = Donation.DonationTypes.recurring donation.save() # Update the last donation with the remaining amount. donation = donations[num_donations - 1] donation.amount = recurring_payment.amount - (amount_per_project * (num_donations - 1)) donation.donation_type = Donation.DonationTypes.recurring donation.save() set_order_created_datetime(recurring_order, order_created_datetime) logger.info("") logger.info("Recurring Donation Processing Summary") logger.info("=====================================") logger.info("") logger.info("Total number of recurring donations: {0}".format(recurring_payments_queryset.count())) logger.info("Number of recurring Orders successfully processed: {0}".format(donation_count)) logger.info("Number of errors: {0}".format(len(recurring_donation_errors))) logger.info("Number of skipped payments: {0}".format(len(skipped_recurring_payments))) if len(recurring_donation_errors) > 0: logger.info("") logger.info("") logger.info("Detailed Error List") logger.info("===================") logger.info("") for error in recurring_donation_errors: logger.info("RecurringDirectDebitPayment: {0} {1}".format(error.recurring_payment.id, error.recurring_payment)) logger.info("Error: {0}".format(error.error_message)) logger.info("--") if len(skipped_recurring_payments) > 0: logger.info("") logger.info("") logger.info("Skipped Recurring Payments") logger.info("==========================") logger.info("") for skipped_payment in skipped_recurring_payments: logger.info("RecurringDirectDebitPayment: {0} {1}".format(skipped_payment.recurring_payment.id, skipped_payment.recurring_payment)) for closed_order in skipped_payment.orders: logger.info("Order Number: {0}".format(closed_order.order_number)) logger.info("--")
[ 11748, 269, 21370, 198, 11748, 28686, 198, 11748, 10688, 198, 11748, 18931, 198, 11748, 12854, 1891, 198, 11748, 7007, 198, 11748, 25064, 198, 6738, 17268, 1330, 3706, 83, 29291, 198, 6738, 2172, 29572, 1330, 787, 62, 18076, 198, 6738, 42...
2.602817
8,165
# Author: Kim Hammar <kimham@kth.se> KTH 2018 from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk.tokenize import TweetTokenizer from nltk.tag.perceptron import PerceptronTagger import nltk import emoji nltk.download('averaged_perceptron_tagger') nltk.download('stopwords') nltk.download('wordnet')
[ 2, 6434, 25, 6502, 4345, 3876, 1279, 74, 320, 2763, 31, 74, 400, 13, 325, 29, 509, 4221, 2864, 198, 198, 6738, 299, 2528, 74, 13, 10215, 79, 385, 1330, 2245, 10879, 198, 6738, 299, 2528, 74, 13, 927, 1330, 9678, 7934, 43, 368, 6...
2.743802
121
from .utils.handler.config import ConfigHandler
[ 6738, 764, 26791, 13, 30281, 13, 11250, 1330, 17056, 25060 ]
4.7
10
from ._core import Collection, local, task ns = Collection("start") ns.add_task(start_all) ns.add_task(start_main) ns.add_task(start_minimal)
[ 6738, 47540, 7295, 1330, 12251, 11, 1957, 11, 4876, 628, 628, 198, 198, 5907, 796, 12251, 7203, 9688, 4943, 198, 5907, 13, 2860, 62, 35943, 7, 9688, 62, 439, 8, 198, 5907, 13, 2860, 62, 35943, 7, 9688, 62, 12417, 8, 198, 5907, 13,...
2.722222
54
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 17 23:14:28 2018 @author: Akihiro Inui """ def rolloff(input_power_spectrum: list, param: float=0.85) -> float: """ Spectral Rolloff :param input_power_spectrum: power spectrum in list :param param: threadshold for roll off :return Spectral Rolloff """ assert (param <= 0 or param >= 1) is False, "parameter must be between 0 and 1" # Initialize energy and FFT number energy = 0 count = 0 # Calculate total energy total_energy = sum(input_power_spectrum[:]**2) # Find Count which has energy below param*total_energy while energy <= param*total_energy and count < len(input_power_spectrum): energy = pow(input_power_spectrum[count], 2) + energy count += 1 # Normalise Spectral Rolloff return count/len(input_power_spectrum)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 41972, 319, 7031, 1526, 1596, 2242, 25, 1415, 25, 2078, 2864, 198, 198, 31, 9800, 25, 48663, 49907, 5...
2.674699
332
#!/usr/bin/env python from lib2to3.main import main import sys import os sys.exit(main("lib2to3.fixes"))
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 201, 198, 6738, 9195, 17, 1462, 18, 13, 12417, 1330, 1388, 201, 198, 11748, 25064, 201, 198, 11748, 28686, 201, 198, 201, 198, 17597, 13, 37023, 7, 12417, 7203, 8019, 17, 1462, 18, 13, 42...
2.434783
46
""" Afterglow Core: photometric calibration job schemas """ from typing import List as TList from marshmallow.fields import Integer, List, Nested from ..job import JobSchema, JobResultSchema from ..field_cal import FieldCalSchema, FieldCalResultSchema from ..photometry import PhotSettingsSchema from .source_extraction_job import SourceExtractionSettingsSchema __all__ = ['FieldCalJobResultSchema', 'FieldCalJobSchema']
[ 37811, 198, 3260, 4743, 322, 7231, 25, 2825, 16996, 36537, 1693, 3897, 5356, 198, 37811, 198, 198, 6738, 19720, 1330, 7343, 355, 309, 8053, 198, 198, 6738, 22397, 42725, 13, 25747, 1330, 34142, 11, 7343, 11, 399, 7287, 198, 198, 6738, ...
3.627119
118
#import unittest #case 1 t = Node(4) #binary_insert(t, Node(2)) #binary_insert(t, Node(7)) #binary_insert(t, Node(3)) #binary_insert(t, Node(6)) #binary_insert(t, Node(2)) #binary_insert(t, Node(5)) #insertIntoBinaryTreeWithAGivenIntArray(t, [4, 2, 6, 3, 1, 5]) t.left = Node(2) t.right = Node(6) t.left.left = Node(3) t.left.right = Node(1) t.right.left = Node(5) pre_order_print(t) d = 2 v = 99 addRow(t, d, v) pre_order_print(t) #in_order_print(t) #case 2
[ 2, 11748, 555, 715, 395, 628, 628, 198, 2, 7442, 352, 198, 83, 796, 19081, 7, 19, 8, 198, 2, 39491, 62, 28463, 7, 83, 11, 19081, 7, 17, 4008, 198, 2, 39491, 62, 28463, 7, 83, 11, 19081, 7, 22, 4008, 198, 2, 39491, 62, 28463,...
2.089686
223
expected_output = { "interface": { "GigabitEthernet0/0/0": { "interface_is_ok": "YES", "ip_address": "10.105.44.23", "method": "other", "protocol": "up", "status": "up" }, "GigabitEthernet0/0/1": { "interface_is_ok": "YES", "ip_address": "10.174.10.1", "method": "other", "protocol": "up", "status": "up" }, "GigabitEthernet0/0/2": { "interface_is_ok": "YES", "ip_address": "10.64.10.1", "method": "other", "protocol": "up", "status": "up" }, "GigabitEthernet0/0/3": { "interface_is_ok": "YES", "ip_address": "10.186.10.1", "method": "other", "protocol": "up", "status": "up" }, "Loopback65528": { "interface_is_ok": "YES", "ip_address": "192.168.1.1", "method": "other", "protocol": "up", "status": "up" }, "NVI0": { "interface_is_ok": "YES", "ip_address": "unassigned", "method": "unset", "protocol": "up", "status": "up" }, "Sdwan-system-intf": { "interface_is_ok": "YES", "ip_address": "192.168.10.64", "method": "unset", "protocol": "up", "status": "up" }, "TenGigabitEthernet0/0/4": { "interface_is_ok": "YES", "ip_address": "10.121.10.1", "method": "other", "protocol": "up", "status": "up" }, "TenGigabitEthernet0/0/5": { "interface_is_ok": "YES", "ip_address": "unassigned", "method": "unset", "protocol": "down", "status": "down" }, "Tunnel1": { "interface_is_ok": "YES", "ip_address": "10.174.10.1", "method": "TFTP", "protocol": "up", "status": "up" }, "Tunnel2000000001": { "interface_is_ok": "YES", "ip_address": "192.168.2.1", "method": "unset", "protocol": "up", "status": "up" }, "Tunnel2000000002": { "interface_is_ok": "YES", "ip_address": "192.168.166.1", "method": "unset", "protocol": "up", "status": "up" }, "Tunnel3": { "interface_is_ok": "YES", "ip_address": "10.186.10.1", "method": "TFTP", "protocol": "up", "status": "up" }, "TwoGigabitEthernet0/1/0": { "interface_is_ok": "YES", "ip_address": "unassigned", "method": "unset", "protocol": "up", "status": "up" }, "TwoGigabitEthernet0/2/0": { "interface_is_ok": "YES", "ip_address": "unassigned", "method": "unset", "protocol": "up", "status": "up" }, "Ucse1/0/0": { "interface_is_ok": "YES", "ip_address": "10.19.14.1", "method": "other", "protocol": "down", "status": "administratively down" }, "Ucse1/0/1": { "interface_is_ok": "YES", "ip_address": "unassigned", "method": "unset", "protocol": "down", "status": "administratively down" }, "VirtualPortGroup0": { "interface_is_ok": "YES", "ip_address": "192.0.2.1", "method": "other", "protocol": "up", "status": "up" }, "VirtualPortGroup1": { "interface_is_ok": "YES", "ip_address": "192.168.2.1", "method": "other", "protocol": "up", "status": "up" }, "VirtualPortGroup3": { "interface_is_ok": "YES", "ip_address": "192.168.3.1", "method": "other", "protocol": "up", "status": "up" }, "VirtualPortGroup4": { "interface_is_ok": "YES", "ip_address": "192.168.166.1", "method": "other", "protocol": "up", "status": "up" } } }
[ 40319, 62, 22915, 796, 1391, 198, 220, 220, 220, 366, 39994, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 366, 38, 328, 29968, 36, 490, 3262, 15, 14, 15, 14, 15, 1298, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 220, 22...
1.615803
2,759
from common import is_connection_ok import paramiko """ execute_ssh(host, port, username, password, cmd) """
[ 6738, 2219, 1330, 318, 62, 38659, 62, 482, 198, 11748, 5772, 12125, 198, 198, 37811, 198, 41049, 62, 45824, 7, 4774, 11, 2493, 11, 20579, 11, 9206, 11, 23991, 8, 198, 37811, 198, 220, 220, 220, 220, 220, 220, 220, 220 ]
2.878049
41
''' ''' HEADERS_IPHONE = {'user-agent': ( 'Mozilla/5.0 ' '(iPhone; CPU iPhone OS 6_0 like Mac OS X) ' 'AppleWebKit/536.26 (KHTML, like Gecko) ' 'Version/6.0 Mobile/10A5376e Safari/8536.25' )} HEADERS_CHROME = {'user-agent': ( 'Mozilla/5.0 (X11; Linux x86_64) ' 'AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/67.0.3396.99 Safari/537.36' )}
[ 7061, 6, 198, 198, 7061, 6, 198, 198, 37682, 4877, 62, 4061, 39, 11651, 796, 1391, 6, 7220, 12, 25781, 10354, 357, 198, 220, 220, 220, 705, 44, 8590, 5049, 14, 20, 13, 15, 705, 198, 220, 220, 220, 29513, 37032, 26, 9135, 7133, 7...
2.016216
185
from ped_core import editor_common import io import pprint import os import curses import curses.ascii import time import re from ped_core import keymap from ped_core import keytab from ped_core import clipboard from ped_test_util import read_str, match_attr, undo_all, window_pos, play_macro, validate_mark, validate_screen, editor_test_suite import subprocess
[ 6738, 7190, 62, 7295, 1330, 5464, 62, 11321, 198, 11748, 33245, 198, 11748, 279, 4798, 198, 11748, 28686, 198, 11748, 43878, 198, 11748, 43878, 13, 292, 979, 72, 198, 11748, 640, 198, 11748, 302, 198, 6738, 7190, 62, 7295, 1330, 1994, ...
3.447619
105
from rsmtpd.response.action import OK from rsmtpd.response.base_response import BaseResponse
[ 6738, 374, 5796, 83, 30094, 13, 26209, 13, 2673, 1330, 7477, 198, 6738, 374, 5796, 83, 30094, 13, 26209, 13, 8692, 62, 26209, 1330, 7308, 31077, 628 ]
3.481481
27
import datetime import re from django.contrib.sites.models import Site from django.core import mail from django.test import TestCase from django.urls import reverse from django.utils import timezone import numpy as np import pandas as pd import pytz from qatrack.qa.tests import utils from qatrack.qatrack_core.serializers import QATrackJSONEncoder from qatrack.qatrack_core.utils import end_of_day, relative_dates, start_of_day
[ 11748, 4818, 8079, 198, 11748, 302, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 49315, 13, 27530, 1330, 14413, 198, 6738, 42625, 14208, 13, 7295, 1330, 6920, 198, 6738, 42625, 14208, 13, 9288, 1330, 6208, 20448, 198, 6738, 42625, 1...
3.167883
137
from django.conf.urls import patterns, url from app.blog import views as blog_views urlpatterns = [ #django url url(r'^$', blog_views.index, name='blog_index'), ]
[ 6738, 42625, 14208, 13, 10414, 13, 6371, 82, 1330, 7572, 11, 19016, 198, 198, 6738, 598, 13, 14036, 1330, 5009, 355, 4130, 62, 33571, 628, 198, 6371, 33279, 82, 796, 685, 198, 220, 220, 220, 1303, 28241, 14208, 19016, 198, 220, 220, ...
2.557143
70
# -*- coding: utf-8 -*- from os import environ from typing import Optional, Dict, Any, Type
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 28686, 1330, 551, 2268, 198, 6738, 19720, 1330, 32233, 11, 360, 713, 11, 4377, 11, 5994, 628, 628, 198 ]
2.771429
35
try: s = raw_input("Enter score between 0.0 and 1.0: ") score = float(s) if score < 0 or score > 1: raise Exception except ValueError: print "You didn't even enter a number" except: print "Not a possible score." else: if score >= 0.9: print "A" elif score >= 0.8: print "B" elif score >= 0.7: print "C" elif score >= 0.6: print "D" else: print "F"
[ 28311, 25, 198, 220, 220, 220, 264, 796, 8246, 62, 15414, 7203, 17469, 4776, 1022, 657, 13, 15, 290, 352, 13, 15, 25, 366, 8, 198, 220, 220, 220, 4776, 796, 12178, 7, 82, 8, 198, 220, 220, 220, 611, 4776, 1279, 657, 393, 4776, ...
2.096154
208
import pyttsx3 engine = pyttsx3.init() engine.setProperty('rate', 150) voices = engine.getProperty('voices') engine.setProperty("voice", 'english_rp+f4') talk("My name is robot leena")
[ 11748, 12972, 83, 912, 87, 18, 198, 198, 18392, 796, 12972, 83, 912, 87, 18, 13, 15003, 3419, 198, 18392, 13, 2617, 21746, 10786, 4873, 3256, 6640, 8, 198, 13038, 1063, 796, 3113, 13, 1136, 21746, 10786, 13038, 1063, 11537, 198, 198, ...
2.676056
71
import logging
[ 11748, 18931, 628, 198 ]
4.25
4