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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
82d6105b8a28bbcf28d1a748eb939f1c281a9e74 | Python | Kushal1412/Competitive-Programming-and-Interview-Prep | /LeetCode/Python/0451. Sort Characters By Frequency.py | UTF-8 | 183 | 2.9375 | 3 | [
"MIT"
] | permissive | from collections import Counter
class Solution:
def frequencySort(self, s: str) -> str:
c = Counter(s)
return "".join(sorted(sorted(s), key=c.get, reverse=True))
| true |
03935ed1b17d43ea0264607c5a72f0135640a076 | Python | abhinav1592/DS_and_Algo_Python_implementations | /Data Structures/Python Lists.py | UTF-8 | 1,815 | 3.46875 | 3 | [] | no_license | '''
Arrays in Python.
Reference: https://www.geeksforgeeks.org/array-python-set-1-introduction-functions/
TYPE CODE C TYPE PYTHON TYPE MINIMUM SIZE IN BYTES
‘b’ signed char int 1
‘B’ unsigned char int 1
‘u’ Py_UNICODE unicode c... | true |
74488a2586d8a9687296d1719542efdfcb678441 | Python | doducthao/Programming | /leetcode/30daysChallenge/week2/ContiguousArray.py | UTF-8 | 1,673 | 3.703125 | 4 | [] | no_license | # Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
# Input: [0,1]
# Output: 2
# Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
# Input: [0,1,0]
# Output: 2
# Explanation: [0, 1] (or [1, 0]) is a longest contiguous subarray with e... | true |
6742ddf8d82287421f64d50ee91a0027b1fb0ce3 | Python | sahilbnsll/Python | /Fuctions and Recursion/Program02.py | UTF-8 | 184 | 4.0625 | 4 | [] | no_license | # Greeting a user
def greet(name):
p = print("Good Day, " + name)
return p
# both approach are correct
greet('Sahil')
name =input("Enter your name: ")
print(greet(name))
| true |
96b549cd42942b67401e3ddb8f0d907d3d007a0c | Python | Ernest-Macharia/Data-Structures-in-Python | /trial.py | UTF-8 | 100 | 3.453125 | 3 | [] | no_license | x = [3,6,2,10,7,22,4,9,5]
num = [y if y%2 == 0 else 10 * y for y in x]
print("numbers: " + str(num)) | true |
84f6ebea1250042613c0155e6e083f795e4ee46b | Python | 981377660LMT/algorithm-study | /7_graph/经典题/置换环/CyclePartition-置换环分组.py | UTF-8 | 1,122 | 3.375 | 3 | [] | no_license | # CyclePartition-置换环分组+容斥原理
from typing import List
MOD = 998244353
def cyclePartition(nexts: List[int]) -> List[List[int]]:
"""给定一个0-n-1的排列,返回环分组
nexts[i]表示i的下一个元素.
"""
n = len(nexts)
groups = []
visited = [False] * n
for i in range(n):
if not visited[nexts[i]]:... | true |
d3ec348df33b2162546578f76564b5019ad4896a | Python | database-ai4db-group/Dotil | /data/Dataset/ProcessRdb.py | UTF-8 | 9,372 | 2.90625 | 3 | [] | no_license | """
用于处理RDB数据,分为以下几步:
1.将所有p分开,统计每一个p所处的文件大小
2.将文件按照大小从小到大排序
3.将文件按照排序聚合成 10个3G左右文件,具体大小不固定,可以超过1次3G,保存下来索引表
4.按照索引表对workload进行分表处理
5.将数据导入MySQL数据库,开始查询
"""
import re
import sys
import os
def split_p():
"""将所有p分开,减少spo的长度到500"""
f = open("dbpedia2000.nt", "r", encoding="utf8")
p_dict = dict() # 保存p的索引文件,... | true |
a0fc33ca7cbbe88c0d80e9809e886489c332b8ab | Python | jovillal/Learning-Python | /3Manuscripts/coral-multiple-inheritance.py | UTF-8 | 492 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
Doing multiple inheritances
This is a temporary script file.
"""
class Coral:
def community(self):
print('Coral lives in a comunity')
class Anemone:
def protect_clownfish(self):
print('The anemone is protecting the clown.')
class Cor... | true |
c58c3f82062f5906246a9cae09875720b26c5042 | Python | NikiDimov/SoftUni-Python-Fundamentals | /reg_ex_07_21/SoftUni_bar_income.py | UTF-8 | 615 | 3.21875 | 3 | [] | no_license | import re
pattern = r'%(?P<name>[A-Z][a-z]+)%([^\|\$\.\%]*)<(?P<product>\w+)>([^\|\$\.\%]*)\|(?P<count>\d+)\|([^\|\$\.\%]*?)(?P<price>\d+\.?\d+)\$'
line = input()
total_income = 0
while not line == "end of shift":
result = re.findall(pattern, line)
if result:
result = re.finditer(pattern, line)
... | true |
efc590ce5d720ad36c5ea3db231bb5a2a24643a8 | Python | AlisonZXQ/leetcode | /python/205. Isomorphic Strings.py | UTF-8 | 519 | 2.890625 | 3 | [] | no_license | #coding=utf-8
__author__ = 'xuxuan'
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(s)!=len(t):
return False
smap={}
tmap={}
for i in range(len(s)):
if smap.get... | true |
2ea262b5c0ee441b06745416b37b5f416376d365 | Python | uniquefu/monitor | /app01/gordon/core/main.py | UTF-8 | 947 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#Author:Jeff Lee
from core.client import ClientHandle
class command_handler(object):
def __init__(self,args):
self.sys_args =args
if len(self.sys_args)<2:
exit(self.help_msg)
self.command_allowcator()
def help_msg(self):
... | true |
c5b4e32bf2c5666cecde5b7ff343f939c331dfda | Python | PriyalP24/OnlineTiffinService | /applicationfolder/common/utils.py | UTF-8 | 519 | 2.53125 | 3 | [] | no_license | from flask import *
import os
path = os.path.dirname(os.path.abspath(__file__))
UPLOAD_FOLDER = os.path.join(path, 'uploaded_files')
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif','json','py','html','js'}
def output_html(data,code,headers=None):
resp = Response(data,mimetype='text/html',headers=... | true |
b83458cb3fb7546bd94bb2ebba5575722a0081dd | Python | rohitsuv/Project-Euler | /euler59.py | UTF-8 | 1,540 | 3.015625 | 3 | [] | no_license | import string
f = open('p059_cipher.txt')
g = f.read()
g = g.replace('\n','')
h = g.split(',')
list1 = []
for i in h:
list1.append(int(i))
letters = string.ascii_lowercase
letters2 = string.ascii_uppercase
def is_word(str1):
for i in str1:
if i not in letters and i not in letters2:
return False
return ... | true |
1774ace2ff6b001206a590d704c092870c985fd9 | Python | FeMonky/PLC-Notify | /Sequencer.py | UTF-8 | 303 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 26 15:05:43 2016
@author: avieux
"""
def sequence(*functions):
def func(*args, **kwargs):
return_value = None
for function in functions:
return_value = function(*args, **kwargs)
return return_value
return func | true |
12ddc599c8dc9dc8f3a5aa81ecea893a31881cba | Python | daniapm/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/3-print_alphabt.py | UTF-8 | 145 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python3
for alpha in range(97, 123):
if alpha not in [101] and alpha not in [113]:
print("{}".format(chr(alpha)), end="")
| true |
6116a735bfe6bd3e2e778d6da5476f634acbfa42 | Python | bjutliulei/Positive-and-Unlabeled-Learning | /DDI-PULearn/DDI-PULearn.py | UTF-8 | 3,009 | 2.65625 | 3 | [] | no_license | '''CSV文件格式'''
from Conversion import CSV
from sklearn.svm import SVC
import numpy as np
import random
f1 = []
accuracy = []
path = r'C:\Users\yyveggie\Desktop\UCI\Conversion\mushroom.csv'
k = 5 # k近邻
T = 4.8 # 阈值
texts_1, texts_0 = CSV(path)
def SplitData(k, texts_1, texts_0): ... | true |
07b64adadaf8d465b24c3b0fb58f7e787b1e2aaf | Python | edgar1140/SoccerPK_Game | /shell.py | UTF-8 | 1,693 | 3.0625 | 3 | [] | no_license | import core, disk
from termcolor import cprint
import os
def welcome_message():
cprint(disk.get_field(), 'yellow')
def shoot(player):
cprint(r'''
,
- \O , .-.___
- /\ O/ /xx\XXX\
- __/\ ` ... | true |
041f3f61144785bf59918ba67fea8c680cb129a0 | Python | martyurb/OOAnalysis-Design | /src/classes/bag.py | UTF-8 | 844 | 3.65625 | 4 | [] | no_license | class Bag:
def __init__(self):
self.letters = [] # array of letters
def add(self, letters): # with rack
"""
Inherit letters from rack and add them to bag.
@param letters (list): Length of list must be between 1 and 7.
@return: Void
"""
... | true |
b3758fa60da08868c6ab69a5ff4ddc92edcd651d | Python | sprawin/Quick-Dashboard | /SampleCodes/reader.py | UTF-8 | 4,875 | 3.359375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
import seaborn as sns
import matplotlib.pyplot as plt
from numpy import mean
dirname = os.getcwd()+'/dataset/'
filename = 'supermarket_sales' #input("Enter File Name: ")
extension = '.csv' # input("Enter extension eg: '.csv' ")
file = dirname+filename+extension
dataset =... | true |
08a7c5892ce93f39aa380f1bdafd47aa3f668b0b | Python | fmarculino/CursoEmVideo | /ExMundo2/Ex054.py | UTF-8 | 740 | 4.1875 | 4 | [] | no_license | """
Crie um programa que leia o ano de nascimento de sete pessoas. no final,
mostre quantas pessoas ainda não atingiram a maioridade e quantas já
são maiores de idade.
"""
from datetime import date
dtatual = date.today().year
idade = int(0)
nasceu = int(0)
maior = int(0)
menor = int(0)
for con in range(1, 8):
nasce... | true |
c24e8752cc072a0acd14e4af96252e1eb8eeb136 | Python | carlotta-93/Assignments | /A5/gradient_descent.py | UTF-8 | 3,837 | 3.625 | 4 | [] | no_license | import numpy as np
from sympy import *
from sympy.abc import x
import matplotlib.pyplot as plt
def compute_derivative(x_s):
"""Compute derivative of function given as argument"""
grad_function = exp(-x_s / 2) + 10 * (x_s ** 2)
yprime = grad_function.diff(x_s)
return yprime, grad_function
# transform... | true |
89e03cb2586f29d197dd46b7e73269ea6904fad2 | Python | ahmadturkmani/CPSC231 | /Battleship/Battleship5.3.py | UTF-8 | 4,923 | 3.46875 | 3 | [
"MIT"
] | permissive |
import random
B='~'
grid = [[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,B,B,B,B,B],
[B,B,B,B,B,... | true |
23a1f829f1eede3057a0aba9fbac7aff2cd7bc06 | Python | SundeepPundamale/CarND-Behavioral-Cloning-P3 | /clone.py | UTF-8 | 3,127 | 2.84375 | 3 | [] | no_license | import os
import csv
import keras
from random import shuffle
from keras.models import Sequential
from keras.layers import Flatten, Dense, Lambda, Cropping2D
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from sklearn.model_selection import train_test_split
import cv2
import ... | true |
e0241b8c3c00d187a0849c0e5d5fa6a31e563c27 | Python | htrahddis-hub/DSA-Together-HacktoberFest | /strings/Easy/roman_to_integer.py | UTF-8 | 655 | 3.75 | 4 | [
"MIT"
] | permissive | # Link : https://leetcode.com/problems/roman-to-integer/submissions/
# Approach :
# 1.
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
values = {
"I" : 1 , "V" :5 , "X" : 10 , "L" : 50 , "C" : 100 ,
"D" : 500 , "M" :... | true |
3a1c7a452f4c5944c47648828cf45bcd1802d39e | Python | bugbear1982/ChenWork | /爬取网页所有zip并上传到文件服务器.py | UTF-8 | 6,244 | 2.703125 | 3 | [
"Unlicense"
] | permissive | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# 作者:ChrisChan
# 用途:开启5个进程下载jenkins网页的所有的zip文件,并且上传到文件服务器里
# 本脚本搭配ini文件使用,文件格式如下
#[group1]
#hostIP = IP地址
#port = 端口
#username = 登录用户
#password = 服务器密码
#remote_path = 远程路径
import os
import re
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
import param... | true |
3f7a1e276e298ccd4fa2e2c791df8994f567e5c6 | Python | MiguelRavello/algebra-lineal | /transformacion/complex.py | UTF-8 | 1,895 | 3.546875 | 4 | [] | no_license | import math
import matplotlib.pyplot as plt
import numpy as np
class Complex(object):
def __init__(self, real, imag=0.0):
self.real = real
self.imag = imag
def __add__(self, other):
return Complex(self.real + other.real,
self.imag + other.imag)
def __sub__(s... | true |
e724160daa284638ff40703895f67f4e3a9ca767 | Python | dummy-andra/python-penetration-testing-freecodecamp | /port-scanner.py | UTF-8 | 467 | 3.359375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import socket
sock = socket.socket(
socket.AF_INET,
socket.SOCK_STREAM
)
sock.settimeout(5)
def scanPort(host, port):
# connect_exc return error code instead of exception which is easy to handle
if sock.connect_ex((host, port)):
print("Port is down!")
else:
pri... | true |
050877638a6b9e1009bb6dc788a3dbac67c6b687 | Python | vinzenzstampf/PlotFactory | /plotting/multi.py | UTF-8 | 167 | 2.71875 | 3 | [] | no_license | from multiprocessing import Pool
def doubler(number):
return number * 2
pool = Pool(processes=3)
result = pool.apply_async(doubler, (25,))
print(result.get())
| true |
383df86e12beeb4a1254c17030c3014460c73b26 | Python | WanNJ/Wiki-QA-Magic | /ask | UTF-8 | 934 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from question_generator import qg_main
def generate_questions(wiki_text_block, no_of_questions):
"""
generates the questions based on the wiki text and returns the no of
questions based on the no_of_questions parameter
:param wiki_text_block: Wikipedia text
... | true |
2caa6906bb8de7b4bc83f79de324020a6e519154 | Python | romancardenas/is_project | /wind_turbine/faulty_turbine.py | UTF-8 | 4,921 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
from random import randint
pd.options.display.max_rows = None
def fum1(maxPower):
return randint(0, maxPower)
def fum2(P, reduced):
return P * reduced
def fum3(P, offset):
if (P > offset):
return P - offset
else:
return 0
def fu_data(data... | true |
139e61d376583d62cd89091ce991f933ee3391f0 | Python | Delta4Studio/Leetcode | /206 Reverse Linked List/206 Reverse Linked List.py | UTF-8 | 237 | 2.625 | 3 | [] | no_license | class Solution(object):
def reverseList(self, head):
cp = head
np = None
while cp != None :
pp = cp.next
cp.next = np
np = cp
cp = pp
return np
#Min:56ms | true |
e5cc12587c5c21c2750638b38d0a162fb779009f | Python | amrann/quantus_materi_git | /luas.py | UTF-8 | 279 | 2.890625 | 3 | [] | no_license | class LuasSegititiga():
def hitung(self, alas:float, tinggi:float):
return 0.5*alas*tinggi
class PrismaSegitiga():
def hitung(self, alas:float, tinggi:float, rusuk1:float, rusuk2:float, rusuk3:float):
return tinggi*(rusuk1 + rusuk2 + rusuk3) + (2 * alas) | true |
7b863b31c45cc90c124c31a449a54641f1d0b37e | Python | kaichingchang/Python-Function | /fdemo1.py | UTF-8 | 1,056 | 3.546875 | 4 | [] | no_license | import tkinter as tk
def do_nothing():
pass
class FDemo(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.winfo_toplevel().title("函數物件")
self.button = tk.Button(self)
... | true |
ba701c23833c070e8e74dc2449e57a2296f1b3b0 | Python | JBannwarth/OrbitalMechanics | /chapter2/example_2_03.py | UTF-8 | 3,145 | 3.25 | 3 | [
"MIT"
] | permissive | """ Orbital Mechanics for Engineering Students Example 2.3
Question:
A 1000 kg satellite orbits earth. Given the initial conditions
R_0 = 8000*i + 6000*k
V_0 = 7*j km/s
Solve the relative motion of the satellite with respect to the earth from
t = 0 to t = 4 hours.
Also determine the mini... | true |
5991858c9e2aa9c65c1ed7dc18469278adc69382 | Python | rahulpaul/Problems | /hackerrank/queen_attack_2.py | UTF-8 | 1,775 | 3.359375 | 3 | [] | no_license | # Problem: https://www.hackerrank.com/challenges/queens-attack-2/problem
def count_moves(n, rq, cq, obstacles):
moves = 0
# move right => increase columns
for ci in range(cq+1, n+1):
if (rq, ci) in obstacles:
break
moves += 1
# move left => decrease columns
for ci ... | true |
d3fe19e836374802d3d945647a4a114e788af02a | Python | denisond/ncaamb_elo | /elo_creation.py | UTF-8 | 4,585 | 3 | 3 | [] | no_license | import numpy as np
import pandas as pd
import statistics as stats
from sklearn.metrics import log_loss
import matplotlib.pyplot as plt
import random
import seaborn as sns
sns.set()
from datetime import timedelta
from datetime import datetime
reg_szn = pd.read_csv("data/RegularSeasonCompactResults.csv") # read in matc... | true |
5f8241b52abcae9b744811fcf50e1cf9d9826ea6 | Python | yuluomeng/evolution | /src/core/utils.py | UTF-8 | 4,291 | 3.734375 | 4 | [] | no_license | from operator import itemgetter
import signal
def is_natural(maybe_natural):
"""is the maybe_natural a natural?
:param maybe_natural: item to check if is a Natural
:type maybe_natural: Any
:returns: whether maybe_natural is a Natural
:rtype: bool
"""
min_value = 0
return type(maybe_... | true |
e784907231b433b6c6804f92d092c79592b3dacd | Python | satyajitghana/ProjektFrancium | /francium/algorithms/simulated_annealing/solver.py | UTF-8 | 3,379 | 3.125 | 3 | [] | no_license | from typing import Optional
from francium.algorithms.simulated_annealing.agent import Agent
from francium.algorithms.simulated_annealing.environment import Environment
from francium.core import BaseSolver, setup_logger, State
import numpy as np
logger = setup_logger(__name__)
class Solver(BaseSolver):
def __in... | true |
cc86ae04aeea0487d856f219a1a3097c60c109c4 | Python | zhouchuang/pytest | /test19.py | UTF-8 | 422 | 4.03125 | 4 | [] | no_license | """
题目:一个数如果恰好等于它的因子之和,这个数就称为"完数"。例如6=1+2+3.编程找出1000以内的所有完数。
程序分析:请参照程序Python 练习实例14。
"""
for i in range(1,1000):
sum = 0
nums= []
for j in range(1,i):
if(i%j==0):
sum = sum+j
nums.append(j)
if(sum==i):
print("是一个因子数%d" % sum ,nums)
| true |
bf2eb5570873013af524f13abd245bd51db7fbb3 | Python | craigderington/celery-example-1 | /stalks/tasks.py | UTF-8 | 4,949 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | from celery import Celery
from celery.schedules import crontab
from celery.utils.log import get_task_logger
from datetime import datetime, timedelta
import random
import requests
from requests.auth import HTTPBasicAuth
import config
# setup our celery object
app = Celery(__name__,
broker=config.CELERY_BRO... | true |
30d40ab3c1a2ff0bc612c9cd0741fb1c667433c9 | Python | Brendan-Lucas/Computer-Systems-ThirdYearProject | /DoorCode/VirtualDoorSimulator.py | UTF-8 | 1,522 | 2.796875 | 3 | [] | no_license | #============================================================================================
# VirtualDoorSimulator.py
#--------------------------------------------------------------------------------------------
# Patrick Perron
#----------------------------------------------------------------------------------------... | true |
af0c34b535d99ba8f2ee06f0714e01101960e8e3 | Python | waingram/citation-parsing | /python/count_etd_departments.py | UTF-8 | 1,125 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
"""
Count departments from ETD collection
"""
import os
import shutil
import xml.etree.ElementTree as ET
from pathlib import Path
__author__ = "William A. Ingram"
__version__ = "0.1.0"
__license__ = "BSD-3"
def count_depts():
""" Sort by department """
data = Path('.')
theses = [t... | true |
40895bb4cb3992eab2882bb2085e2793f3802c1c | Python | josnin/kivy_handson | /banner.py | UTF-8 | 899 | 2.640625 | 3 | [] | no_license | from kivy.lang import Builder
from kivy.factory import Factory
from kivymd.app import MDApp
Builder.load_string('''
<ExampleBanner@Screen>
MDBanner:
id: banner
text: ["One line string text example without actions."]
# The widget that is under the banner.
# It will be shifted down ... | true |
1d7dee1f2eb01d8542bdb0c7d7e7a4056ab2c7e4 | Python | arrayExample/Python | /Calculators/HourlyPayCalculator.py | UTF-8 | 1,380 | 4 | 4 | [] | no_license | print("ABC Inc., Gross Pay Calculator!")
employee_name = str
while employee_name != 0:
employee_name = str(input("Enter employee's name or 0 to quit: "))
if employee_name == "0":
print("Exiting program...")
break
hours_worked = int(input("Enter hours worked: "))
pay_rate = float(... | true |
6c816958f68377e2fd4f82dca13e348aaeec03cb | Python | zzuse/fluentPythonLearning | /clip.py | UTF-8 | 4,598 | 3.171875 | 3 | [] | no_license | def clip(text, max_len=80):
"""
Return text clipped at the last space before or after max_len
:param text:
:param max_len:
:return:
"""
end=None
if len(text) > max_len:
space_before = text.rfind(' ',0,max_len)
if space_before >= 0:
end = space_before
e... | true |
aad5a2ba009e32f305829d7de3d9e091f89bcb15 | Python | KodchakornL/Python-Bootcamp2021 | /GUI Project/GUI_Translator/Autotranslate&Date.py | UTF-8 | 1,460 | 2.875 | 3 | [
"MIT"
] | permissive | #easyread=>translator
# from googletrans import Translator,LANGUAGES
from easyread.translator import Translate
from openpyxl import Workbook
from datetime import datetime
# print(LANGUAGES)
# translator = Translator() #ตัวแปลคำศัพท์
# result = Translator.translate('cat',dest='th',encoding='uft=')
# print(re... | true |
9558bcbe2e83dba5cb6c7218adefb78485162b44 | Python | zhangyiwen5512/tools | /NN.py | UTF-8 | 971 | 2.796875 | 3 | [] | no_license | #coding:utf-8
#两层神经网络
import tensorflow as tf
#定义输入和参数
#x_data = tf.constant([[0.7,0.5]])
#placehold 喂入多组数
#一组两个特征参数
x_data = tf.placeholder(tf.float32,shape=(1,2))
#多组两个特征参数
x_data = tf.placeholder(tf.float32,shape=(None,2))
w1 = tf.Variable(tf.random_normal([2,3],stddev=1,seed=1))
w2 = tf.Variable(tf.random_norma... | true |
fd12f652723a4abfaaca0edb10e6b878908f6025 | Python | BryceLuna/commercials_project | /evaluate_model.py | UTF-8 | 1,061 | 2.640625 | 3 | [] | no_license | import argparse
from keras.models import Sequential
from sklearn.metrics import classification_report
import load_data as ld
from keras.models import model_from_json
import cPickle as pickle
def load_model(model_path,weights_path):
with open(model_path) as f:
mod = f.read()
model = model_from_json... | true |
57e61cffc98dbe8140915b4a7d688bc2050db26d | Python | ming037/Busstop_project | /MyBusStop.py | UTF-8 | 9,928 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import requests
from bs4 import BeautifulSoup
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
class StartApp(QWidget):
def __init__(self):
super().__init__()
self.url = 'http://openapi.jeonju.go.kr/jeonjubus/... | true |
767586cd28f39dd86447d0dc08a948ff528273fb | Python | jbenua/rch | /tasks/task1/tests.py | UTF-8 | 2,957 | 3.546875 | 4 | [] | no_license | import unittest
from copy import deepcopy
from .nest import group_by_key
ITEMS = [
{
"country": "US",
"city": "Boston",
"currency": "USD",
"amount": 100
},
{
"country": "FR",
"city": "Paris",
"currency": "EUR",
"amount": 20
},
{
... | true |
f8655c94959fa35bd59b7e301bc338ceb2a94c49 | Python | SheikhFahimFayasalSowrav/100days | /days021-030/day026/lectures/lec03.py | UTF-8 | 302 | 3.265625 | 3 | [] | no_license | from random import randint
names = ["Alex", "Beth", "Caroline", "Dave", "Eleanor", "Freddie"]
student_scores = {student: randint(0, 100) for student in names}
print(student_scores)
passed_students = {student: score for student, score in student_scores.items() if score >= 60}
print(passed_students)
| true |
5495370b89dac3ec7f85503f791b3a90a5f09081 | Python | turgon91/Cryptocurrencies | /getGdaxData.py | UTF-8 | 1,272 | 2.984375 | 3 | [] | no_license | import gdax
import csv
public_client = gdax.PublicClient()
def getHistoricGdaxData(currencies, starttime, endtime, granularity):
"""This function obtains historic data for a specified list of pairings of currencies, a start datetime, end
datetime, and granularity (measured in seconds). The datetimes must be i... | true |
a440f8fe28436eaae515bd970a83889b5cd2d8ac | Python | MartinHvidberg/sudoku | /ec_sudoku/es/test_sdkbase.py | UTF-8 | 6,267 | 2.625 | 3 | [] | no_license | import unittest
import sdk_base
#import sdk_coms as sdk_base # To test if sdk_base functionality inherits to sdk_coms, Rename all 'sdk_base.SDK_base()'
SDKZ = '000000000000000000000000000000000000000000000000000000000000000000000000000000000' # A completely empty SuDoKu grid
SDKI = '10000000209040005000600070005090... | true |
57f541234da83f773c5e138adedb2caf20cfceb3 | Python | SerdarKuliev/proj1 | /2/2-1.py | UTF-8 | 1,320 | 4.1875 | 4 | [] | no_license | #1. Создать список и заполнить его элементами различных типов данных. Реализовать скрипт проверки типа данных каждого элемента.
#Использовать функцию type() для проверки типа. Элементы списка можно не запрашивать у пользователя, а указать явно, в программе.
my_list = [34, None, 3.14, "Yo!", [1,2,67], 8*5, '8*5', True,... | true |
6b453982425c19398cbf7f6d015ac25b7f66f4c3 | Python | HanielDorton/Project_Rosalind | /TheFounderEffectAndGeneticDrift/TheFounderEffectandGeneticDrift.py | UTF-8 | 1,404 | 3.0625 | 3 | [] | no_license | import math
with open('rosalind.txt') as f:
for line in f:
line = line.strip()
line = line.split()
for w in range(len(line)):
line[w] = int(line[w])
population = 19
total = population*2
gens = 3
def binomial(number, total, percent):
answer = (percent**number) * ((1-percent)**(total-num... | true |
9d77c73824d76bfb4c4c1006da6b5b47e6c8b930 | Python | mcc-sw-eng-course/python-programs-Alexrg | /L1/exNine.py | UTF-8 | 393 | 4 | 4 | [] | no_license | input_number = input('Enter a number:')
roman_numbers = ['I', 'XV', 'V', 'IX', 'X', 'L', 'C', 'D', 'CM', 'M']
integer_numbers = ['1', '5', '10', '50', '100', ]
convertion = []
for i in range(len(integer_numbers)):
count = int(input_number / integer_numbers[i])
convertion.append(roman_numbers[i] * count)
i... | true |
d159a2f133ed37d36f078de481c3f18b92848df2 | Python | liujianhuiouc/python_exercise | /threading_test/share_counter.py | UTF-8 | 407 | 2.6875 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
class ShareCounter(object):
def __init__(self):
self._value = 0
self._lock = threading.Lock()
def incr(self, delta=1):
with self._lock:
self._value += delta
def decr(self, delta=1):
with self._l... | true |
9afc894712bec4aa0727aed65a0098285fa39d1f | Python | Malgus1995/CNU_MogakCO | /CV/RE_2.py | UTF-8 | 553 | 2.59375 | 3 | [] | no_license | from skimage import io, color
img = io.imread("rena.jpg")
#io.imshow(img)
#io.imsave("duple_rena.jpg",img)
rena_hsv = color.rgb2hsv(img)
#io.imshow(rena_hsv)
import numpy as np
from skimage import io,draw
npimg =np.zeros((100,100),dtype=np.uint8)
x,y = draw.circle(50,50,10)
#npimg[x,y]=1
#io.imshow(img)
epx,epy... | true |
0c9e2232957187597f1a2af1ad0c6accc9c168c5 | Python | dhankhar313/Computer-Vision | /OpenCV Basics/shapes_on_pic.py | UTF-8 | 335 | 2.71875 | 3 | [] | no_license | import cv2
import numpy as np
# img = cv2.imread('data\lena.jpg', 1)
img = np.zeros([1024, 1024, 3])
cv2.rectangle(img, (50, 50), (500, 500), (255, 0, 0), -1)
cv2.circle(img, (250, 250), 100, (0, 0, 255), -1)
cv2.putText(img, 'Hello', (400, 750), cv2.FONT_HERSHEY_COMPLEX, 3, (0, 255, 0), 3)
cv2.imshow('Lena', img)
cv2... | true |
850bc2cb9b990056c9267c8d67a7de76f2c8374d | Python | alvaralmstedt/py_scripts | /fasta_capitals.py | UTF-8 | 1,177 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
"""
Usage: fasta_capitals.py fastafile.fasta [C/L] > result.fasta
"""
from sys import argv
from string import maketrans
filename = argv[1]
action = argv[2]
def capitals(fil):
transfrom = "abcdefghijklmnopqrstuvxyz"
transto = "ABCDEFGHIJKLMNOPQRSTUVXYZ"
transtab = maketrans(transfrom,... | true |
b5b8f5c6cf7f4c30118e313f13059b2da9e96065 | Python | anair13/gradebrain | /brain/stats.py | UTF-8 | 2,536 | 3.375 | 3 | [] | no_license | from internal import *
import scipy
import numpy
from sklearn import linear_model
from math import sqrt
from operator import add, sub
def covariance(samples):
""" Gets the covariance of grades """
xs, ys = list(map(lambda a: a[0], samples)), list(map(lambda a: a[1], samples))
avgx = float(sum(xs)) / len(x... | true |
a4707a3fde49e298b4a597aba7d5bdea2909f07c | Python | Amrutha-Kumaraswamy/Firewall-SDN-Python | /mytopo.py | UTF-8 | 1,035 | 3.15625 | 3 | [] | no_license | """Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Top... | true |
cebdfad7462f1cc013bc766cfa37725fc6553a10 | Python | EyalRozenberg1/Geometric-Learning | /Spectral_Theory_on_Graphs_and_Manifold_Learning/q4_pm.py | UTF-8 | 2,497 | 3.375 | 3 | [] | no_license | import numpy as np
from numpy.linalg import eig
from numpy.linalg import norm
from numpy.random import randn
eps = 1e-5
n = 30
def PowerMethod(B, eps=1e-5):
"""
PowerMethod(B): returns the largest (in absolute value) eigenvalue and
the corresponding eigenvector. With a reasonable stopping criterion to the... | true |
dea08ebb22c031ee9cb42571f0dad3a84b2cf0bf | Python | BrittX/PyShell | /shell_package/shell.py | UTF-8 | 1,570 | 3.078125 | 3 | [] | no_license | import os
import sys
import shlex
from shell_package.constants import *
from shell_package.builtins import *
# Dict to store our builtins and references
builtins = {}
# Add a built in command into our map
def add_command(name, action):
builtins[name] = action
# Register the builtins
def init():
add_command("... | true |
ea44677fff31e5e52c3ec32102d7f773aa865c95 | Python | MaxTyson/GH | /GH/HT_1/task_6.py | UTF-8 | 342 | 4.34375 | 4 | [] | no_license | # 6. Write a script to check whether a specified value is contained in a group of values.
# Test Data :
# 3 -> [1, 5, 8, 3] : True
# -1 -> (1, 5, 8, 3) : False
testData = [1, 5, 8, 3]
print(testData)
number = int(input('Enter a number: '))
for i in testData:
if i == number:
print('True, number {} is present... | true |
490ab87624f2ae6d80a64d0bfe80ba94c5fa6ef9 | Python | yelluri/echo-state-networks | /scripts/experiments/facebook/OwnPosts_InteractionRate/Hierarchical-II/predictFuture.py | UTF-8 | 3,302 | 2.546875 | 3 | [] | no_license | from utility import Utility
from datetime import datetime
import pandas as pd
from timeseries import TimeSeriesInterval as tsi
import numpy as np
from reservoir import ActivationFunctions as activation, HierarchicalESNI as hesni
# Dataset
directoryName = "Datasets/"
profileName = "BMW"
datasetFileName = directoryName ... | true |
5bb0533a7295122f96ddc00d5af70e958e00e046 | Python | vzmehta/BigData2016 | /py/reduce_zip.py | UTF-8 | 314 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
def parseInput():
for line in sys.stdin:
try:
yield line.strip('\n').split('\t')
except:
pass
def reducer():
agg = {}
for key,values in parseInput():
print '%s,%s' % (key,values)
if __name__=='__main__':
reducer()
| true |
b56bec33e869b9649eae979ae32da992e3d0f6c0 | Python | JamesPC44/USC_LowerDivision_Spring2019 | /gameboard/gen_input.py | UTF-8 | 235 | 3.3125 | 3 | [] | no_license | #! /usr/bin/env python3
# Justin Baum 2019
from random import randint
n = randint(15,100)
board = [[randint(0,1) for i in range(n)] for j in range(n)]
print(n)
for row in board:
for column in row:
print(column, end="")
print()
| true |
5da2be7c0e18458140f9942520c74ceba13b539f | Python | abhishek-peri/facenet_face_recogniton | /dataset_prep.py | UTF-8 | 1,163 | 2.890625 | 3 | [] | no_license | # Import OpenCV2 for image processing
import cv2
import os
def assure_path_exists(path):
dir = os.path.dirname(path)
if not os.path.exists(dir):
os.makedirs(dir)
face_id=input('enter your id')
# Start capturing video
vid_cam = cv2.VideoCapture(0)
# Detect object in video stream using Haarcascade Fro... | true |
578ff3992264256535ae1738c2a4369ab0c4c63a | Python | bmatis/time_tracker_cli | /common_functions.py | UTF-8 | 3,658 | 3.515625 | 4 | [] | no_license | from datetime import datetime, timedelta
def print_menu(options, header=""):
"""Prints a numbered list of menu options."""
if header != "":
print(header)
print("-" * len(header))
i = 1
for option in options:
print(str(i) + ". " + option)
i += 1
def convert_str_to_timede... | true |
302977783aa99d0d0ba0cff80a27f9add7780527 | Python | Rain9876/ProjectEuler | /Q61-70/Q70.py | UTF-8 | 2,376 | 4.125 | 4 | [] | no_license | # Project Euler Problem 70
# Yurun SONG
# 2019-10-12
#
# Problem 70:
# Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less tha... | true |
f5e8e87329fbd14eb7a4004d3f4e894c1ef9de5a | Python | dials/dials | /src/dials/algorithms/refinement/prediction/managed_predictors.py | UTF-8 | 6,402 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | """Managed reflection prediction for refinement.
* ScansRayPredictor adapts DIALS prediction for use in refinement, by keeping
up to date with the current model geometry
* StillsRayPredictor predicts reflections without a goniometer, under
the naive assumption that the relp is already in reflecting position
"""
... | true |
b7af3b6d59562d69d38f5e0fcde56ad09ec19736 | Python | eirtaza/CloudCrypt | /decrypt.py | UTF-8 | 633 | 2.859375 | 3 | [
"MIT"
] | permissive | import binascii
from Crypto.Cipher import AES
import os
padding = 0;
def unpad(s):
diff = len(s) % 16
global padding
padding = int (s[-diff:])
#print "Padding:" + str(padding)
s = s[:-diff]
#print "Return Length:" + str(len(s))
return s
def decrypt(k, iput, oput):
key = k
key = binascii.unhexlify(key)
f... | true |
d2103ec94a5e86861b1fc06b7bcba952e690b06b | Python | hikomat/dmenergy | /dmenergy/Guti/spain_now.py | UTF-8 | 1,552 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 15 17:49:00 2015
@author: Dániel
"""
import time
import csv
from selenium import webdriver
from bs4 import BeautifulSoup
from datetime import timedelta,datetime
driver = webdriver.Chrome(r'C:\Users\Dániel\Downloads\WinPython-64bit-3.4.3.1\chromedriver')
cdate=datetime.n... | true |
7a5f8d0292166b047dd86e157d0a9ff2316d2769 | Python | dylanlee101/leetcode | /code_week22_921_927/increasing_order_search_tree.py | UTF-8 | 1,351 | 3.765625 | 4 | [
"Apache-2.0"
] | permissive | '''
给你一个树,请你 按中序遍历 重新排列树,使树中最左边的结点现在是树的根,并且每个结点没有左子结点,只有一个右子结点。
示例 :
输入:[5,3,6,2,4,null,8,1,null,null,null,7,9]
5
/ \
3 6
/ \ \
2 4 8
/ / \
1 7 9
输出:[1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9]
1
\
2
\
3
\
4
\
... | true |
7f91e84ef41e2079af27a0c7a69ac5a94239d255 | Python | benno90/bldc_foc_python_tools | /svpwm_prototype.py | UTF-8 | 2,030 | 2.734375 | 3 | [] | no_license | import numpy as np
from definitions import *
"""
Prototype of the SVPWM switch time computation in C.
SQRT shift should be as high as possible without causing an overflow.
Using
_T_SHIFT = 11
max amplitude U = 2<<11
31 - 11 - 11 = 9
9 -> overflow
8 -> overflow
7 -> works
... | true |
d195028b523970e98f77ffc315e21ac0a6ddda08 | Python | trancongcanh/mysite | /stocks/common.py | UTF-8 | 2,111 | 3.359375 | 3 | [] | no_license | # Thay đổi format date từ dd/mm/yyyy --> yyyy-mm-dd
def change_format_date_update(date_update):
date_update_view = ""
date_update_view_list = date_update.split("/")
if (date_update != ""):
for index in range(len(date_update_view_list)):
if (index == 0) :
date_update_view ... | true |
e4b61c34acb04d706dbf03f6d9f6923f8339425c | Python | zws910/scrapy_projects | /demo/demo/spiders/xiaohuar.py | UTF-8 | 1,470 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import scrapy
from scrapy.selector import Selector, XPathSelector
from scrapy.http import Request
from demo.items import XiaohuarItem
import re
class XiaohuarSpider(scrapy.Spider):
name = 'xiaohuar'
allowed_domains = ['xiaohuar.com']
start_urls = ['http://www.xiaohuar.com/list-1-0.... | true |
22bef1186c13c3b3502c33339f73c5a335cefbd8 | Python | cqaxo/movie_trailers | /entertainment_center.py | UTF-8 | 3,564 | 3.046875 | 3 | [] | no_license | from media import Movie
from fresh_tomatoes import open_movies_page
"""
Instantiate movies here with Movie class
The args for Movie are (title, storyline, poster_image, trailer_youtube)
"""
magnolia = Movie("Magnolia",
("An epic mosaic of interrelated characters in search of "
"lov... | true |
468483e32f18c74c3c4c53be28f6504e78dbaa33 | Python | ejohn977-modvar/Data-Science-Portfolio-Scripts | /ts_clustering.py | UTF-8 | 5,516 | 2.546875 | 3 | [] | no_license | import pandas as pd
from pandas import concat
import numpy as np
import time
import sys
import os
from datetime import date
import calendar
t0 = time.time()
import psycopg2
import psycopg2.extras
from dateutil import parser
import csv
from unidecode import unidecode
import configparser
ini_file = str... | true |
fe80157b84f5c3ed5aa7e228e59594882fc24589 | Python | Mart1nDimtrov/Math-Adventures-with-Python | /07. Complex Numbers/complex.py | UTF-8 | 457 | 3.96875 | 4 | [] | no_license | from math import sqrt
def cAdd(a,b):
'''Returns the sum of two complex numbers'''
return [a[0]+b[0],a[1]+b[1]]
def cMult(u,v):
'''Returns the product of two complex numbers'''
return [u[0]*v[0]-u[1]*v[1],u[0]*v[1]+u[1]*v[0]]
def magnitude(z):
return sqrt(z[0]**2 + z[1]**2)
u = [1,2]
v = [3,4]
print(cAdd(u,v... | true |
f0c24c96f69158346180eead2f6864612ca77632 | Python | Datenworks/ggenerator | /src/lib/writers/file.py | UTF-8 | 818 | 3.140625 | 3 | [
"MIT"
] | permissive | from pandas import DataFrame
class FileWriter(object):
"""Class that receive pandas dataframe
and write it down in Json format
"""
key = 'file'
def __init__(self, formatter, specification):
self.formatter = formatter
self.specification = specification
def write(self, datafram... | true |
f4f3b6a02b507d191ee98ba454ee9167fa6bdfda | Python | bblazeka/movement-prediction | /server/clustering.py | UTF-8 | 1,711 | 2.9375 | 3 | [] | no_license | import scipy.cluster.hierarchy as hcluster
from sklearn.cluster import DBSCAN
import numpy as np
import pandas as pd
def get_cluster_id(clusters,route_id):
"""
Returns the cluster_id of a given route_id
"""
for i in range(len(clusters)):
try:
clusters[i].loc[route_id]
... | true |
9f5830ea177ee34f3d5cd73ceb18f735a0dd7b24 | Python | anton515/Stack-ADT-and-Trees | /dataStructures.py | UTF-8 | 3,675 | 3.921875 | 4 | [] | no_license | # Implementation of the Queue ADT using a Python list.
class Queue:
# Creates an empty queue.
def __init__(self):
self._qList = list()
# Returns True if the queue is empty.
def isEmpty(self):
return len(self) == 0
# Returns the number of items in the queue.
def ... | true |
f340b0f55b2be96cfeaae5cf6b20faa092b65a27 | Python | dh4gan/luce | /plot/plot_orbit.py | UTF-8 | 3,624 | 2.828125 | 3 | [] | no_license | '''
Created on Apr 16, 2013
@author: dh4gan
Plot the orbits of the bodies in the system
'''
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
from sys import argv
import io_nbody_EBM as io_nbody
def plot_orbits():
# Data file read from the command line
if len... | true |
a14325c6eed074f83c7aff596962d125ae46c499 | Python | Mar3eczek17/zdpytpol44_database-solutions_programming_ | /zad_25.py | UTF-8 | 1,803 | 3.421875 | 3 | [] | no_license | # Obsługa dużych wyników
from sqlalchemy import create_engine
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import select
engine = create_engine('sqlite:///census.sqlite')
connection = engine.connect()
metadata = MetaData()
census = Table('census', metadata, autoload=True, autoload_with... | true |
361c320c739d5237c51703591519c5daa84c08a6 | Python | daniel-reich/ubiquitous-fiesta | /ZwmfET5azpvBTWoQT_5.py | UTF-8 | 180 | 2.875 | 3 | [] | no_license |
def valid_word_nest(word, nest):
while word in nest:
if word == nest:
return True
nest = nest.split(word)[0]+nest.split(word)[1]
return False
| true |
bd081645b43a5615cff4dc401fefabf0449b3426 | Python | HKarpenko/Python | /pom.py | UTF-8 | 270 | 3.203125 | 3 | [] | no_license | def podzial(l,p,a):
x=a[l]
i=l
j=p
while i<j:
while a[j]>x: j-=1
while a[i]<x: i+=1
if i<j:
y=a[j]
a[j]=a[i]
a[i]=y
i+=1
j-=1
return j
print(podzial(0,3,[3,1,4,2]))
| true |
b0b72f48e4a6a4f68dd9948cda4f0ddb598c96e7 | Python | avfael/dash-ibov | /app.py | UTF-8 | 2,557 | 2.84375 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import plotly.express as px
import yfinance as yf
st.set_page_config(layout="wide")
st.title('Dashboard Financeiro - Código Quant')
periodo_box = st.sidebar.selectbox(
"Variação",
("Diária", "Semanal", "Mensal")
)
st.header("Variação "+periodo_box)
@st.cache
def ge... | true |
1373854d25db380c9fc8f6d1d8c428eaeb603c4c | Python | flagz404/radio-id-bot | /app/player.py | UTF-8 | 10,267 | 2.828125 | 3 | [] | no_license | import asyncio
import discord
import random
from discord.ext import commands
from .utils import (
is_valid_url, Stations, Playing
)
class RadioPlayer(commands.Cog):
def __init__(self, bot, prefix):
self.bot = bot
self.prefix = prefix
self.playing = Playing()
self.stations = St... | true |
718d45d43ff3c4fa3890496b78705a51a108ef33 | Python | allrod5/injectable | /tests/unit/common_utils_unit_test.py | UTF-8 | 1,139 | 2.625 | 3 | [
"MIT"
] | permissive | from injectable.common_utils import get_dependency_name, get_caller_filepath
class TestGetCallerFilepath:
def test__get_caller_filepath__with_1_step_back(self):
# given
expected = __file__
# when
filepath = get_caller_filepath(steps_back=1)
# then
assert filepath ... | true |
96be7b6bcc072863217cccb392884c4f3c21c35d | Python | kalpnilanjan/Simplex2Vec | /Simplex2Vec/Simplex2Vec.py | UTF-8 | 16,889 | 2.703125 | 3 | [] | no_license | #! usr/bin/python3
import warnings
import os
import networkx as nx
import numpy as np
import pickle as pkl
import random
from platform import python_version
from multiprocessing import Pool
from tqdm import tqdm_notebook
from gensim.models import Word2Vec
from copy import deepcopy
from joblib import Parallel, delaye... | true |
d235b2b141e2cc5a4b3c5a65ebd5cc794f006fad | Python | otterchurchill/Naive-Bayesian | /clickBays.py | UTF-8 | 2,124 | 3 | 3 | [] | no_license | def getCompPrediction(Input,click,listcur,total):
Input = zip(head,Input)
guessVal = 1 #will eventually be our guess
Nsamples = float(listcur[('click',click)])
probOverall = Nsamples / total
#print probOverall
for i,element in enumerate(Input):
if i != 0:
#print element,... | true |
ff1d8989dada731b6f2ac703e1b25ca999274892 | Python | atomextranova/leetcode-python | /BFS/Graph/Clone Graph/brute_force.py | UTF-8 | 1,211 | 3.5625 | 4 | [] | no_license | class UndirectedGraphNode:
def __init__(self, x):
self.label = x
self.neighbors = []
class Solution:
"""
@param: node: A undirected graph node
@return: A undirected graph node
"""
def cloneGraph(self, node):
# write your code here
if not node:
return... | true |
34342f526950e580cd5bbab183a0eb4a3911c00a | Python | walkccc/LeetCode | /solutions/1017. Convert to Base -2/1017.py | UTF-8 | 181 | 2.65625 | 3 | [
"MIT"
] | permissive | class Solution:
def baseNeg2(self, n: int) -> str:
ans = []
while n != 0:
ans.append(str(n & 1))
n = -(n >> 1)
return ''.join(ans[::-1]) if ans else '0'
| true |
ad46c53dda11bc1cc42c9010d6a008436f1b5d23 | Python | rdenham/pymcmc | /examples/using_pymcmc_efficiently.py | UTF-8 | 5,105 | 2.703125 | 3 | [] | no_license | ## Using PyMCMC efficiently
## we use the same program as for example2
## but replace logl function:
import os
from numpy import random, loadtxt, hstack
from numpy import ones, dot, exp, zeros, outer, diag
from numpy import linalg, asfortranarray
from pymcmc.mcmc import MCMC, RWMH, OBMC
from pymcmc.regtools import Bay... | true |
3d1323e1470c6fdb1e2f2d6057c0a11f03e9eb3c | Python | seonghwii/Computer-Vision | /histogram.py | UTF-8 | 2,642 | 3.328125 | 3 | [] | no_license | """
[히스토그램/이진화 구현]
명암 값이 각각 영상에 몇 번 나타나는지 가시적으로 나타내기 위해 히스토그램을 사용한다.
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
#사진 가져오기
img = cv2.imread("img2.jpg", cv2.IMREAD_GRAYSCALE)
gray = img.copy()
#numpy library 사용한 histogram 구현
hist_src = np.bincount(... | true |
8a9cceede82161422a43e8905b7812468a3039df | Python | dylanjorgensen/modules | /(custom)/cmd/ls.py | UTF-8 | 3,449 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
#download this script
# This is essentially equivalent to `ls -ld --color=auto`
# Note most of the comments contain links to more info
#get library modules
import sys, stat, os
import grp, pwd
import locale
import time
#simple command line processing to get files (if, list)
if len(sys.argv) ==... | true |
4158c574fb0caa32e87c907af0b8e3e7ca72a5b5 | Python | rachana-uniyal/Zelthy_Assignment | /Module2/dictionary_search.py | UTF-8 | 902 | 3.875 | 4 | [] | no_license | import requests
class Dictionary:
def __init__(self,word):
self.url = "https://api.dictionaryapi.dev/api/v2/entries/en_US/"
self.Word = word
# Function to search a given word in dictionary
def search(self):
if not self.Word:
print("Please enter a valid input")
return
response = requests.get(self... | true |
9c99c1da8660162c20e68e84ab514e518d87dae7 | Python | jodalysherrera/CSSI2018 | /CSSI/Python/states.py | UTF-8 | 611 | 3.140625 | 3 | [] | no_license | states = {
'CA':'california',
'AZ':'arizona',
'AK':'arkansas'
}
for state in states:
print(' %s is the abbreviation for %s' % (state,states[state]))
store_prices = {
'cereal': 2.00,
'stapler': 1.50,
'fiber-optic': 25.00,
'lambo':75000
}
store_inventory = {
'cereal': 750,
'sta... | true |