index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
0 | aff1a9263e183610f403a4d6a7f27b45eacb7ff2 | name='valentina '
print(name*1000)
|
1 | eabf06481509962652812af67ad59da5cfe30fae | """ mupub module.
"""
__all__ = (
'__title__', '__summary__', '__version__',
'__author__', '__license__', '__copyright__',
)
__title__ = 'mupub'
__summary__ = 'Musical score publishing utility for the Mutopia Project'
"""Versioning:
This utility follows a MAJOR . MINOR . EDIT format. Upon a major
release, t... |
2 | 54f0ed5f705d5ada28721301f297b2b0058773ad | """Module for the bot"""
from copy import deepcopy
from time import sleep
import mcpi.minecraft as minecraft
from mcpi.vec3 import Vec3
import mcpi.block as block
from search import SearchProblem, astar, bfs
from singleton import singleton
_AIR = block.AIR.id
_WATER = block.WATER.id
_LAVA = block.LAVA.id
_BEDROCK =... |
3 | 45969b346d6d5cbdef2f5d2f74270cf12024072d | # Generated by Django 4.1.9 on 2023-06-29 16:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("search", "0003_auto_20230209_1441"),
]
operations = [
migrations.CreateModel(
name="SearchSettings",
fields=[
... |
4 | 3fbf1768a2fe78df591c49490dfce5fb374e7fc2 | from functools import wraps
import os
def restoring_chdir(fn):
#XXX:dc: This would be better off in a neutral module
@wraps(fn)
def decorator(*args, **kw):
try:
path = os.getcwd()
return fn(*args, **kw)
finally:
os.chdir(path)
return decorator
clas... |
5 | 67b967b688aeac1270eee836e0f6e6b3555b933e | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This program is run at regular intervals to check the battery charge status of the uninterruptible power supply.
In our case, it is a LiPo battery with a nominal voltage of 3.7 volts. By setting the voltage for the
Raspberry PI shutdown procedure at 3.7 V,we ensure th... |
6 | c59707ba07c1659d94684c54cdd7bb2658cba935 | from __future__ import division, print_function, absolute_import
import numbers
import warnings
from abc import ABCMeta, abstractmethod
import numpy as np
from .base import check_frame
from skutil.base import overrides
from sklearn.externals import six
from sklearn.base import _pprint
from sklearn.utils.fixes import si... |
7 | 41cfd558824b6561114a48a694b1e6e6a7cb8c05 | import streamlit as st
from streamlit.components.v1 import components
from streamlit.report_thread import get_report_ctx
from util.session import *
from multipage import MultiPage
from pages import register
def app(page):
if not login_status():
title_container = st.empty()
remail_input_container = ... |
8 | f2bb44600f011a205c71985ad94c18f7e058634f | import os
import requests
from PIL import Image
from io import BytesIO
import csv
from typing import Iterable, List, Tuple, Dict, Callable, Union, Collection
# pull the image from the api endpoint and save it if we don't have it, else load it from disk
def get_img_from_file_or_url(img_format: str = 'JPEG') -> Callabl... |
9 | 302605d8bb45b1529742bf9441d476f0276085b9 | import sys
from PyQt5.QtWidgets import (QMainWindow, QWidget, QHBoxLayout, QVBoxLayout, QFrame,
QSplitter, QStyleFactory, QApplication, QPushButton, QTextEdit, QLabel, QFileDialog, QMessageBox)
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont, QColor
import myLoadData
from UIPack import setLossParameterDia... |
10 | 5d9c8e235385ff53c7510994826ff3a04e4a5888 | """
@file : 001-rnn+lstm+crf.py
@author: xiaolu
@time : 2019-09-06
"""
import re
import numpy as np
import tensorflow as tf
from sklearn.metrics import classification_report
class Model:
def __init__(self, dim_word, dim_char, dropout, learning_rate,
hidden_size_char, hidden_size_word, num_l... |
11 | 54e04d740ef46fca04cf4169d2e7c05083414bd8 | import random
import math
import time
import pygame
pygame.init()
scr = pygame.display.set_mode((700,700))
enemies = []
#music = pygame.mixer.music.load('ENERGETIC CHIPTUNE Thermal - Evan King.mp3')
#pygame.mixer.music.play(-1)
hit = []
class Player:
def __init__(self):
self.x = 275
sel... |
12 | 0a7ffc027511d5fbec0076f6b25a6e3bc3dfdd9b | '''
Given a sorted array and a target value, return the index if the target is found.
If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Here are few examples.
[1,3,5,6], 5 -> 2
[1,3,5,6], 2 -> 1
[1,3,5,6], 7 -> 4
[1,3,5,6], 0 -> 0
'''
class Solution(o... |
13 | 2cbce618d1ec617d1c7dc0e9792b6a49361ec5a4 | def mais_populoso(dic):
p=0
sp=0
for t,i in dic.items():
for m in dic[t].values():
p+=m
if p>sp:
sp=p
x=t
return x |
14 | 2092ead8b8f268a22711b8af8052241c1ac00c15 |
wage=5
print("%d시간에 %d%s 벌었습니다." %(1, wage*1, "달러"))
print("%d시간에 %d%s 벌었습니다." %(5, wage*5, "달러"))
print("%d시간에 %.1f%s 벌었습니다" %(1,5710.8,"원"))
print("%d시간에 %.1f%s 벌었습니다" %(5, 28554.0, "원"))
|
15 | b5cbb73c152dd60e9063d5a19f6182e2264fec6d | #!/usr/bin/python
# coding=UTF-8
import sys
import subprocess
import os
def printReportTail(reportHtmlFile):
reportHtmlFile.write("""
</body>
</html>
""")
def printReportHead(reportHtmlFile):
reportHtmlFile.write("""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" ... |
16 | 805fc9a26650f85227d14da972311ffbd9dbd555 | class Date:
def __init__(self, strDate):
strDate = strDate.split('.')
self.day = strDate[0]
self.month = strDate[1]
self.year = strDate[2]
|
17 | a7218971b831e2cfda9a035eddb350ecf1cdf938 | #!/usr/bin/python
# encoding: utf-8
#
# In case of reuse of this source code please do not remove this copyright.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... |
18 | 038ccba05113fb7f2f589eaa7345df53cb59a5af | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import torch
from torch import nn, autograd
import config
import time
import copy
import progressbar as pb
from dataset import TrainDataSet
from model import BiAffineSrlModel
from fscore import FScore
config.add_option('-m', '--mode', dest='mode', default='train... |
19 | b5180a2dbe1f12e1bbc92874c67ea99c9a84a9ed |
# print all cards with even numbers.
cards = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
for card in cards:
try:
number = int(card)
if number % 2 == 0: # modulo operator
print(card, "is an even card.")
except ValueError:
print (card, "can not be divi... |
20 | a045423edd94d985dfc9660bcfe4a88c61bf4574 | #Script start
print"This is the two number subtraction python program."
a = 9
b = 2
c = a - b
print c
# Scrip close
|
21 | 13c9f0f58ec6da317c3802f594bb0db7c275dee9 | '''
!pip install wget
from zipfile import ZipFile
import wget
print('Beginning file downlaod with wget module')
url = 'https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip'
wget.download(url, 'sample_data/')
print('2. Extract all files in ZIP to different dir... |
22 | 95c5971a102fb2ed84ab0de0471278d0167d8359 | #!/usr/bin/python3
"""1. Divide a matrix """
def matrix_divided(matrix, div):
"""Divides a Matrix
Args:
matrix: A list of lists of ints or floats
div: a non zero int or float
Exceptions:
TypeError: if the matrix and/or div is not as stated or the matrix elements
are not of the... |
23 | 5fb998fa761b989c6dd423634824197bade4f8a5 | """
You can perform the following operations on the string, :
Capitalize zero or more of 's lowercase letters.
Delete all of the remaining lowercase letters in .
Given two strings, and , determine if it's possible to make equal to as described. If so, print YES on a new line. Otherwise, print NO.
For example, give... |
24 | 5ed439a2a7cfb9c941c40ea0c5eba2851a0f2855 | #!/bin/python3
# Implement a stack with push, pop, inc(e, k) operations
# inc (e,k) - Add k to each of bottom e elements
import sys
class Stack(object):
def __init__(self):
self.arr = []
def push(self, val):
self.arr.append(val)
def pop(self):
if len(self.arr):
return... |
25 | 39f9341313e29a22ec5e05ce9371bf65e89c91bd | """
리스트에 있는 숫자들의 최빈값을 구하는 프로그램을 만들어라.
[12, 17, 19, 17, 23] = 17
[26, 37, 26, 37, 91] = 26, 37
[28, 30, 32, 34, 144] = 없다
최빈값 : 자료의 값 중에서 가장 많이 나타난 값
① 자료의 값이 모두 같거나 모두 다르면 최빈값은 없다.
② 자료의 값이 모두 다를 때, 도수가 가장 큰 값이 1개 이상 있으면 그 값은 모두 최빈값이다.
"""
n_list = [[12, 17, 19, 17, 23],
[26, 37, 26, 37, 91],
[28,... |
26 | 312cc666c88fcd22882c49598db8c5e18bd3dae1 | from setuptools import setup, find_packages
from setuptools.extension import Extension
from sys import platform
cython = True
try:
from Cython.Build import cythonize
cython = True
except ImportError:
cython = False
# Define the C++ extension
if platform == "darwin":
extra_compile_args = ['-O3', '-pthread',... |
27 | 2aec0581413d4fb0ffb4090231fde0fed974bf18 | import numpy as np
import random
with open("./roc.txt", "r") as fin:
with open("./roc_shuffle.txt", "w") as fout:
tmp = []
for k, line in enumerate(fin):
i = k + 1
if i % 6 == 0:
idx = [0] + np.random.permutation(range(1,5)).tolist()
for sen i... |
28 | 4f13e2858d9cf469f14026808142886e5c3fcc85 | class Solution:
def merge(self, nums1, m, nums2, n):
"""
Do not return anything, modify nums1 in-place instead.
"""
if n == 0:
nums1 = nums1
if nums1[m-1] <= nums2[0]:
for i in range(n):
nums1[m+i] = nums2[i]
... |
29 | 57967f36a45bb3ea62708bbbb5b2f4ddb0f4bb16 | # -*- coding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1428612037.145222
_enable_loop = True
_template_filename = 'C:\\Users\\Cody\\Desktop\\Heritage\\chf\\templates/account.rentalcart.html'
_t... |
30 | 5771f49ad5254588f1683a8d45aa81ce472bb562 |
def prime_sieve(n):
if n==2: return [2]
elif n<2: return []
s=range(3,n+1,2)
mroot = n ** 0.5
half=(n+1)/2-1
i=0
m=3
while m <= mroot:
if s[i]:
j=(m*m-3)/2
s[j]=0
while j<half:
s[j]=0
j+=m
i=i+1
m=2*i+3
return [2]+[x for x in s if x]
ps = prime_sieve(1000000)
def get_primes_upto(n):
... |
31 | 44d87f112ab60a202e4c8d64d7aec6f4f0d10578 | # coding: utf-8
import os
import factory
import datetime
from journalmanager import models
from django.contrib.auth.models import Group
from django.core.files.base import File
_HERE = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(_HERE, 'xml_samples', '0034-8910-rsp-48-2-0216.xml')) as xml_fil... |
32 | 81dfdf0479fc1f136fa5153840d8c7015f9db676 | # required !!!
# pip install selenium
# pip install webdriver-manager
from theMachine import loops
# fill the number and message
# you can fill the number with array
phoneNumber = "fill the number"
message = "fill with ur message"
loop = 1 # this how many u want to loop
loops(loop, phoneNumber, message)... |
33 | 24de4f486d4e976850e94a003f8d9cbe3e518402 | a= input("Enter number")
a= a.split()
b=[]
for x in a:
b.append(int(x))
print(b)
l=len(b)
c=0
s=0
for i in range(l):
s=len(b[:i])
for j in range(s):
if b[s]<b[j]:
c=b[s]
b.pop(s)
b.insert(b.index(b[j]),c)
print(b,b[:i],b[s])
|
34 | 0ecd2a298203365b20b2369a99c3c1d7c0646f19 | # coding: utf-8
#ack program with the ackermann_function
""" ackermann_function """
def ack(m,n):
#n+1 if m = 0
if m is 0:
return n + 1
#A(m−1, 1) if m > 0 and n = 0
if m > 0 and n is 0:
return ack(m-1, 1)
#A(m−1, A(m, n−1)) if m > 0 and n > 0
if m > 0 and n > 0:
re... |
35 | a98be930058269a6adbc9a28d1c0ad5d9abba136 | import sys
import time
import pymorphy2
import pyglet
import pyttsx3
import threading
import warnings
import pytils
warnings.filterwarnings("ignore")
""" Количество раундов, вдохов в раунде, задержка дыхания на вдохе"""
rounds, breaths, hold = 4, 30, 13
def play_wav(src):
wav = pyglet.media.load(sys.path[0] + '... |
36 | 4f0933c58aa1d41faf4f949d9684c04f9e01b473 | from os.path import exists
from_file = input('form_file')
to_file = input('to_file')
print(f"copying from {from_file} to {to_file}")
indata = open(from_file).read()#这种方式读取文件后无需close
print(f"the input file is {len(indata)} bytes long")
print(f"does the output file exist? {exists(to_file)}")
print("return to continue,... |
37 | 5c81ddbc8f5a162949a100dbef1c69551d9e267a | # -*- coding: utf-8 -*-
from django.test import TestCase
from django.contrib.auth.models import User
from ..models import Todo
class MyTestCase(TestCase):
def test_mark_done(self):
user = User.objects.create_user(email='user@…', username='user', password='somepasswd')
todo = Todo(title='SomeTitl... |
38 | 509129052f97bb32b4ba0e71ecd7b1061d5f8da2 | print (180 / 4) |
39 | 2c90c4e0b42a75d6d387b9b2d0118d8e991b5a08 | import math
import decimal
from typing import Union, List, Set
from sqlalchemy import text
from .model import BaseMixin
from ..core.db import db
Orders = List[Set(str, Union(str, int, decimal.Decimal))]
class BaseDBMgr:
def get_page(self, cls_:BaseMixin, filters:set, orders:Orders=list(), field:tuple=(), pag... |
40 | cb2e800cc2802031847b170a462778e5c0b3c6f9 | from math import *
from numpy import *
from random import *
import numpy as np
import matplotlib.pyplot as plt
from colorama import Fore, Back, Style
from gridworld import q_to_arrow
N_ROWS = 6
N_COLUMNS = 10
class State(object):
def __init__(self, i, j, is_cliff=False, is_goal=False):
self.i = i
... |
41 | 52da8608e43b2d8dfe00f0956a1187fcf2e7b1ff | # Generated by Django 2.2.6 on 2020-05-21 09:44
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('DHOPD', '0015_auto_20200515_0126'),
]
operations = [
migrations.CreateModel(
name='Patient_c',
field... |
42 | 1084478226777b9259274e053984ac34d461198d | from .ast import *
# noinspection PyPep8Naming
def addToClass(cls):
def decorator(func):
setattr(cls, func.__name__, func)
return func
return decorator
def print_intended(to_print, intend):
print(intend * "| " + to_print)
# noinspection PyPep8Naming,PyUnresolvedReferences
class TreeP... |
43 | 999de0965efa3c1fe021142a105dcf28184cd5ba | import dnf_converter
def parse(query):
print("parsing the query...")
query = dnf_converter.convert(query)
cp_clause_list = []
clause_list = []
for cp in query["$or"]:
clauses = []
if "$and" in cp:
for clause in cp["$and"]:
clauses.append(clause)
clause_list.append(clause)
else:
clause = cp
... |
44 | cb08f64d1ad7e53f1041684d4ca4ef65036c138d | import json
import re
from bs4 import BeautifulSoup
from bs4.element import NavigableString, Tag
from common import dir_path
def is_element(el, tag):
return isinstance(el, Tag) and el.name == tag
class ElemIterator():
def __init__(self, els):
self.els = els
self.i = 0
def peek(self):
try:
... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 22