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 |
|---|---|---|---|---|---|---|---|---|---|---|
0928ab866d388b9eb3615284aa243af51314129f | oeg-upm/bimerr-epw | /Code/Functions2MakeJson/OneBuilding/zipScraperFunctions.py | UTF-8 | 1,105 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | import zipfile, urllib, os
from urllib.request import Request,urlopen, urlretrieve
from io import BytesIO
from bs4 import BeautifulSoup
import requests
import urllib.request
import time
def scraperZip(url, searchData):
resultList = [] # Lista donde se va a almacenar los resultados
response = requests.get(url... | true |
be32e53b869f5ec7b583dc8daf66b2598b1107ec | yprodev/python_ads | /recursion/sll_traverse_stack.py | UTF-8 | 489 | 4.53125 | 5 | [] | no_license | # Print the contents of a linked list in reverse order using a stack
from '../stack_linked_list' import Stack
def printListStack(head):
# Create a stack to store the items
s = Stack()
# Iterate through the list and push each item onto the stack
curNode = head
while curNode is not None:
s.push(curNode.data)
... | true |
3bb54678b402bee9147d2d91d7367039be69f0f4 | qianteng/JQXXXX | /kaggle/modelers/eg/walmart/walmart.py | UTF-8 | 2,474 | 2.625 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
import calendar
import numpy as np
import pandas as pd
import xgboost as xgb
# In[ ]:
train = pd.read_csv('~/Kaggle/walmart/train.csv', dtype={'Upc': str, 'FinelineNumber': str})
# In[ ]:
test = pd.read_csv('~/Kaggle/walmar... | true |
a3966c7075168f0e8b441ae6ca0970e2399a0858 | nishaoshan/OnlineDict_project | /dict_client.py | UTF-8 | 4,679 | 3.1875 | 3 | [] | no_license | """
author: Nishaoshan
email:790016602@qq.com
time:2020-6-22
env:python3.6
socket,V负责界面显示
"""
from socket import *
class Client:
def __init__(self, host="127.0.0.1", port=9999):
self.host = host
self.port = port
self.sock = socket()
self.name = ""
def r(self):
while Tru... | true |
e6809eaa1e71f8b10b2b1cd8333db303a511e425 | kradalby/dotfiles | /bin/kontoret | UTF-8 | 969 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from datetime import datetime
from datetime import timedelta
import requests
def parse_date(timestamp):
if not timestamp:
return "Ingen"
return datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ") + timedelta(hours=2)
r = requests.get("https://passoa.online.ntnu.n... | true |
0430dbff21fc1402888655f9c3e83459c794eeae | khsfashi/2018180002-2DGP-PROJECT | /Code/object.py | UTF-8 | 2,581 | 2.734375 | 3 | [] | no_license | from pico2d import *
import tile
# 1 == Red, 2 == Green, 3 == Blue, 5 == Red + Green, 6 == Red + Blue, 7 == Green + Blue
# 2 == gate, 1 == jump, 0 == turret
class Object:
GATE_WIDTH = 32
GATE_HEIGHT = 32
image = None
def __init__(self):
self.x = 0
self.y = 0
self.isDraw = Fals... | true |
74066ab19294722c8f1dd83c7ee501c465877a38 | GabrielaGalvis/Lab_Com_2 | /ejemplo_1/epy_block_0.py | UTF-8 | 605 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from gnuradio import gr
class blk(gr.sync_block):
def __init__(self,):
"""Bloque acumulador simplemente toma la senal entrante y entrega una senal acumulada"""
gr.sync_block.__init__(
self,
name='Acumulador',
in_sig=[np.float32],
out_sig=[np.float32]
)
self.acum_anterior=0
... | true |
192ee6a85cbe56073dcbe40b52d78798b4bdde85 | estar21/lscrub | /Proper/scrubbers/common/helpers.py | UTF-8 | 2,868 | 3.28125 | 3 | [] | no_license | """Helper methods for datafusion ingest."""
# For printing current date and time
import datetime
# For checksum generation and validation
import hashlib
# For output of valid data in original folder structure
import os
if __name__ == "__main__":
print "This module cannot be run as a script."
print "Import thi... | true |
06d50a8a133e673e279a93dc55c380c8859f9490 | dysbulic/tip | /bin/full_octahedral_group.py | UTF-8 | 8,557 | 2.53125 | 3 | [] | no_license | import numpy as np
from math import log, ceil
from misc.bin2svg import bin2svg # https://pastebin.com/y8rY5Vj4
from octahedral_permutations import * # https://pastebin.com/JBx0TSsC
from store_svg import * # https://pastebin.com/FaBF6k7E
def number_to_reverse_binary_list(n, length):
bin... | true |
319aed1e24176401aaf550801dad0b458998b4c0 | victorblaga/leetcode | /001_two_sum.py | UTF-8 | 381 | 2.984375 | 3 | [] | no_license | from typing import List
class Solution(object):
def twoSum(self, nums: List[int], target: int) -> List[int]:
complements = {}
for i in range(len(nums)):
complement = target - nums[i]
if complement in complements:
return list(sorted([i, complements[complement... | true |
ffcfd3a1fb83da4790d30e8e27ea646461e255d8 | buraktekin/ManhattanDistance | /manhattan-distance.py | UTF-8 | 2,374 | 3.75 | 4 | [] | no_license | __author__ = 'Burak Tekin'
__date__ = '05/12/2013'
__contact_ = 'iletisim@buraktekin.net / tknbrk@gmail.com'
import math
#********************************#
# +---+---+---+ #
# | 1 | 2 | 3 | #
# +---+---+---+ #
# GOAL STATE: | 4 | 5 | 6 | #
# +---+-... | true |
c8b0b77bf5e2381404256f017b94aa1d91aff5b0 | XTRunner/KDRQ_2019 | /index.py | UTF-8 | 7,145 | 2.65625 | 3 | [] | no_license | #import osmnx as ox
#import pandas as pd
#import geopandas as gpd
import csv
import os
import random
import sys
import timeit
#from descartes import PolygonPatch
#from shapely.geometry import Point, c, MultiPolygon
# sptSet: shortest path tree
# dist: distance list
class Graph():
# Graph as two-dimension list
def... | true |
720b69ded57076e35b48548524e0e1a787ab1859 | Arjun-Arora/pbrt-v3 | /scripts/benchmarks/detail-graphs.py | UTF-8 | 2,847 | 2.640625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python3
import pandas as pd
import numpy as np
import argparse
import os
import matplotlib
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', required=True)
parser.add_argument('-t', '--title', required=True)
parser.add_argument('-o', '--out', requir... | true |
1846ff7b2351faf5a856b1597250711d78958d92 | markpackham/PythonRevise | /PythonStatistics/PythonStatNotes.py | UTF-8 | 4,379 | 3.921875 | 4 | [] | no_license | # Mean/Average
#np.average()
# Import packages
import numpy as np
import pandas as pd
# Read author data
greatest_books = pd.read_csv("top-hundred-books.csv")
# Set author ages to a NumPy array
author_ages = greatest_books['Ages']
# Use numpy to calculate the average age of the top 100 authors
average_age = np.average(... | true |
0ecf91a107a9f14ac18bb09121afed06ea39021e | rdashr/jhu-bfx | /605.620_bfx algo/project 3/displayLCS.py | UTF-8 | 1,598 | 3.921875 | 4 | [] | no_license | #!/usr/bin/env python3
# Programming Assignment 3: Longest Common Subsequence
# Richard Ren - December 8, 2020
'''
This module handles outputing LCS computation results to the external user.
The output is separated into 2 sections (by dash delimiter): input echoing,
and result with statistics.
'''
from textwrap i... | true |
cdb6162a797a23e9ca616361e1b48a82ce337f2c | amitibo/EyeTab | /EyeTab_Python/ransac_ellipse.py | UTF-8 | 7,611 | 2.609375 | 3 | [
"MIT"
] | permissive | import cv2, numpy as np, random
from math import sin, cos, atan2, radians, degrees
from conic_section import Ellipse, BadEllipseShape
from gaze_geometry import get_gaze_point_px
from draw_utils import draw_cross, draw_points, draw_normal, draw_gaze
write_text = lambda x, y : cv2.putText(x, y, (10, 20), cv2.FONT_HERSH... | true |
7e4f175cd4ef2552174cdecf88fa7bfde0756476 | girinssh/CDIC2021_LiDAR | /pi/lidarManager.py | UTF-8 | 2,410 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 23 16:05:30 2021
@author: tngus
"""
import time
import numpy as np
class LiDARManager:
POS_LEFT = 0
POS_RIGHT = 1
POS_BACK = 2
DIR_LEFT2RIGHT = 1
DIR_RIGHT2LEFT = -1
def __init__(self, rpm:int, samp_rate:int, minAngle, maxAngle, isLiDA... | true |
243f292c9609b0bbd50ebaf695c56497b50b4fb7 | bm5w/sea-f2-python-sept14 | /Students/CaseyMacPhee/session02/test_fibonacci.py | UTF-8 | 137 | 2.578125 | 3 | [] | no_license | import pytest
from series import fibonacci
def test_fib():
assert fibonacci(3) == 2
assert fibonacci(4) == 3
assert fibonacci(5) == 5
| true |
356c93a8c135966eed159e44dc53bb2d04def1bd | ayemnadia/corpusProject | /WebCorpora/storing.py | UTF-8 | 395 | 2.9375 | 3 | [] | no_license | # converting the json/dict file to csv
import pandas as pd
import json
import csv
json_file = open('/repository/corpus.json', 'r')
dict = json.load(json_file)
json_file.close()
df = pd.DataFrame.from_dict(dict, orient='index')
df.rename_axis('Word').reset_index().assign(length = df.index.str.len())\... | true |
b9f64fd7bd876448db201ee0eb77f623e14388dd | flying1223/old_boy_git | /old boy/day5/模块/shutil_test.py | UTF-8 | 365 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-07-30 20:23:16
# @Author : flying
import shutil
#高级的文件、文件夹、压缩包处理模块
'''
#copy 文件
f1 = open('笔记',encoding = 'utf-8')
f2 = open('笔记2','w',encoding='utf-8')
shutil.copyfileobj(f1,f2)
'''
'''
#copy 文件
shutil.copyfile('笔记2','笔记3')
'''
| true |
18a29315c038b0d4b3f44d07db2733aa24eebc87 | DogRuz/test_task_neokord | /task/utils.py | UTF-8 | 597 | 3.15625 | 3 | [] | no_license | from math import *
def get_the_number(number):
if sqrt(5 * number ** 2 + 4) % 1 == 0 or sqrt(5 * number ** 2 - 4) % 1 == 0:
fibonancci_number = number
else:
c = 0
while True:
c += 1
if sqrt(5 * (number + c) ** 2 + 4) % 1 == 0 or sqrt(5 * (number + c) ** 2 - 4) %... | true |
635030b34ef58cc20e48861cf40e58da5e2108a1 | pascal22p/advent2020 | /day3.py | UTF-8 | 517 | 3.15625 | 3 | [
"Unlicense"
] | permissive | import numpy
import math
tree = '#'
moves = [[1,1],[3,1],[5,1],[7,1],[1,2]]
data = []
with open('day3input') as input:
for line in input:
data.append(line.strip())
xRepeat = len(data[0])
product = 1
for move in moves:
treeCount = 0
for y in range(0, math.ceil(len(data)/move[1])):
x = (y ... | true |
675ec4f2c1b543b8177ac9e19793db66c133e79d | jpinsonault/clausewitz_parser | /tests.py | UTF-8 | 5,652 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# from __future__ import unicode_literals
import unittest
from save_file_syntax import Dictionary
from save_file_syntax import List
from save_file_syntax import Date
from save_file_syntax import SaveFile
from save_file_syntax import Identifier
from save_file_syntax import C... | true |
b14898488552d46e03c86d772d22d7c23f95aa89 | jiayu520/xiaojiayu | /proxy_eg.py | UTF-8 | 555 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import urllib.request
import random
iplist =['192.168.0.3:80','45.56.97.56:99']
url = 'http://www.whatismyip.com.tw'
proxy_support = urllib.request.ProxyHandler({'http': random.choice(iplist)})
opener = urllib.request.build_opener(proxy_support)
opener.addheaders = [('User-Agent','Mozilla/5.0 (W... | true |
5968128179d5f10657ce649b21dc96723d25785c | alfredo-svh/wallbreakers | /week2/wordSearchII.py | UTF-8 | 1,653 | 3.703125 | 4 | [] | no_license | class Node:
def __init__(self):
self.word = ""
self.children = {}
class Trie:
def __init__(self):
"""
Initialize your data structure here.
"""
self.root = Node()
def insert(self, word: str) -> None:
"""
Inserts a word into the trie.
... | true |
c512b0bc70ca0ac8a98b44ae6c00fba7155d6a69 | shuvo14051/python-data-algo | /Problem-solving/HackerRank/HackFest 2020 - Game of Maximization.py | UTF-8 | 444 | 3.28125 | 3 | [] | no_license | n = int(input())
li = list(map(int, input().split()))[:n]
odd = []
even = []
sum1 = 0
sum2 = 0
result = 0
for i in range(0, len(li)):
if i % 2:
even.append(li[i])
else:
odd.append(li[i])
for i in even:
sum1 = sum1 + i
for i in odd:
sum2 = sum2 + i
while True:
if sum1 == sum2:
... | true |
12b58d44a1e2d469e1982b8c90f9120e3941b153 | kireevys/operation_and_article | /app/models/orm.py | UTF-8 | 6,830 | 3.09375 | 3 | [] | no_license | import re
import os
from sqlite3 import connect, IntegrityError, Row
from jinja2 import Template
from config import db_path as config_path_db
from logs import db_logger, debug_logger
class Column(object):
"""
Класс столбца таблицы
"""
def __init__(self, name, value=None, primary=False):
self... | true |
dd77da2aa7db718666c68a659646830aa5751fb5 | daniel-reich/ubiquitous-fiesta | /X5dZShpH7hfoRn7bJ_3.py | UTF-8 | 508 | 3.15625 | 3 | [] | no_license |
import itertools
def c_fuge(n, k):
if n <= 1 or k <= 1 or k > n:
return False
elif n == k:
return True
else:
factors = get_prime_factors(n)
possible_sums = set(sum(k) for i in range(1,len(factors)+1) for k in itertools.permutations(factors,i))
if k in factors or n-k in factors or k in po... | true |
73f9c9f00c551c1721d4ca80661d4a4cfdf4a018 | cmccahil/Classwork | /cs150/lab10/mouse.py | UTF-8 | 513 | 3.171875 | 3 | [] | no_license | #mouse.py
#gives the mouse critter class
#
#Colin McCahill
#11/18/15
import critter
import color
class Mouse(critter.Critter):
def __init__(self,x,y,color):
self.counter=0
pass
def getStats(self):
return (60,40)
def getChar(self):
return "M"
def getColor(self):
... | true |
b93af6895585893af379397eda17c9dcd3b52e76 | kumanmontt/python- | /进程与线程.py | UTF-8 | 5,295 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 9 15:07:42 2018
@author: DELL
"""
'''
#不使用多进程
from random import randint
from time import time, sleep
def download_task(filename):
print('开始下载%s...' % filename)
time_to_download = randint(5, 10)
sleep(time_to_download)
print('%s下载完成!... | true |
08eaad955289dbd16c15046fa4364c548326490a | philbucher/Kratos | /applications/RomApplication/python_scripts/element_selection_strategy.py | UTF-8 | 854 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive |
class ElementSelectionStrategy():
def __init__(self):
""" The required tolerances are entered here. Default values to be provided
"""
def SetUp(self):
""" This method treats the data passed to the object, in order to obtain a suitable format
"""
def Initialize(self):
... | true |
35cd99a923ae388dfe9f9a46245e64f23721d172 | yhyoscar/codingpractice | /python/cci_9.0_sorting.py | UTF-8 | 2,343 | 4.03125 | 4 | [] | no_license | # implement of bubble sort, selection sort, merge sort, quick sort, heap sort, and bucket sort
def bubblesort(array):
n = len(array)
flag = True
while flag:
flag = False
for i in range(n-1):
if array[i] > array[i+1]:
tmp = array[i]
array[i] = arra... | true |
54b7c036f013a5d3c873017d6bf30fc94d3952fe | green-fox-academy/nandormatyas | /week-05/characters.py | UTF-8 | 1,493 | 3.40625 | 3 | [] | no_license | from tkinter import *
root = Tk()
canvas = Canvas(root, width="720", height="792")
canvas.pack()
class Character():
def __init__(self, x, y, status, image, canvas):
self.x = x
self.y = y
self.image = image
self.status = status
self.canvas = canvas
def draw_character(s... | true |
fd33c21237c34049c0ca7795121d553f21c6b533 | k018c1052/kadai | /Challenge02/C-2_4.py | UTF-8 | 60 | 2.828125 | 3 | [] | no_license | moji = input('入力>')
num = len(moji.split())
print(num) | true |
3d6d83eeec10bbc6eb9ef38d8e9c0004dde6350c | mex3semmen/video-game-behavioural-cloning | /utils/draw_figures.py | UTF-8 | 10,152 | 2.734375 | 3 | [
"MIT"
] | permissive | import json
import re
import os
import statistics
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
def human_normalized_score(score, random, human, stdev=None):
norm_score = 100 * (score - random) / (human - random)
if stdev is not None:
upper = 100 * ((score + stdev) - ran... | true |
660ff30b38959370601ce4ca8a591b54c970df8d | huangyingw/submissions | /330/330.patching-array.233524745.Accepted.leetcode.py | UTF-8 | 387 | 2.734375 | 3 | [] | no_license | class Solution(object):
def minPatches(self, nums, n):
next_missing = 1
patches = 0
i = 0
while next_missing <= n:
if i < len(nums) and nums[i] <= next_missing:
next_missing += nums[i]
i += 1
else:
next_missing +... | true |
d8938e6591436ec5218349627b5ef05f574864f6 | glqglq/cs_knowledge_graph | /get_and_preprocess_data/get_corpus.py | UTF-8 | 3,822 | 2.6875 | 3 | [] | no_license | # coding=utf-8
import re,requests,jieba
from random import choice
from settings import useragents,stop_word_dir
from url_cleaning import all_url_cleaning
from jparser import PageModel
link_pattern = re.compile(r'href=\".*?\"', re.M)
urls = set([u'http://www.ccf.org.cn'])
finished_urls = set([])
def get_corpus_from_we... | true |
e8789a57de3b14895d40f04b249f1ed5d3ca09bd | PaulDodd/Fin | /datatypes.py | UTF-8 | 3,360 | 2.734375 | 3 | [
"MIT"
] | permissive | #
# datatypes.py
# Created by Paul Dodd
# 08/24/2014
#
import json
import os
import sys
import time
import uuid
uuid_null = uuid.UUID(bytes='\x00'*16);
time_format = "%Y-%m-%d";
# class time_struct:
# def __init__(self):
# self.year = 0;
# self.month = 0;
# self.day = 0;
# def t... | true |
a4de76b12641887312a02eed0c229e46cb29bde3 | UWPCE-PythonCert-ClassRepos/SP_Online_PY210 | /students/tihsle/lesson05/mailroom3.py | UTF-8 | 3,293 | 3.640625 | 4 | [] | no_license | #!/usr/bin/env python3
import sys
donors = {"William Gates, III": [65000.00,10.00],
"Mark Zuckerberg": [1442.25, 4000.00, 5000.00],
"Jeff Bezos": [877.33],
"Paul Allen": [400.00, 200.0000, 10.00],
"Joe Smithe": [1000.00, 2000.00]
}
def send_thank_you():... | true |
7cc9083ffd7fe2ffdf1b0bba7b65bdc5910a73d3 | HubblEDev1/Ejercicios-de-python | /pf_01.py | UTF-8 | 1,892 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
1. Given a file with results from matches between soccer teams, write a Python program
to generate a table with team positions. In the input file, each row must contain three
columns separated by a ‘;’ indicating the two team names and the result of the match
for the first team. For example ... | true |
4efcf0136347c6f2c994d87691b98fed7d773de4 | gsgurpreet429/Sorting_Visualizer | /Sorting_Visualizer.py | UTF-8 | 4,291 | 3.015625 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
import random
import time
root = Tk()
root.title('Sorting Algorithm Visualisation')
root.maxsize(1000, 1000)
root.config(bg='#1B1725')
selected_alg = StringVar()
data = []
def swap(data, i, j):
data[i], data[j] = data[j], data[i]
return data
def draw_bars(da... | true |
f5bee7041889920f46e59e2883bee88f720fc581 | SyedAanif/fundamentals-python-v1 | /15-working_with_files.py | UTF-8 | 790 | 4.125 | 4 | [] | no_license | # WORKING WITH FILES
# CREATE A NEW FILE
# MODES --> 'w' -- WRITING, 'r' -- READING, 'r+' -- READING/WRITING
file = open("./data.csv", "w")
# WRITE DATA TO FILE
file.write("""Writing a very random
text into the file
to see whether formatting really
works while creating a file.""")
# READING A FILE --> COMMENT WRITING ... | true |
f57de87b9f39351e2daf0f1053dcc3346cb80c2d | nicolearaya/cs107_nicole_araya | /homework/HW2/HW2-final/P2.py | UTF-8 | 548 | 3.46875 | 3 | [] | no_license | def dna_complement(dna):
if not dna:
return None
dna = dna.upper()
output = ""
for x in dna:
if x == "A":
output = output + "T"
elif x == "T":
output = output + "A"
elif x == "C":
output = output + "G"
elif x == "G":
... | true |
5278bbb9a5dc562e40fbfb60cb5dbe0b341923dc | BrunoScaglione/Willump | /willump/graph/willump_graph_node.py | UTF-8 | 1,173 | 2.890625 | 3 | [
"MIT"
] | permissive | from typing import List
from weld.types import *
class WillumpGraphNode(object):
"""
Interface for Willump Graph Nodes. All types of nodes subclass this class. Nodes represent
transforms.
"""
_is_costly_node = False
def get_in_nodes(self) -> List['WillumpGraphNode']:
"""
R... | true |
365f40dc60ba1dfa11170ed34f3ec9267801b644 | jas7553/project-euler | /problem_6.py | UTF-8 | 258 | 3.4375 | 3 | [] | no_license | '''Jason A Smith'''
import math
def sumOfSquares(start, end):
return sum([i * i for i in range(start, end + 1)])
def squareOfSums(start, end):
return math.pow(sum([i for i in range(start, end + 1)]), 2)
print(squareOfSums(1, 100) - sumOfSquares(1, 100))
| true |
8ebe9b3e487958c10eaa46a6ec047123f9e8390c | invywyh/ThymesisFlow | /libthymesisflow/scripts/read_counters.py | UTF-8 | 222 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import sys
FIFO ="/tmp/thymesispcount"
fd=open(FIFO,"r")
def read_fifo():
while True:
line = fd.readline()
if line !="":
sys.stdout.write(line)
if __name__ == '__main__':
read_fifo()
| true |
58c391968f400c56eadf29ce7bd36a96899f7e7a | PhyuCin/CP1404PRAC | /Prac_07/names.py | UTF-8 | 727 | 3.5 | 4 | [] | no_license | from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
class NamesApp(App):
def __init__(self, **kwargs):
"""Construct main app."""
super().__init__(**kwargs)
self.names = ["James", "Lauran", "Kerry", "Bruce"]
def build(self):
""" build Kivy ap... | true |
0cc2c47d9b985aef566c36268d80f2d3655f2a96 | aharshbe/holbertonschool-higher_level_programming | /0x0A-python-inheritance/8-rectangle.py | UTF-8 | 622 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
"""a rectangle class"""
BaseGeometry = __import__('7-base_geometry').BaseGeometry
class Rectangle(BaseGeometry):
"""creates a rectable
Args:
BaseGeometry: inherits from given class
"""
def __init__(self, width, height):
"""initalizer method
Args:
... | true |
7928ad747e58ac8081a48819bbee2c402b3d23d8 | kar-m/Classic-ML | /unsupervised.py | UTF-8 | 5,647 | 3.203125 | 3 | [] | no_license | import numpy as np
import random
def euclid_dist(p1, p2):
return (np.sum((p1-p2)*(p1-p2)))**0.5
class KMeans:
def __init__(self, k=2, max_iterations=500, tol=0.5):
# number of clusters
self.k = k
# maximum number of iterations to perform
# for updating the centroids
self.max_iterations = ma... | true |
07cb454667154810ea6343b3d99b62eeca100549 | kwag93/Py_Algorism | /chap6/6-5.py | UTF-8 | 439 | 3.375 | 3 | [] | no_license | # 계수정렬
# 이는 가장 큰 데이터와 작은 데이터의 차이가 100만을 넘지 않을때 효과적이다
# 또한 양의 정수인 경우여야 한다
# 이때 최악의 경우여도 N + K 의 시간복잡도를 보장해준다.
arr = [7,5,9,0,3,1,6,2,9,1,4,8,0,5,2]
cnt = [0] * (max(arr) + 1)
for i in range(len(arr)):
cnt[arr[i]] += 1
for i in range(len(cnt)):
for j in range(cnt[i]):
print(i, end=' ')
| true |
1e60ee9c147e0d5191838dae61b5c10fcfde9345 | amand1996/similarity | /MinHash.py | UTF-8 | 7,182 | 2.921875 | 3 | [] | no_license | """
InterMine @ Open Genome Informatics : Similarity Project
-> Implementation of the MinHash Algorithm to finding similarity amongst Genes treated as sets of information
-> Implementation of LSH on the signatures generated to find highly similar genes
-> This method of Finding has a huge benefit when... | true |
d15d8503ff650ea750c2cbc3fd662b57050b111f | kobeomseok95/codingTest | /boj/silver/18352.py | UTF-8 | 576 | 2.765625 | 3 | [] | no_license | from sys import stdin
from collections import deque
READ = lambda : stdin.readline().strip()
n, m, k, x = map(int, READ().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
a, b = map(int, READ().split())
graph[a].append(b)
dist = [-1] * (n + 1)
dist[x] = 0
q = deque()
q.append(x)
while q:
no... | true |
5fcb31c3d37963945e987fbf5211dca74463a27c | chivesab/convert_data | /replace.py | UTF-8 | 673 | 3.15625 | 3 | [] | no_license | import csv
import sys
#1. Place each record of a file in a list.
#2. Iterate thru each element of the list.
#3. If the index==1 amd x is '0'.
test=sys.argv[2] #sys.argv[2]=test3
date=sys.argv[1] #sys.argv[1]=2017-12-08
file_heart='heart_'+test+'_'+date+'.csv' # = heart_test3_2017-12-08.csv
f=open('heart_'+test+"_"+da... | true |
8a73e56aa7a5c8a896fae6a68882ff8b202aae81 | paulhankin/aoc2019 | /day13.py | UTF-8 | 1,117 | 2.921875 | 3 | [] | no_license | import intcode
import collections
prog = intcode.read('day13.txt')
screen = collections.defaultdict(int)
r = intcode.Runner(prog)
while True:
try:
x = r.run()
y = r.run()
i = r.run()
screen[y,x] = i
except StopIteration:
break
print(sum(1 for v in screen.values() if v == 2))
prog[0] = 2
r = intcode.Ru... | true |
0a20cd8ebbf4798c1d0df2c25cf8750fdf3ac165 | marshmallow-code/apispec | /src/apispec/ext/marshmallow/__init__.py | UTF-8 | 8,527 | 2.8125 | 3 | [
"MIT"
] | permissive | """marshmallow plugin for apispec. Allows passing a marshmallow
`Schema` to `spec.components.schema <apispec.core.Components.schema>`,
`spec.components.parameter <apispec.core.Components.parameter>`,
`spec.components.response <apispec.core.Components.response>`
(for response and headers schemas) and
`spec.path <apispec... | true |
4560474cf21c14d42a5fd99897c1028a13f855bb | C3BI-pasteur-fr/python-solutions-1 | /source/_static/code/fasta_to_one_line.py | UTF-8 | 146 | 2.734375 | 3 | [
"CC0-1.0"
] | permissive |
def fasta_to_one_line(seq):
header_end_at = seq.find('\n')
seq = seq[header_end_at + 1:]
seq = seq.replace('\n', '')
return seq
| true |
76e7399b705342cd203971e4bf9f21ea8952b3d0 | HaoZ17/IOT_Temperature_Realtime_Control_System | /iot-devices/apps/labs/common/DataUtil.py | UTF-8 | 2,588 | 2.625 | 3 | [] | no_license | '''
Created on Feb 18, 2019
toJsonFromSensorData and toSensorDataFromJson
@author: alex
'''
from labs.common import ActuatorData
from labs.common import SensorData
import json
class DataUtil:
def jsonToActuatorData(self, jsonData):
with open(jsonData, encoding='utf-8') as jsonData:
... | true |
314dbc9d3fae898a04d8df9e398ee66063cc46d1 | Blaastolen/intranett | /src/Products.Extropy/Products/Extropy/utils.py | UTF-8 | 1,276 | 2.671875 | 3 | [] | no_license | from re import search
from Record import Record
def safe_unicode(v):
if isinstance(v, unicode):
return v
return unicode(v, 'utf-8', 'replace')
def dictifyBrain(item):
"""Make a dict with all the metadata
and getURL and getPath"""
d = {}
if isinstance(item, Record):
for key in ... | true |
97b7fc6f54ab6305d3c81b614629ad119d931a15 | marble-git/python-laoqi | /docs/chap6/code/agebirth.py | UTF-8 | 634 | 4.09375 | 4 | [
"MIT"
] | permissive | #coding:utf-8
'''
filename:agebirth.py
The example of class method
'''
import datetime
class Person:
def __init__(self,name,age):
self.name=name
self.age=age
@classmethod
def by_birth(cls,name,birth_year):
thisyear = datetime.date.today().year
age = thisyear - bi... | true |
1dac1ef9077c5b8497ef0923bcf58a9612065ffa | chuzcjoe/Leetcode | /4. Median of Two Sorted Arrays.py | UTF-8 | 640 | 3.109375 | 3 | [] | no_license | class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
m = len(nums1)
n = len(nums2)
half = (m+n) // 2
ALL = nums1 + nums2
#larger part
minq = []
#smaller part
maxq = []
... | true |
eedfd9244f5e4ba2ccbbdfaac21254cf09a9d6b5 | dkloz/reddit_data_preprocessing | /preprocessing/text.py | UTF-8 | 10,334 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | """A file to parse text from json files and similar functions."""
import os
import time
import io
import numpy as np
import multiprocessing as mp
import json
from preprocessing.config_filenames import n_proc
from util.preprocessing_util import set_to_dict, combine_dicts, is_valid_entry
from util.text_util import entr... | true |
3976267d4305994aebb097a8cb1c9359c98c9c3f | Nachtfeuer/concept-py | /concept/performance/measurement.py | UTF-8 | 1,656 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Performance tools.
.. module:: measurement
:platform: Unix, Windows
:synopis: performance tools
.. moduleauthor:: Thomas Lehmann <thomas.lehmann.private@googlemail.com>
=======
License
=======
Copyright (c) 2015 Thomas Lehmann
Permission is hereby granted, free of charge, to any person... | true |
cebbe88a4b110f9bb5c558b514b913da094d8f66 | korabl/python_lessons | /lesson_2/task5.py | UTF-8 | 261 | 3.65625 | 4 | [] | no_license | number = int(input('Введите число: '))
my_list = [7, 5, 3, 3, 2]
i = 0
for el in my_list:
if my_list[i] <= number:
my_list.insert(i, number)
break
else:
my_list.append(number)
break
i += 1
print(my_list) | true |
06c5888e64b25bbc21c54fc367c717b1e52f21a6 | clipklop/codecademy | /pokemon/pokemon.py | UTF-8 | 6,269 | 3.734375 | 4 | [] | no_license | """
* Become a Pokèmon master
"""
class Pokemon:
"""A class for creating Pokemons"""
def __init__(self, name, ptype, level):
self.name = name
self.type = ptype
self.level = level
self.max_health = level * 5
self.current_health = level * 5
self.is_knocked_o... | true |
80633e3d15ceea634881e58509c5f93cf99af6dd | Aqua-sama250/Blind-Signature-Voting-System | /voter/register.py | UTF-8 | 1,755 | 2.546875 | 3 | [] | no_license | import sys
import os
import json
from RSA.crypt import *
pubPath = '../publickey/'
def gcd(a,b):
# a < b
if a == 0:
return b
else:
return gcd(b % a, a)
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y... | true |
472d38c0bb1a8974c80801d1f31440961866d97f | XuXingyu-98/Recurrent-models | /Basic_RNN_cell.py | UTF-8 | 1,083 | 3.0625 | 3 | [] | no_license | import torch
import torch.nn as nn
import math
class BasicRNNCell(nn.Module):
def __init__(self, input_size, hidden_size, bias=True, nonlinearity="tanh"):
super(BasicRNNCell, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.bias = bias
self.... | true |
0e2a7fb386fd695b79278df70bc27eaf15a0b160 | hadoopaws8/my_owned_python_programs | /squir_count.py | UTF-8 | 938 | 3.078125 | 3 | [] | no_license |
##def countsqu(a,b):
## cnt=0
## for i in range(a,b+1):
## j=1
## while j*j <=i:
## if j*j ==i:
## cnt+=1
## print(j*j)
## for k in range(j):
## if k*k==j:
## cnt+=1
## ... | true |
2c0a488995aa05343d4e3dc1c676ed068c18a97b | KEATZZ14/PYTHON | /50.py | UTF-8 | 115 | 3.515625 | 4 | [] | no_license | a=int(input("enter the value:"))
x=a**2
if (a%2) == 0:
print("power of 2")
else:
print("not a power of 2")
| true |
51fa344bd6bd357a61e8029ed69c5789a91becd0 | gaosz0755/asprilo | /generator/generator/utils/logger.py | UTF-8 | 2,107 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Custom Logger."""
import sys
import logging
class SingleLevelFilter(logging.Filter):
def __init__(self, passlevel, reject):
self.passlevel = passlevel
self.reject = reject
def filter(self, record):
if self.reject:
return (re... | true |
36bd39dea5696e9cac0a52add60736b2b6fa3cb6 | ixinyue94/Data-Visualization | /Heatmap with two x-axis.py | UTF-8 | 828 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(font='SimHei')
df = pd.read_csv('Example Data.csv', engine='python')
flights = df.pivot(index='A',columns='B',values='VALUE')
c = []
for i in range(len(df)):
if df.loc[i,'C'] not in c:
... | true |
4d2059d81c3e6c48768e8124d1fa4c79d57fd4d2 | ytlee0430/LeetCodePy | /LeetCode/Stack.py | UTF-8 | 808 | 3.734375 | 4 | [] | no_license | class node:
def __init__(self, v):
self.value = v
self.max = v
self.next = None
pass
class stack:
def __init__(self):
self.node = None
pass
def push(self, v):
if self.node is None:
self.node = node(v)
return
n = node(... | true |
a9b8206ee0063d49f06e9484cd729d1b03764bd3 | michael-zero/estudo_pytista_kkk | /projects/bar_tab.py | UTF-8 | 538 | 3.28125 | 3 | [] | no_license | class Tab:
menu = {
'cuscuz': 4,
'coxinha': 3.5,
'café': 0.5,
'batata': 10
}
def __init__(self):
self.total = 0
self.items = []
def add(self,item):
self.items.append(item)
self.total +=self.menu[item]
def print_conta(self,tax,se... | true |
58edd261c2cb75462420e74b0706be4bea51a88b | Felipecard/Codigos-Exercicios-Python | /1. Estrutura de Decisao/loja de tinta (arredonda).py | UTF-8 | 509 | 3.671875 | 4 | [] | no_license |
print("Programa para loja de tintas")
metros = float(input("Quantos metros quadrados voce precisa pintar?"))
quant_litros = metros / 3
print("Voce precisara de {} litros de tinta".format(quant_litros))
quant_latas = quant_litros / 18
print("Voce precisara de {} latas".format(quant_latas))
quant_latas = int(quant_l... | true |
5631e29f11b0b4a13caf86d1d3dce2e5be0bf755 | suhasreddy123/python_learning | /week/flow statements.py | UTF-8 | 133 | 3.328125 | 3 | [] | no_license | num=input()
if num%2==0:
print("num is even")
elif num%2!=0:
print("enter number is odd")
else:
print("num is not value") | true |
11c753b16cafe51707d424df88b8b2e0a3c2ff16 | ViniciusBellagamba/prova-samba | /utils/endpoints_exceptions.py | UTF-8 | 593 | 2.703125 | 3 | [] | no_license | from flask import abort, make_response, jsonify
def endpoint_ex(code, msg):
abort(make_response(jsonify(message=msg), code))
def body_validation(body):
required_keys = ['name', 'url', 'duration', 'deleted']
if body is None:
raise endpoint_ex(400, f"BAD REQUEST: The request body is empty")
fo... | true |
e70e458f96915af9e4ef0b475916343f89990f1f | abhi-laksh/Python | /Linear Regression/LR.py | UTF-8 | 1,214 | 3.71875 | 4 | [] | no_license | # This is Linear regression model
# - - - Coded in UTF-8
# - - - This is a Linear Regression model with self-defined class (imported as a module named LR_module)
#
# !!! Created by @abhi-laksh aka Abhishek Soni
# on 22nd December 2018 11:35:08 ( GMT + 5:30 ) !!!
import pandas as pd
import matplotlib.pyplot ... | true |
40bdc06764fc6db9be1ebf66a74f1b46ba96faf7 | gokulsiva/Python | /helloworld/Contacts/Add_Contact.py | UTF-8 | 588 | 3.234375 | 3 | [] | no_license | import pickle
import os
def add_contact():
f = None
try:
if os.path.exists('contacts.txt'):
f = open('contacts.txt', 'a')
else:
f = open('contacts.txt', 'w')
name = raw_input('Enter contact name : ')
email = raw_input('Enter email id : ')
phone =... | true |
f50b2300f6fd5e872d95d9e7d0acc61631f28b08 | Dcooper15/July_2020_python_1 | /exercises729.py | UTF-8 | 840 | 4.125 | 4 | [] | no_license | #list1 = [22, 14, 78, 94, 15, 6]
#sum_list1 = sum(list1)
#print("SUM OF LIST")
#print(sum_list1)
#exercise1 summing a list ^
#exercise2 printing largest number
#list1.sort()
#print("The largest number is:", list1[-1])
#exercise3 print smallest number
#print("The smallest number is:", list1[0])
#exercise4 print... | true |
d5cf11e50266126ca7d11cb76f84c08403409473 | Triandasyahputra/HIMIT-Socmed-Analytics | /youtube/youtube_stats.py | UTF-8 | 4,450 | 2.8125 | 3 | [] | no_license | import requests
import json
from tqdm import tqdm
class Stats:
def __init__(self, api_key, channel_id, date):
self.api_key = api_key
self.channel_id = channel_id
self.date = date
self.channel_stats = None
self.video_data = None
def get_channel_stats(self):
... | true |
f1eddc6a3d3ab53311fe5b99d25001e6d7449da7 | feixiao/learning-python | /bigdata/源代码汇总-2020-12-16/第2章 数据分析的基本武器/源代码汇总_Pycharm格式/2.3.2 Matplotlib数据可视化基础.py | UTF-8 | 1,213 | 3.984375 | 4 | [
"Apache-2.0"
] | permissive | # **2.3.2 数据可视化常见小技巧**
# (1) 添加文字说明
import matplotlib.pyplot as plt
x = [1, 2, 3]
y = [2, 4, 6]
plt.plot(x, y)
plt.title('TITLE')
plt.xlabel('X')
plt.ylabel('Y')
plt.show()
# (2) 添加图例
import numpy as np
import matplotlib.pyplot as plt
# 第一条线, 设定标签lable为y = x + 1
x1 = np.array([1, 2, 3])
y1 = x1 + 1
plt.plot(x1, y1, la... | true |
69cd1bbdb211b70180ada8a62351b20ffc19d98f | abhishek-123-mona/python | /Chapter11/11_pr_02.py | UTF-8 | 347 | 3.609375 | 4 | [] | no_license | # class Animals:
# animalType = "Mammal"
# class Pets:
# color = "White"
# class Dog:
# @staticmethod
# def bark():
# print("Bow bow!")
# d = Dog()
# d.bark()
class Animals:
animalType="mammel"
class pets:
colors="white"
class dog:
@staticmethod
def bark():
print("... | true |
9b2c45894d6f22d07632c1f4716d2bd90dcb09d1 | kennanmell/robotics-ios | /pressure_client.py | UTF-8 | 941 | 2.5625 | 3 | [] | no_license | import socket
import sys
kill = 11
ping = 19
pressurePair = 29
pressurePairSucceeded = 30
pressurePairFailed = 31
pressureDataNone = 32
pressureDataHolding = 33
pressureDataHigh = 34
if len(sys.argv) != 3:
print "Usage: python", sys.argv[0], "<server-ip> <server-portno>"
exit()
# Create a TCP/IP socket
sock ... | true |
f062ed7bbd00cdc3619626428e39a02b783c1ae8 | flyingcircle/LatinProgLang | /src/Evaluator.py | UTF-8 | 6,615 | 2.703125 | 3 | [] | no_license | from Builtins import *
from Environment import *
def Eval(tree, env):
if tree == None:
return
name = tree.name
if name == "NUMBER":
return tree.value
elif name == "STRING":
return tree.value
elif name == "ARRAY":
return evalArray(tree, env)
elif name == "VAR... | true |
e246b5e66e92aaa456d006f3cbb50e4ce49635d0 | fbsource/orjson | /test/test_canonical.py | UTF-8 | 738 | 2.796875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import unittest
import orjson
class CanonicalTests(unittest.TestCase):
def test_dumps_ctrl_escape(self):
"""
dumps() ctrl characters
"""
self.assertEqual(orjson.dumps("text\u0003\r\n"), b'"text\\u0003\\r\\n"')
def test_dumps_esc... | true |
0a6d796c7039ee4e267f5d643c5beb45f591a0a7 | sukhesai/algorithms_and_data_structures | /algorithms and ds/AC_string_match.py | UTF-8 | 2,997 | 2.96875 | 3 | [] | no_license | from collections import deque
class node:
def __init__(self):
self.children = {}
self.suffixlink = None
self.wordid = None
self.endwordlink = None
self.parent = None
self.char = None
self.isleaf = False
class Aho:
def __init__(self):
self.trie ... | true |
46a094f8ec080ea564f9abe2a45705ca57237482 | Shiori06/FixPoint | /problem1.py | UTF-8 | 1,496 | 2.640625 | 3 | [] | no_license | import datetime
f = open('monitoring.log', 'r')
datalist = f.readlines()
time_ip_ping = []
trouble = []
#時刻,IP,応答時間に分ける
for data in datalist:
data = data.strip('\n')
time_ip_ping.append(data.split(','));
#ログを行ごとに調べる
for data in time_ip_ping:
#すでに故障しているサーバがあれば
if trouble:
for index, trouble_... | true |
0c62ca4eb1b4d20ca049cb36781b6a5209fe6971 | macoyulloa/AirBnB_clone_v2 | /models/engine/db_storage.py | UTF-8 | 2,366 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
"""This is the database storage class for AirBnB"""
from os import getenv
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import scoped_session
from models.base_model import BaseModel, Base
from models.user import User
from models.state import State
fr... | true |
719a5e095411503b7d931290454b3aadac6b36ba | rohitshetty/popular-electronics-autodownloader | /main.py | UTF-8 | 1,926 | 3.40625 | 3 | [] | no_license | import requests
import re
import os
import urllib
from bs4 import BeautifulSoup
from time import time,sleep
from threading import Thread
def createFolderIfNotExists(name):
#This creates a particular folder if not exists
if not os.path.exists(name):
os.makedirs(name)
def downloadURL(url,name):
print "Download... | true |
e8615380119348bbc8b95473d579688d8c620fa8 | uxDaniel/ctci | /1.1 isUnique.py | UTF-8 | 1,205 | 3.953125 | 4 | [] | no_license | # Is Unique: Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
# O(n)
# def isUnique(string):
# if not isinstance(string, str):
# return False
# return len(string) == len(set(list(string)))
# without aditional data structure... | true |
0bf3d1b056fa52b61ac855f330d90ffc3e7ec46d | victordpc/Ejercicios-CyBD | /P21_spark.py | UTF-8 | 575 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#Victor del Pino
from pyspark import SparkConf, SparkContext
import string
import sys
#Spark configuration
conf = SparkConf().setMaster('local').setAppName('WordCount')
sc = SparkContext(conf=conf)
RDDvar = sc.textFile("input.txt")
wanted = sys.argv[1] # patron given by the user
words = RDDvar.fl... | true |
f9f9fc1778c36c0548d2df20c2d52cd5e5c1c39d | bozsahin/ceng444 | /project-material/project_1_for_students/misc.py | UTF-8 | 863 | 3.109375 | 3 | [] | no_license | from ast_tools import *
from typing import List
from parser import Parser
from lexer import Lexer
def process(source):
'''parse the source text here. you may return the AST specified in ast_tools.py or something else.'''
pass
def generate_ast(intermediate) -> Program:
'''return the AST using the output of... | true |
b73e7b9462ff81dd7b6529a9e338a9e79017942b | ijazbacha/learn-python | /loan_emi.py | UTF-8 | 1,136 | 3.78125 | 4 | [] | no_license | import math
def loan_emi(amount, duration, rate, down_payment=0):
"""Calculates the equal montly installment (EMI) for a loan.
Arguments:
amount - Total amount to be spent (loan + down payment)
duration - Duration of the loan (in months)
rate - Rate of interest (monthly)
do... | true |
45485fbc75e33c38a4fdb73677997e6a7db6b862 | deepintoSky/python_learning | /8_multicore.py | UTF-8 | 1,637 | 3.546875 | 4 | [] | no_license | #导入模块
import multiprocessing as mp
import time
#被调用的函数
def job1(q):
res=0
for i in range(1000):
res+=i+i**2+i**3
q.put(res) #queue存入
def job2(x):
return x*x
def job3(v, num, l):
l.acquire() # 锁住
for _ in range(5):
time.sleep(0.1)
v.value += num # 获取共享内存
p... | true |
c57e0f0dc2456d30cba4e45e2998b291a5c4799c | barkhaneum/TestingGithub | /Practice_3.py | UTF-8 | 419 | 3.75 | 4 | [] | no_license | zero = 0
one = 0
counting = [0,0]
def fibonaccie(n):
if n == 0:
global zero
zero = zero + 1
global counting
counting.append()
return 0
elif n == 1 :
global one
one = one + 1
return 1
else:
return fibonaccie(n-1) + fibonaccie(n-2)
pr... | true |
bd371b9104e9dd17ebcdf34ca37d77ebc32979b2 | nordicomm/databuilder | /nanitWebScraping/babysleepsite_web_scraper.py | UTF-8 | 4,892 | 3.28125 | 3 | [] | no_license | from selenium_webscraping import selenium_webscraping_function
import time # to add dealy
import json
from html.parser import HTMLParser
import re
# TAGS to separate title from paragraph descriptions
SUBSTRING_TITLE_TAG = 'Titl3: '
SUBSTRING_DESCRIPTION_TAG = 'D3scr1ption: '
# class to help us separate start tags,... | true |
4d2a94099ea968cebb6af48b47f4906c908a66e5 | liangchaob/cangbaotu | /src/weight_compute.py | UTF-8 | 2,050 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Liang Chao"
# 价格权重
def w1(price):
if price <= 90:
return 5
elif price <= 100:
return 4
elif price <= 110:
return 3
elif price <= 120:
return 2
elif price > 120:
return 1
# 价值权重
def w2(convert_value... | true |
2ef2857ab1db6f04023dafae137f3d551010143c | zhmsg/dms | /dms/utils/ip.py | UTF-8 | 915 | 2.71875 | 3 | [
"MIT"
] | permissive | # !/usr/bin/env python
# coding: utf-8
__author__ = 'zhouhenglc'
class IPManager(object):
def __init__(self):
self.ip_1a = 256
self.ip_2a = self.ip_1a * self.ip_1a
self.ip_3a = self.ip_1a * self.ip_2a
self.ip_4a = self.ip_1a * self.ip_3a
def ip_value_str(self, ip_str=None, ... | true |
95a1aa51e771e98b778bafd403b0a9084845cc1d | rheena/Python-Intermediate | /Database programming.py | UTF-8 | 1,505 | 3.96875 | 4 | [] | no_license | #Basic database used is called SQLite 3
import sqlite3
class Person:
def __init__(self, id_number, first, last, age):
self.id_number = id_number
self.first = first
self.last = last
self.age = age
#Creating a connection to a database
self.connection = sq... | true |
56f1ec38023934ec5506cd9e1b716b24c72ed31b | rogerbear/tarena_project | /03_python_thread/day03/day3/process_event.py | UTF-8 | 629 | 3.125 | 3 | [] | no_license | from multiprocessing import Process,Event
import time
def wait_event():
print('process1要等主进程操作完我才能操作')
e.wait()
print('终于操作完了,该我了',e.is_set())
def wait_event_timeout():
print('process2要等主进程操作完我才能操作')
e.wait(2)
print('我等不了了,干别的去',e.is_set())
e = Event()
p1 = Process(name = 'block',\
ta... | true |
355433adeb7aba41873fd50241c4ed245cd4e63a | seanchen513/leetcode | /sorting/1424_diagonal_traverse_ii.py | UTF-8 | 3,338 | 3.96875 | 4 | [] | no_license | """
1424. Diagonal Traverse II
Medium
Given a list of lists of integers, nums, return all elements of nums in diagonal order as shown in the below images.
Example 1:
Input: nums = [[1,2,3],[4,5,6],[7,8,9]]
Output: [1,4,2,7,5,3,8,6,9]
Example 2:
Input: nums = [[1,2,3,4,5],[6,7],[8],[9,10,11],[12,13,14,15,16]]
Outpu... | true |