blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
e313161b474761d72693f7e992c7fb5456afd159 | Python | CFhM/tedukuri-train | /Problems/0x00「基本算法」例题/0101 a^b/gen.py | UTF-8 | 250 | 2.703125 | 3 | [] | no_license | import random
def main():
with open('gen.in', 'w') as f:
a = random.randint(1, 1e9)
b = random.randint(1, 1e9)
p = random.randint(1, 1e9)
f.write('%d %d %d\n' % (a, b, p))
if __name__ == '__main__':
main()
| true |
cefdd9a664673e6881b7f9efee0ae03722a89b9f | Python | ruthdevgpwr/introducao-programacao-uniesp | /atividade-A04/Q06.py | UTF-8 | 732 | 3.453125 | 3 | [] | no_license | numero1 = float(input('Digite o 1º número: '))
numero2 = float(input('Digite o 2º número: '))
numero3 = float(input('Digite o 3º número: '))
numero4 = float(input('Digite o 4º número: '))
numero5 = float(input('Digite o 5º número: '))
quantidade_maiores_10 = 0
if numero1 > 10:
quantidade_maiores_10 = qua... | true |
050748907b0a688c926cd37f29d21d8553d548f7 | Python | Yllcaka/Random.python | /GAME/automate.py | UTF-8 | 1,296 | 3.671875 | 4 | [] | no_license | import random_word
string = '''The French lettering company Letraset manufactured a set of dry-transfer
sheets which included the lorem ipsum filler text in a variety of fonts, sizes, and layouts.
These sheets of lettering could be rubbed on anywhere and were quickly ado... | true |
34dd2d1e9b929ab709ae6245b467438e6ce225b6 | Python | mrgsfl/python_lessons | /max_min_rest.py | UTF-8 | 765 | 3.15625 | 3 | [] | no_license | maxnum = int(input())
minnum = int(input())
rest = int(input())
if maxnum < minnum:
(maxnum, minnum) = (minnum, maxnum)
if maxnum < rest:
(maxnum, rest) = (rest, maxnum)
print('max', maxnum, '\nmin', minnum, '\nrest', rest)
elif minnum > rest:
(minnum, rest) = (re... | true |
338d208931900ec5b0d0922ab68d11cec40b841f | Python | vieirinhasantana/boilerplate-aws-sam-python | /{{ cookiecutter.project_name }}/default/app.py | UTF-8 | 3,259 | 2.609375 | 3 | [
"MIT-0",
"MIT"
] | permissive | import json
import boto3
from aws_lambda_powertools import Logger, Metrics, Tracer
# https://awslabs.github.io/aws-lambda-powertools-python/#features
tracer = Tracer()
logger = Logger()
metrics = Metrics()
# Global variables are reused across execution contexts (if available)
session = boto3.Session()
@metrics.log_... | true |
03e2962dfa5cb1dffdb99525719203c790a3c5f0 | Python | Ahmer-444/ZeroMQ_Python | /ZMQ_PUB_SUB_Model/PrintHeader.py | UTF-8 | 970 | 2.71875 | 3 | [] | no_license | __author__ = "Ahmer Malik"
__copyright__ = "Copyright (C) 2016 Linux IoT"
__revision__ = "$Id$"
__version__ = "0.1"
class _header:
def __init__(self,__file__,__author__,__copyright__,__version__):
self._marker = '-------------------------------------------'
self._n = '\n'
... | true |
e3862cd3b4b30bb87788da6eb9f6c29de978e1a6 | Python | zhangct79/py_learn | /01basic/string.py | UTF-8 | 142 | 2.828125 | 3 | [] | no_license | print("hello {0}, 你的成绩提升了{1:.1f}" . format("小明", 17.125))
print("hello %s, 你的成绩提升了%.1f" % ('小明', 17.125)) | true |
f16930fa9cc66bad2f960247a39bb54b1d079905 | Python | rogthedodge/redux | /source/create_DB.py | UTF-8 | 3,151 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import time
import psycopg2
from os.path import dirname
from get_config import config
from import_campaigns import import_campaigns
from import_members import import_members
from import_users import import_users
def create_tables():
""" create tables in the PostgreSQL database"""
commands =... | true |
393e9b2adc645191dad3c90bb741a3442fae5b14 | Python | 19mateusz92/pythonPrograms | /ex.py | UTF-8 | 557 | 3.171875 | 3 | [] | no_license | from datetime import datetime
def getDivSum(num):
sum = 0
for i in range(1,num):
if (num % i == 0):
sum += i
return sum
def isPerf(num):
if (num == getDivSum(num)):
print (num)
start = datetime.now().microsecond
lista = []
lista2 = list(range(1,1001))
for i in range(1,1001):
isPerf(i)
lista.append(getD... | true |
dc47fb7ec8f1a3048cd1eafd834a7754b5021fdf | Python | zerosum99/python_basic | /myPython/time_date/jul_ord_test.py | UTF-8 | 640 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 03 16:59:06 2016
@author: 06411
"""
import datetime
def cal_julian(year,month,day) :
start = datetime.date(year,month,day)
print ' start day : ', start
end = datetime.date.today()
print ' end day : ', end
time_delta = end - start
p... | true |
34c5c05ed6220388b8d9bca8e5666a417384a5b5 | Python | gregorylull/human-sound-classification | /src/utilities/data.py | UTF-8 | 6,353 | 2.53125 | 3 | [] | no_license | import glob
import pandas as pd
import numpy as np
import re
import json
import pickle
from matplotlib import pylab as plt
from sklearn import svm
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.linear_model impo... | true |
109e1ffa0102c45d752a8b50d1313923095d3fc4 | Python | rraj29/ProgramFlow | /contrived.py | UTF-8 | 382 | 3.734375 | 4 | [] | no_license | numbers = [1,45, 32, 12, 60]
#ELSE in a LOOP.
#HERE, the use is different than that in IF statement.
#The ELSE STATEMENT will COME TO WORK ONLY IF THE WHOLE LOOP WORKS FULLY WITHOUT BREAKING ANYWHERE.
for number in numbers:
if number % 8 == 0:
#reject the list
print("The numbers are unacceptable."... | true |
dbe80ee312ef48e90588562a2763cecbecd540af | Python | gffryclrk/ThinkPython2e | /test/test_ch15_9_1_geometry.py | UTF-8 | 3,548 | 3.78125 | 4 | [] | no_license | """Unit tests for shape objects created for Chapter 15 Exercise 1"""
import math
import unittest
import sys
sys.path.append('ch15/')
from ex_15_9_1 import Point, Rectangle, Circle, rect_in_circle, rect_circle_overlap, LineSegment, Line
class TestGeometry(unittest.TestCase):
def setUp(self):
self.rectangle... | true |
f90f235a4ef626b40a9cf040de00523f035752d9 | Python | phoebe4561/week2HW | /hw2.py | UTF-8 | 1,366 | 3.84375 | 4 | [] | no_license | def calculate(min, max):
sum = 0
for x in range(min, max+1):
sum = sum+x
print(sum)
calculate(1, 3)
calculate(4, 8)
def avg(data):
num = data['count']
sal = data['employees']
total = 0
for i in sal:
sal = i['salary']
total += sal
avg = total/... | true |
c509bbfb2ab796ab5d5362b45efc99b268cd606a | Python | LukeTownsendJCU/CP1804-Practicals | /prac_01/sales_bonus.py | UTF-8 | 501 | 4.4375 | 4 | [] | no_license | """
Program to calculate and display a user's bonus based on sales.
If sales are under $1,000, the user gets a 10% bonus.
If sales are $1,000 or over, the bonus is 15%.
"""
def main():
users_sales = float(input("Please enter sales: $"))
while users_sales >= 0:
if users_sales < 1000:
bonus... | true |
71b598b813b9f97d8ba336cdd2def5c1ea6f60be | Python | nacro90/user-activity-generator | /src/data/dataset.py | UTF-8 | 8,330 | 2.703125 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from enum import Enum, auto
from math import sqrt
from pathlib import Path
from typing import Callable, ClassVar, Dict, Optional, Tuple, Type
import pandas
from pandas import DataFrame, Series
from ..util.integrity import recursive_sha256
from .filetype import Csv, FileType
from .r... | true |
9e63f6af003a87bb2e8d118af3864829277eea62 | Python | wpilibsuite/supervisely | /supervisely_lib/collection/str_enum.py | UTF-8 | 116 | 2.53125 | 3 | [] | no_license | # coding: utf-8
from enum import Enum
class StrEnum(Enum):
def __str__(self):
return str(self.value)
| true |
41d36559c0e2240b8eec04ebf4dd9747473c64c7 | Python | InduPriya-pokuri/Python_Advance_Topics | /Python Advanced Workshop/files/multiplication table.py | UTF-8 | 1,080 | 3.28125 | 3 | [] | no_license | ''' n=int(input("Enter a number:"))
for i in range(1,11):
print(n,'*',i,'=',n*i)
n2=int(input("Enter the number:"))
mul=[print(n2,'*',i,'=',n2*i) for i in range(1,11)]
print(mul) '''
dic={'int':123,'float':87.67,'str':'name'}
#print(dic)
dic2={'st':'name',id:238,'cgpa':8.7}
#print(dic2)
'''print(d... | true |
0ed34afd4d6c317f82595655a171a17984efc3ee | Python | howard/serdisp-python | /libdisplay.py | UTF-8 | 7,937 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
from ctypes import *
import characters as chrs
import subprocess
class Display:
def __init__(self, driver, port, options="", lib_path="/usr/local/lib/libserdisp.so.1"):
self.lib = CDLL(lib_path)
self.driver = driver
# The following is ugly and C-ish
self.disp... | true |
9ae3ca509bc4d67f82cfb0ea1ffa1a923bd6bb19 | Python | LauraPeraltaV85/AirBnB_clone_v2 | /web_flask/5-number_template.py | UTF-8 | 1,172 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3
"""Hello Flask"""
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello():
"""prints hello"""
strict_slashes = False
return 'Hello HBNB!'
@app.route('/hbnb')
def _hbnb():
"""prints hbnb"""
strict_slashes = False
return 'HBNB'
@app.route... | true |
666ca10e62d558a22ff106a0473d5b9459c91302 | Python | wheejoo/PythonCodeStudy | /5주차 DP,그래프/백준/최소스패닝트리/김휘주.py | UTF-8 | 1,002 | 3.5 | 4 | [] | no_license | # https://www.acmicpc.net/problem/1197
# 크루스칼 - 가장 적은 비용으로 노드 연결 / 사이클 X
# 이것이 코딩테스트다 책 참고
v,e = map(int,input().split())
n = []
for _ in range(e):
a,b,c = map(int,input().split())
n.append((c,a,b)) #c는 가중치
n.sort() #가중치 순으로 정렬
parent = [0] * (v+1)
result = 0
# 특정 원소 속한 집합 찾기
def find_parent(parent, x):
... | true |
6297f8831ac59953f4a6fd428e79f6c8c9efed04 | Python | ddtkra/atcoder | /aising2019/B/main.py | UTF-8 | 697 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32
def solve(N: int, A: int, B: int, P: "List[int]"):
P.sort()
from bisect import bisect_left, bisect_right
x = bisect_right(P, A)
y = bisect_right(P, B)
print(min(x, y-x, N-y))
return
def main():
def iterate_toke... | true |
425a82f8a1d69b6679369dc3924e14c63139e38a | Python | Abhishek-MR/SAM | /Python/cart.py | UTF-8 | 348 | 3.765625 | 4 | [] | no_license | cart = []
def cartop( str ):
if str.lower() in ['add']:
nxt_item = raw_input("what do you want to add? ")
cart.append(nxt_item)
elif str.lower() in ['show']:
for x in range(len(cart)):
print cart[x]
return
flag=True
while flag:
opt = raw_input("hat do you want to do")
if(opt=="exit"):
flag=False... | true |
0a01c2817249a93a2ed64f7353880bb42532924c | Python | charlesthomas/introspect | /introspect/introspect.py | UTF-8 | 984 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from datetime import datetime
from os import makedirs, path
from time import sleep
from window_title import get_window_title
NOW_TO_THE_HOUR = '%Y-%m-%d-%H'
EPOCH = '%s'
def logger(run_forever=True, stdout=False):
write_path = setup_write_dir()
run = True
while run:
now = da... | true |
eff4f7ce9f276c4dc5aa2c433fefbce5690bdf90 | Python | GuilhermeCaeiro/wisard | /Wisard.py | UTF-8 | 15,918 | 3.1875 | 3 | [] | no_license | """
Module that implements the WiSARD classifier.
"""
import pyximport; pyximport.install()
from Discriminator import Discriminator
from Utils import DataPreprocessor
import random
import math
import copy
import time
import pickle
import multiprocessing
class Wisard:
"""
WiSARD "neural network". A weightless... | true |
8d9e30031470bb98ba8073ef6bf0187fea22fc55 | Python | peteut/ramda.py | /src/ramda/internal/__init__.py | UTF-8 | 23,700 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import collections
import types
import functools
import builtins
import math
import inspect
import fastnumbers
try:
from collections.abc import Callable, Iterable, Mapping, Sequence
except ImportError:
from collections import Callable, Iterable, Mapping, Sequence
class _Placeholder():
pass
__ = _Placeho... | true |
aaeec1d6d647c94088b0199934bf065522efafe3 | Python | abdulkk49/Per-protein-lightning | /prepare_data.py | UTF-8 | 3,228 | 2.515625 | 3 | [] | no_license | import csv
import os
import sys
from itertools import groupby
from Bio import SeqIO
import random
from sklearn import preprocessing
test_loc = []
test_mem = []
test_seq = []
trainval_loc = []
trainval_mem = []
trainval_seq = []
def load_dataset(path_fasta):
"""
Loads dataset into memory from fasta file
"... | true |
fda1c099914d401c38f7f679009276b86dcf8146 | Python | rab170/uhh-ml | /01/src/stochastic_gradient_descent.py | UTF-8 | 536 | 2.90625 | 3 | [] | no_license | import numpy as np
from numpy import pi
def sgd(X, Y, alpha=0.005, epsilon=2, max_iter=10000):
errors = []
theta = np.random.normal(-0.1, 0.1, np.shape(X)[1])
model = lambda x: np.dot(theta, x)
cur_iter = 0
e = np.sum((map(model, X) - Y)**2)
while e > epsilon:
errors.append(e)
f... | true |
7060f0eac99d83d75793de8326f0b17f9d6143c5 | Python | tensorflow/probability | /tensorflow_probability/python/internal/broadcast_util.py | UTF-8 | 3,600 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | true |
5bb35aae758b1dd9692a796177e19d561c2d5687 | Python | rajlath/rkl_codes | /LeetCodeContests/81/81_822.py | UTF-8 | 1,404 | 3.546875 | 4 | [] | no_license | '''
Input: fronts = [1,2,4,4,7], backs = [1,3,4,1,3]
Output: 2
Explanation: If we flip the second card, the fronts are [1,3,4,4,7] and the backs are [1,2,4,1,3].
We choose the second card, which has number 2 on the back, and it isn't on the front of any card, so 2 is good.
'''
class Solution:
def flipgame(self, fro... | true |
951cb161cb78f01775199b196ac7ff8f5d6f33ea | Python | rakshmitha/similar-minds | /csv_reader.py | UTF-8 | 907 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on
Course work:
@author:
Source:
https://stackoverflow.com/questions/2942889/reading-parsing-excel-xls-files-with-python
GSheet:
https://docs.google.com/spreadsheets/d/1YX4vLv3xj6tQC6Ou-Sx8yC1k5jT7VN4ulTWF1BldL9Y/edit#gid=39068816
'''
#import ... | true |
888bf0e70c02a499e123049a8df116fd8e79990d | Python | paulojblack/open-health-inspection-scraper | /scraper/helpers/spare_parts.py | UTF-8 | 693 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | ### Code to parse district page using Item/Field syntax (instead of ItemLoader)
'''
health_district_item = HealthDistrictItem()
health_district_item['district_name'] = district.xpath('a/text()').extract()
health_district_item['district_link'] = district.xpath('a/@href').extract()
health_district_item['district_id'] = ... | true |
d5745b87e07c2b41d630fca3296b1ca2897714a3 | Python | haslem/pytest_web_mobile | /tests/screens/folder_screen.py | UTF-8 | 1,504 | 2.5625 | 3 | [] | no_license |
class FolderScreen(object):
def __init__(self, mobile):
self.mobile = mobile
@property
def get_titles(self):
title_list = []
# for i in range(1,7):
# try:
# elem = self.mobile.find_element_by_xpath(f'/hierarchy/android.widget.FrameLayout/android.widget.... | true |
41f4adc35293bcac1c10fecb5b3feda3f1e311f1 | Python | saintifly/leetcode | /爬楼梯.py | UTF-8 | 370 | 2.953125 | 3 | [] | no_license | class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
if n==1:
return 1
if n==2:
return 2
sum = [0]*(n+1)
sum[0]=0
sum[1]=1
sum[2]=2
for i in range(3,n+1):
sum[i]=... | true |
8e21a52839921c4ec9d0ca1c1f551c7b6b43d14c | Python | brenthompson2/Minterface | /src/services/MintHistoryReader.py | UTF-8 | 2,934 | 2.84375 | 3 | [] | no_license | import errno
import os
import os.path
import pandas as pd
class MintHistoryReader(object):
"""Exposes methods for retrieving the saved Intuit Mint data"""
def __init__(self):
"""
Initializes the object and gets the path to the saved history data
"""
# TODO: Get the history pat... | true |
d77eeaedced15dacc0e1aed4d032fd57c3661b0a | Python | abityab/TBG | /Spot Check.py | UTF-8 | 1,872 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
df = pd.read_excel ('aaaa.xlsx')
df.head()
# In[2]:
df.drop("A", axis=1, inplace=True)
df.drop("B", axis=1, inplace=True)
df.drop("C", axis=1, inplace=True)
df.drop("D", axis=1, inplace=True)
df.head()
# In[3]:
colo = pd.get_dummies(df['COL... | true |
81faf8ff4b18cf54db98a0a995915399e9bca8f0 | Python | NWood-Git/terminal-teller-sql | /tests/app/view.py | UTF-8 | 2,928 | 3.71875 | 4 | [] | no_license |
def print_login_menu():
print("""Welcome to Terminal Teller!:
1) create account
2) log in ... | true |
bd633896bd5346a9b5e60a6e8632a36c135d8246 | Python | cwr1518/origin | /在线二分匹配程序/print_state.py | UTF-8 | 335 | 3.234375 | 3 | [] | no_license |
def print_state(left,right,edge,i):
print("第",i,"轮")
print(("左边"))
for ii in range(len(left)):
print(left[ii][0])
print("右边")
for ii in range(len(right)):
print(right[ii][0])
print("边值")
for ii in range(len(edge)):
print(edge[ii][0]," ",edge[ii][1]," ",edge[ii][2])
| true |
cfaead2d37bf1c3962105b51261f99808a85afd6 | Python | MLsmaller/sfd_hand | /utils/to_json.py | UTF-8 | 1,002 | 2.8125 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import json
import numpy as np
import os
import cv2
#-----save the keypoint of finger to json
def to_json(point_l,point_r,res,path):
num=0
dict={}
dict['filename']=path
dict['keypoint_l']=[]
for point in point_l:
if point is None:
dict['... | true |
cee68f98d32ba811cd9e28ca7968cbf4c097064d | Python | PotentialPie/leetcode-python | /algorithm/leetcode-23.py | UTF-8 | 839 | 3.421875 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
#coding=utf-8
class Solution:
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
## 边界!边界!边界!咋就是不听话呢!!!!打自己记耳光
i... | true |
f096ecbe4a74f3537d927981dfba70ba82358c3a | Python | erishabh/restaurantClosuresCovid19 | /race_cleaning.py | UTF-8 | 1,856 | 3.109375 | 3 | [] | no_license | import pandas as pd
# Importing the original data file
race_orig = pd.read_excel('raw_data/ACS_data/SF_race_ethnicity.xlsx', sheet_name = 1, header = [0, 1], index_col = 0)
# Compressing the heraders
race_orig.columns = [' '.join(col).strip() for col in race_orig.columns.values]
# Dropping MOE columns and the percet... | true |
b00ae33159a9ff9955b1436ba1f12e5969e0fcd0 | Python | peitalin/cryptometrics | /poloniex_api.py | UTF-8 | 1,457 | 2.921875 | 3 | [] | no_license |
import pandas as pd
import seaborn as sb
import requests
from requests import get
from datetime import datetime
import pickle
def get_json_data(json_url, cache_path):
'''Download and cache JSON data, return as a dataframe.'''
try:
f = open(cache_path, 'rb')
df = pickle.load(f)
prin... | true |
51c2f1f1d00c9182f735be2802d066c0f90b1a28 | Python | tok41/opencv_sample | /bin/sample_08_2.py | UTF-8 | 2,571 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import cv2
import cv2.cv as cv
##### 動画から顔を検出してみる
# トラックバーを動かしたときに呼び出されるコールバック関数の定義
def onTrackbarSlide(pos):
updatelock = True
cap.set(cv.CV_CAP_PROP_POS_FRAMES, pos)
updatelock = False
## カスケードファイル
cascade_path = "/usr/local/Cellar/opencv/2.4.11_2/share/OpenCV/haarcascades/haar... | true |
a6b95e5a5a02dab2cf16d6d1222ed23768470298 | Python | lingomaniac88/ktaneKlaxon | /Assets/Models/fix_button.py | UTF-8 | 3,470 | 2.734375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | # A script to fix the normals from the exported button.obj.
# This script mainly exists because I have more experience with Python than I do with Blender. :-p
# Note: the top of the button is in the +Y direction.
import collections
import functools
import math
import pywavefront
Point3 = collections.namedtuple('Poi... | true |
675c0538ad2ef0d7ba280e08afccad0eaaa50506 | Python | linzai1992/myai | /NLP/Old/data_batcher.py | UTF-8 | 3,343 | 2.578125 | 3 | [] | no_license | import json
import random
import numpy as np
class DataBatcher:
def __init__(self, data_path):
self.sos_token = "<S>"
self.eos_token = "<E>"
self.unk_token = "<U>"
self.pad_token = "<P>"
with open(data_path, "r") as json_file:
raw_json = json.load(json_file)
index = 4
key_index = 0
self.word_map... | true |
f619e75a48ebe00d260b97c83ccd7809436d7e3c | Python | 6188506/LearnPythonHardWay | /tower_builder(debug).py | UTF-8 | 316 | 2.890625 | 3 | [] | no_license | def tower_builder(n):
tower = []
for i in range(1, n*2,2):
tower.append(' '*(((n*2-1)-i)/2)+i*'*'+' '*(((n*2-1)-i)/2))
print '['
for i in tower:
print " " + "\'%s\'" %i + ','
print ']'
#=>我觉得对的,系统没过去 ,idle中可以正常输出 | true |
4412a70c0e1b29b0689991b96256b5d675391a86 | Python | PeterZhu514/PythonCrawlerStudy | /Regx_Practice/正则表达式练习.py | UTF-8 | 601 | 3.15625 | 3 | [] | no_license |
#正则表达式
#匹配以".com"和".cn"结尾的域名
import re
pattern ="[a-zA-Z]+://[^\s]*[.com|.cn]"
string="<a href='http://www.baidu.com'>百度首页</a>"
result=re.search(pattern,string)
print(result)
#匹配电话号码
import re
pattern="\d{4}-\d{7}|\d{3}-\d{8}"
string="021-6728263652341"
result=re.search(pattern,string)
print(result)
#匹配电子邮件地址
impo... | true |
fe54ebd30705a07091ecf9b4f511845a735833ff | Python | blueboy1593/algorithm | /SSAFY알고리즘정규시간 Problem Solving/10월 Problem Solving/1015/5248그룹나누기re.py | UTF-8 | 943 | 2.796875 | 3 | [] | no_license | from pprint import pprint
import sys
sys.stdin = open("5248_input.txt", "r")
T = int(input())
for tc in range(1, T + 1):
N, M = map(int, input().split())
wish_list = list(map(int, input().split()))
wish_arr = [ [0] * (N + 1) for _ in range(N + 1) ]
for i in range(len(wish_list)):
if not i % 2:... | true |
d41063ed971abbe71b41283b709e6420ed646fee | Python | joshpaulchan/banksim | /main.py | UTF-8 | 3,577 | 3.40625 | 3 | [] | no_license | #
# main.py
# Bank simulator
#
# Written by Joshua Paul A. Chan
import argparse
import math
from banksim.customer import Customer
from banksim.bank import Bank
# set up argument parsing
parser = argparse.ArgumentParser()
parser.add_argument("c", type=int, help="the number of customers to visit the \
bank")
parser.... | true |
babf47ad0b8d2b6c29dc0314d18f4ee216af8e09 | Python | cunconbkhp/Deep_learning_basic | /SB_PRACTICE/CH7/kNN.py | UTF-8 | 1,144 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 22:58:42 2019
@author: huyquang
"""
from sklearn.neighbors import KNeighborsClassifier
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from simplepreprocessor import ... | true |
edff8949922bf3f162b5344bf39d5c3f392193ca | Python | Parthdoshi04/Python-basics-5 | /code3.py | UTF-8 | 319 | 3.234375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
count=0
url = input("Enter a website to extract the URL's form: ")
r=requests.get("https://"+url)
data=r.text
soup = BeautifulSoup(data,'html.parser')
print(soup)
for link in soup.find_all('a'):
print(link)
count=count+1
print("Total number of anchors:",count) | true |
4ea9fbc636993a226016131d7f9a1f781cb0f0ad | Python | wheeler2000/mpg2kpl-python | /converters.py | UTF-8 | 222 | 3.734375 | 4 | [] | no_license | # do the simplest thing that could possibly work
# ask the user to input an MPG value
mpg = input("What is the MPG? ")
# convert the input into a numeric (float) value
mpg = float(mpg)
print(mpg * 1.609344 * 0.2641720524)
| true |
071b587323f6263c39f6109b66e6c95c4c91f1b5 | Python | Capitains/Flint | /tests/test_ingest.py | UTF-8 | 965 | 2.78125 | 3 | [] | no_license | from unittest import TestCase
from CapitainsFlint.ingest import MyCapytainLocalParser
class TestCapitainParser(TestCase):
def test_passages(self):
""" Test that passage retrieving works well
"""
parsed = MyCapytainLocalParser(
"xml_resources/1294.002.xml",
"urn:cts... | true |
2c3fac9ba0b1175e0401c4df277653a3e8122f4d | Python | ivangar/COMP479 | /invertedIndex.py | UTF-8 | 5,205 | 2.6875 | 3 | [] | no_license | from nltk import word_tokenize
from bs4 import BeautifulSoup
from nltk.corpus import PlaintextCorpusReader
import re
import string
import json
import itertools
def generate_token_list():
# load reuters files with the help of NLTK's PlaintextCorpusReader
sgm_files = PlaintextCorpusReader("reuters", '.*\.sgm')... | true |
58eed63ed352549a8bca231ea4afb9fd3218b884 | Python | lyy-leticia/PythonTest1211 | /PythonProject/PythonTest1211/prac/prac13.py | UTF-8 | 867 | 4.875 | 5 | [] | no_license | # 迭代器
# 迭代是Python最强大的功能之一,是访问集合元素的一种方式。
# 迭代器是一个可以记住遍历的位置的对象。
# 迭代器对象从集合的第一个元素开始访问,直到所有的元素被访问完结束。迭代器只能往前不会后退。
# 迭代器有两个基本的方法:iter() 和 next()。
# 字符串,列表或元组对象都可用于创建迭代器:
# alist=[1,2,3,4,5]
# it=iter(alist)# 创建迭代器对象
# print(next(it))# 输出迭代器的下一个元素
# print(next(it))
# print(next(it))
# list=[1,2,3,4]
# it = iter(list) ... | true |
087d979c1e112727a123c5af1e48da88de04d292 | Python | brookicv/machineLearningSample | /keras/pyimagesearch/nn/conv/lenet.py | UTF-8 | 1,236 | 2.71875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from keras.models import Sequential
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.layers.core import Activation
from keras.layers.core import Flatten
from keras.layers.core import Dense
from keras import backend as K
class LeNet:
... | true |
3c382e181f3d24bdd1ad0754513f6937c57bd35e | Python | NestorMonroy/Courses-coursera | /Django-for-Everybody/src/other/excercies/week5/01.py | UTF-8 | 732 | 3.078125 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('week5.sqlite')
cur = conn.cursor()
cur.execute('DROP TABLE IF EXISTS Ages')
cur.execute('''CREATE TABLE Ages( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE,
name VARCHAR(128),
age INTEGER) ''')
cur.... | true |
cd3be04adeb712ad763dfb2e80dd93d618f901d2 | Python | JannaKim/PS | /etc/14467_소가길을건너간이유1.py | UTF-8 | 411 | 3.203125 | 3 | [] | no_license | cow = []
[cow.append([]) for _ in range(10)]
N = int(input())
for _ in range(N):
a, b = [int(i) for i in input().split()]
cow[a-1].append(str(b))
cnt=0
for cross in cow:
if cross:
now = cross[0]
for road in cross:
if now==road:
pass
else:
... | true |
62a02043a9989c4af99db5e11f6b38171cfc5a69 | Python | seenu-g/Experiments | /py_examples/host_basic_API.py | UTF-8 | 2,497 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
#{"1": "First", "2": "Second", "3": "Third", "4": "Fourth"}
with open("data.json") as data_file:
data = json.load(data_file)
#Defining a HTTP request Handler class
class ServiceHandler(BaseHTTPRequestHandler):
#sets basic ... | true |
fef40f64eda50d4a3eb7191d18e9e891c8a23683 | Python | rebeccabilbro/orlo | /selection/classi.py | UTF-8 | 4,373 | 3.15625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# classi.py
# Title: Apply Classification to UCI Datasets for ROC Curves Tour
# Author: Rebecca Bilbro
# Date: 3/9/16
# Organization: District Data Labs
"""
Apply different classification methods to applicable datasets from UCI.
Use highest-scoring-estimator wins approach.... | true |
d33f75f0aa04690a3192cecca0be97c9f49fc6c3 | Python | dareryl/exploring | /fx.py | UTF-8 | 1,599 | 2.78125 | 3 | [] | no_license | #!/Users/darylchan/opt/anaconda3/bin/python3
import sys
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
import csv
import pandas as pd
import datetime
if len(sys.argv) != 2:
print('Usage: '+sys.argv[0]+' cu... | true |
3b6e73b9b8923f9e0d4883a59d833fe8807207dc | Python | dochead/LeagueTable | /tests/test_matchParser.py | UTF-8 | 1,223 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | import unittest
from leaguetable import match_parser
from leaguetable.league import League
class TestMatchParser(unittest.TestCase):
def test_parse(self):
mp = match_parser.MatchParser()
l = League('Futbolico')
l.add_match(mp.parse(u'Lions 3, Snakes 3'))
l.add_match(mp.parse(u'Ta... | true |
5462c969510762a2a7b8a004809a27abdbe40585 | Python | jaredparmer/ThinkPythonRepo | /time.py | UTF-8 | 764 | 3.765625 | 4 | [] | no_license | import time
# this function returns the time of day in hrs, min, and secs, plus the
# number of days since the epoch
def time_report():
total_secs = int(time.time())
total_mins = total_secs // 60
total_hrs = total_mins // 60
total_days = total_hrs // 24
total_yrs = int(total_days // 365.25)
se... | true |
4e67b6c941b6229cd561bdaa5eaddac1da0590d9 | Python | Maxondria/python-flask-rest-api | /fundamentals/inheritence.py | UTF-8 | 661 | 3.796875 | 4 | [] | no_license | class Student:
def __init__(self, name, school):
self.name = name
self.school = school
self.marks = []
def average(self):
return sum(self.marks) / len(self.marks)
@classmethod
def friend(cls, origin, friend_name, salary):
return cls(friend_name, origin.school, s... | true |
92ca31202382aa297986137e7e2e47a5fc19e1c9 | Python | trietptm/loadbalancer-finder | /loadbalancer-finder/src/updater.py | UTF-8 | 2,590 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
'''
This code is taken from GoLISMERO - Simple web mapper. Copyright (C) 2011
Original idea: Daniel Garcia aka cr0hn - dani@iniqua.com
Author and code writer: Henri Halo - henri@nerv.fi
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Pu... | true |
d145727b3fedf2f7669ac60a500fabc1ed8e1d9c | Python | DiegoCacau/infinitygames | /running.py | UTF-8 | 3,564 | 2.765625 | 3 | [] | no_license | from PPlay.sprite import *
from PPlay.sound import *
import random
import time
class running():
def __init__(self, window):
a = open("Running/running.txt", "r")
self.matrizMundo = []
for i in a:
linha = []
for j in i.split():
linha.append(int(j))
self.matrizMundo.append(linha)
a.close()
... | true |
f83d54af30e4d04dd0f97bc7daf7404e35de2853 | Python | latchdevel/latch-moneybox | /MoneyBoxPython/mb_unpair.py | UTF-8 | 804 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) ElevenPaths 2016
import latch
'''
Python Script to unpair your latch account, The latch appId and secret ID are necessary
'''
## Set the needed params
APP_ID = "******vajh3********"
SECRET_KEY = "****************UEesj********************"
accountid = "*******... | true |
6ae27b4361889790638465f7bc0d1e8738765ae9 | Python | keepnad/py_radio | /py_radio.py | UTF-8 | 6,677 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
import requests
import vlc
import time
import signal
import sys
# Run a listener to exit nicely on ctrl+c
def exit_handler(signal, frame):
print(' SIGINT caught -- Exiting...')
sys.exit(0)
# return a track name given track id
def name_from_id(track_id):
url='http://us-qa.api.iheart.... | true |
7a39c3481ff8050a905479b262fdc3715cdbf8b9 | Python | GustavSB/pepper-code | /mgribb3n-pepper-5bababb73a86/Weather/WeatherAnswers.py | UTF-8 | 3,152 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from time_utilities import *
from weather import WeatherService, OpenWeatherMap
class WeatherAnswers(object):
def __init__(self, language):
self.default_language = language
self.weather = OpenWeatherMap()
self.time_util = TimeUtilities()
self.words = {"thu... | true |
bb4b369d4a7e8fde12b97bcf9ae89d8972f1bbb8 | Python | Le0nerdo/ot-harjoitustyo-1 | /projekti/src/event_queue.py | UTF-8 | 1,065 | 3.265625 | 3 | [] | no_license | import pygame
from collections import deque
class Eventqueue():
def __init__(self):
self.events = deque()
def get_event(self):
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
self.events.append("L")... | true |
f61a376945f6380f37e878530d051e1903a1a930 | Python | algemi/guess-number | /guess-number.py | UTF-8 | 928 | 4.125 | 4 | [] | no_license | import random
chances = 0
print('Welcome to the game "Guess a number"')
number = random.randint(1,100)
while chances < 7:
user_guess = int(input('Guess a number between 1 and 100: '))
#while True:
#user_guess = User_Guess()
#comp_gen = Computer_Generator()
if user_guess == number:
print('... | true |
5db0ee64e633155f29183661d6bc1c969f36eb55 | Python | hyliush/ccks-2021-task3-baseline | /dataset.py | UTF-8 | 8,533 | 2.734375 | 3 | [] | no_license | import pandas as pd
import torch
from torch.utils.data import (DataLoader,TensorDataset)
import logging
from tqdm import tqdm
import os
from config import Config
from fastNLP import cache_results
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%... | true |
a1deea796e166cd6fbd74298c32c10b70ef7aeb4 | Python | SimOgaard/YoloDatasetCreator | /YoloDataset/lego-gubbar-detection/TestingFiles/ManualReview.py | UTF-8 | 458 | 2.609375 | 3 | [] | no_license | import cv2
import glob
import os
for image in glob.glob("Edit Characters/ImagesNoBackground/*.png"):
img = cv2.imread(image)
while(1):
cv2.imshow('img',img)
k = cv2.waitKey(33)
if k==27:
break
elif k==0:
print("[INFO] deleting {}".format(image))
... | true |
413d3944995540305aa3f6a97011855eef703e76 | Python | Li-Evelyn/vanilla-cake-bot | /Files/gaming.py | UTF-8 | 683 | 3.421875 | 3 | [
"MIT"
] | permissive | import random
rps_choices = ["rock", "paper", "scissors"]
rps_process = {"rock": "scissors", "paper": "rock", "scissors": "paper"}
def rps_classic(choice):
computer_choice = rps_choices[random.randint(0, 2)]
victory = f"I picked {computer_choice}.\nLooks like "
if choice.lower() == computer_choice:
... | true |
4d41388de02d57c16385472a8a46da0cc29a9a7c | Python | LMJW/DSA_UCSD | /Algorithm_tool_box/week3/assignment/task1/task1.py | UTF-8 | 223 | 3.546875 | 4 | [] | no_license | # Uses python3
def michange(x):
d = [10,5,1]
i = 0
count = 0
while x != 0:
while x>= d[i]:
x-=d[i]
count+=1
i+=1
return count
n = int(input())
print(michange(n)) | true |
c9a102280cc91a7abeb6e123c65727e7841698aa | Python | mit-plv/riscv-coq | /export/py/ZBitOps.py | UTF-8 | 204 | 3.171875 | 3 | [] | permissive | def bitSlice(w, start, stop):
mask = (1 << (stop - start)) - 1
return (w >> start) & mask
def signExtend(l,n):
if (n >> (l - 1)) & 1:
return n - (1 << l)
else:
return n
| true |
3e1efa9e4d72ad0da01b8d9e4d340261ea586904 | Python | Environmental-Informatics/03-working-with-files-in-python-warre112 | /warre_evaluate_raccoon_lifes.py | UTF-8 | 3,477 | 4.3125 | 4 | [] | no_license |
"""
Created on Fri Jan 31 14:05:46 2020
@author: warre112
"""
"""
Assignment 04- Raccoon Life
Les Warren
Created Friday, January 31, 2020
This program is designed to assess the life of George, the raccoon. Functions
included: creating lists, using a dictionary, summary statistics, and
saving to .txt file
"""
"""In... | true |
62f9b9a110b7f5121c5faba2f948cf354b27b385 | Python | reesporte/art | /art.py | UTF-8 | 2,620 | 3.125 | 3 | [] | no_license | import random, os, sys
def get_rgb():
"""
makes a semi-random rgb
"""
colors = [0, 0, 0]
colors[0] = random.randint(1, 255)
if colors[0] == 255:
colors[1] = random.randint(0, 100)
else:
colors[1] = random.randint(0, 255)
if colors[1] == 255 or colors[0] == 255:
c... | true |
69aabcca644c60fef9c53a316b3046966629430e | Python | legorobo/drive | /Drive.py | UTF-8 | 3,818 | 3.390625 | 3 | [] | no_license | # ------------------------------------------------------------------------
# Drive.py
# ------------------------------------------------------------------------
#
# Alan Li written on March 17, 2015
#
# Waffle Revengeance
#
# ------------------------------------------------------------------------
from .ev3dev imp... | true |
4c73e5c4c2dbfb767fe4b89b2980639da6477536 | Python | csc202summer19/lectures | /05_stacks/array_stack.py | UTF-8 | 789 | 4.125 | 4 | [] | no_license | class Stack:
""" A last-in, first-out collection of elements """
def __init__(self):
# The backing array:
self.array = [None] * 4
# The length of the backing array:
self.capacity = 4
# The number of elements in the stack:
# NOTE: The top-of-stack is always "size ... | true |
58c1108ebe0c76780b058d653129de0e27ccc114 | Python | cliffeby/Duckpin2 | /blobtestv2.py | UTF-8 | 2,624 | 2.796875 | 3 | [
"MIT"
] | permissive | import os
import credentials
from azure.iot.device import IoTHubDeviceClient
from azure.core.exceptions import AzureError
from azure.storage.blob import BlobClient
CONNECTION_STRING = credentials.loginFree["ConnectionString"]
PATH_TO_FILE = r"/home/cliffeby/Pictures/videoCCEFrame30.jpg"
def store_blob(blob_info, ... | true |
f2fb1bbb9676bf3e749276216e3cf487e326848d | Python | sirBarbouchi/aircrafts | /aircrafts/spiders/spiderUrl10.py | UTF-8 | 1,667 | 2.703125 | 3 | [] | no_license | import scrapy
from scrapy_splash import SplashRequest
from ..items import AircraftsItem
def listToString(l):
s = ''
for e in l:
s += e
return s.replace('Upgraded', '')
class TxtavSpider(scrapy.Spider):
name = 'txtav'
def start_requests(self):
url = "https://txtav.com/en/pr... | true |
c458f7b652ccd54c80c425de34d2a56762d50aab | Python | andrevo/covid19-ntnu | /Network models/helge master/network.py | UTF-8 | 904 | 2.828125 | 3 | [] | no_license | import networkx as nx
import numpy as np
import pandas as pd
from classes import *
from utilities import *
from parameters import *
from model import *
def loadNetwork(filename):
nodes = pickle
try:
nodes = pickle.load( open('data/{}.pkl'.format(filename), 'rb'))
print('Loaded nodes from pickle... | true |
a1ee336110450a8368ef09559949f5ca9b0da9b4 | Python | sarahclarke-skc/week_03_homework_music_library | /console.py | UTF-8 | 677 | 2.625 | 3 | [] | no_license | import pdb
from models.artist import Artist
from models.album import Album
import repositories.artist_repository as artist_repository
import repositories.album_repository as album_repository
album_repository.delete_all()
artist_repository.delete_all()
artist = Artist("Michael Jackson")
artist_repository.save(artist)... | true |
ad2bf04da0b4763d52aad94ebef0bf43c7b45588 | Python | tommyanthony/textme | /send_sms.py | UTF-8 | 588 | 2.78125 | 3 | [] | no_license | # Download the twilio-python library from http://twilio.com/docs/libraries
from twilio.rest import TwilioRestClient
# Find these values at https://twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXX"
auth_token = "YYYYYYYYYYYYYYYYYY"
FROM_NUMBER = "+15555555555"
client = TwilioRestClient(account_sid, auth_toke... | true |
f1f0aa0f3588530b8048adebed12757ba2d18456 | Python | kevinhuang06/BussinessCardDetection | /util.py | UTF-8 | 2,418 | 2.875 | 3 | [] | no_license | # coding=utf-8
import cv2
import numpy as np
def find_top_k_contours(edges, k):
contours, hierarchy = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
contours_with_len = []
for con in contours:
contours_with_len.append([con, len(con)])
sorted_contours = sorted(contours_with_len,... | true |
25686dfb7b60420c312d79f2cc89d1d720d85a95 | Python | undead404/russianroulette | /get_reaches.py | UTF-8 | 1,035 | 2.578125 | 3 | [] | no_license | import json
import requests
from roulettewheel import RouletteWheel
LASTFM_API_KEY = '053c2f4d20bda39f8e353be6e277d6d0'
LASTFM_SHARED_SECRET = '573e5a2995048342d40070134835c0e1'
TAG_GETINFO_URL = 'http://ws.audioscrobbler.com/2.0/?method=tag.getinfo&tag={tag}&api_key={api_key}&format=json'
def get_tag_reach(tag):
... | true |
b2680be43df2ca8b6fb17b6f2590e41b892d55b5 | Python | Taoge123/OptimizedLeetcode | /LeetcodeNew/DFS/LC_721_Accounts_Merge.py | UTF-8 | 9,435 | 3.59375 | 4 | [] | no_license |
"""
Given a list accounts, each element accounts[i] is a list of strings,
where the first element accounts[i][0] is a name,
and the rest of the elements are emails representing emails of the account.
Now, we would like to merge these accounts.
Two accounts definitely belong to the same person if there is some email ... | true |
57de5e1b3a98e118cb6eb2e25fdb2a2b78dd74d2 | Python | syo16/python_doc_practice | /functools/singledispatch-sample.py | UTF-8 | 480 | 3.46875 | 3 | [] | no_license | from functools import singledispatch
@singledispatch
def func(arg, verbose=False):
if verbose:
print('Let me just say', end='')
print(arg)
@func.register
def _(arg:int, verbose=False):
if verbose:
print('Value---->', end='')
print(arg)
@func.register
def _(arg:list, verbose=False):
... | true |
0ef2a3bdb811bed369097eddbb1d48bdd16e8762 | Python | luyuan2002/PythonLearn | /100/4构造程序逻辑.py | UTF-8 | 2,082 | 4.4375 | 4 | [] | no_license | """
目前学习的内容只是Python的冰山一角,但是这些内容以及该足够我们来构建程序中的逻辑,
现在必须要做的一件事情就是尝试用所学的只是取解决现实中的问题,换句话说就是锻炼自己把用人类自然 语言描述的算法(解决问题的方法和步骤)编译成Python代码的能力
而这件事必须通过大量的联系才能达成
"""
"""
寻找水仙花数
说明:水仙花数也被称为超完全数字不变数、自恋数、自幂数、阿姆斯特朗数
它是一个3位数,该数字每个位上数字的立方之和正好等于它本身,例如:$1^3 + 5^3+ 3^3=153$。
"""
for num in range(100, 1000):
low = num % 10
mid = nu... | true |
0c77f688163199691f5f6f928155963efae4407d | Python | omarala/tp_prog_cpp | /Tp3_omar_alex/draw.py | UTF-8 | 1,174 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python3
# # import numpy as np su
import matplotlib.pyplot as plt
import sys
#crée un itérateur de point
def iterator_point(fichier):
for line in fichier:
line = line.strip()
# res = line.split(",")
res = float(line)
yield res
def create_plot():
#on ouvre un fichier... | true |
899b6c7b64a0c4748e1efeaab5ec06e78ea059ff | Python | Sanved07/Python-Projects | /Reverse No.py | UTF-8 | 492 | 4 | 4 | [] | no_license | def makepalindrome(pali):
if pali<10:
print(f"the number is itself palindrome i.e. {pali}")
elif str(pali)==str(pali)[::-1]:
print(f"the next palindrome is {pali}")
else:
pali2=pali+1
makepalindrome(pali2)
if __name__ == "__main__":
no_ip=int(input("enter the n... | true |
93b2bba8a8979092a56f904752a3c3d5801f9b52 | Python | CS4311-spring-2020/pick-tool-team03-we-showed-up | /src/Connections/Network.py | UTF-8 | 2,117 | 3.296875 | 3 | [] | no_license | # This Python file uses the following encoding: utf-8
import threading
import socket
class Network:
"""This class will serve to bind the analyst to the lead in order to share a session."""
def __init__(self):
# Ask clients what port they would like to connect through
self.port = 8091
#... | true |
63568284de333af0a74a47c894f3039a8fea8521 | Python | Jiangshan00001/pygerber | /src/pygerber/parser/pillow/apertures/circle.py | UTF-8 | 2,363 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import annotations
from functools import cached_property
from typing import Tuple
from PIL import Image, ImageDraw
from pygerber.mathclasses import Vector2D
from pygerber.parser.pillow.apertures.arc_mixin import ArcUtilMixinPillow
from pygerber.parser.pillow.apertures.flash_mi... | true |
74189faee9fc1ec850abb5c89022b2ee558483cd | Python | svenzin/ym2149f_player | /convert_ym/ympeek.py | UTF-8 | 3,589 | 2.671875 | 3 | [
"MIT"
] | permissive | import sys
from lhafile import LhaFile
import struct
import os
def to_string(ymdata):
return ymdata.decode('cp1252')
def to_byte(ymdata):
assert(isinstance(ymdata, int))
return ymdata
def to_word(ymdata):
assert(len(ymdata) == 2)
return struct.unpack('>H', ymdata)[0]
def to_dword(ymdata):
as... | true |
b37a16839eb7054056e6a5a91dca51e5c6324f66 | Python | codeplaysoftware/py_gen | /internal/funcs.py | UTF-8 | 2,806 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (C) Codeplay Software Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use these files except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# For your convenience, a copy of... | true |
15904106131eec9d1f7485bf7a0ff5cabcafc708 | Python | Parthi10/hackerrank | /hackerrank_contests/week_of_code_27/hackonacci-matrix-rotations3.PY | UTF-8 | 1,224 | 3.40625 | 3 | [
"MIT"
] | permissive | #!/bin/python3
import sys
from collections import defaultdict
n,q = input().strip().split(' ')
n,q = [int(n),int(q)]
hackonacciDictionary = defaultdict(int)
hackonacciDictionary = {0:0,1:1,2:2,3:3}
def hackonacci(i):
if i in hackonacciDictionary.keys():
return hackonacciDictionary[i]
else:... | true |
08a3aef190322a14bb838643da6cc84068aaadcb | Python | 6un9-h0-Dan/GeoInt-Localisator | /web.py | UTF-8 | 3,054 | 2.515625 | 3 | [] | no_license | import bs4
from bs4 import BeautifulSoup
import webbrowser
from sys import stdout
import requests
import sys
import time
from const import *
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import ... | true |
dd40c8d143b0aa574cde92b7317ada3edc67e778 | Python | david30907d/iscom_crawler | /iscom.py | UTF-8 | 3,189 | 2.546875 | 3 | [] | no_license | from KCM.__main__ import KCM
import json, sys, requests, os, pyprind
def hybrid(ratioX, ratioY):
hybridResult = {}
for index, (i, j) in enumerate(zip(tmp, distance)):
if i[0] == j[0]:
hybridResult[i[0]] = hybridResult.setdefault(i[0], 0) + index
else:
hybridResult[i[0]] =... | true |
7f8d1a3e44ec7bd46987ef7ce4a6f130577fa530 | Python | ZehaoDong32/Hierarchical-Risk-Parity-Approach | /Code/Portfolio_Models.py | UTF-8 | 8,430 | 2.671875 | 3 | [] | no_license | from HRP import *
from MVP import *
import matplotlib.pyplot as plt
import seaborn as sns
import pyfolio as pf
import matplotlib
sns.set_context("talk")
sns.set_style("darkgrid")
sns.set_palette(sns.color_palette(palette='Set2'))
matplotlib.rcParams.update({'font.family': 'Arial',
... | true |