blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
cbdb6a0d5604b063694fc22a7fcbd0fc235f9134 | adamrab123/SSL-SSH | /ciphers.py | UTF-8 | 3,223 | 2.984375 | 3 | [] | no_license | import DES
import numpy as np
# General Use -----------------------------------------------------------------
def modInverse(a, m) :
m0 = m
y = 0
x = 1
if (m == 1) :
return 0
while (a > 1) :
# q is quotient
q = a // m
t = m
# m is remainder now... | true |
ca9fc11f3cd95c623b30b481b953335c6c872fcf | jklole/spider_for_jable.tv | /getList.py | UTF-8 | 2,334 | 2.75 | 3 | [
"WTFPL"
] | permissive | import requests #导入requests包
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import pyodbc
from time import sleep
item_num=24
page_num=124
proxies={
"https":"socks5://127.0.0.1:20001"
}
# 获取特定页码的url,按照最近更新排序
def getPageurl(pageNum):
url="https://jable.tv/categories/chinese-subtitle/?mo... | true |
38a744b2a296cf51d416891aa100694cf62c5a9d | vis98/Interview-Preparation-Kit | /Merge/Merge Intervals.py | UTF-8 | 572 | 3 | 3 | [] | no_license | class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
lst = []
if len(intervals)==0:
return lst
intervals = sorted(intervals,key = lambda x:x[0])
lst.append(intervals[0])
j = 1
for i in range(1,len(intervals)):
lo = in... | true |
a569e07ca9cc22d3442be3211d665a0971eeb6ad | DaeHyupp/Baekjoon | /12015.py | UTF-8 | 657 | 3.078125 | 3 | [] | no_license | import sys
input = sys.stdin.readline
N = int(input())
arr = list(map(int,input().rstrip().split(" ")))
lis = []
lis.append(10**9)
def bs(start,end,target):
if target < lis[0]:
lis[0]=target
return
if target > lis[end]:
lis.append(target)
return
while start<= end:
... | true |
e8b0f4e9f2a2ff64ae9ae5a9c742705375c2c09b | aslupin/cpe31-task | /aum_task/calender.py | UTF-8 | 1,502 | 3.34375 | 3 | [] | no_license | m = int(input())
n = int(input())
Day = [31,28,31,30,31,30,31,31,30,31,30,31]
LeDay = [31,29,31,30,31,30,31,31,30,31,30,31]
def leap(n):
if n%4 == 0:
if n%100 == 0:
if n%400 == 0:
return True
else:
return False
else:
return True
... | true |
c6e1ed28da92fee22007226dd89053262523707e | 1david5/oj | /HackerRank/algorithms/implementation/angry_professor.py | UTF-8 | 474 | 3.078125 | 3 | [] | no_license | # author: David Lozano
# source: HackerRank ( https://www.hackerrank.com )
# problem name: Algorithms: Implementation: Angry Professor
# problem url: https://www.hackerrank.com/challenges/angry-professor/problem
# date: 06/29/2020
if __name__ == "__main__":
for _ in range(int(input())):
student_count, min_... | true |
e709e118b353cf49d43a34131b87eaf1bfb86846 | pichuang/programming_in_python3 | /yield.py | UTF-8 | 1,806 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
'''
Research yield
http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/
'''
import time
import logging
NUMBER = 10000
'''
Log handle
'''
# Add logger
logger = logging.getLogger('fab')
logger.setLevel(logging.DEBUG)
# Add file log
fh = logging.FileHandler('fab.log')
fh.setLevel... | true |
1cf7faf4b35465b25e432745d6d9bb639a03c8c3 | lovecn/lovecn.github.io | /login_qq.py | UTF-8 | 2,497 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
#http://www.djhull.com/python/training-python-5.html
import time,random
from splinter import Browser
def login(url, q, p):
browser=Browser('chrome')
#browser = Browser('webdriver.chrome')
# browser = Browser('firefox')
browser.visit(url)
#time.sleep... | true |
9d5caac0dacc70735e738300ff2d43fe693a17bb | khanrc/pt.seq2seq | /models/rnn/encdec.py | UTF-8 | 4,572 | 2.59375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from .attention import KeyValueAttention, AdditiveAttention, MultiplicativeAttention
from const import *
class Encoder(nn.Module):
""" Simple encoder without attention """
def __init__(self, in_dim, emb_dim, h_dim, n_layers=1, bidirect=False, ... | true |
2bd3d7a6af7072568cfd2d9a3bc4d9b0d68d7271 | yanga11ang/2020_area_passenger_prediction | /module/strategy/NegativeSampling.py | UTF-8 | 1,626 | 3.265625 | 3 | [] | no_license | from .Strategy import Strategy
# 优化目标函数, 负采样
# 父类 是nn.Module 因为用到了forward 的特殊用法
class NegativeSampling(Strategy):
def __init__(self, model = None, loss = None, batch_size = 256, regul_rate = 0.0, l3_regul_rate = 0.0):
super(NegativeSampling, self).__init__()
self.model = model # 正常的模型 trans系列模型
self.loss = lo... | true |
7c97d10b0a7941f306ab88e25c55feb3bf7c8189 | dlink/vbin | /count | UTF-8 | 212 | 2.515625 | 3 | [] | no_license | #!/bin/env python
# usage:
import os
import sys
try:
tablename=sys.argv[1]
except:
print("You must specify tablename.")
sys.exit(1)
os.system("echo 'select count(*) as count from %s'" % tablename)
| true |
32d240b96edec058be87447c3e4b87f2218350b4 | jeremybaby/leetcode | /Python/143_reorder_list.py | UTF-8 | 2,832 | 4.28125 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
"""
思路1: 把后一半的链表进行反转,
如何找到一半呢? ---> 快慢指针
然后可以进行插入 / 搞个新链表,重新弄
思路2:把链表存入list里,然后从开始进行插入
未想到的思路:相反顺序 ---> 使用栈
"""
class Solution1:
"""Solution1:
- 快慢指针到链表的一半
-... | true |
86aa91458515d59fae67c9c4224127952bda7842 | baihao8904/DataStructuresAndAlgorithmsInPython | /DataStructres/ReStr/findUrl.py | UTF-8 | 308 | 2.65625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import requests
from bs4 import BeautifulSoup
import re
url ='http://www.ziroom.com/z/nl/sub/z2.html'
wb_data = requests.get(url)
Soup = BeautifulSoup(wb_data.text,'lxml')
Strsoup =str(Soup)
rel = re.compile('href="(.*)" ')
for item in rel.finditer(Strsoup):
print(item.group(1)) | true |
6702a358b8cf2d604ac49ab116f63c75935467a6 | CodeCamp-STL-May2017/unit-1-assignments-aandertodd | /Chapter_09/__init__.py | UTF-8 | 385 | 3.578125 | 4 | [] | no_license | def get_initials(fullname):
#get first init
first_init = fullname[0]
#find ' '
for char in range(len(fullname)):
if fullname[char] == ' ':
#for every instance of ' ', return the character to the right as an upper().
next_init = char + 1
# while char == next_init:
... | true |
2a9f9729db4acbfd4296cb854bfd2cf1821d5829 | AbdallahAhmed1999/WDMM-1402 | /chapter7/count_vowels.py | UTF-8 | 310 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | def is_vowel(my_word):
vowels = 'aeiouAEIOU'
return my_word[0] in vowels
#####################################
my_file = open('file_example.txt', 'r')
text = my_file.read()
vowel_count = 0
for word in text.split():
if is_vowel(word):
vowel_count += 1
print('vowel count:', vowel_count)
| true |
94075af4f387998e53af2bd3d82080392ba42731 | chaopower-zhang/report | /tools/readxlsx.py | UTF-8 | 1,274 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import logging
import json
import sys
from tools import database
logger = logging.getLogger('main.sub')
sheetname = database.sheetname()
def read(merge):
result = list()
df = pd.read_excel(merge, None)
samplelist = df['样本信息']['sampleSn'].to_list()
if not ... | true |
811d60fbe0f08b51582b1ef3576a670164940eb7 | stijn-volckaert/linux-exploitation-course | /lessons/3_intro_to_tools/scripts/7_gdbremote.py | UTF-8 | 364 | 2.578125 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/python
from pwn import *
def main():
# Start a new process
p = remote("localhost", 1900)
# Name and Token
name = "Santo & Johnny".ljust(63, "\x00")
token = 0xdeadc0de
# Send name and token
p.send(name)
p.send(p32(token))
# Start an interactive session
p.interactiv... | true |
a4a4e776d33e9bf05d52bc0656ee6ad06168d3d5 | mordor-ai/M1MIASHS_projet_twitter | /utils/split_csv_file.py | UTF-8 | 612 | 2.796875 | 3 | [
"MIT"
] | permissive | chunk = 10000000 # number of lines from the big file to put in small file
this_small_file = open('../files/split/twitter_0.csv', 'a')
with open('twitter_100M.csv') as file_to_read:
for i, line in enumerate(file_to_read.readlines()):
file_name = f'files/split/twitter_{i // chunk}.csv'
# print(i, fil... | true |
ed0ee4ac78a9ba2b3b38e6233862c393f5e73a90 | danser99/mastermind | /tests/random_test/rnd_analog_read/test_random_ordi.py | UTF-8 | 323 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
from random import randrange as rr
a=[]
i=0
while i<1000:
i+=1
a.append((rr(1,7), rr(1,7), rr(1,7)))
multiple = []
for t in a:
cnt = a.count(t)
i=0
if cnt>1:
multiple.append((t,cnt))
while i<cnt:
a.remove(t)
i+=1
for m in multiple:
print("{}: {} fois /1000".format(m[0], m[1]))... | true |
b946faef45ecc228c653d2626b76739fa85772e5 | KFranciszek/PyLove-Python-Workshops | /PyLove 1.3 External libraries and REST API/task 3.7.py | UTF-8 | 595 | 3.203125 | 3 | [] | no_license | # Using an API from https://swapi.co/api get data of all inhabitants of the planet Tatooine
import requests
resp = requests.get("http://swapi.co/api/planets")
residents = []
while True:
for planet in resp.json()["results"]:
if planet["name"] == "Tatooine":
for resident_url in planet["residents... | true |
851f815b4ad8ef281342d4cc7b8c6de6d9ff7bd1 | yeahatgithub/LightComputerGames | /guess_number/guessNumber.py | UTF-8 | 550 | 3.953125 | 4 | [] | no_license | # @Time : 2018/6/14 11:11
# @Author : freedomyeah
# @Email : iamdouble@163.com
# @Copyright: MIT
import random
number = random.randint(1, 20)
print("我已经想好了1到20之间的一个数。")
for i in range(6):
print("你猜一猜看是什么数:")
guess = int(input())
if guess == number:
print("你猜对了。恭喜!")
break
elif ... | true |
cd08fd7c53f1375b006856d7836f181a3827ab33 | komalupatil/30-Day-LeetCoding-Challenge | /July2020/Week1/Plus One.py | UTF-8 | 987 | 3.703125 | 4 | [] | no_license | #Problem 6
#Given a non-empty array of digits representing a non-negative integer, plus one to the integer.
#The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.
#You may assume the integer does not contain any leading zero, excep... | true |
4dc47a13e3e541ef7fcffda90e535cbe867b0178 | sdytlm/sdytlm.github.io | /downloads/code/LeetCode/Python/Roman-to-Integer.py | UTF-8 | 597 | 3.1875 | 3 | [] | no_license | class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
R2Imap = {'M':1000,'D':500,'C':100,'L':50,'X':10,'V':5,'I':1}
ret = 0
if s == "":
return ret
index = len(s)-2
while index >=0:
# CM, IV, ... | true |
6497c59f06cdbd08ce2efc456267439cb3d02e9f | gaford/project-euler | /python/16.py | UTF-8 | 235 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# Project Euler 16
x = str(2**1000) # the number as a string
y = list(x) # the list of its digits as strings
z = [int(a) for a in y] # the list of its digits as integers
print(sum(z)) # their sum, 1366
| true |
237f44ead682fb3e9afa4eb0351776be555c8f13 | sudoghut/Leetcode-notes | /13. Roman to Integer/13. Roman to Integer.py | UTF-8 | 909 | 3.265625 | 3 | [] | no_license | class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
num_before = 0
num_now = 0
result = 0
for i in s:
if i=="I": num_now = 1
if i=="V": num_now = 5
if i=="X": num_now = 10
if i=="L":... | true |
ebd683a8cbc30793f9da2c91a95e3bc2a05302f5 | srinivasmachiraju/Philips-Data-Science-Hackathon-2k18-Cue-and-Scope-Detection | /Round2/Hackoverflow.py | UTF-8 | 1,877 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
dataset=pd.read_csv('train.csv')
X = dataset.iloc[:, [0,2,4,6,7,8,9,10,11,12,13,14,15,16]].values
Y=dataset.iloc[:, 20].values
from sklearn.preprocessing import StandardScaler
sc_X = StandardScaler()
X = sc_X.fit_transform(X)
y... | true |
8485af74ffde2f0c7c331a34c4f214d981264914 | cencfeng/pythonExcel | /src/com/cen/beautiful/crawlQB.py | UTF-8 | 1,776 | 3.125 | 3 | [] | no_license | # coding=utf-8
from bs4 import BeautifulSoup
from urllib.request import *
from _io import open
class Spider:
def __init__(self):
self.page = 1
# 记录访问的页码
self.user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safar... | true |
893b6eee825ed721bd4228ee4502de1945b97776 | chrisbeldam/TreeHouse-Python | /Write Better Python/cleanercode.py | UTF-8 | 666 | 2.765625 | 3 | [] | no_license | #Docstring
import logging
logging.basicConfig(filename='starter.log', level=logging.DEBUG)
# levels: Critical = 50, error = 40, warning = 30, info = 20, debug = 10, notset = 0
# Add a docstring to Treehouse.student.
# It should say "Gives a pleasant message about the student."
import pdb; pdb.set_trace()
# positio... | true |
8014815b78d05351dbf3b740369fa7233f4be3f3 | Luca111097/Consistent_Query_Answering | /Atom.py | UTF-8 | 2,219 | 3.03125 | 3 | [] | no_license | class Atom:
def __init__(self, relation_name, key, non_key):
self.relation_name = relation_name
self.key = key
self.non_key = non_key
self.closure = []
# Calculate closure for an atom
def calculate_closure(self, functional_dependency_to_check, all_constant_in_query):
... | true |
9769e844a14b0c7112c6d2a0a2112163d48ad96f | AriGute/Bots-of-war | /Objects/Projectile.py | UTF-8 | 543 | 3.15625 | 3 | [] | no_license | import pygame
from GameObject.GameObject import GameObject
class Projectile(GameObject):
def __init__(self, position, tag):
GameObject.__init__(self,"ExampleObj", position)
self.img = pygame.image.load("Resources/projectile.png")
self.speed = 40
self.tag = 'Projectile'
self... | true |
0e2f0d666437c9f5362090fceafbfe0dfa5aa42d | defiasto/OPR | /L14/1.py | UTF-8 | 335 | 2.953125 | 3 | [] | no_license | def cond(a, i):
if i % 2 and a != 1:
for j in range(2, int(a ** 0.5) + 1):
if a % j == 0:
return False
return True
else:
return False
def search(lst, cond):
for i in(range(len(lst))):
if cond(lst[i], i):
return i... | true |
e8823762e96014ae5896bc88c391458fcd643a87 | dinspi3/Python | /find all links.py | UTF-8 | 480 | 3.125 | 3 | [] | no_license | #https://www.geeksforgeeks.org/how-to-write-the-output-to-html-file-with-python-beautifulsoup/
import requests
from bs4 import BeautifulSoup
urls = 'https://www.discountbank.co.il/DB/private'
grab = requests.get(urls)
soup = BeautifulSoup(grab.text, 'html.parser')
# opening a file in write mode
f = open("tes... | true |
c04803b1154da94cbf7cdc3ee21352989a33fd2b | Eirenne/CodeforcesSolutions | /101606I.py | UTF-8 | 242 | 2.984375 | 3 | [] | no_license | N = int(input())
settings = [int(a) for a in input().split()]
tree = int(input())
min = 4000
min_setting = 600
for setting in settings:
if tree % setting < min:
min = tree % setting
min_setting = setting
print(min_setting) | true |
8420918fe604e948d09086afb271c5526e2f7e43 | mikaelma/TDT4305Project2 | /sparktest.py | UTF-8 | 483 | 2.890625 | 3 | [] | no_license | from pyspark import SparkContext
from operator import add
sc = SparkContext(appName="sparky")
d1 = [('new york','someValue1',5),('new york','somevalue2',5),('chicago','somevalue2',3),('boston','somevalue1',1),('chicago','somevalue5',4)]
d2 = [('new york', 10), ('chicago',7), ('boston',1)]
d2 = sc.parallelize(d2)
d1 =... | true |
d2a94142ad4b53c6f65097e2cc5837cf4393ee68 | mayu0007/DepositPrediction | /binary_encode.py | UTF-8 | 2,403 | 2.765625 | 3 | [] | no_license | import csv
import numpy
from sklearn import preprocessing
from sklearn import tree, svm
from sklearn.metrics import make_scorer, matthews_corrcoef, recall_score
from sklearn.model_selection import cross_val_score
import category_encoders as ce
numpy.set_printoptions(threshold='nan')
categorical_index = (1, 2, 3, 4, 5... | true |
b719b93266a9e5a5b6e6638a88007aef208ee378 | yehudit96/coreferrability | /graph/rule_graph.py | UTF-8 | 5,475 | 2.71875 | 3 | [] | no_license | """
Create a graph based align tweets pairs (ids) per rule.
"""
import networkx as nx
from collections import defaultdict
from tqdm import tqdm
import os
import sys
sys.path.append('/home/nlp/yehudit/projects/coreferrability/rules_ranking/')
from rank_utils import AP
import pickle
import argparse
import logging
loggin... | true |
72e57bba0e7a7105d0b7fd878b1a1221324c638c | qiqidone/Vectorization | /vector0.2/Render/generate_data.py | UTF-8 | 459 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
#encoding=utf-8
height = 512
width = 512
def generate_data():
file = open('data.txt','w');
file.write('# v id x y\n')
for n in range(10):
file.write('v '+str(n+1)+' '+str(n**2+n+100)+' '+str(n*3+n*31)+'\n')
file.write('# l id ids ide cl cl cl cl cr cr cr cr\n')
for n in range(10):
fil... | true |
351c6197e9c7382df1be5d6e38a32eb70a89a26b | jzorrof/headfirst | /ch1/ch1_p13.py | UTF-8 | 331 | 3.875 | 4 | [] | no_license | __author__ = 'joe_fan'
cast = ["The Holy Grail", "The Life of Brian", "The Meaning of life"]
# insert year
cast.insert(1, 1975)
cast.insert(3, 1979)
cast.append(1983)
print(cast)
# create new list
cast_new = ["The Holy Grail", 1975,
"The Life of Brian", 1979,
"The Meaning of life", 1983]
prin... | true |
7c090da8358f5c5c11d38454247b4f8a21c0891f | RoyFlo360/Prolog | /permutaciones.py | UTF-8 | 939 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env pthon3
def imprime(p):
for elemento in p:
print(elemento, end='')
print()
def permuta(p, u, c):
for i in range(len(p)):
if not u[i]:
p[c] = i + 1
c += 1
u[i] = True
if c == len(p):
imprime(p)
else:... | true |
1fe41e44404f9b357c7753d9fa8e370ca24f6fed | mrking646/2Months | /day7/oj/practice.py | UTF-8 | 568 | 3.3125 | 3 | [] | no_license | def school(name, addr, type):
def recruit(school):
print("%s %s is recruiting" % (school['type'], school['name']))
def having_exam(school):
print("%s %s is having an exam" % (school['type'], school['name']))
def init(name, addr, type):
sch = {
"name": name,
... | true |
2f6276ef3e5dc371a6f6483fc807b8e790a62c1d | pombredanne/poteau | /poteau/mbox.py | UTF-8 | 1,833 | 3.15625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
"""My Thunderbird mail crash the email.mbox library.
Here is a violent way to read mbox format : yielding mail as text and
parsing them with lamson.
"""
import mmap
from email.utils import parsedate
# Lamson is an application, but also the best way to read email without
# struggling with "batter... | true |
be32429576da94f71609678fe73a1915f5daed4b | CoderKn1ght/Algorithm-Implementations | /CH2_Linked_Lists/Traverse_List.py | UTF-8 | 219 | 3.234375 | 3 | [] | no_license | from CH2_Linked_Lists.Node import Node
if __name__ == '__main__':
n1 = Node(5)
n2 = Node(7)
n3 = Node(3)
n4 = Node(6)
n1.next = n2
n2.next = n3
n3.next = n4
n1.iterate_and_print()
| true |
6319ae1092a69fdd7b0496f12015e8da52ab0a7c | HyunSung-Na/TIL-algorism | /알고리즘/4주 완주하지못한 선수_수정.py | UTF-8 | 170 | 2.71875 | 3 | [] | no_license | from collections import Counter
def solution(participant, completion):
return [runner for runner, num in Counter(participant + completion).items() if num % 2].pop()
| true |
f3936362afb4ebc7f200924dfbe83fca45f8dd16 | giovixo/cta_simulator | /GRB080916/plot_spec_Thomas.py | UTF-8 | 1,188 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from astropy.io import ascii
infile='../GRB_Models_Thomas/data/GRB080916009.out'
#data=pd.read_csv(infile,comment='!', sep='',header=None,skiprows=None,skip_blank_lines=True)
#data=pd.read_csv(infile,header=None)
#data_array=data.values
#table=da... | true |
3f145b9d05fbfcddebdd609d12a7676392e02039 | joelYing/Learn_Python | /database/test/test.py | UTF-8 | 467 | 2.53125 | 3 | [] | no_license | import pymongo
def x():
client = pymongo.MongoClient(host='localhost', port=27017)
db = client.test
collection = db['second']
with open('D:\\mygit\\learn_python\\Learn_Python\\domain.txt', 'r') as fw:
for index, line in enumerate(fw.readlines()):
domain = line.strip()
... | true |
c29443a2d9fd711574aea7c94650a04196533249 | Oleh1989/PythonStudy | /FirstApp.py | UTF-8 | 706 | 4.3125 | 4 | [] | no_license | #firstName = input("Enter Your first name: ")
#lastName = input("Enter Your last name: ")
#print("Hello,", firstName, lastName)
#print(type(firstName))
#print(type(lastName))
print(8 ** 2) # возведение в степень
i = 0
while i <= 20:
print(i)
i += 1
firstNum = "1"
secondNum = 4
sum = int(firstNum) + second... | true |
b504d71fb1c41512b89ae7213d5f1a191febcf2e | krodyx/corpint | /corpint/enrich/gmaps.py | UTF-8 | 2,746 | 2.546875 | 3 | [] | no_license | from os import environ
import googlemaps
from normality import latinize_text
API_KEY = environ.get('GMAPS_APIKEY')
def tidy_address(address):
address = address.upper()
if 'ESQ,' in address or 'ESQ.,' in address:
a = address.split('ESQ,')
if len(a) == 1:
a = address.split('ESQ.,')
... | true |
0388f87e33878378857d106e554bf99fce337b28 | gisxing/lab | /ip_check.py | UTF-8 | 883 | 2.96875 | 3 | [] | no_license | import string
def to_digit(addr) :
lst = map(string.atoi, addr.strip().split('.'))
return reduce(lambda x, y: x*256+y, lst)
netmask = lambda n : 2**32 - 2**(32-n)
def belongs(addr, network) :
if '/' in network:
naddr, nm = network.split('/')
mask = netmask(string.atoi(nm))
return... | true |
11b0a7cbdcc461d1e5387745c66c045ce46a78e4 | rostock/geocodr | /api/geocodr/lib/flst.py | UTF-8 | 6,769 | 3.09375 | 3 | [
"CC0-1.0"
] | permissive | import re
from collections import namedtuple
flst = namedtuple('flst', [
'gemarkung', # 6
'flur', # 3
'zaehler', # 5
'nenner', # 4
'gemarkung_name',
])
flst_re = re.compile(r'''
^\s*
(
((?P<gemarkung>\d{6})[-/ ]?) # 6 digit gemarkung
|
(?P<gemarkung_name>[^0-9]+?) # o... | true |
7a85cafbe4d1e15e3133cc7303c490ed412c5b20 | AlbertMillan/ML--task-101--team-23 | /Code/AzureML/Graphs/Classification-Results.py | UTF-8 | 2,445 | 3.0625 | 3 | [] | no_license | # The script MUST contain a function named azureml_main
# which is the entry point for this module.
# imports up here can be used to
import pandas as pd
import seaborn as sns
# The entry point function can contain up to two input arguments:
# Param<dataframe1>: a pandas.DataFrame
# Param<dataframe2>: a pandas.Da... | true |
47f352feb22df399e28f456913068b54ef2aa075 | Jueast/HelloWorld | /edX/ProblemSet4/ps4.py | UTF-8 | 2,717 | 3.15625 | 3 | [] | no_license | # 6.00.2x Problem Set 4
import numpy
import random
import pylab
from ps3b import *
#
# PROBLEM 1
#
def simulationDelayedTreatment(numTrials):
"""
Runs simulations and make histograms for problem 1.
Runs numTrials simulations to show the relationship between delayed
treatment and patient outco... | true |
f8b4e50afe9998851244e3721cd9afe73a07ba25 | benshushanster/ML | /ex5.py | UTF-8 | 884 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets
iris = datasets.load_iris()
X = iris.data[:, :2] # we only take the first two features.
y = iris.target
all = np.column_stack([X, y])
np.random.shuffle(all)
plt.scatter(all[:, 0], all[:, 1], c=all[:, 2])
plt.show()
def distance(a, b)... | true |
1dba7dd1b3b7a2c0a6872d3731cfc2dc2c375b8f | teachtechtoe/Python | /09-OOP/Rectangle.py | UTF-8 | 394 | 3.28125 | 3 | [] | no_license | from Shape import *
class Rectangle(Shape):
def __init__(self, length, width , c='', b=0):
self.length = length
self.width = width
super(Rectangle,self).__init__(c,b)
def area(self):
return self.length * self.length
def __str__( self ):
return "Rectangle: Length %d Widt... | true |
3ef91c8d3404f7f4b1f66a493065808ba7bad18f | OnofreTZK/Overclock-backend | /produto/controllers.py | UTF-8 | 3,164 | 2.546875 | 3 | [] | no_license | from rest_framework.serializers import ModelSerializer
from produto.models import Produto
from produto.services import ProdutoService
from produto.exceptions import *
from rest_framework.response import Response
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from rest_framew... | true |
063d46efef9e43bd368b5182b5b25ebd398d1134 | minfun/OralCardGenerator | /math_templete.py | UTF-8 | 4,795 | 3.40625 | 3 | [
"MIT"
] | permissive | from random import randint
sym = [' + ', ' - ']
# 当前文件夹下创建口算题目文件math.txt
fobj = open('math.txt', 'w')
def base_exei_oneline(pmin, pmax, mmin, mmax, multimin, multimax, divmin, divmax):
"""
pmin,pmax:加数、被加数最小最大值
mmin,mmax:减法转换成加法后,加数、被加数最小最大值
multimin,multimax:乘数、被乘数最小最大值
divmin,divmax:除法转换成乘法后,乘... | true |
4aeb5e4701745ecaa7793a45431f615fe83edffc | techthiyanes/w2v2-speaker | /src/lightning_modules/speaker/dummy.py | UTF-8 | 3,048 | 2.765625 | 3 | [] | no_license | ################################################################################
#
# Implements a dummy module which uses very few parameters to generate
# predictions/embeddings.
# This is useful for debugging training schedules as it removes the
# heavy computation for each step so a full training run can be executed... | true |
86b0800840557c8b8d1c2ba2d90513ef4a9f4613 | jntushar/Algorithmic-Toolbox | /week2_algorithmic_warmup/5_fibonacci_number_again.py | UTF-8 | 627 | 3.5625 | 4 | [] | no_license | # Uses python3
import sys
def get_fibonacci_huge_naive(n, m):
current, previous = 1, 0
for i in range(m * m + 1):
previous, current = current, (current + previous) % m
if (previous, current) == (0, 1):
time_period = i + 1
break
index = n % time_period
if index... | true |
c9cd6d9d20d29ad28ff571d0adacfe959fbc7e1e | shankar7791/MI-10-DevOps | /Personel/Yash/Python/25feb/prog1.py | UTF-8 | 327 | 4.21875 | 4 | [] | no_license | # #Program 1 : Write a Python program to add two positive integers without using the '+' operator.
num1=int(input("Enter the first number : "))
num2=int(input("Enter the second number : "))
while num2 !=0:
carry=num1 & num2
num1=num1^num2
num2=carry << 1
print("Sum of two numbers are",n... | true |
8f25c739b250a2895be57d9f4d8a0cca78c9e03c | gsh199449/stickerchat | /gpu_cluster.py | UTF-8 | 3,122 | 2.671875 | 3 | [] | no_license | import csv
import select
import socket
import subprocess
import sys
def get_host_ip():
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
ip = s.getsockname()[0]
finally:
s.close()
return ip
def get_available_gpu():
child = subproces... | true |
30ceba3af0f531c31e45272c821a0e6ad5b5ecc4 | huninged/geatpy | /geatpy/demo/single_objective_demo4/aimfuc.py | UTF-8 | 415 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
aimfc.py - 目标函数demo
描述:
Geatpy的目标函数遵循本案例的定义方法,
若要改变目标函数的输入参数、输出参数的格式,则需要修改或自定义算法模板
"""
def aimfuc(Phen):
x1 = Phen[:, [0]]
x2 = Phen[:, [1]]
x3 = 1 - x1 - x2 # 将x1 + x2 + x3 = 1的等式约束降维化处理
f = 4 * x1 + 2 * x2 + x3
return f
| true |
2fb664073f0a3c2b451fbfe50fb57fc188c403c9 | AAUCrisp/Python_Tutorials | /Anders Holm/pythonpractice.org/Exercise_5.py | UTF-8 | 780 | 4.125 | 4 | [] | no_license | #Take two lists, say for example these two:
#a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
#b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
#and write a program that returns a list that contains only the
# elements that are common between the lists (without duplicates).
# Make sure your program works on two lists o... | true |
868c85ecb3e78d8d93daac05d4bf1c387a940abd | nickdelgrosso/drawtraces | /scripts/draw_traces.py | UTF-8 | 1,750 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
def main():
# load csv as data frame
df = pd.read_csv('./example_data/draw_traces/top5_correlated.csv')
# calculate number of time points
frames_recorded = 6080
ntimepoints = int(len(df) // frames_recorded)
# extract time (t) and fluorescen... | true |
50b5f1d87dee8cfe9c917ce527ee8c0062041e6e | EDA2021-2-SEC06-G08/Reto3-G08 | /App/model.py | UTF-8 | 13,599 | 2.703125 | 3 | [] | no_license | """
* Copyright 2020, Departamento de sistemas y Computación,
* Universidad de Los Andes
*
*
* Desarrolado para el curso ISIS1225 - Estructuras de Datos y Algoritmos
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published b... | true |
c5d1674141daf4f1f6be07e6d4b15269c2680dcc | Vivekgupta2227/hackout | /test_support.py | UTF-8 | 1,161 | 2.625 | 3 | [] | no_license | from hackout import Email
EMAIL1 = Email(from_='sender@example.com', to='recipient@example.com',
subject='Hello, World!', content='PS This is a test.')
EMAIL2 = Email(from_='other.sender@example.com', to='recipient@example.com',
subject='Hey, There!', content='Another test.')
EMAIL3 = Em... | true |
a8582c13227f01b3420630e146f87d88be213dcd | Qianjm1018/shishi | /test_case/demo(1).py | UTF-8 | 2,506 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'xuepl'
__mtime__ = '2019/7/24'
# code is far away from bugs with the god animal protecting
I love animals. They taste delicious.
┏┓ ┏┓
┏┛┻━━━┛┻┓
┃ ☃ ┃
┃ ┳┛ ┗┳ ┃
┃ ... | true |
980bcb4defc18eeaf81e6707c0da64f30f46296e | joulebit/Projects-for-learning | /Rock Paper Scissors/TilfeldigSpiller.py | UTF-8 | 322 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 22 14:00:33 2019
@author: Joule
"""
import random as rn
from Spiller import Spiller
class Tilfeldig(Spiller):
"""Tilfeldig spiller"""
def __init__(self, name):
super().__init__(name)
def velg_aksjon(self):
return rn.randint(0, 2)... | true |
dc6f01a0f2c07760c30226b8a0571cce32b4eb4f | sufyansalim/python3 | /regex.py | UTF-8 | 222 | 3.078125 | 3 | [] | no_license | import re
text = "A random string. MyName@website.com. some more random text. YourName@company.net"
pattern = re.compile("[a-zA-Z-9\.\-\_]+\@[a-zA-Z-9]+\.[a-zA-Z]+")
# result = pattern.search(text)
result = pattern.findall(text)
print(result)
| true |
2ad96f7b3c31352d011de1f5246a06068743215d | SeldonIO/seldon-core | /components/routers/thompson-sampling/ThompsonSampling.py | UTF-8 | 4,018 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | import random
import logging
import numpy as np
__version__ = "0.1"
logger = logging.getLogger(__name__)
class ThompsonSampling(object):
""" Multi-armed bandit routing using Thompson Sampling strategy.
This class implements Thompson Sampling for the Beta-Binomial model, i.e.
rewards are assumed to come ... | true |
6653bc278ccfbefc989d6c34cd971520d4c2953c | DeltaEpsilon-HackFMI2/FMICalendar-REST | /schedule/models.py | UTF-8 | 4,666 | 2.734375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from django.db import models
from datetime import datetime
class Place(models.Model):
"""
Holder object for basic info about the rooms
in the university.
"""
room_place = models.CharField(max_length=255)
floor = models.IntegerField()
def __unicode__(self):
... | true |
b27b34951188f9222df7f36b14e6347d4051a6be | dogada/PyT | /pt/benchmark/tiny.py | UTF-8 | 1,439 | 2.578125 | 3 | [
"BSD-2-Clause"
] | permissive | #! /usr/bin/env python
# encoding: utf-8
"""
Test small template with 2 variables.
"""
from pt.benchmark import *
ctx = {'name': 'Hello world',
'content': 'Where we will be when the summer will gone?'}
if PtTemplate:
def pt_template():
return PtTemplate() [html [body [h1 [V("name")],
... | true |
d9b0363ca3f051f00960f60484d0b409b37fa3f2 | ggrillo93/School | /Grad School/Fall 2016/AEP 4380/HWs/HW #9/Scripts/hw9plot1.py | UTF-8 | 747 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
import pyfits
import numpy as np
import math
from pylab import *
from matplotlib import pyplot as plt
def columnToList(text,colnumber):
with open(text) as f:
lista=[]
for line in f:
spl=line.split()
lista.append(spl[colnumber])
return lista
y1 = co... | true |
96b40982965765348791bf18f24459b4694fad4c | flaviolimpio/Otimizacao | /dict_reader.py | UTF-8 | 865 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 27 11:15:34 2016
@author: pulabio
"""
import csv
import numpy as np
filename = "AR6.csv"
#input_file = csv.DictReader(open(filename))
with open(filename, mode='r') as infile:
reader = csv.reader(infile)
mydict = {float(rows[0]):float(rows[1]) for rows in reader... | true |
ab71bf0c2d4320ec3cf21ca391672b09070fb750 | DaStoll/learna-1 | /src/learna/environment.py | UTF-8 | 14,103 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import time
from pathlib import Path
from itertools import product
from dataclasses import dataclass
from distance import hamming
import numpy as np
from tensorforce.environments import Environment
from RNA import fold
@dataclass
class RnaDesignEnvironmentConfig:
"""
Dataclass for the configuration of the ... | true |
d3a8fb5d686f15b1dc0f35442efaa9dc2cec2486 | pangguoping/python-study | /平时练习/socket/ssh-socket/socket-client.py | UTF-8 | 2,734 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Auther: pangguoping
"""
import socket
ip_port = ('127.0.0.1',9999)
#买手机
s = socket.socket()
#拨号
s.connect(ip_port)
#发送消息
send_data = input(">>>:").strip()
s.send(bytes(send_data,encoding='utf-8'))
#收消息
recv_data = s.recv(1024)
print("----------------",type(recv_data))
pr... | true |
f4f91ccfb0a57e034710c0838460dc41ace7b027 | crbaker/sudoku | /app.py | UTF-8 | 4,231 | 3.390625 | 3 | [] | no_license | from cell import Cell
from file_utils import FileReader
class Game:
def __init__(self, file_name):
self.grid = self.read_grid(file_name)
def read_grid(self, file_name):
reader = FileReader(file_name)
return reader.build_grid()
def solve_grid(self):
groups = []
for i in range(9):
groups.append(self.... | true |
e1cc4c6e90298bd331d65c0debccd1a2c8e10a47 | changsong321/LeetCode | /week5/GS_oa1.py | UTF-8 | 263 | 3.53125 | 4 | [] | no_license | def rankIndex(values, rank):
scores = []
for i in range(len(values)):
scores.append((sum(values[i]), i))
scores.sort(reverse=True)
return scores[rank-1][1]
values = [[79,89,15],[85,89,92],[71,96,88]]
rank = 2
print(rankIndex(values,rank)) | true |
e1e26f11cc7f017f30e651e9989ad0caf80ee623 | henrytwo/Goose-Draw | /server.py | UTF-8 | 1,355 | 2.703125 | 3 | [] | no_license | import socket
import pickle
import multiprocessing
def recv_messages(recv_queue, sock):
while True:
try:
msg = sock.recvfrom(1024)
recv_queue.put([pickle.loads(msg[0]), msg[1]])
except:
pass
def send_messages(send_queue, sock):
while True:
try:
... | true |
f7603eae2c68bfecfe32262b3d830953ef65a55a | ningningliu/Prudential-Life-Insurance-Assessment | /previouswork/zhanghan/prudential_utils/utils.py | UTF-8 | 5,977 | 2.625 | 3 | [] | no_license | import pandas as pd
from copy import deepcopy
import numpy as np
from local import paths
from sklearn import preprocessing
from sklearn.preprocessing import PolynomialFeatures
import operator
import random
random.seed(26)
print('Load the data using pandas')
path_train = paths.TRAIN_PATH
path_test = paths.TEST_PATH
p... | true |
3cee3fb7901110f6ba259b5fa6a2f147bd8bd298 | sairamprogramming/python_book1 | /chapter7/programming_exercises/exercise14.py | UTF-8 | 1,005 | 4.71875 | 5 | [] | no_license | # Expense Pie Chart
# Create a text file that contains your expenses for last month in the following categories:
# Rent
# Gas
# Food
# Clothing
# Car payment
# Misc
# Write a Python program that reads the data from the file and uses matplotlib to plot a pie
# chart showing how you spend your mo... | true |
eab4daacece3b512456cc5e918fb3899501ae4e9 | gaurang-tandon/python-practice | /mail_programs/problem_5_classes.py | UTF-8 | 858 | 4.96875 | 5 | [] | no_license | """
Define a class which has at least two methods:
getString: to get a string from console input
printString: to print the string in upper case.
Also include simple test function to test the class methods.
"""
class StringTest:
def __init__(self, number, age, gender):
self.number = number
self... | true |
1709363c203f2b689c5051873b44fb6872643cea | joycejhang/learningml | /sleftry/5-2_encode_.sparse.py | UTF-8 | 924 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 3 16:45:24 2018
@author: Joyce
"""
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot = True)
#加上稀疏的限制條件 (sparse con... | true |
8bfbe0e052dbc3d7d805c38a5dbd09f398d66c64 | turkeydonkey/nzmath3 | /sandbox/pyexprfield.py | UTF-8 | 4,788 | 3.296875 | 3 | [] | no_license | """
Python Expression field, another finite prime field characteristic two definition.
field element is defined by bool(Python Expression).
This module is reference design for finite field characteristic two.
but I recommend that this field should be used only checking Python syntax.
"""
import logging
import operat... | true |
0b6644b869249bae05d3d532da22469aae0751b4 | m2030/recipe-app-api | /app/app/calc.py | UTF-8 | 176 | 2.890625 | 3 | [
"MIT"
] | permissive | """
calculators functions
"""
def add(x, y):
"""add x and y return result. """
return x+y
def substract(x, y):
"""add x and y return result. """
return x-y
| true |
cf7b9e01d3241108c9d135f91e0890ffe9d8a300 | natefoo/galaxy-beta2 | /lib/galaxy/dataset_collections/matching.py | UTF-8 | 2,689 | 2.78125 | 3 | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from galaxy.util import bunch
from galaxy import exceptions
from .structure import get_structure
CANNOT_MATCH_ERROR_MESSAGE = "Cannot match collection types."
class CollectionsToMatch( object ):
""" Structure representing a set of collections that need to be matched up
when running tools (possibly workflows ... | true |
b0b9c4261095d4e045fa19dd1e44d44b03c6f4dd | DonnaDia/Projects | /Python/Natural_Language_Processing/Parsing/script.py | UTF-8 | 1,184 | 2.65625 | 3 | [] | no_license | from nltk import pos_tag, RegexpParser
from tokenize_words import word_sentence_tokenize
from chunk_counters import np_chunk_counter, vp_chunk_counter
text = open("dorian_gray.txt",encoding='utf-8').read().lower()
word_tokenized_text = word_sentence_tokenize(text)
single_word_tokenized_sentence = word_tokenized_tex... | true |
7a61875a5a4a04ab8626be294738e09f1c0ffb56 | adityatummala/Mosh | /HelloWorld/car game.py | UTF-8 | 696 | 3.921875 | 4 | [] | no_license | car_input = ""
car_status = False
while car_input != "quit":
car_input = input("> ").lower()
if car_input == "help":
print("""
start - to start the car
stop - to stop the car
quit - to exit
""")
elif car_input == "start":
if car_status:
print("Car ... | true |
7088ab8ebafaf06a6b9a755e0a76b5fd88b01b6a | DeVriesMatt/VGN | /code/check_pixel_mean_value.py | UTF-8 | 4,719 | 2.515625 | 3 | [
"MIT"
] | permissive | # To get the pixel mean value from training images
# coded by syshin (170805)
# DRIVE : [ 180.73042427 97.27726367 57.10662087] on mask
# DRIVE : [ 126.83705873 69.0154593 41.42158474]
# STARE : [ 150.29591358 83.55034309 27.50114876]
# ALL : [ 136.00693286 74.69702627 35.98020038] # DRIVE+STARE
# CHA... | true |
b476cdf38464ab07d40b4166c18813967cf5d897 | killua-killua/RE-Engine | /my_re.py | UTF-8 | 29,840 | 3.015625 | 3 | [] | no_license | import os
import sys
from typing import List, Tuple, Set, final
# Grammar tree
class GTNode():
uid:int = 0
def __init__(self):
self.children = []
self.min_times:int = 1
self.max_times:int = 1
self.uid = GTNode.uid
GTNode.uid += 1
def add_child(self, node):
... | true |
6b699664c15db9f783a8660cdd5a82a1a02838b0 | YunHao-Von/Mathematical-Modeling | /手写代码/第3章 Python在高等数学和线性代数中的应用/Pex3_8.py | UTF-8 | 142 | 2.71875 | 3 | [] | no_license | from sympy import *
k,n=symbols('k n')
print(summation(k**2,(k,1,n)))
print(factor(summation(k**2,(k,1,n))))
print(summation(1/k**2,(k,1,oo))) | true |
f56bef8df1cd3aa3a968848e6e2871f042e76b83 | nmsoccer/convert_table | /test_struct.py | UTF-8 | 336 | 2.671875 | 3 | [] | no_license | import struct
import binascii
print "Ready to test struct..."
values = ["test" , 199 , 28 , 10]
s = struct.Struct('4sihB')
data = s.pack(*values)
hex_data = binascii.hexlify(data)
print "packet data :" , data
print "hexpacket_data: " , hex_data
values.append("77")
print values
f = file("res.bin" , "w")
f.write(hex... | true |
3d3248b4fc0c374ac7fd5bfb3840bff788e6d11e | guolong123/dbfaker | /dbfaker/table2yml.py | UTF-8 | 5,041 | 2.8125 | 3 | [
"LicenseRef-scancode-mulanpsl-1.0-en",
"MulanPSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import yaml
from dbfaker.common.database import Database
import sys
import os
from dbfaker.utils.constant import __version__
import argparse
def table_name_to_table_building_statement(db_session, tables):
table_words = ';\n'.join([db_session.query_table(s) for s in tables]) + ';'
print(table_words)
return... | true |
35102ebe4f552607f7f027587b9524373d5254e4 | moazshorbagy/OCR-Arabic-Scripts | /test_model.py | UTF-8 | 1,317 | 2.515625 | 3 | [] | no_license | from classification import build_model, load_model
from feature_extraction import get_features
import os
import skimage.io as io
from preprocessing import get_char_images_pred, save_predictions
from time import time
def test_data(input_path, model_path):
data = os.listdir(input_path)
model = load_model(model_p... | true |
1857670a7d147573ee434f722f7cf64a6f873be9 | chloeeekim/TIL | /Algorithm/Leetcode/Codes/IntegerBreak.py | UTF-8 | 1,014 | 4 | 4 | [] | no_license | """
343. Integer Break : https://leetcode.com/problems/integer-break/
양의 정수 n이 주어졌을 때, 이를 적어도 2개 이상의 정수의 합으로 나누고, 이 정수들의 최대곱을 구하는 문제
- n은 2 이상 58 이하이다
Example:
- Input : 2
- Output : 1
- 2 = 1 + 1이므로, 1 x 1 = 1
- Input : 10
- Output : 36
- 10 = 3 + 3 + 4, 3 x 3 x 4 = 36
Note:
특정 값을 여러 정수들의 합으로 나누었을 때 구할 수 있는 최대곱을 ... | true |
123e43e5d61fe010d4334d8a7c7fd35b7325ac54 | chenyaqiao0505/Code111 | /testCode/together.py | UTF-8 | 1,060 | 2.96875 | 3 | [] | no_license | import xlrd
import xlwt
import csv
def readwrite():
data = xlrd.open_workbook(u'订单行项汇总5月.xls') # 打开excel
table = data.sheets()[0] # 打开第一张表
nrows = table.nrows # 获取表行数
ncols = table.ncols # 获取表列数
readlist = []
for i in range(nrows):
# print(table.row_values(i))
# 遍历全部元素,用的是r... | true |
670426d2af35704db487adef79f1239b8014b4cc | Aasthaengg/IBMdataset | /Python_codes/p03362/s104710465.py | UTF-8 | 562 | 3.25 | 3 | [] | no_license | def main():
import sys
input = sys.stdin.readline
isprime = [True if i % 2 else False for i in range(55555+1)]
isprime[1] = False
rem = 1
ans = []
for i, j in enumerate(isprime[2:], start=2):
if not j:
continue
ind = i * 2
while ind <= 55555:
i... | true |
9aa949dd58c716e6e432714d49a48d62d79b610e | MsMalcolm/INF308 | /Spring2021/programs/Severance_Textbook/Chapter11_Exercises/11.9.1.py | UTF-8 | 1,602 | 3.921875 | 4 | [] | no_license | # Exercise 1: Write a simple program to simulate the operation of the grep command on Unix.
# Ask the user to enter a regular expression and count the number of lines that matched the regular expression
import re
def openFile(filename):
print(filename)
# Reads a file and returns it
# Displays an error m... | true |
17d6f5e686738e10d869ce3e87874e5ba5240e9d | riteshms/sakura | /sakura/daemon/db/table.py | UTF-8 | 388 | 2.625 | 3 | [] | no_license | from sakura.daemon.db.column import DBColumn
class DBTable:
def __init__(self, dbname, table_name):
self.dbname = dbname
self.name = table_name
self.columns = []
def add_column(self, *col_info):
col = DBColumn(self.name, *col_info)
self.columns.append(col)
def pack(s... | true |
18fd7a6fbc6b11737d38ae198d4395616f3073d0 | chris-kruining/mario-badge | /entity.py | UTF-8 | 507 | 3.078125 | 3 | [] | no_license | class Entity(object):
w = 0
h = 0
x = 0
y = 0
c = 0x111111ff
wrap = False
children = []
def __init__(self, width, height, xPos, yPos, color, wrap = None):
self.w = width
self.h = height
self.x = xPos
self.y = yPos
self.c = color
se... | true |
3dd9e22e4425a4d0327acc705374c1e2c8202443 | shakfu/polylab | /py/rules/test_state_machine.py | UTF-8 | 1,144 | 3.703125 | 4 | [] | no_license | from state_machine import *
@acts_as_state_machine
class Person():
name = 'Billy'
sleeping = State(initial=True)
running = State()
cleaning = State()
run = Event(from_states=sleeping, to_state=running)
cleanup = Event(from_states=running, to_state=cleaning)
sleep = Event(from_states=(runn... | true |
c4d7827768bf6ca4909b66f7e6fa86c51b002319 | flaccid/timezone_converter | /timezone_converter.py | UTF-8 | 2,514 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import argparse
import os
import pytz
import json
from dateutil import parser
from time import strftime
# example usage:
# timezone_converter.py '2017-01-19T08:45:09.778Z' 'Australia/Sydney'
def convert_time(dts, tzs):
"""Converts an ISO 8601 datetime with the given timezone"""
tzinfo ... | true |