index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
17,100
15ce460de811a43340446c3540d8982b46cc4b7c
# ์ด๋ฆ„ : ์˜คํ˜œ์„ฑ # ๋‚ ์งœ : 11 02 2017 # ์ฃผ์ œ : 2016๋…„์˜ ์š”์ผ ๊ณ„์‚ฐ def getDayName(month, day) : dotw = ("FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU") beforeDays = 0 for i in range(1, month) : if i == 2 : beforeDays += 29 elif i <= 7 : if i % 2 == 1 : bef...
17,101
8146d2a9ed4b586efaa7e1d096af7fd61dbb018e
# day 4* # text animation- show the words overtime(like pokemon and other JRPGs) # i missed 3 days so it should be day 7 now but yea import time import pygame pygame.init() pygame.display.set_caption('dialogue') # screen settings size = width, height = 800, 800 bg_color = 0, 0, 0 white = (220, 220, 220) ...
17,102
cea0a7aa900d769f1f018275aa44eaf05f9ab40e
## https://leetcode.com/problems/search-insert-position/ ''' ๅฐ‡targetๆ•ธๅญ—ๆ’ๅ…ฅๅˆฐๅทฒๆŽ’ๅบๅฅฝ็š„ๅบๅˆ—ไธญ, ่ฟ”ๅ›žๅฏๆ’ๅ…ฅ็š„index ่‹ฅๅบๅˆ—ไธญๅซๆœ‰target, ๅ‰‡่ฟ”ๅ›žtarget็š„index ex: nums = [1,3,5,6], target = 5, return 2 (ๆ‰พๅˆฐ) nums = [1,3,5,6], target = 2, return 1 (ๆฒ’ๆ‰พๅˆฐ, ๆ’ๅ…ฅๅœจ1็š„ไฝ็ฝฎ) nums = [1,3,5,6], target = 7, return 4 (ๆฒ’ๆ‰พๅˆฐ, ๅคงๆ–ผๆœ€ๅพŒไธ€ๅ€‹ๅ€ผ, ๆ’ๅ…ฅๆœ€ๅพŒไธ€ๅ€‹ไฝ็ฝฎ) nums = [1,3,5,6], target = 0...
17,103
2f53c3db8ff8ba2beceba23fb7eb616bec38cc7a
'''Defina os atributos e mรฉtodos das seguintes classes: Veรญculos:''' class carro: def __init__(self,Marca,Modelo,Ano,Estado,Km_rodados): self.marca = Marca self.modelo = Modelo self.ano = Ano self.estado = Estado self.km.rodados = Km_rodados def base(self): a = carro a.marca = input("Digi...
17,104
86f41b5c6dab7d5edb1e30bd2cdd3bb0ee547dce
""" ============ Mean filters ============ This example compares the following mean filters of the rank filter package: * **local mean**: all pixels belonging to the structuring element to compute average gray level * **percentile mean**: only use values between percentiles p0 and p1 (here 10% and 90%) * **b...
17,105
58b34d088f718c5d119f75fdfa9320128bb60409
""" Dots module. @author: Jason Cohen @author: Shaun Hamelin-Owens @author: Sasithra Thanabalan @author: Andrew Walker """ # Imports from PointItem import PointItem # Constants DOT_POINTS = 10 class Dot(PointItem): """ Dot class. This class contains the methods used in the creation of Dots. It is of the tkinter l...
17,106
d66177d7c440210135281588a2fcfdfd6b5ce9c6
#!/usr/bin/env python import os ZMQ_ADDR = os.getenv('NMZ_ETHER_ZMQ_ADDR') from hexdump import hexdump import pynmz from pynmz.inspector.ether import EtherInspectorBase from pynmz.signal.event import PacketEvent LOG = pynmz.LOG.getChild(__name__) class Zk2080Inspector(EtherInspectorBase): # @Override def ma...
17,107
969e2e97b9e538d7496fb259a07de8dab529b317
from transformers import BertTokenizer, BertModel MAX_LENGTH = 128 TOKENIZER = BertTokenizer.from_pretrained("bert-base-uncased") TRAIN_BATCH_SIZE = 8 VALID_BATCH_SIZE = 4 MODEL = BertModel.from_pretrained("bert-base-uncased") NUM_EPOCHS = 2 MODEL_PATH = "/"
17,108
5b57a6a869ea790be7fe97fee52b0c66b3993342
#!/usr/bin/env python #----------------------------------------------------------------------------- # Copyright (c) 2011-2013, The BIOM Format Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #--------------...
17,109
a57b09286bdc5d679610befb19642c18e2b7a7d2
# encoding=utf8 import os rowS, columnS = os.popen('stty size', 'r').read().split() row = int(rowS) col = int(columnS) feral = [] feral.append(" โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–“โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–€โ–ˆโ–ˆโ–ˆ โ–„โ–„โ–„ โ–ˆโ–ˆโ–“ ") feral.append(" โ–“โ–ˆโ–ˆ โ–’ โ–“โ–ˆ โ–€ โ–“โ–ˆโ–ˆ โ–’ โ–ˆโ–ˆโ–’โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–“โ–ˆโ–ˆโ–’ ") feral.append(" โ–’โ–ˆโ–ˆโ–ˆโ–ˆ โ–‘ โ–’โ–ˆโ–ˆโ–ˆ โ–“โ–ˆโ–ˆ โ–‘โ–„โ–ˆ โ–’โ–’โ–ˆโ–ˆ โ–€โ–ˆโ–„ โ–’โ–ˆโ–ˆโ–‘ ") fer...
17,110
354ced17696d287524b48f9ef4f43d7ff70a1520
from pal.writer.access_mechanism.access_mechanism \ import AccessMechanismWriter from pal.logger import logger class GasX86_64AttSyntaxAccessMechanismWriter(AccessMechanismWriter): def declare_access_mechanism_dependencies(self, outfile, register, access_mechanism): ...
17,111
05f070ee2296e17882060d7350a55d9a2a50ba9f
def kume_dondur(str_kume: str): if str_kume.startswith("{") and str_kume.endswith("}"): kume_elemanlari = str_kume[1:len(str_kume) -1] v = kume_elemanlari.split(", ") print(v) kume_dondur("{1, 2, 3, 17}")
17,112
c06aa43491b1a785ce278b420174f8dabdd4205a
import pytest @pytest.fixture(scope='package', autouse=True) def st_emptyEnv(): print(f'\n#### ๅˆๅง‹ๅŒ–-็›ฎๅฝ•็บงๅˆซ ####') yield print(f'\n ### ๆธ…้™ค-็›ฎๅฝ•็บงๅˆซ ####')
17,113
3efbd5e40e20cb37f47bd5178fbc0f7886fdcc95
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from itertools import product from pathlib import Path import numpy as np import tensorflow as tf from dotenv import load_dotenv from annotation.direction import PinDirection from annotation.piece import Piece from ..count import WhiteEffectCountLayer from ..lo...
17,114
c53ad01f54a813c268fc264280221c239e3b2ffc
from datetime import time from datetime import date from datetime import datetime from datetime import timedelta #span of time time based maths def main(): print(timedelta(days=365,hours=5,minutes=1)) now=datetime.now() print("today is",now) print("one year later:",now+timedelta(days=365)) print("In...
17,115
3c8657f0ca1773a6a42f4ae5c3a5b65b595981ad
from .sudoku_board import SudokuBoard from .solving_functions import solve __all__ = ["SudokuBoard", "solve"]
17,116
d83318b9aa836aeb23af80f9c80a776b6d654a85
UNSCOPED_TOKEN = { u'access': {u'serviceCatalog': {}, u'token': {u'expires': u'2012-10-03T16:58:01Z', u'id': u'3e2813b7ba0b4006840c3825860b86ed'}, u'user': {u'id': u'c4da488862bd435c9e6c0275a0d0e49a', u'name': u'exampleuser', ...
17,117
bc35853e90d66182c6cb5cab745e83a4e39dab93
""" Using zip builtin function to iterate multiple lists. If one list is bigger than other, it will iterate only through the smaller one size. """ list_1 = ['a', 'b', 'c', 'd', 'e', 'f'] list_2 = [1, 2, 3] for item_list_1, item_list_2 in zip(list_1, list_2): print("Item list 1: %s refers to Item list 2: %s" % (it...
17,118
f3ae47622b46bc7ec95414d6e74dc411ae09a797
import collections from typing import List class Solution: def countCharacters(self, words: List[str], chars: str) -> int: good = collections.Counter(chars) result = 0 for word in words: missing = collections.Counter(word) - good if not missing: res...
17,119
4f076822d6258667f4cbdb9a9dcb712583ea860d
class Solution: def convert(self, s: str, numRows: int) -> str: if len(s) < numRows or numRows == 1: return s flag = 1 index = 0 A = [] result = "" for i in range(numRows): A.append([]) for i in range(len(s)): A[index].appe...
17,120
0edc1eac0fda8aa402b62a58c688141d4675f795
mydict={"Shivani":'Abcd@11',"Saloni":'Efgh@12'} def upassword(password): validu=0 validd=0 validsc=0 for i in password: if i.isupper(): validu=validu+1 elif i in '1234567890': validd=validd+1 elif i in '!@#$%^&*': validsc=validsc+1...
17,121
be5bccb60a5ce5ad5b9cd7342ca351c32e937aab
import requests from requests_oauthlib import OAuth1 base_url = "https://api.tumblr.com/v2/blog/" with open('api-keys.txt') as keyfile: keys = [key.strip() for key in keyfile] keyfile.close() auth = OAuth1(*keys) def api_url(blog,method): return "{0}{1}.tumblr.com/{2}".format(base_url,blog,method) def ...
17,122
f5a34035f4536c555fa46880a79f24d0909871cb
def class_to_dict(obj): dic = {} dic.update(obj.__dict__) if "_sa_instance_state" in dic: print dic['_sa_instance_state'] del dic['_sa_instance_state'] return dic
17,123
a5fbe0d2aced1b8d86739b2d84594a07da91279b
from facebook_business.adobjects.productcatalog import ProductCatalog as FacebookProductCatalog from facebook_business.adobjects.productgroup import ProductGroup as FacebookProductGroup from facebook_business.adobjects.productitem import ProductItem as FacebookProductItem from facebook_business.adobjects.productset imp...
17,124
5642e4ce7c63b9a9059697b10d0f83f842b9df0c
from __future__ import division from __future__ import print_function import os import pickle from engine import * from model import * from utils import * np.random.seed(1234) tf.set_random_seed(123) # load data to df start_time = time.time() data_df = pd.read_csv('../../datasets/tmall_1mth_2014_item20user50k_1neg_3...
17,125
964c63f969fa92b29c72de89185b8b47269d2283
from django.shortcuts import render, get_object_or_404 from .models import Clientes, ClientesForm from django.views.generic import ListView from django.contrib.auth.decorators import login_required from django.http.response import HttpResponse, HttpResponseRedirect # Create your views here. @login_required(login_url=...
17,126
fa0404dffbdce5f7e2ccba49e8ca37c8cfebf0db
import numpy as np import pandas as pd import re from sklearn.feature_extraction.text import TfidfVectorizer from pprint import pprint def pre_process_text(name, n=3): """ :param name: :param n: determines the n-grams (bi-gram, tri-gram, etc). By default, it's tri-gram :return: string with the n-gram...
17,127
cebbaee54c84f5e52c129ee7ccb5ff0a44ca1d87
class Newtype(type): # ็ปงๆ‰ฟtype็ฑป def __init__(self, a, b, c): print("ๅ…ƒ็ฑป็š„ๆž„้€ ๅ‡ฝๆ•ฐๆ‰ง่กŒ") def __call__(self, *args, **kwargs): print("็ฑป่ฟ›่กŒๅˆๅง‹ๅŒ–ๆ—ถ็š„()๏ผŒ้ฆ–ๅ…ˆ่ฐƒ็”จ็š„ๆ˜ฏๅ…ƒ็ฑป็š„__call__ๆ–นๆณ•") obj = object.__new__(self) # print(type(obj)) self.__init__(obj, *args, **kwargs) return obj class Bar(m...
17,128
5421e2905031c45488df0f1b21129cb2173821a0
from join import Join as join from joindocuments import joindocuments import pandas as pd from oddratio import OddRatio as ratio from topwords import topwords from ngrams import ngrams from truncatedsvd import SVDf from PCAC import pcaf import arff import numpy as np #joinoddratios #it gets the data preprocessing def ...
17,129
19f7bf69c346cc5a29aa6e38b5441b129bb35148
import numpy as np from .data_analysis import moving_average def test_moving_average(): avg = moving_average(np.ones(10),4) assert np.any(np.isnan(avg)) assert np.allclose(avg[3],1.0) return
17,130
2aa353b9c67c5cb42abb977f46432f09efddf63a
import requests import json import http.client as httplib, urllib.parse import logging import yaml import datetime config = yaml.safe_load(open("config.yaml")) curr_date = datetime.datetime.now() date_Array = [] for i in range(7): curr_date += datetime.timedelta(days=1) date_Array.append(curr_date.strftime("%...
17,131
4f4053488ffc363fca093596bebb7ffbb0e7735d
from hashlib import md5 from textract import process def integers_only(text) -> str: """ Removes all symbols except integers ex: +998(91) 333 33 33 -> 998913333333 """ return ''.join(x for x in text if x.isdigit()) def get_boolean(value): return value not in ('false', None, 0, 'False', '0') ...
17,132
cee15b4b021e76c732696e71c14f8f20115f8c44
from config import Config import numpy as np from PaperTest.help import Help class FrequencyMeasures(object): """Computes idf, tfidf, suidf""" def __init__(self, meetingHisto, meetingWords, wordsVector, Ns): #config class cfg = Config() #class variables self.meetingHisto = meeti...
17,133
5743cb2b072a326296b355a13cc67278b55a87ea
# coding: utf-8 """ Rustici Engine API Rustici Engine API # noqa: E501 OpenAPI spec version: 2.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class LaunchLinkRequestSchema(object): """NOTE: This class is auto gener...
17,134
ead4132aeb1ed4e2707747f2f2d0b2d9ff509ecd
import pygame import random # TILES DIRT = 0 GRASS = 1 WATER = 2 WALL = 3 TREE_0 = 4 TREE_1 = 5 TREE_2 = 6 class Tree: def __init__(self): self.SPRITE = pygame.transform.scale(pygame.image.load('./textures/trees/tree.png'), (125, 125)) self.X_POS = random.randint(50, 300) self.Y_POS = rand...
17,135
d8fc6ba514bf61adc45fe99f0f337681653d729f
"""Support for retrieving status info from Google Wifi/OnHub routers.""" from __future__ import annotations from dataclasses import dataclass from datetime import timedelta import logging import requests import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, SensorEntity, ...
17,136
112e48f03692a6c13e5c373ce07c7fe6c5407352
class Node: def __init__(self,initdata): self.data =initdata self.next=None def getData(self): return self.data def getNext(self): return self.next def setData(self,newdata): self.data=newdata def setNext(self,newnext): self.next=newnext
17,137
898b881b7108bc0233aa8696b82f390e148e5ed2
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes Email: danaukes<at>gmail.com Please see LICENSE for full license. """ import pynamics from pynamics.tree_node import TreeNode from pynamics.vector import Vector from pynamics.rotation import Rotation, RotationalVelocity from pynamics.name_generator import NameGen...
17,138
426b19ebec25354ffab4e788161ed3f1d1db3a04
import os import pygame pygame.init() #์ดˆ๊ธฐํ™” (๋ฐ˜๋“œ์‹œ ํ•„์š”) #ํ™”๋ฉด ํฌ๊ธฐ ์„ค์ • screen_width = 640 #๊ฐ€๋กœํฌ๊ธฐ screen_height = 480 #์„ธ๋กœ ํฌ๊ธฐ screen = pygame.display.set_mode((screen_width, screen_height)) # ํ™”๋ฉด ํƒ€์ดํ‹€ ์„ค์ • pygame.display.set_caption("Pang") #FPS clock = pygame.time.Clock() ########################################### # 1. ์‚ฌ์šฉ์ž ๊ฒŒ์ž„ ...
17,139
566b4dfd5d903630669410eebe0ee342a0c726ed
#!/usr/bin/python """ """ # IMPORT from Bio import SeqIO from collections import OrderedDict import sys from os import listdir from os.path import isfile # FUNCTIONS def check_duplication(file): with open(file,"r") as f: records = list(SeqIO.parse(f,"fasta")) pool = OrderedDict() for record in rec...
17,140
a1b26d594efc584e99f80982af50f7e7ad8ddb01
# test inbound rules # 2 participants - receiver has multiple router connections mode multi-switch participants 2 peers 1 2 #participant ID ASN PORT MAC IP PORT MAC IP participant 1 100 PORT MAC 172.0.0.1/16 participant 2 200 PORT MAC 172.0.0.11/16 PORT MAC 172.0.0.12/16 PORT MAC 172.0.0.13/16 PORT MAC 172.0.0.14/16...
17,141
2fafd80638c983bce2bf44e62582b3b5ad868874
#!/usr/bin/env python import os import sys import string from datetime import datetime source_exts = ('.cpp', '.c', '.cc') header_exts = ('.hpp', '.h') sln_exts = ('.sln') proj_exts = ('.vcproj') CREATE_PRI_FILES = False ignore_dirs = ('.svn', 'GeneratedFiles', 'generatedfiles', '_UpgradeReport_Files...
17,142
7a8af5883308e11ea847aae30732613c9261b4e8
import re def remove_ansi_color_from_string(input_string): ansi_escape = re.compile(r'(\x9B|\x1B\[)[[0-?]*[ -/]*[@-~]') return ansi_escape.sub('', input_string) def is_valid_charts_yaml(content): """ Check if 'content' contains mandatory keys :param content: parsed YAML file as list of diction...
17,143
9d0d4c1de06c77fb2e14a449f7fa805f31b2c991
print('I love {0} and {1}'.format('bread','butter')) # Output: I love bread and butter print('I love {1} and {0}'.format('bread','butter')) # Output: I love butter and bread
17,144
118b27bd67e40f0a1c5f487609c09335ddd30ddb
class Rule: ''' provides interface to query the raw representation of rules returned by the parser ''' def __init__(self, head, body): ''' head: a symbol to represent the head body: list of the body symbols in this format => [[('terminal', False), ('non-terminal', 'True')], [('terminal', False)]] ...
17,145
06abb18f8545e839333cae66bd2745b6c61ce592
# ะ ะตะฐะปะธะทะพะฒะฐั‚ัŒ ั„ะพั€ะผะธั€ะพะฒะฐะฝะธะต ัะฟะธัะบะฐ, ะธัะฟะพะปัŒะทัƒั ั„ัƒะฝะบั†ะธัŽ range() ะธ ะฒะพะทะผะพะถะฝะพัั‚ะธ ะณะตะฝะตั€ะฐั‚ะพั€ะฐ. # ะ’ ัะฟะธัะพะบ ะดะพะปะถะฝั‹ ะฒะพะนั‚ะธ ั‡ะตั‚ะฝั‹ะต ั‡ะธัะปะฐ ะพั‚ 100 ะดะพ 1000 (ะฒะบะปัŽั‡ะฐั ะณั€ะฐะฝะธั†ั‹). # ะะตะพะฑั…ะพะดะธะผะพ ะฟะพะปัƒั‡ะธั‚ัŒ ั€ะตะทัƒะปัŒั‚ะฐั‚ ะฒั‹ั‡ะธัะปะตะฝะธั ะฟั€ะพะธะทะฒะตะดะตะฝะธั ะฒัะตั… ัะปะตะผะตะฝั‚ะพะฒ ัะฟะธัะบะฐ. from functools import reduce def total_number(current_number, next_number): r...
17,146
01186258c1d1232757540962ee67184e4fb1c7b7
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
17,147
722e133e64d23d1858d97d96d9b5cced83ee796e
""" This is a solution to an exercise from Think Python, 2nd Edition by Allen Downey http://thinkpython2.com Copyright 2015 Allen Downey License: http://creativecommons.org/licenses/by/4.0/ Exercise 12-4: What is the longest English word, that remains a valid English word, as you remove its letters one at a time? ...
17,148
5afdbb840eac93bfb7ac5a92f5ee1854a228d7ab
# -*- coding: utf-8 -*- # @Time : 2021/2/3 17:32 # @Author : Jclian91 # @File : iris_model_predict_using_onnx_runtime_server.py # @Place : Yangpu, Shanghai import numpy as np import assets.onnx_ml_pb2 as onnx_ml_pb2 import assets.predict_pb2 as predict_pb2 import requests from sklearn.datasets import load_iris # Crea...
17,149
112f1aff2c3d9bfe5b17ea45fa3dd04d4f74f67a
# -*- coding: utf-8 -*- """ Created on Tue Mar 7 13:46:24 2017 @author: lindseykitchell """ from parse_ev_files import parse_ev from sklearn.cross_validation import KFold from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClas...
17,150
bc06cafa5b1112a40b93df35c51362146d57b5d3
# # Copyright (C) 2017 Murata Manufacturing Co.,Ltd. # ## # @brief AP main function. # @author E2N3 # @date 2018.11.09 # -*- coding: utf-8 -*- import json import sys import threading from Debug import Debug_GetObj from CLS_Define import COM_DEF from tx_snd import snd_rsp_cmd ## # @brief Identify the command ID and...
17,151
2ba03c3cfd870e00e51bf4009ed6f10038127c6f
from cymbology.identifiers.sedol import Sedol from cymbology.identifiers.cusip import Cusip, cusip_from_isin from cymbology.identifiers.isin import Isin __all__ = ('Sedol', 'Cusip', 'cusip_from_isin', 'Isin')
17,152
8ee949a5f003b98d07eb5d37bff7dd66ba43670f
import warnings from pyod.models.iforest import IForest warnings.filterwarnings('ignore', category=FutureWarning) import argparse import datetime import gc import os import sys from pathlib import Path import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import keras from pyod...
17,153
901c97d3c2127d718051b39d193e5a7430592372
from random import random as rr class Filter: def __init__(self): pass def filter(self, buffer, interests, preference): ret = [] bonus = 0 for post in buffer: var bonus = 0 if post.preference != 0: if post.preference == preference: bonus = 0.1 else: bonus = -0.2 if in...
17,154
dd05edda7cf5c5111761060a8b33a78a747cb001
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import pandas as pd # ๅฏผๅ…ฅpandasๅบ“ import seaborn as sns # ๅฏผๅ…ฅseabornๅบ“ import matplotlib.pyplot as plt # ไธ‹่ฝฝAUTO-MPGๆ•ฐๆฎ้›† dataset_path = keras.utils.get_file("auto-mpg.data", "http://archive.ics.uci.edu/ml/machine-learning-data...
17,155
9274415bfb9f8e95dc38e6a170e6047331b014bf
import numpy as np import pandas as pd from sklearn.cluster import KMeans # Extract features from data def add_features(data, eps=10**-10, n_cluster=50, embeddings=None, ewma = True, aggregate = True): #print("mem data:", id(data)) # Get useful columns (data from different hours) return_cols = [col for co...
17,156
1a2686d3aba64f0a642eef6cee71257ac9aa2fc1
import glob import os import re import math def word_list_maker(address): file_list = glob.glob(os.path.join(os.getcwd(), address, "*.txt")) AllFiles = [] for file_path in file_list: with open(file_path, errors = 'ignore') as f_input: AllFiles.append(f_input.read()) split_version...
17,157
8bdec5d57b9d465623dc71c4fa81041683961f08
from uuid import uuid4 from ui_testing.pages.base_selenium import BaseSelenium import time, pyperclip, os from random import randint import datetime import pymysql class BasePages: def __init__(self): self.base_selenium = BaseSelenium() self.pagination_elements_array = ['10', '20', '25', '50', '10...
17,158
5230316544b89273ebe8f840a180454e05a74b8a
import calendar import logging import random from collections import defaultdict, deque, namedtuple from enum import Enum from math import ceil from typing import cast, Iterable, Union, Literal import discord from redbot.cogs.bank import is_owner_if_bank_global from redbot.cogs.mod.converters import RawUse...
17,159
61e75d889096b003b403a17cc0a88f5738a3112d
# import necessary modules and libraries from skytrip.revalidate_itinerary.sabre_revalidate_prefs import SabreRevalidatePrefs from skytrip.gds_handler import SabreHandler from skytrip.revalidate_itinerary.sabre_revalidate_structure_adapter import SabreRevalidateStructureAdapter from skytrip.revalidate_itinerary.revalid...
17,160
3733778ec74d3e8d732a144150c0439baac9dd78
from argparse import ArgumentParser, Namespace from cli.cli import (add_database_option, add_logging_options, set_logging_options, add_team_option, add_league_option, add_venue_option, add_half_...
17,161
2846efdd4646dfd6cbc2eb53036ec6f548b4d234
'''unzip: unzips a file usage: unzip file [destination] ''' from .. tools.toolbox import bash,pprint import zipfile,os def main(self, line): """unzip a zip archive""" # filename with optional destination args = bash(line) if args is None: return elif not (1 <= len(args) <= 2): print "u...
17,162
65891686956a7309ecc97151b8cd6407dbb3fd03
def is_prime(num): for i in range(2, int(num**0.5)+1): if num % i == 0: return False return True index = 1 number = 2 while (index != 10001): number += 1 if is_prime(number): index += 1 print(number)
17,163
63c3d7f6fdd28a82c5c8326b35d19b7e31da2034
#- # Copyright (c) 2016 Alfredo Mazzinghi # All rights reserved. # # This software was developed by SRI International and the University of # Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 # ("CTSRD"), as part of the DARPA CRASH research programme. # # @BERI_LICENSE_HEADER_START@ # # Licensed ...
17,164
95a1cd4c8fdd8a1a72de74284de7f6032a4bbcd7
from random import randint def create_matrix(length): rows = [] for i in range(length): tnp = [] for s in range(length): tnp.append(randint(0,10)) rows.append(tnp) return rows matrix = create_matrix(2) def sum_of_elements_by_divider(matrix, divider): s = 0 for p...
17,165
100abce572e901455441ce59942621389098f124
segundos_str = input ("Por favor, entre com o nรบmero de segundos que deseja converter: ") total_segs = int(segundos_str) dias = total_segs // 86400 horas = total_segs % 86400//3600 segs_restantes = total_segs % 3600 minutos = segs_restantes // 60 segs_restantes_final = segs_restantes % 60 print(dias,"dias,",horas,"h...
17,166
19c1f9e7f7e88bc2606420adbff366c3e9774a4b
from rest_framework.permissions import BasePermission, SAFE_METHODS from pages.models import ProductCategory class OwnerWritePerm(BasePermission): message = 'Manipulating objects is restricted to owner only' def has_object_permission(self, request, view, obj): if request.method in SAFE_METHODS: ...
17,167
77d4470df68922e2c49ffac6bad89aa12e0dc04a
# Logger.py 14/05/2016 D.J.Whale # # A simple logger - logs to file. import os, time try: # Python 3 from .energenie import OpenThings except ImportError: # Python 2 from energenie import OpenThings LOG_FILENAME = "energenie.csv" HEADINGS = 'timestamp,mfrid,prodid,sensorid,flags,switch,voltage,fre...
17,168
ab563be577533be118943791b38102dcd1f2050f
import generic_interface import pipeline_utils class QueueManagerFatalError(pipeline_utils.PipelineError): """This error should be used when the queue manager has a fatal error. The queue manager will be stopped. The job/action currently being processed will be left in whatever state it is ...
17,169
8fd9504c13c2cb95867f05ceae224f7eef638d60
d = int(input('ะ’ะฒะตะดะธั‚ะต ะดะธะฐะผะตั‚ั€ ะพะบั€ัƒะถะฝะพัั‚ะธ: ')) ะฒั‹ะฑะพั€ = input("ะŸะปะพั‰ะฐะดัŒ ะธะปะธ ะฟะตั€ะธะผะตั‚ั€?:") if ะฒั‹ะฑะพั€ == "ะŸะปะพั‰ะฐะดัŒ": print("ะŸะปะพั‰ะฐะดัŒ ะพะบั€ัƒะถะฝะพัั‚ะธ = ",float(d**2/4*3.14)) if ะฒั‹ะฑะพั€ == "ะŸะตั€ะธะผะตั‚ั€": print("ะŸะตั€ะธะผะตั‚ั€ ะพะบั€ัƒะถะฝะพัั‚ะธ = ",float(d*3.14))
17,170
7510a31cd6784a5c7da188100feb21d8e96b8a65
from decouple import config import gdown import zipfile #1 Descargar wav url = config("RAW_DATA") name_raw = config("FOLDER_NAME") output = config("RAW_FOLDER")+name_raw gdown.download(url, output, quiet=False) # Descomprimir with zipfile.ZipFile(output, 'r') as zip_ref: zip_ref.extractall(config("RAW_FOLDER")) ...
17,171
427ce703f09179b58293160189f43ca59586acc4
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from .models import * from django.shortcuts import get_object_or_404 class NeighbourhoodForm(forms.ModelForm): class Meta: model = Neighbourhood fields = ('neighbourhood',...
17,172
1cf7b57507a7e0e8a94a41a4ea973ec05f8afd0c
# -*- coding: utf-8 -*- """ Created on Thu Sep 14 13:46:15 2017 @author: QXXV1697 """ import math import usefulFunctions as uf #from sklearn.naive_bayes import MultinomialNB #import numpy as np #spamWords = tokenizeFromList(spam) #hamWords = tokenizeFromList(ham) def calculateProbability(wordCount, totalSpam, total...
17,173
453112694c0e94e27e0ced9fc8b335de74b35ecc
#Daniel Brestoiu #Symbolic Expression Calculator import re import sys from sympy import simplify FUNCTION_DICT = {"add": "+", "multiply": "*", "subtract": "-", "divide": "/"} #REGEX_PATTERN = "(\([0-9A-Za-z]+\ [0-9]+\ [0-9]+\))" REGEX_PATTERN = "(\([0-9A-Za-z]+\ [0-9\ ]+\ +[0-9]+\))" def parse_input(): args = s...
17,174
510bd7809c08015b2fa7fcb6e66c7ca6e35fbdf0
import re from .. import Provider as AutoProvider class Provider(AutoProvider): """Implement license formats for ``az_AZ`` locale.""" license_formats = ("##-??-###",) ascii_uppercase_azerbaijan = "ABCDEFGHXIJKQLMNOPRSTUVYZ" license_plate_initial_numbers = ( "01", "02", "03", ...
17,175
43e05f030a2bce147cf166afd2e7604c384fabdb
from .signup import AccountViewSet from .login import LogInView
17,176
af6dfd4532b97a8c2173ffa0ec6eaf4edd777248
"""empty message Revision ID: 4c58b3c1a250 Revises: daaa786774cc Create Date: 2019-02-14 16:41:05.729050 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '4c58b3c1a250' down_revision = 'daaa786774cc' branch_labels = None depends_on = None def upgrade(): # ...
17,177
d29574a659dc67b60bdfe5e6a1bd00ffdcbe3ce3
#%% Import import numpy as np import matplotlib.pyplot as plt import os import importlib import my_constants as mc import my_utilities as mu import chain_functions as cf mc = importlib.reload(mc) mu = importlib.reload(mu) cf = importlib.reload(cf) import time os.chdir(mc.sim_folder + 'PMMA_sim') #%% m = np.load('...
17,178
37613313306c67798de670323d4b3de3a4a57cb3
from django.db import models from django.utils.translation import ugettext_lazy as _ class Proform(models.Model): CASH = 'cash' CREDIT_CARD = 'credit_card' NEGOTIABLE = 'negotiable' TRANSFER = 'transfer' PAYMENT_CONDITIONS = ( (CASH, _('Cash')), (CREDIT_CARD, _('Credit card')), ...
17,179
14a91f2f8c448708d6fc52383844d7931f6fa9da
# Generated by Django 2.2.9 on 2020-01-28 11:02 import brueckio.pages.blocks from django.db import migrations import wagtail.blocks import wagtail.fields import wagtail.images.blocks class Migration(migrations.Migration): dependencies = [ ('pages', '0006_projectpage_description'), ] operations ...
17,180
73272c1f7365e79c8a1bcf9d2e25d1fdc10f5418
from commons import get_tensor,get_model import torch import json with open('class_to_idx_json.json') as f: class_to_idx = json.load(f) with open('bird_to_name_json.json') as f: bird_to_name = json.load(f) model = get_model() def get_bird_name(image_bytes): tensor = get_tensor(image_bytes) ...
17,181
64f37947b124a13fe3724bc5df4c66fe01741e9e
#!/usr/bin/python # -*- coding: utf-8 -*- import MySQLdb as mdb import RPi.GPIO as RPIO import time import telebot, config door_sensor = 12 door_log = open(config.log_path + 'door.log', 'a',0) db_conect = mdb.connect(config.db_host, config.db_user, config.db_password , config.db_database); bot = telebot.TeleBot(con...
17,182
0157a34de087767eb1af11b5e5e7e08c5b1759ff
import pytest from reconcile.utils.external_resource_spec import ExternalResourceSpec from reconcile.utils.terrascript.cloudflare_resources import ( UnsupportedCloudflareResourceError, create_cloudflare_terrascript_resource, ) def create_external_resource_spec(provision_provider): return ExternalResource...
17,183
c7081d15f2935e4316593de858dd632d7e191f6e
#!/usr/bin/env python import cgi import rtorrent import torrentHandler import random import string import os import sys import time import login import config class Detail: def __init__(self, torrent_id, conf=config.Config()): self.Config = conf self.RT = rtorrent.rtorrent(self.Config.get("rtorren...
17,184
9e647ea246e9d04af4d4ef4e9a81295e9b189291
from . import _WekanObject from .colors import Colors class List(_WekanObject): """ Wekan List """ def __init__(self, api, board_id, list_id: str): super().__init__(api, list_id) _list = self._api.get(f"/api/boards/{board_id}/lists/{list_id}") self.title = _list.get("title") ...
17,185
099f38502d7d9fa5b77e70ed4f7474f73cb97b10
import socket udp_socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) address = ("192.168.137.1", 8080) send_data = input("่ฏท่พ“ๅ…ฅ่ฆๅ‘้€็š„ๅ†…ๅฎน๏ผš") udp_socket.sendto(send_data.encode("utf-8"), address) recv_data = udp_socket.recvfrom(1024) print(recv_data[0].decode("gbk")) print(recv_data[1]) udp_socket.close()
17,186
347b2d76891aa2f8649980b2742cffccd3424ead
import urllib import mechanize from bs4 import BeautifulSoup import re def getGoogleLinks(link,depth): br = mechanize.Browser() br.set_handle_robots(False) br.addheaders = [('User-agent','chrome')] term = link.replace(" ","+") #query = "http://www.google.com.br/search?num=100&q="+term+"&start="+depth query = "h...
17,187
efaabd751de8bf927baa5f54eeffe6ba10667f53
# !/usr/bin/evn python # -*- coding:utf-8 -*- # @time: 2020/5/30 13:14 #
17,188
5de3b5d7588b5bec43a5a175c0fd0be49a254a7a
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext from numpy.distutils.misc_util import get_numpy_include_dirs ext_modules = [Extension("pxutil", ["pxutil.pyx"], include_dirs=get_numpy_include_dirs()), Extension("procrustesopt", ["procrustesopt.pyx"], in...
17,189
086c26f957175976d19e9f733ea93a13acf1d352
# https://adventofcode.com/2020/day/2 lines = [] def load_data(fileName): global lines with open(fileName, "r") as input_data: lines = input_data.readlines() for i in range(len(lines)): lines[i] = lines[i].strip() def problemOne(): pass # global lines # print(lines) # va...
17,190
ea61663cebd86a7de3946221b90eb8685f6e2843
#!/usr/bin/env python3 def remove_item(file_name): remove_item = input("Is there anything that you would like to delete? Type `clear` to clear your list. > ") if remove_item == "clear": clear_file(file_name) else: with open(file_name,"r") as f: read = f.read().split("\n") ...
17,191
f6d0d4090000ddfd4beaad99ffa8bdef310ec3d6
""" File: myinfo.py Project 1.2 Prints my name, address, and phone number. """ print("Ken Lambert") print("Virginia") print("345-9110")
17,192
a3297e07a5086ee04a22646f2c5dad625bc5c8ae
"""empty message Revision ID: 8defef1bfe68 Revises: 1e2339618ea2 Create Date: 2019-08-21 14:30:16.084842 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '8defef1bfe68' down_revision = '1e2339618ea2' branch_labels = None depends_on = None def upgrade(): # ...
17,193
8ddbb2c1ac689fb17e3ffbc05dc98e10f50a5791
class Medio: def __init__(self, etiqueta): self.etiqueta = etiqueta
17,194
f98aeeadd9f6f41a30eb54f7bc50123d721344c7
# Generated by Django 2.2 on 2021-06-15 11:01 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('webapp', '0024_collection'), ] operations = [ migrations.AlterField( model_name='collection', ...
17,195
88041b060b92ba508c077a54ca3029e020edf34a
""" Admin Commands cog for Talos. Holds all commands relevant to administrator function, guild specific stuff. Author: CraftSpider """ import discord import discord.ext.commands as commands import asyncio import logging import typing import spidertools.common as utils import spidertools.discord as dutils ...
17,196
d31b3fbb60c35f4cf0a4655f7cfdf5c84cd869e5
import artrat.lispparse as lisp import random class ExpansionKey: def __init__(self, parent, pos, brother_symbol, brother_text): assert isinstance(parent,str) assert isinstance(pos,str) assert isinstance(brother_symbol,str) or brother_symbol == None, type(brother_symbol) assert isin...
17,197
75352affaeb344bf926837322b500e7cdf4cd97d
import numpy as np import pandas as pd from tensorloader import EncoderUtil as u #Author: Asa Thibodeau class BaseToInt: """Initializes a dictionary which maps characters that correspond to one or more bases. """ def __init__(self): self.basetoint = dict() self.basetoint["A"] = ...
17,198
4a4885458ef0997b8369f78871f1d0cdf0186f43
class QwcoreError(Exception): """Qwcore base exception""" class PluginNameNotFoundError(QwcoreError): """Raised when a specific plugin is not found""" class PluginNameMismatchError(QwcoreError): """Raised when a plugin name does not match the 'name' attribute of the object""" class DuplicatePluginErr...
17,199
45f8537280cb95a22adbd28e0b44eb7b040c271d
from data.state_machine import StateMachine from data.states import intro_screen, game def main(): state_dict = {'INTRO': intro_screen.IntroScreen(), 'GAME': game.Game()} sm = StateMachine(state_dict, 'INTRO') sm.main_loop()