index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
998,200
6baf2478703ad51e0d998483d520e5f0e3821869
class Proposal: def __init__(self, priority, message, origin): self.priority = round(float(priority), 4) self.message = str(message) self.origin = origin def __repr__(self): return "Proposal(" + str(self.priority) + ", " + str(self.message) + ")" def __lt__(self, other): ...
998,201
a240389ee3310fe1ba6740b199ecb5da1d9a305f
#!/cvmfs/sft.cern.ch/lcg/views/LCG_98python3/x86_64-centos7-gcc9-opt/bin/python3 # -*- coding: utf-8 -*- """ Example: python HiggsAnalysis/friend-tree-producer/scripts/add_ML_models_prediction_in_root_file.py \ --input <path to root file> \ --XGBs <path to XGB json files> \ ...
998,202
6d5365252c3aa1290b03461fee9dc9442f1ba300
from django.contrib import admin from landloard.models import HostelHomePage, HostelService, HostelGallary, HostelContact, HostelPlan from Profile.models import LandlordProfile # Register your models here. class HostelHomePageModelAdmin(admin.ModelAdmin): list_display = ["hostel_name","welcoming_message","backgrou...
998,203
20be6d3931c2ea56d726104d4a345907dd9aa728
from datetime import datetime def write_log(logs, from_file): for log in logs: print(f"{str(log)} \n") print("\nFrom file: " + from_file + "\n" + "Date-time: " + datetime.now().strftime("%Y-%m-%d %H-%M \n")) print("-" * 25 + '\n\n\n') # with open("log.txt", "a", encoding="utf-8") as f: #...
998,204
f65530d4b29101c388ffbc3be35d7e0a6d86da46
def solver(line): l, sequence = line.split()[1:], [] for i in xrange(0,len(l),2): sequence.append((l[i], int(l[i+1]))) prevB, prevO = 1, 1 timeB, timeO, time = 0, 0, 0 for next in sequence: if next[0] == 'O': step = abs(prevO-next[1]) + 1 prevO = next[1] timeO = max(timeO + step, timeB + 1) tim...
998,205
570f04b6a563f9ae3597e0eec25977222a3ef97f
import json import jsonschema import os with open(os.path.join(os.path.dirname(__file__), "1ZoneUncontrolled.epJSON")) as f2: input_file = json.load(f2) with open(os.path.join(os.path.dirname(__file__), "Energy+.schema.epJSON")) as f: schema = json.load(f) jsonschema.validate(input_file, schema)
998,206
08bf95d49d7fb7806daf01ea953f2bdf35ec3950
import numpy as np from keras.layers import Dense, Embedding, LSTM from keras.models import Sequential from keras.preprocessing import sequence from keras.datasets import imdb # Устанавливаем seed для повторяемости результатов np.random.seed(42) # Максимальное количество слов (по частоте использования) max_features =...
998,207
876aedb27be373148a772c68bbde098f7b911169
from flask import Blueprint, jsonify, current_app, abort bp = Blueprint('routes', __name__, url_prefix="/routes") # pylint: disable=invalid-name @bp.route('/', methods=['GET']) def routes(): # pragma: no cover """Print available functions.""" if not current_app.debug: abort(404) func_list = [...
998,208
c8352748395e998eea6db98477a20efd73b65cba
#! /usr/bin/env python # -*- coding: utf-8 -*- import requests import bs4 import json import time if __name__ == '__main__': with open("29027415.html", "r") as fw: content = fw.read() htmlSoup = bs4.BeautifulSoup(content, features="html.parser") # txt = htmlSoup.find_all('div', class_='d2txt') ...
998,209
4e352de3ff4d215d2364400e2e822644e00b3cd4
# tkinter — Python interface to Tcl/Tk # The tkinter package (“Tk interface”) is the standard Python interface to the # Tk GUI toolkit. # Tk itself is not part of Python; it is maintained at ActiveState. # lookup(style, option, state=None, default=None). # Returns the value specified for option in style. # If ...
998,210
3b74fe012607e69360fc3a5a4b5cfca823353105
# Busqueda primero en anchura - Breadth First Search from Nodos import Nodo def busqueda_BPA_solucion(conecciones, estado_inicial, solucion): resuelto = False nodos_visitados = [] nodos_frontera = [] nodo_inicial = Nodo(estado_inicial) nodos_frontera.append(nodo_inicial) while (not resuelto) a...
998,211
f632909afe6014a50ffda534c6947a382df9bd72
# Generated by Django 2.1.3 on 2018-11-11 20:01 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('etsy_core', '0014_productimage'), ] operations = [ migrations.CreateModel(...
998,212
843db326b32965fd1687202cfa4307a31b095c6e
# Django settings for instamedia project. import os, logging logging.basicConfig( level = logging.DEBUG, format = '%(asctime)s %(levelname)s %(message)s', ) DEBUG = True TEMPLATE_DEBUG = DEBUG logging.debug("Reading settings...") ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) PROJECT_PATH = os....
998,213
cfa6671c6b08c695953c3413785d39864036dc86
from django.db import models # Create your models here. class Transaction(models.Model): # Transaction id sent by merchant. transaction_id = models.CharField(max_length=100) # Payment gateway type used in transaction payment_gateway_type = models.CharField(max_length=20, null=True, blank=True) # Ma...
998,214
315207ccb422fcf3d82db7beca509059265a583f
import RPi.GPIO as GPIO import time #import requests #import os #os.system('fswebcam image.jpg -save /home/pi/Desktop/image.jpg') #url="https://smart-sort.herokuapp.com/process" #filess = {"img":open("/home/pi/Desktop/image.jpg","rb")} #result=requests.post(url,files=filess) #print(resu...
998,215
dde7f523d311f53df89cb0d0b39ef97e27bce783
from flask import request, jsonify from flask.views import MethodView from werkzeug.exceptions import abort from weathertracker.stats import get_stats from weathertracker.utils.conversion import ( convert_to_datetime, convert_to_string, DatetimeConversionException, ) class StatsAPI(MethodView...
998,216
a466335b2ec63302b973af3576067000d8c62715
import operator f=open("intro.txt") words=[] dict={'the':0, 'of':0, 'for':0, 'is':0, 'as':0, 'an':0} for line in f: a=line.split(",") for i in a: b=i.split(".") for j in b: c=j.split() for k in c: if k in dict: dict[k]+=1 t=tuple(dict.items()) t = sorted(t, key=operator...
998,217
dc89143753fdebe7f51f516971091a89f947e8e9
#!/usr/bin/env python def div(a, y): ''' Divide two numbers''' if y == 0: return 0 else: return a/y if __name__ == '__main__': print (div(2,4)) print (div(2,0))
998,218
d7415ceb2834a83efb4ecacd78a85a5954a2c4d6
# Copyright The OpenTelemetry Authors # # 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 ...
998,219
5a1a87af9ac3f0eb6db671af6162c1ace7b0f069
import os import numpy as np import pandas as pd import cPickle as pickle from natsort import natsorted from random import randint from skimage import exposure from matplotlib import pyplot from skimage.io import imread from PIL import Image from skimage.io import imshow from skimage.filters import sobel from skimage ...
998,220
de1cd4efe72560e1159d82541af09a8350005630
r = sum(range(1,101)) s = [x*x for x in range(1,101) ] print((r*r) - sum(s))
998,221
828b96ed2451e67cdfe07ed28150a91accd84ba2
# -*- coding: utf-8 -*- # @Time : 2019/12/5 0005 13:09 # @Author : 没有蜡笔的小新 # @E-mail : sqw123az@sina.com # @FileName: xadmin.py # @Software: PyCharm # @Blog :https://blog.csdn.net/Asunqingwen # @GitHub :https://github.com/Asunqingwen # @WebSite : labixiaoxin.me import xadmin from .models import Goods, GoodsCa...
998,222
352c50c827e64f13ad6ae53c7e942322e032819e
from datetime import datetime import logging import json logging.basicConfig(level=logging.INFO) USERFILE = 'user.json' # 产生一条信息,返回信息的字典形式 def create_user(user, passwd, label): logging.info("create user recorde") message = {} message['time'] = datetime.today().strftime('%Y-%m-%d %H:%M:%S') message['use...
998,223
13658f1ccccf02770e12ddaa13364976a4d79dd7
# -*- coding: utf-8 -*- # # Created by: PyQt5 UI code generator 5.12.3 # # WARNING! All changes made in this file will be lost! import sys from PyQt5 import QtCore, QtGui, QtWidgets from howToReachUsGUI import ROOT_DIR sys.path.append(ROOT_DIR + '\\YOUniversity\\BayesianNetwork') from bayesianNetwork import gradeBaye...
998,224
4d72fd0d0cf186ab9f2ea9edeb7a92821d0f6edd
""" Backtracking(Time limit exceeds) Illustraction of the backtracking tree: ex. nums = [ 1,1,1], S = 1. The node is the possible sum in nums[0:level] root / \ 1 -1 / \ / \ 2 0 0 -2 / \ / \ / \ / \ 3 1 1 -1 1 -1 -1 -...
998,225
4f2f3b4c025a02ef8e42b702286c8f7165bd8e31
#!/usr/bin/env python3 # This script is a all-in-one script. # It includes the the create_blob, create_tree and create_commit functionality. # # Author: Tim Silhan import os import zlib import time from hashlib import sha1 # Create the blob object print("Blob") print("-----------------------") blob_content = 'Hell...
998,226
9a07d3fb295afd6c9f316382a6eb2a1d08374934
import os.path, sys from sage.all import SQLDatabase import base padic_db = base.getDBConnection().ellcurves.padic_db padic_db.ensure_index("label") padic_db.ensure_index("prime") def lookup_or_create(label,p): item = padic_db.find_one({'label': label, 'p': p}) if item is None: return {'label': label,...
998,227
972ad02c94aecba3f4259f1197fd1b6c38a76ac3
import numpy as np from sklearn.svm import LinearSVC from sklearn.model_selection import GridSearchCV from sklearn.svm import SVC import read_data import pca from imputation import * USE_IMPUTED_DATA = True def train_basicSVM(): #basic SVM model basic_svm = LinearSVC() basic_svm.fit(X_train, y_train) print("Bas...
998,228
15d618678d58deb911ba641dddfd995fdf00ed14
#!/bin/python class Questionair(): def __init__(self, data:str ): self._raw = data; # Dont like work in the constructor. Might remove this self.answers = data.replace( '\r', '' ).replace( '\n', '' ); self.individual_answers = data.replace( '\r', '' ).split( '\n' ); def count_ans...
998,229
d6591d8e29319e1a5f7ea8618d1d4863c494507e
import configparser import os import pymongo class MongoTools: def __init__(self): config = configparser.ConfigParser() BASE_DIR = os.path.dirname(os.path.abspath(__file__)) path = os.path.join(BASE_DIR, 'config.ini') config.read(path) self.mongo_database = config['MONGO']...
998,230
8e5187a9dea988e0958d4d9b9f3a5b117ea710ca
#! /usr/bin/python from distutils.core import setup import os version = "3.0.0" versionfile_path = os.path.join("globus","connect","server", "version") oldversion = None if os.path.exists(versionfile_path): oldversionfile = file(versionfile_path, "r") try: oldversion = oldversionfile.read().strip() ...
998,231
0d8cb2a16de9d41a38a4670555c669dc79211a19
import folium from itertools import cycle def draw_paths(center, paths, file_name): """ :param center: list[lat, lng] :param paths: list of Paths, where path is a list like this: [(52.529, 13.407, 'TItle 1'), (52.529, 13.407, 'TItle 2')] :param file_name: where to save the map, e.g. 'map.html'...
998,232
a21637baac43301b9a2317b384b34bc771f04683
from argparse import Namespace from commands.command import Command from datetime import datetime from util import tint_yellow, tint_red, tint_green, tint_blue from util import tri_state_value, tri_state_device import csv class Profile(Command): """This class represents the 'profile' subcommand.""" def __init__(...
998,233
3a13fbc2f4c6154474d162f30e6ccea766a288a3
#!/usr/bin/env python from setuptools import setup, find_packages setup(name='gibbrish', version='1.0.0', description="Generate '.strings' file with long gibberish strings in order to test if your app is ready for translation.", author='Matan Lachmish', author_email='matan.lachmish@gmail.com',...
998,234
1ebcb5bdb61985d808247f4ef66b24c5df9e9f2b
#Üç basamaklı bir tamsayının basamakları toplamını bulan bir program yazınız. sayi = int(input("3 basamaklı sayı:")) yuzler = int() onlar = int() birler = int() fark = int() yuzler = sayi // 100 fark = sayi - (yuzler*100) onlar = fark // 10 birler = fark % 10 print("basamak toplamları:{}".format(yuzler + onlar + bi...
998,235
1132c5161ca7554f70a878af401d3b1e81eba2d3
import pickle h_00 = pickle.load(open("train_history_unet_comb3_mse_00_10lvels.pkl", "rb")) h_20 = pickle.load(open("train_history_unet_comb3_mse_20_10lvels.pkl", "rb")) h_40 = pickle.load(open("train_history_unet_comb3_mse_40_10lvels.pkl", "rb")) h_80 = pickle.load(open("train_history_unet_comb3_mse_80_10lvels.pkl", ...
998,236
1b423b19fd324018998b27eee5bbc1d3f3d2f990
import os import datetime from passlib.hash import sha256_crypt from flask import Flask, render_template, request, redirect, url_for, jsonify from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker engine = create_engine("postgres://tncdzhysojhnjn:e07995eb170d7115f2b7c503afa00...
998,237
1f25a24b32915a2c3d982f7087dc776eee072ccf
#!/usr/bin/env python # Jim Mainprice, ARC # September 2013 # Worcester Polytechnic Institute # # http://openrave.org/docs/latest_stable/command_line_tools/ # openrave-robot.py /your/path/to/your.robot.xml --info=joints # On that page you can find more examples on how to use openrave-robot.py. from openravepy import *...
998,238
815f621c38e3b56a1edb8c6fc6f8f2ea8526cbf1
if PRESENT( UKDPP_Picture_Ratio ): CHECK( UKDPP_Picture_Ratio in [{"Numerator":4, "Denominator":3}, {"Numerator":14, "Denominator":9}, {"Numerator":15, "Denominator":9}, {"Numerator":16, "Denominator":9}, ...
998,239
c28e82d86d1b63e0c52b0884b486e04015b627de
from selenium import webdriver from selenium.webdriver.chrome.options import Options import os import json import requests from urllib.request import urlopen chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--window-size=1920x1080") chrome_dirver = os.getcwd() + "/chro...
998,240
f987e34ff0cf4e1c4ced1f42da9d78c9dac8253b
#-*- coding:utf-8 -*- import os,sys #这里放着你要操作的文件夹名称 path = 'load' #添加被动态加载的路径 sys.path.append(path) files = os.listdir(path) #动态加载py def on_load(): load_module = [] for load_file in files: loaf_file_name = str(load_file).split('.')[0] if loaf_file_name.find('load_') == 0: ...
998,241
1544103293a710ed68b7dd94b411796bae7d970d
import numpy as np from collections import deque ## Day 1 # This datastructure keeps track of the current top-3 elfs with most calories. top_three = deque([0, 0, 0], maxlen=3) def evaluate_elf(calories): """Compare the calories carried by an elf with the top 3. Update the top 3 if necessary.""" if calori...
998,242
e9c46d379a9a8a76ebdededc659e716a11cbd605
# Calcular e apresentar o valor do volume de uma lata de óleo, utilizando a fórmula VOLUME <- 3.14159 *R^2 * ALTURA. Alt = float(input('Informe a altura da lata: ')) R = float(input('informe o raio da lata: ')) volume = 3.14159 * R**2 * Alt print('O volume da lata corresponde a: {}'.format(volume))
998,243
9a36762e7c4dab9fde228e80df8fc0cfe86c05eb
# coding=utf-8 import unittest from utils import PackageTypes from app.product import Product class ProductTestCase(unittest.TestCase): def setUp(self): self.product = Product() def tearDown(self): self.product = list() def test_add_product_complete(self): self.assertEqual(self...
998,244
d8ddca55163f3a8301b4cf1c85abb175c07c26c9
# SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-1emj5*2t%yxisb!&bjw#3v21ca-a89xnn3%y1qsyx9!m_llivq' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { #'default': { # 'ENGINE': 'django.db.backends.sqlite3', # 'NAM...
998,245
57f2e6aeb51634315a3054ea712bf3a5b3adf9ad
from auth import * from burnt_toast import * from deps import * import argparse import os import json import time from datetime import datetime # Time to wait between upload checks if we haven't detected any in-progress # videos yet. DEFAULT_POLLING_FREQUENCY_SECONDS = 200 # Turn on for debugging ENABLE...
998,246
39dc31fbbc678ee1bcb6be2bc3dc63377cc9c25d
print("enter marks for 5 subjects:") sum = 0.0 avg = 0.0 for marks in input().split(): sum += float(marks) avg = sum/5.0 print(f"average: {avg}")
998,247
d37eb0ea1126d6d012ae6ba90b83e4107dfd26dd
from django_restql.mixins import DynamicFieldsMixin from rest_framework import serializers from core.serializers import CustomWritableNestedModelSerializer from employees.models import ( Employee, EmergencyContact, WorkHistory, Education, ) from users.api.v1.serializers import UserSerializer class Em...
998,248
2c282e1f076c086814bd1872eebfcd06e13fc41b
import os import collections import torch import torch.utils.data as data import gzip from gqnshapenet import * from tqdm import tqdm import argparse parser = argparse.ArgumentParser(description='Convert and save data to PyTorch tensor format') parser.add_argument('--SKETCH_TRAIN_DATASET_PATH', type=str, help='Path to...
998,249
a6b68d04109c9c90e2f11a52347efd5af92ef72b
from django.http import HttpResponse, HttpResponseRedirect from texts.models import Language, SourceText, Exam, Grader from records.models import Record from django.core import serializers from django.template import RequestContext from django.core.context_processors import csrf from django.shortcuts import get_object_...
998,250
4087ab6bf9ae2049f186764265eddb4da83b3aa4
import unittest import zserio from testutils import getZserioApi class ExtendedFieldInTemplateTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.api = getZserioApi(__file__, "extended_members.zs").extended_field_in_template def testConstructorSimple(self): extended = self.api....
998,251
ba69a64e216f240793a9ac67eab6568ba4c0681b
import os class Config: SECRET_KEY = '0917b13a9091915d54b6336f45909539cce452b3661b21f386418a257883b30a' SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI') SQLALCHEMY_TRACK_MODIFICATIONS = False TWILIO_URL = 'https://www.twilio.com/company/jobs' TWILIO_EMP_URL = 'https://api.greenh...
998,252
307e3386e608010e4839b99d3b9b103aa8d42c68
#!/usr/bin/env python # encoding: utf-8 # @Time : 2019/12/18 11:36 # @Author : lxx # @File : process.py # @Software: PyCharm print("开始。。。。。") with open("result.txt","w",encoding="utf-8") as resultFile: for line in open("replaceAttribute_Value_Concept",encoding="utf-8"): line=line.strip() ...
998,253
0ae108a0ee33e68800936bc3daa423c673978623
import sys # #TE = {Pseudo0:[(x,y),(z,l)...],Pseudo1:[(m,x)...]...} TE_ranges = {} CHROM,START,STOP = 0,1,2 def isDataLine(line): """ Determines in line contains site data """ if len(line) > 1: return line[0] != "#" return False def loadTEranges(TE_file_loc): """ Load TE ranges f...
998,254
353bdb4ef52be349151d50fa7383f6bdf443f6d6
from datetime import datetime from django.db import models # Create your models here. class Projeto(models.Model): """ classe para modelar banco de dados para me app """ nome_projeto = models.CharField(max_length=200) descricao_projeto = models.TextField() cliente = models.CharField(max_length...
998,255
b294eb7569d6e44860ff9056b9534505699a94ae
/Users/pranavsankhe/anaconda/lib/python3.6/ntpath.py
998,256
7d2e22caa0d8d0397f63ed9b7b426e7a00f99f1d
from django.shortcuts import render, redirect from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.contrib.auth import login, authenticate, logout from django.urls import reverse from assistant.models import * from assistant.forms import * from assistant.unit_conv impor...
998,257
cf3de74403ee08a3171d84d1616f59b3ec313622
import math class Vector3: def __init__(self, x=0, y=0, z=0): self.x = x self.y = y self.z = z def to_string(self): return "x: {0}, y:{1}, z:{2}".format(self.x, self.y, self.z) def clone(self): return Vector3(self.x, self.y, self.z) def set_x(self, x): ...
998,258
7a430fe7a8985653def8a3481429c06cd89b8488
import itertools L = [int(x) for x in input().split()] C = [int(x) for x in input().split()] L.sort() min_length = float('inf') for l in itertools.permutations(L): length = (l[0]*2+l[1]*2)*C[0] + (l[1]*2+l[2]*2)*C[1] + (l[2]*2+l[0]*2)*C[2] min_length = min(min_length, length) print(min_length)
998,259
c07552b19e1a8889a535948b5ed6c0dcb5967621
from problem00 import print1DList def find_greatest_student(students_information_list): """ find person who has highest GPA and return tuple(0:the person's name and 1:it's GPA) :param students_information_list: array of tuples :return: tuple(greatest_student_name, highest_gpa) """ highest_gpa ...
998,260
7edb4be9fe6031fe5e73e1652ed97f55581199a0
""" Good morning! Here's your coding interview problem for today. This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For example, given [10, 15, 3, 7] and k of 17, return true since 10 + 7 is 17. Bonus: Can you do this in one ...
998,261
4c93e51ad4488e6c54632bf7f2628c5bb2765c26
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pprint import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import json import pdb from ...utils import visdom_render from ...utils import transformations from ...utils import visutil ...
998,262
3e1a498d50235b023a03e24a1106fb8e012e5aa7
import pandas as pd from datetime import datetime, timedelta, date import time PLAYER_URL = "https://raw.githubusercontent.com/vaastav/Fantasy-Premier-League/master/data/2020-21/gws/merged_gw.csv" columns = [] df = pd.read_csv(PLAYER_URL) difficult_teams = [5, 9, 11, 12, 13, 17] # big six df["difficult"] = df["oppon...
998,263
1ba5d6fb2393b57b0079df42b73e0b4c38f24b8c
some = list() print(some)
998,264
54f9cddeeaab38608e0b8ec99b2b26f62a4e9d34
rows, col = map(int, input().split(', ')) matrix = [(list(map(int, input().split(' ')))) for i in range(rows)] for i in range(col): sum_columns = 0 for j in range(rows): sum_columns += matrix[j][i] print(sum_columns)
998,265
9074f45c52bed42e513731008574ead6e047fa5d
class QueryStore(): def __init__(self, storage): self.storage = storage def trajectory_collectivevariable(self, collectivevariable, ensemble=None, replica=None, step=None): """ Return list of collectivevariables fast for specific sets of samples samples can be all samples foun...
998,266
cbbbdca3b8e261f3ae2c9f7abd8d2dd8e361908c
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright (c) 2014 Mirantis, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "Licen...
998,267
c8985cfbdcb06ac2d0716ce4c5d60415173b856d
import asyncio import base64 import websockets import json from sortedcontainers import SortedDict from RestAgent import RestAgent class Subscription: def __init__(self, instance_name, uri, symbol, subs_type, rest_agent): self.__topBook = { 'bid': 0.0, 'ask': 0.0, 'las...
998,268
735840bc8b38aa3a43110a02357028927384627f
from typing import List from slack_entities.client.client import get_client from slack_entities.entities import Channel class FileUpload: def __init__( self, channels: List[Channel], token: str, file_path: str, filetype: str, filename: str, ...
998,269
e8544b95acde8e77b6155d340ea00e434b7aa9c1
#!/usr/bin/env python def count(num): # if not num.isnumeric(): # return "INSOMNIA" if num == 0: return "INSOMNIA" base = {0,1,2,3,4,5,6,7,8,9} seen = set() counter = 1 num1 = str(num) while True: # Add to seen: # print seen, num for c in num1: ...
998,270
b3e988276f9bec682ec2b1642e19b2feefff6cdb
import sys def factorial(n): res = 1 for i in range(1, n+1): res *= i return res def tbs_numbers(n): return int(factorial(2 * n) / (factorial(n + 1) * factorial(n))) def main(): n = int(sys.stdin.readline().strip()) print(tbs_numbers(n)) if __name__ == '__main__': main()
998,271
97124bfa298a7edf88517275706d803518b86f94
from __future__ import print_function import ConfigParser class TGICConfigDB: def __init__(self): core_dict = TGICConfigDB.parseTGICConfig() self.tag_token = core_dict['tag_token'] self.comment_token = core_dict['comment_token'] def __repr__(self): return "TGIC Config:\n\ttag_...
998,272
e9262c1a13a92fe410e452a968b6f2b9dfb7d5d9
x = "C\Users\bernard.castello\Documents\classMates.txt" y = raw_input ("Type in a name") def open(Path, x): with open(Path) as file: for line in file: if y in file: print (line) break: else: print("Searching...") print("Name not found") '''def splitFile(Path, x): first = []: last = []: z = : w...
998,273
9886cf21aa0c5ab30d28ce8bd8526555f3797461
#!/usr/bin/python from colprint import colprint def download_file(url, webuser = None, webpass = None): request = __urllib2.Request(url) if webuser: base64string = __base64.encodestring('%s:%s' % (webuser, webpass))[:-1] request.add_header("Authorization", "Basic %s" % base64string) htmlFile = __...
998,274
52b50192266887fcdff0fbb57fce84478dbfa7b6
from __future__ import print_function import multiprocessing import signal import random import datetime as dt import my_subprocess import my_subprocess2 import my_subprocess3 import logging from common import * import process_logger as pl def call_subprocess(params): pl.initProcess() print("...
998,275
2ebe26c049e34001960246d7d06673f519ec81cf
#!/usr/bin/python3 ''' Write a function that returns an object (Python data structure) represented by a JSON string ''' import json def from_json_string(my_str): '''Function that gives the python object of a string JSON''' return json.loads(my_str)
998,276
bf83eada4e0e09ef46e15cc7aaf2b220a9e12c46
if __name__ == '__main__': from FileTracker import * from Hub import * hub = Hub() appendline = ['234','567'] msg = {'action':'ADD','pre':1, 'lines':appendline} hub.LoadFile('test.txt') hub.ChangeFile('test.txt', msg); hub.ChangeFile('test.txt',{'action':'REMOVE','lines':[3,4]}) hub.CloseFile('test.txt'...
998,277
d7489dd6d8f5b0b7cd449329483a22aca2f11c6f
# -*- coding: utf-8 -*- from linepy import * # from akad.ttypes import * # from multiprocessing import Pool, Process # from akad.ttypes import ContentType as Type # from thrift import transport, protocol, server from LINEPY import * #from akad.ttypes import * #from multiprocessing import Pool, Process from datetime imp...
998,278
994ba3f9d1c9e6e597985d3ea2aff49ac1a3635d
import re import sys import csv import time def main(): res = {} test_file = sys.argv[1] if len(sys.argv) > 1 else 'test_file.csv' with open(test_file, 'r') as fd: # read file line by line for line in fd: # pop the 'date' row from the line strip_line = re.sub('([0-9...
998,279
b49026fe0b0e06b404391f86b5936309fcec9e2e
# Note that this relies on pytest (instead of unittest) to also redirect # stdout to a non-tty, which prevents man from calling a pager. import subprocess import sys import pytest def speedoc(*args): subprocess.check_call([sys.executable, "-m_speedoc", *args]) def test_main(): speedoc("sphinx") speedo...
998,280
580ebdb86440d7f0693ea651ed1fd191bb9e4471
import face_recognition import numpy as np # import socket programming library import socket # import thread module from _thread import * import threading import json from dotenv import load_dotenv, find_dotenv from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker import os print_lock = thread...
998,281
9d99880883062ae209c02a79362434728f7100b8
from math import log def binary_flip(n): return (~n) & int((pow(2,log(n)/log(2))-1)) print(binary_flip(5)) print(binary_flip(4)) print(binary_flip(6))
998,282
d9c1924216579a2732376d6599614e83e93970e8
# coding: utf-8 import os from StringIO import StringIO from email.utils import COMMASPACE from girlfriend.testing import GirlFriendTestCase from girlfriend.plugin.mail import ( SMTPManager, Attachment, SendMailPlugin, Mail, ) from girlfriend.util.config import Config class SMTPManagerTestCase(GirlFr...
998,283
0784a7a8f97b6c3ee213ee2bb864e07f485d7159
# # # import os import shutil # # domain # from _domain.utils import FileWriter, JsonDumper # # # from utility.generator import BaseGenerator from antivirus.models import SafeBrowsing # # # class Generator(BaseGenerator): # # # def __init__(self, root_dir): # cal...
998,284
a45d9c732f97b35a2ac827ff90ab786096ae9a6a
from . import ImageObject, BlockGroup, Mothership def hp_up(screen, player): """Increase the hp of the player""" player.add_lifes(1) def bullet_up(screen, player): """Increase player bullet reload speed""" #If the player is not firing at a higher speed if player.maxcooldown > 6: player.max...
998,285
6745e5eb295f1a1064d22096f910df3089c5fa24
ximport sys from collections import defaultdict import numpy as np infile = sys.argv[1] input = open(infile, "r") data = input.read().split("\n")[1:-1] input.close() SYS_MOS = defaultdict(list) SYS_SPK = defaultdict(list) SPK_MOS = defaultdict(list) SPK_SYS = defaultdict(list) UTT_MOS = defaultdict(list) #spoofe...
998,286
f7cce749cbd77b5b3f1350eb5762e1b7966c2324
from cards.exceptions import ErrorCreatureOwner from cards.exceptions import InvalidParameter from cards.exceptions import CreatureNotFound from mapchart.models import HexMap as Map def play_card(hexmap, player, card, targets): result = {'card': card} piece = hexmap.get_piece(*targets[0]) result.update(mo...
998,287
7378adf176b14b2586cafdd0761655cf3bd3087b
from __future__ import print_function import io from setuptools import setup import pylibrespot_java def read(*filenames, **kwargs): encoding = kwargs.get("encoding", "utf-8") sep = kwargs.get("sep", "\n") buf = [] for filename in filenames: with io.open(filename, encoding=encoding)...
998,288
50826de6667c5b96f1bc10d9578083097a233e02
# coding:utf-8 import time import numpy as np import model.cluster as cluster import os import collections import time c = collections.Counter() _cur_dir = os.path.dirname(os.path.realpath(__file__)) class config(): def __init__(self): self.result_dir = os.path.join(_cur_dir) sel...
998,289
7794e69611a769fe2c4e15ad92a7621f3a35b327
import math class AllPrimeNumbers: def countPrimes(self, n): if n < 3: return 0 arr = [0] * n arr[0] = 1 arr[1] = 1 sqrt = int(math.sqrt(n)) for i in range(2, sqrt + 1): j = 2 while (i * j) < n: arr[i * j] = 1 ...
998,290
d31f85476331bf8ce2ebafbb1f8cb066d4640cae
# This file is part of scorevideo_lib: A library for working with scorevideo # Use of this file is governed by the license in LICENSE.txt. """Test operations needed to run other tests. """ from tests.src.test_rawlog import get_actual_expected from tests.src import TEST_RES def test_file_read(): """Test that fi...
998,291
6eaa96cb8f3a0528d0510af4315c539b6c024c87
import os import math import json out = {"Main Power Up":{}} for file in os.listdir("."): if ".txt" in file: with open(file, 'r') as f: d = f.readlines() name = d[0].strip() desc = d[1].strip() d = d[2:] if "Damage Up" in desc: _mi...
998,292
74f766c126907cb61ccd06c83c3966bc075c5af9
""" Compute statistical significance with spatial autoregressive modeling. """ from scipy.optimize import curve_fit import numpy as np import pysal as ps def fit_exp_decay(x, y): """ Fit an exponentially decaying function of the form y = exp(-x/x0) for dependent variable `y` evaluated at positions `x`. ...
998,293
707da3ccddd492f20b490a0e7b2798638b7f11ab
from clove.network.bitcoin import Bitcoin class Chaincoin(Bitcoin): """ Class with all the necessary CHC network information based on https://github.com/chaincoin/chaincoin/blob/master/src/chainparams.cpp (date of access: 01/18/2018) """ name = 'chaincoin' symbols = ('CHC', ) seeds = (...
998,294
965e3fba2c13451f4b6f434cf8f0260eb704e1f6
import multiprocessing from multiprocessing import Process from capture import main as capture from owl import main as logger import tkinter WIDTH = 200 HEIGHT = 100 if __name__ == '__main__': multiprocessing.freeze_support() logger_process = Process(target=logger) logger_process.daemon = True log...
998,295
9c576683f641adaed037ad92aad5b078f723400e
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import print_function, division import subprocess from scipy.stats import chi2 TESTFILE_TEMPLATE = """#include <iostream> #include "Chi2PLookup.h" int main() {{ Chi2PLookup Chi2PLookupTable; double x = {0}; int df = {1}; double outvalu...
998,296
fcbeb31ae46b3320ce6c870ba769a524c55a98f0
# -*- coding: utf-8 -*- """ Created on Sat Feb 14 14:49:22 2015 @author: hoseung PURPOSE: halo mass evolution catalog for Jinsu's phase space diagram study. OUTPUT: Consists of 10 columns, for each galaxy in each snapshot. # ID x y z vx vy vz Rvir Mvir Mass ((nnouts*ngal) x ncolumns...
998,297
1d5dd1940a53bc8e0ae64ab76aa68f9cecc89598
__author__ = "TROY Development Team" __copyright__ = "Copyright 2013, RADICAL" __license__ = "MIT" from compute_unit_description import ComputeUnitDescription from compute_unit import ComputeUnit from relation_description import RelationDescription from relation import Relation ...
998,298
883d233124d9b9e4557201d1146eee45e63e5d4d
#!/usr/bin/env python from random import randint, choice from math import floor def public_good(): players = [5,5,5,5] pool = 0 multiplier = 3 for _ in range(10): for n, p in enumerate(players): val = randint(0,floor(p)) players[n] -= val pool += val ...
998,299
8a4b5e8701edc030ad278f015e6790346a2294b2
''' czytanie znakow ''' imie = raw_input("jak masz na imie?\n") print imie