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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c489ef40028c06de24d8293c78498b0ee22c717e | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1_neat/16_0_1_WEDEMBOYZ_a.py | UTF-8 | 669 | 2.53125 | 3 | [] | no_license | f = open("A-large.in", "r")
j = open("o.out","w")
cases = map(int, f.read().strip().split())
for kjas in xrange(cases[0]):
sleep = ['1','2','3','4','5','6','7','8','9','0']
num = cases[kjas+1]
calculate = 0
if num == 0:
j.write("Case #" + str(kjas+1) + ": INSOMNIA\n")
else:
x = 1
... | true |
9068b03263f8a42179fca1face1621cbec64b8c4 | Python | avi09/LeetCode | /median-2-sorted-arrays.py | UTF-8 | 1,059 | 2.796875 | 3 | [] | no_license | class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
m = len(nums1)
n = len(nums2)
if nums1==[] and nums2==[]:
return 0
x1 = -1
x2 = -1
while (x1+x2+2)<((m+n+1)//2):
print((m+n+1)//2, x1+x2+2, ... | true |
c786c60ddacd9cd43400e85b677f95a1b8c0781b | Python | scaryclam/sqlfluff | /src/sqlfluff/parser_2/grammar.py | UTF-8 | 44,104 | 3 | 3 | [
"MIT"
] | permissive | """ Definitions for Grammar """
import logging
from .segments_base import BaseSegment, verbosity_logger, check_still_complete
from .segments_common import KeywordSegment
from .match import MatchResult, join_segments_raw_curtailed
from ..errors import SQLParseError
from ..helpers import get_time
class BaseGrammar(obj... | true |
9c696d9108f9b7c91bba51895f6b3dcf20823f00 | Python | koyo922/leetcode | /p24_swap_nodes_in_list.py | UTF-8 | 972 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 expandtab number
"""
给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。
你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
示例:
给定 1->2->3->4, 你应该返回 2->1->4->3.
Authors: qianweishuo<qzy922@gmail.com>
Date: 2019/6/30 下午10:43
"""
class Solution(object):
def swapPairs(self, h... | true |
288e0a553c9054615491b302a37bb6192a59ac3d | Python | snelson3/pokemon-red-proc-randomizer | /randomizer.py | UTF-8 | 1,531 | 2.53125 | 3 | [] | no_license | import os, subprocess, shutil, time, random, sys
from Logger import Logger
from ArgumentProcessor import ArgumentProcessor
class Randomizer(ArgumentProcessor):
def __init__(self):
ArgumentProcessor.__init__(self)
self.logname = 'recent.log'
self.gamedir = ''
self.seed = int(time.tim... | true |
9dcfa4b878be3db4e184cb4e28ea1406ce5d682d | Python | dresen/sphinx_setup | /setup_sphinx_db.py | UTF-8 | 4,843 | 2.765625 | 3 | [] | no_license | # -*- coding: iso-8859-15 -*-
'''
Created on Dec 6, 2011
@author: akirk
Does not handle audio files!
'''
import os, sys, codecs
from extract_freq_list import extract_freq_list
from extract_pron_dic import extract_dic
from phone_from_dic import extract_phones
from extract_transcription import extract_transcription
... | true |
4a51eee1c7eeeb919d43846645b4621fa1d6bad3 | Python | devsh4/ml-projects | /digit recognizer/digitrecog.py | UTF-8 | 2,072 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 7 19:23:41 2017
@author: Dev Shah
"""
#DIGIT RECOGNIZER
import argparse
import sys
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
FLAGS = None
def main(_):
# Import data
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot... | true |
1140ddd97d57d7273ade7496d6bc807d08bf40c7 | Python | yekang-wu/omega-miya | /omega_miya/utils/dice_utils/dice.py | UTF-8 | 2,734 | 2.984375 | 3 | [
"Python-2.0",
"MIT"
] | permissive | """
@Author : Ailitonia
@Date : 2021/07/18 1:28
@FileName : dice.py
@Project : nonebot2_miya
@Description : 掷骰核心
@GitHub : https://github.com/Ailitonia
@Software : PyCharm
"""
import re
import random
import asyncio
from typing import List, Dict
from dataclasses import ... | true |
8104b1b87783761520cd2f9f8ae2d166141d1d5b | Python | necrocry/Copy-of-DBL-HTI-Webtech-Project | /flaskr/networkGraph.py | UTF-8 | 3,632 | 2.546875 | 3 | [] | no_license | from os.path import abspath
from flask import Blueprint
from flask import render_template
import os ,sys
import json
from pyvis.network import Network
import pyvis.options
import pandas as pd
from werkzeug.utils import secure_filename
import numpy as np
from bokeh.io import show
from bokeh.models import BasicTicker... | true |
2b43f8c3886326eb5ebfb7ad8d628aa4cf801f21 | Python | attikis/programming | /python/python_logFileParser.py.apache | UTF-8 | 1,956 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
# Permissions : chmod +x fileName.py
# To launch : python fileName.py OR ./fileName.py
# Definition : Example of how to parse a logfile
'''
Usage:
python_logFileParser.py someLogFile
Description:
This script takes one command line argument (name of log-file to parse) and it parses it
... | true |
5bb1abee1fa35a8ad7921233cf23e20f68891614 | Python | huchuhuchu/pythonProject | /01 사진 모으기/example1.py | UTF-8 | 552 | 2.984375 | 3 | [] | no_license | import requests
# request 패키지 연습 - 웹에서 이미지 다운받기
# img url
url = "https://cdnb.artstation.com/p/assets/images/images/026/481/707/large/santiago-chavarriaga-render-bmo.jpg?1588884436"
# 서버로 url 요청
img_response = requests.get(url)
# 요청 성공
if img_response.status_code == 200:
# 이미지 바이너리 파일 출력
# print(img_respons... | true |
94a272025fc7a96b71f8d9719488d6bb04822f06 | Python | imonsan2002/Programacion | /P7 nº de ceros.py | UTF-8 | 205 | 3.703125 | 4 | [] | no_license | n = int(input("cantidad numeros? ="))
j=0
for i in range(1, n+1):
x = int(input("dime el " + str(i) + "ºnumero"))
if (x==0):
j=j+1
print("+un 0")
else:
print("no es 0")
print(j)
| true |
7b74e50be20238181b0c80c9c88a41046a741246 | Python | nappaillav/ML_homework | /ift6390/Nearest_neighbour/solution.py | UTF-8 | 7,586 | 2.828125 | 3 | [] | no_license | import numpy as np
# import matplotlib.pyplot as plt
######## DO NOT MODIFY THIS FUNCTION ########
def draw_rand_label(x, label_list):
seed = abs(np.sum(x))
while seed < 1:
seed = 10 * seed
seed = int(1000000 * seed)
np.random.seed(seed)
return np.random.choice(label_list)
#################... | true |
f20e972a9978e4068d2df30fd53b10a35aab610b | Python | Jafmitch/AI_HW3 | /Question2/hw3_2.py | UTF-8 | 8,501 | 2.96875 | 3 | [] | no_license | """
- File: hw3_2.py
- Author: Jason A. F. Mitchell and Eric Tulowetzke
- Summary: This is the main module for homework 3 problem 2.
"""
import data_io as io
import graph_wrapper as gw
import math
import numpy as np
import policy as pie
import random as rand
COOLING_FACTOR = 0.1
INITIAL_TEMPERATURE = 3000
MAP_X = 50
M... | true |
fc895fee0fcff1a54a84b88e16f3836f9f313382 | Python | Teslim-Kehinde/Practice | /continuation.py | UTF-8 | 286 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 4 07:30:11 2020
@author: KEHINDE TESLIM
"""
def add(x,y):
return(x+y)
def addd(func,x,y):
return func(func(x,y),func(x,y))
a=int(input("Enter a number: "))
b=int(input("Enter second number: "))
plus = add
print(addd(plus,a,b))
| true |
d4fb3b5bfc23ba119aa4f953f79e9c53e02475d5 | Python | Saradhakal/MachineLearning | /1SVM.py | UTF-8 | 4,539 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import svm
from sklearn.svm import SVC
from sklearn.decomposition import PCA
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.metrics impor... | true |
9015d88a5cccb75a9ba5ab2ee26f20335e0557e9 | Python | allenbao64/Shoot | /cards.py | UTF-8 | 1,998 | 3.484375 | 3 | [] | no_license | def getCardDict(): # returns a dictionary matching each card ID to the card's name
cardDict = {
0: "Dummy", # no code
1: "Give Dummy", # in game_display
2: "Enhancement", # below
3: "Shield", # below
4: "Super Shield", # in battle_state
5: "Clairvoyant", # in... | true |
c49bbe85442e1e6ad2952bb4f6a8791b242e3f5c | Python | srnovak13/Python-Projects | /databaseAssn/db_assignment.py | UTF-8 | 745 | 3.015625 | 3 | [] | no_license | import sqlite3
# create database 'test'
conn = sqlite3.connect('test.db')
#creating a table called 'tbl_files'
with conn:
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS tbl_files(\
ID INTEGER PRIMARY KEY AUTOINCREMENT,\
col_name TEXT\
)")
conn.commit()
conn... | true |
d4429af8c225e977690ddd38ee66c2fd7f7a0753 | Python | usantamaria/IPM-407_Fast_algorithms | /cvalenzuela/project3/code/test_threads.py | UTF-8 | 2,609 | 2.703125 | 3 | [] | no_license | import numpy as np
import fastree
import time
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
np.random.seed(0)
N= 40000
eps=1e-10
theta = 0.5
max_n = 10
p = np.... | true |
44e3e9d9430042508d95f59af044998abf6a53db | Python | eirikgje/cmb_analysis | /utils/file_utils.py | UTF-8 | 1,019 | 2.703125 | 3 | [] | no_license | from scipy.io import FortranFile
import numpy as np
def read_covmat(fname):
with FortranFile(fname) as f:
n = f.read_ints(dtype=np.int32)
ordering = f.read_ints(dtype=np.int32)
polarization = f.read_ints(dtype=np.int32)
mat = []
for i in range(n[0]):
mat.append(f... | true |
177f41f13e918b47155f1c454bbbdabd52bed8a5 | Python | Iamkosgei/python-hashing-code-snippet | /encrypt_one.py | UTF-8 | 206 | 2.984375 | 3 | [
"MIT"
] | permissive | import bcrypt
def hash_token(token):
return bcrypt.hashpw(token.encode(), bcrypt.gensalt())
def check_token(plain_token, hashed_token):
return bcrypt.checkpw(plain_token.encode(), hashed_token)
| true |
62d668c35a012c51f27ada1113dac5ecafb2fb03 | Python | jamie0618/ML_project | /perceptron/perceptron.py | UTF-8 | 2,547 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 16 16:58:17 2017
@author: melon
perceptron learning example
"""
import numpy as np
import matplotlib.pyplot as plt
import random
class Perceptron():
def __init__(self, max_iter = 1000):
self.max_iter = max_iter
self.w = []
self.b = 0
... | true |
c4a4f67a58944cea9c9d4ea316af7271ae0299a7 | Python | rajeshb/SelfDrivingCar | /T1P3-Behavioral-Cloning/generator.py | UTF-8 | 1,951 | 2.8125 | 3 | [
"MIT"
] | permissive | import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import settings
import utils
from collections import Counter
from sklearn.model_selection import StratifiedShuffleSplit
# data generator class
class DataGenerator:
def __init__(self, settings, dataloader):
... | true |
61b057b4e358e0b04197ce477ca639f2ec040896 | Python | qhuydtvt/c4e21 | /lab2/dantri.py | UTF-8 | 803 | 2.984375 | 3 | [] | no_license | # 1.1 Open connection to page
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pyexcel
url = "https://dantri.com.vn"
conn = urlopen(url)
# 1.2 Read data
raw_data = conn.read()
# 1.3 Decode data
html_page = raw_data.decode("utf-8")
# 1.4 Save data to file
# 1.4.1 Open connection to file
# 1.4.... | true |
6b65b88cf573448de8a66d88379463b4211f4620 | Python | Lisooo/TransactionDownloader | /transactions_downloader/main.py | UTF-8 | 1,682 | 2.515625 | 3 | [] | no_license | from transactions_downloader.pages import UserPassPage, HomePage
from transactions_downloader.drivers import FirefoxDriver
from transactions_downloader.import_log.utils import ImportLog
from transactions_downloader.connections import HomeBudgetConnection
from transactions_downloader.files.utils import FileUtils
from tr... | true |
0943cea02d34b1d520d891241319f12613984397 | Python | CasvandenBogaard/home-depot | /feature_extraction/textual.py | UTF-8 | 4,778 | 2.9375 | 3 | [] | no_license | import pandas as pd
class ProductDescription:
def __init__(self, descriptionDF):
self.descriptionDF = descriptionDF
def extract(self, df):
tempdf = pd.merge(df, self.descriptionDF, how='left', on='product_uid')
df['product_description'] = tempdf['product_description']
class BrandNames... | true |
d07431587c918dd2d4669b24fed48e684be30ff3 | Python | Whalepool/wpcoingecko | /wpcoingecko/coins.py | UTF-8 | 8,513 | 2.765625 | 3 | [] | no_license |
# Coins
# https://www.coingecko.com/api/documentations/v3#/coins
class Coins:
def coins_list(self):
"""
def coins_list(self):
https://www.coingecko.com/api/documentations/v3#/coins/get_coins_list
Use this to obtain all the coins’ id in order to make API calls.
Arguments:
None
Returns:
dict r... | true |
0c73f7015d0e8315711e73250c56033a2a90e35e | Python | comp-think/comp-think.github.io | /exercises/development/intermediate/exercise_3.py | UTF-8 | 1,590 | 3.09375 | 3 | [
"CC-BY-4.0",
"ISC",
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... | true |
7ed35959d7a62d8427c49762905bce4e633e28e0 | Python | ilyaphlk/ADR_crosslingual | /ADR_crosslingual/data/splitter.py | UTF-8 | 3,990 | 2.765625 | 3 | [] | no_license | import os
import sys
from glob import glob
import numpy as np
from shutil import copy2
from dataclasses import dataclass
@dataclass
class Fold:
path: str = None
share: float = None
size: int = None
class BratSplitter:
def __init__(self, texts_dir, annotations_dir, out_dir, train_share, test_share,
... | true |
90e25ca8134841fae3c29452da16ce108dfed9c8 | Python | AnanthKumarVasamsetti/ML_Projects | /cancer_analysis_OOP/cancer_analysis_through_binary_clssification.py | UTF-8 | 1,026 | 2.859375 | 3 | [] | no_license | from sklearn import datasets
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import numpy as np
from random import shuffle
from My_Logistic_regression import Logistic_regression
def main():
cancer_data = datasets.load_breast_cancer()
X_train, X_test, y_train, y_test = trai... | true |
3976c48c0296b258d821dd5d204888c0f6b84b51 | Python | sanemguzeller/dse-github | /tests/test_user.py | UTF-8 | 909 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from github import Github
from github import NamedUser
from github.GithubException import UnknownObjectException
from mock import MagicMock
from mock import patch
import dsegithub.user
import unittest
class UserTestCase(unittest.TestCase):
def setUp(self):
pass
@patch.object(Gi... | true |
5ec5fec6f385718b48b8fdc78f4bdd238e8b30c1 | Python | Priyankakosalge/food-ordering-app | /NEW FOOD APP.py | UTF-8 | 7,044 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
class restraunt():
list_of_admins={'username':'admin','password':'admin'}
list_of_item=[]
def admin():
username=input('enter the username')
password=input('enter the password')
if (username in restraun... | true |
093613ebe1a848da5efa348de3c0e2d0c497f278 | Python | Aurgil-cesi/tpQuentinPython | /exercices/utils/input_utils.py | UTF-8 | 837 | 3.5625 | 4 | [] | no_license | import re
def input_number(texte):
right = False
entry = None
while not right:
entry = input(texte)
try:
entry = int(entry)
right = True
except:
pass
return entry
def input_number_range(texte, start, stop):
right = False
entry = None
... | true |
d9744e1de7baf0f27047e0e1f57463d851a6d357 | Python | cry999/AtCoder | /beginner/073/A.py | UTF-8 | 182 | 3.390625 | 3 | [] | no_license | def september9(N: int)->bool:
return N % 10 == 9 or (N//10) % 10 == 9
if __name__ == "__main__":
N = int(input())
yes = september9(N)
print('Yes' if yes else 'No')
| true |
efbe343d8d723d8c8b905aa5caf8d1d863b071c9 | Python | rcox771/adapterbot | /utils/WEA_retriver.py | UTF-8 | 2,714 | 2.671875 | 3 | [] | no_license | import requests
import pprint
from datetime import datetime
from datetime import date
from collections import defaultdict
from iso3166 import countries
import calendar
import geograpy
import pycountry
def most_frequent(List):
return max(set(List), key = List.count)
def _get_weather(city="",country="",lon=0, l... | true |
f194f4668d26bb408d46258a06c36b727b91e1a8 | Python | KazuoKitahara/challenge | /cha43.py | UTF-8 | 306 | 3.765625 | 4 | [] | no_license | def f(x, y, z, a=0.1, b=0.08):
"""
Returns (x+y)*a+z*b
:param x: int.
:param y: int.
:param z: int.
:param a: float default is 0.1.
:param b: float default is 0.08.
:return the float sum of (x+y)*a and z*b
"""
return (x+y)*a+z*b
print(f(3,2,4))
#0.8200000000000001
| true |
b9a741105ca865e0cc83f40f2b82618be87980d8 | Python | dohcgle/pdp_tutorial | /lesson2/ab.py | UTF-8 | 23 | 2.765625 | 3 | [] | no_license | a = 6
b = 78
print(a+b) | true |
1d4ddcbf6ff7e2a4eb114d34c0ec6dd01958144a | Python | daimessdn/belajarnumpy | /5-perkalian-matriks.py | UTF-8 | 310 | 3.765625 | 4 | [] | no_license | import numpy as np
a = np.array([[1, 2],
[3, 4]])
b = np.ones((2, 2))
print(a)
print(b)
# perkalian matriks
## (element-wise product)
c = a * b
print("matriks a * b")
print(c)
# perkalian matriks
## dot product
d1 = np.dot(a, b) # atau
d2 = a.dot(b)
print("matriks a . b")
print(d1)
print(d2)
| true |
266df15aecde59dc992d054bf59de2f06bae1631 | Python | gaochuan2017/testcode | /learn_np/learn_sort.py | UTF-8 | 652 | 2.875 | 3 | [] | no_license | import numpy as np
import torch
'''
a = np.random.randint(low =1,high = 100,size =(5,21))
a = torch.from_numpy(a)
print(a)
i,j = a.max(1)
print(i,i.unsqueeze(1))
print(torch.isfinite(j).all(1))
print(i.all())
'''
a = torch.zeros((3,2,4))
b = torch.Tensor([1,2,3]).view(3,1,1)
print(a)
print(b)
print(torch.add(a,b))
'''
... | true |
abb1ae8667b47a05b95084ba7ac7a8aa0db23ee8 | Python | nanaboat/data-structures | /Cerner/Patients/Allergy.py | UTF-8 | 142 | 2.890625 | 3 | [] | no_license | import Severity
class Allergy:
def __init__(self, name: str, severity: Severity):
self.name = name
self.severe = severity | true |
4002e314d84cd6cdb9be367c33d2a5b574e3e917 | Python | Shamabanu/python | /average of numbers.py | UTF-8 | 92 | 2.890625 | 3 | [] | no_license | n=int(input())
a=[]
for i in range(0,n):
a.append(int(input()))
k=(sum(a))/(n)
print(k)
| true |
01c82111a6d9a27e7ce375041e230aef7c04b495 | Python | nischalshrestha/automatic_wat_discovery | /Notebooks/py/erikalien/a-method-to-handle-ordered-categorical-features/a-method-to-handle-ordered-categorical-features.py | UTF-8 | 3,800 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# The main purpose of this notebook is to share a trick to handle ordered categorical features, so if you want to learn more about EDA, model selection, tuning hyperparameters, and so on, I recommend you to this [great kernel](https://www.kaggle.com/serigne/stacked-regressions-top... | true |
7d4d1dd33d6bfeb06165daaf52e2db3863a2f8df | Python | yaras/BCalc | /bcalc/config.py | UTF-8 | 1,224 | 2.765625 | 3 | [
"MIT"
] | permissive | import os
import json
class Config():
def __init__(self, path='config.json'):
if not os.path.isabs(path) and not os.path.exists(path):
venv = os.environ.get('VIRTUAL_ENV')
if venv:
path = os.path.join(venv, path)
with open(path, encoding='utf8') ... | true |
a7704242160e7da1d773d16010183dd8d36eca6a | Python | tbb/dlcourse_ai | /assignments/assignment3/model_solution.py | UTF-8 | 3,803 | 2.984375 | 3 | [
"MIT"
] | permissive | from collections import OrderedDict
import numpy as np
from layers_solution import (
FullyConnectedLayer, ReLULayer,
ConvolutionalLayer, MaxPoolingLayer, Flattener,
softmax, softmax_with_cross_entropy, l2_regularization
)
class ConvNet:
"""
Implements a very simple conv net
Input -> Con... | true |
eb05f3508adf3c61bb2dfac5b6285860d66bf53d | Python | john911120/Java_ToyProject | /File_Controller_Tools(Python)/Example_Code/Day2/Time/exec_Runtime_Calulate.py | UTF-8 | 403 | 3.359375 | 3 | [] | no_license | from datetime import datetime
start = datetime.now()
print('1에서 1000000까지 더한다.')
ret = 0
for i in range(1000001):
ret += i
print('1에서 1000000까지 더한 결과 : %d' %ret)
end = datetime.now()
elapsed = end - start
print('총 소요된 시간 : ', end='');print(elapsed)
elapsed_ms = int(elapsed.total_seconds()*1000)
print('... | true |
f0c275f1aef8351ad1d8ac93e46a4f1b8cb91dab | Python | zhoujf2010/MyWZGame | /mysocket.py | UTF-8 | 2,519 | 2.609375 | 3 | [] | no_license | '''
Created on 2019年3月21日
@author: zjf
'''
import websocket
import json
import time
import base64
import sys
import os
import psutil
import socket
import threading
import sys
from time import ctime
class mySocket():
def __init__(self,msgcallback):
self.msgcallback = msgcallback
self.clientL... | true |
e42abed344b022db9e52e7ce3aab3818322afc0e | Python | deepzsenu/competetive_programming_python | /Code_chef/G_S_P_C/IS_BOTH_OR_NOT.py | UTF-8 | 168 | 3.34375 | 3 | [] | no_license | # cook your dish here
num = int(input())
if num%5==0 and num%11==0:
print("BOTH")
elif num%5==0 or num%11==0:
print("ONE")
else:
print("NONE")
| true |
56589c6259d60d9bbd670e24d89fe5bb55e7f0a4 | Python | harishdurga/python-tic-tac-toe | /classes/TicTacToe.py | UTF-8 | 8,112 | 3.75 | 4 | [] | no_license | from interfaces import TicTacToeInterface
import random
class TicTacToe(TicTacToeInterface):
def __init__(self) -> None:
self.__player_one = None
self.__player_two = None
self.__turn = ''
self.__game_board = {
'1': ' ',
'2': ' ',
'3': ' ',
... | true |
806fb7f3e7d82849627cbab4180b044367d11238 | Python | cassio12/primeiros-passos-no-Python | /desafio2.py | UTF-8 | 246 | 3.375 | 3 | [] | no_license | valordoHD = int(input('qual o valor do hot dog? '))
nomeCliente = input('qual o nome do cliente? ')
quantidade = int(input('quantos hot dogs? '))
total = valordoHD * quantidade
print(total)
print('o valor do seu pedido é R$ ' + str( total) ) | true |
6ff730cab328ccd21da85f48b0660c4df0585c37 | Python | jiyabing/learning | /开班笔记/python网络编程及MySQL部分/day30/code/wait.py | WINDOWS-1252 | 320 | 2.640625 | 3 | [] | no_license | #coding:gbk
import os,sys
from time import sleep
pid = os.fork()
if pid < 0:
print('Create process failed')
elif pid == 0:
print('ӽ̵PID:',os.getpid())
sleep(2)
sys.exit(3)
else:
p,status = os.wait()
print(p,status)
print(os.WEXITSTATUS(status))
while True:
pass | true |
ce76e1b0fc18ab336eebcd195da1e10b1867c8a6 | Python | tianshang486/Pythonlaonanhai | /day34 课堂笔记以及代码/day34/2.异步阻塞.py | UTF-8 | 1,492 | 2.671875 | 3 | [] | no_license | import requests
from multiprocessing import Process,Queue
url_dic = {
'cnblogs':'https://www.cnblogs.com/Eva-J/articles/8253549.html',
'douban':'https://www.douban.com/doulist/1596699/',
'baidu':'https://www.baidu.com',
'gitee':'https://gitee.com/old_boy_python_stack__22/teaching_plan/issues/IXSRZ',
}
... | true |
30039912c3f2278d311d60da050a34febe3b238c | Python | Ge-shi/LeetCode_python | /easy/572. 另一个树的子树.py | UTF-8 | 905 | 3.671875 | 4 | [] | no_license | class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def isSubtree(s: TreeNode, t: TreeNode) -> bool:
flag = False
if s is not None and t is not None:
if s.val == t.val:
flag = subTree(s, t)
if flag == False:
... | true |
3acadcadb14c8a5f5bb36d78e574123c01915371 | Python | jancervenka/tdd | /lists/views.py | UTF-8 | 1,489 | 2.78125 | 3 | [] | no_license | from django.shortcuts import render, redirect
from django.http import HttpResponse
from lists.models import Item, List
# Create your views here.
# home_page function
def home_page(request):
return render(request, 'home.html')
# for the '/lists/{list_id}/'
def view_list(request, list_id):
list_ = List.objects.ge... | true |
61c4851bf9b34bfa2fbf45fc7358e9d024a6c7d7 | Python | Shivvrat/Decison-Trees | /dt_entropy_reduced_error_post_pruning.py | UTF-8 | 22,611 | 3.265625 | 3 | [
"MIT"
] | permissive | import os
import numpy as np
import pandas as pd
import copy as copy
"""
This function is used to import the data. Put the data in a folder named all_data in the directory of the code
"""
def import_data(dt_name):
"""
:param dt_name: Name of the Dataset
:return: Three pandas frames which... | true |
8c15721bedcecac8fc5110008c00ed585b8ab090 | Python | sirhouses/Hacking-Python | /ackscapy.py | UTF-8 | 2,386 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
ANÁLISIS DE VULNERABILIDADES
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""... | true |
ded62c5622095706b77bcca7c21b0e0efbd8b4e7 | Python | VictorSimao/TrabalhosPython | /Estudo/GameArena/view/console_view.py | UTF-8 | 1,097 | 2.71875 | 3 | [] | no_license | import sys
sys.path.append('Estudo/GameArena')
from time import sleep
from dao.heroi_db import HeroiDb
from dao.inimigo_db import InimigoDb
from controller.luta_controller import LutaController
import os
clear = lambda: os.system('cls')
luta = LutaController()
while True:
clear()
luta.layout()
print('\... | true |
813ea433d08aa50f2fad0eba1d98cd45abd19783 | Python | Aasthaengg/IBMdataset | /Python_codes/p03631/s091359823.py | UTF-8 | 232 | 2.859375 | 3 | [] | no_license | import sys
import os
def main():
if os.getenv("LOCAL"):
sys.stdin = open("input.txt", "r")
a, b, c = str(sys.stdin.readline().rstrip())
print("Yes" if a == c else "No")
if __name__ == '__main__':
main()
| true |
61bbb0766455ca5d5813ed9c24dd642cadb48a11 | Python | BasileiosKal/SocialNetworks-Project | /MaxPath Monte Carlo/MonteCarlo_utils.py | UTF-8 | 1,817 | 3.015625 | 3 | [] | no_license | from collections import defaultdict
import time
import numpy as np
def reachable_set(graph, source):
""" Get the reachable set of the source user in the graph using DFS """
R = []
R = find_path(graph, source, R)
return R
def find_path(graph, source, R):
""" Helping function to run DFS on the Gr... | true |
d25d99c7173c88396d16ef0d3672fd479ad09054 | Python | jenifer-tech/BLOOD-BANK | /bloodbankfinalchange.py | UTF-8 | 5,280 | 2.578125 | 3 | [] | no_license | from flask import Flask,request,jsonify
import json
import pymysql
import re
app=Flask(__name__)
def db_connection():
conn=None
try:
conn=pymysql.connect( host='sql12.freemysqlhosting.net',
database='sql12375682',
user='sql123... | true |
fb4887893be7a474eb6f5d82af54f3cf2a426323 | Python | zacharesmer/synaTudor | /pydrv/tudor/driver/drvcmd/capture.py | UTF-8 | 1,191 | 2.734375 | 3 | [] | no_license | from .cmd import *
from .context import *
import matplotlib.pyplot as plt
import tudor.sensor
@cmd("capture_images")
class CmdCaptureImages(Command):
"""
Captures images from the sensor
Usage: capture_images <number of images>
"""
def run(self, ctx : CmdContext, args : list):
if len(args)... | true |
ff8bc1d5a9a8cd80778e65f8a4bbb5e3a2cd16f1 | Python | JoraKaryan/Repository_600 | /Home-01/ex-8.py | UTF-8 | 241 | 3.3125 | 3 | [] | no_license | #ex-8
mylist = [4,2,1]
def foo(l):
for i in range(1,len(l)+1):
if len(l) == max(l):
return max(l)+1
if i not in l:
return i
if len(l) == 0:
return 1
print(foo(mylist))
| true |
fc088eb5185ce8b80396a2eaaf985bf94fc127b1 | Python | Submitk/face-recognition | /sqlTest.py | UTF-8 | 2,604 | 3.15625 | 3 | [
"LicenseRef-scancode-mulanpsl-2.0-en",
"MulanPSL-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import mysql.connector
import time
import re
##判断表是否存在
def table_exists(con,table_name):
sql = "show tables;"
con.execute(sql)
tables = [con.fetchall()]
table_list = re.findall('(\'.*?\')',str(tables))
table_list = [re.sub("'",'',each) for each in table_list]
if table_name in table_l... | true |
a57dbb2d1c354b8876df91a27b6af6bbecbf599d | Python | rmn7/ProjectEuler | /38.py | UTF-8 | 499 | 2.859375 | 3 | [] | no_license | def pand(z):
f=False
if len(z)!=9 and '0' in z:
f=False
else:
for i in xrange(1,10):
if len(z.split(str(i)))==2:
f=True
else:
f=False
break
return f
ma=0
for i in xrange(1,10000):
n=1
z=''
... | true |
a4d6c178167b1053a8f8ebfbb273955d1ea4e179 | Python | aaandrew152/FiniteStateAutomaton | /Objects/Player.py | UTF-8 | 1,135 | 3.3125 | 3 | [] | no_license | from random import randint
from Objects.Plan import Plan
from Parameters import game
class Player(object):
'''
A single person who is in the game with their strategies
'''
def __init__(self, plan=None):
'''
Sets up a player with the default strategy or a random strategy if none is prov... | true |
f58097c016d5e125198fd4f1120e4ebf83610de1 | Python | alexandraback/datacollection | /solutions_2645486_0/Python/Solaris/problem_2_v2.py | UTF-8 | 2,818 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
import os
import sys
import time
verbose = 0
tStart = time.time()
filename = 'input.txt'
filename = 'B-small-attempt3.in'
ifile = open(filename)
data = ifile.read()
ifile.close()
lines = data.splitlines()
n_cases = int(lines[0])
lines = lines[1:]
print '\n n_cases = ', n_cases
#-------... | true |
d0ed7beda7768550b80dcd58f152c771aa7cbecb | Python | lpavel/Program-Recognition | /CacheParser.py | UTF-8 | 1,549 | 2.796875 | 3 | [] | no_license | from __future__ import print_function
import os
class CacheParser:
def __init__(self, fileNameTrace, fileNameOut):
self.fileNameOut = fileNameOut
self.fileNameIn = fileNameTrace
def parse(self):
print("printing file: " , self.fileNameOut)
content = []
with open(... | true |
60349f534c6d684904d02f55f1aa79535d8ac6c5 | Python | hredder/Python-Scripts | /Calculus Methods/differentiation_methods.py | UTF-8 | 1,018 | 4.09375 | 4 | [] | no_license | import math
#Made by Henry Redder
#A couple differentiation functions
def func(x):
#Arbitrary Function
return math.cos(x)
def polynomial_derivative(polylist):
#Returns the derivative of the polynomial via the power rule
#Polynomials are represented with coefficients in a list. Inde... | true |
cc54b2ce92dd4f2791e60b51193368c1756c98d2 | Python | nixhex7/kirk_byers_python | /week2/test_hello.py | UTF-8 | 218 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
'''
This is part of week 2 exercises. This script calls the my_func out of the
my_func.py file and runs the function contained in that file
'''
from my_func import print_hello
print_hello()
| true |
9c782dec5fda701f4762e3dfd467ad0380727f0a | Python | starimpact/mxnet_v1.0.0 | /nnvm/tests/python/compiler/test_fold_axis.py | UTF-8 | 1,721 | 2.625 | 3 | [
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | """Unittest cases for fold_axis"""
import nnvm
from nnvm import symbol as sym
from nnvm.compiler import graph_util, graph_attr
def test_fold_axis_conv():
def before(x, conv_weight, conv_bias, scale, channels):
y = sym.conv2d(x, conv_weight, conv_bias,
channels=channels,
... | true |
f7e1e3877ea41e41feb5eedf712f34b56235fedf | Python | emysliwietz/crypto | /pollard_p-1.py | UTF-8 | 1,575 | 4.34375 | 4 | [] | no_license | #!/bin/sage
# Python code for Pollard p-1
# factorization Method
#https://www.geeksforgeeks.org/pollard-p-1-algorithm/
# importing "math" for
# calculating GCD
import math
# importing "sympy" for
# checking prime
import sympy
# function to generate
# prime factors
def pollard(n):
... | true |
8afb73f749f8a2f2253d366fc8d9e3743fcb360c | Python | Bogdanp/cobra | /lexer/lexer.py | UTF-8 | 3,077 | 3.0625 | 3 | [] | no_license | import re
from collections import namedtuple
Token = namedtuple("Token", ["type_", "value"])
# Possible token types.
for T in ("NUMBER", "CHARACTER", "STRING",
"TYPE", "KEYWORD", "OPERATOR",
"IDENTIFIER"):
locals()["T" + T] = T
# [(operator, precedence)]
_BINARY_OPERATORS = (
("*", 12)... | true |
8cc141ff1199ee908efa9476e0d73d59ee59b383 | Python | kyleterry/redisnoorm | /redisnoorm/example.py | UTF-8 | 2,127 | 2.765625 | 3 | [] | no_license | from redisnoorm import RedisResourceBase
class Example(RedisResourceBase):
redis_host = 'localhost'
redis_port = 6381
# name of the resource (object)
resource_name = 'example'
# name of the INCR id for this resource
# kind of like a sql Primary Key that
# auto increments.
resource_nex... | true |
e6b2333001fe367c6a711ee15397520d800f598c | Python | ShaneTong/udacity-capstone-project | /train/model.py | UTF-8 | 1,059 | 3.078125 | 3 | [] | no_license | import torch.nn as nn
class LSTMRegressor(nn.Module):
"""
LSTM network that we use to perform regression on financial news data
"""
def __init__(self, embedding_dim, hidden_dim, vocab_size, num_layers=1):
"""
Model initialization: initializing layers
"""
super(LSTMR... | true |
41704a03c9c525e5742496757d48362c163126ef | Python | csayres/astro598 | /targAssign.py | UTF-8 | 5,555 | 2.875 | 3 | [] | no_license | import time
from multiprocessing import Pool, cpu_count
import pickle
import numpy
import matplotlib.pyplot as plt
from keras.models import Sequential, load_model
from keras.layers import Dense
from kaiju import RobotGrid, utils
nHexDia = 7
xCoords, yCoords = utils.hexFromDia(nHexDia)
nPositioners = len(xCoords)
p... | true |
fb3754d3c9ce6f46ca12e539de6ee271f0f2daf6 | Python | lsst-sqre/prometheus-intro | /demo.py | UTF-8 | 508 | 2.59375 | 3 | [
"MIT"
] | permissive | from prometheus_client import start_http_server, Gauge
import random
import time
# Create a metric to track the time spent processing a request.
REQUEST_TIME = Gauge("request_processing_time",
"Time spent processing a request.")
@REQUEST_TIME.time()
def process_request(t):
time.sleep(t)
if... | true |
7f0dcbc47cf513999ebcf5ee6f55ee2d7842b25c | Python | tomMoral/slides_deck | /02_lightning_talks/21_01_19_lt_marcenko_pastur/simulate.py | UTF-8 | 3,292 | 2.890625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
# activate latex text rendering
rc('text', usetex=True)
if __name__ == "__main__":
sig = 1
n_hist = 3
max_iter = 5000
list_m = np.logspace(2, 3, n_hist, dtype=int)
vals, e_min, e_max = {}, {}, {}
for alpha in [0.2... | true |
53fc25bb1978e139eb845a754123d90fdb227b9d | Python | vivienzou1/Hackerrank-10 | /Algorithm/Implementation/Circular Array Rotation.py | UTF-8 | 266 | 2.8125 | 3 | [] | no_license | import sys
def rotate(lis,n):
return lis[-n:] +lis[:-n]
n,k,q = raw_input().strip().split(' ')
n,k,q = [int(n),int(k),int(q)]
a = map(int,raw_input().strip().split(' '))
for a0 in xrange(q):
m = int(raw_input().strip())
res=rotate(a,k)
print res[m]
| true |
5aeb99dbe377583138fda836ae44b5dcd66861f8 | Python | vjNakic0627/vjezbe6-9 | /vjezba9/primjer1.py | UTF-8 | 878 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 23 20:49:01 2021
@author: IceBear
"""
import socket, ssl, datetime
from local_machine_info import print_machine_info
print("Datum:" , datetime.datetime.now())
host = "127.0.0.1" # Localhost
port = 60000
print_machine_info()
print("************************************... | true |
f8e8e6ea71d80dd91a697fdb192e31afc40beb5f | Python | BrianWilkinsonSSFS/py_unit_six | /Tests/option_one_test.py | UTF-8 | 732 | 3.09375 | 3 | [] | no_license | import unittest
import assignment_six
class MyTestCase(unittest.TestCase):
def test_is_duplicates(self):
list_one = [1, 2, 3, 4, 4, 5, 6, 7, 8]
list_two = [1, 1, 2, 3, 4, 5, 6, 7]
list_three = [4, 5, 6, 7, 8, 8]
list_four = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list_five = [1, 2,... | true |
d012870780f2c3172d9d29eb60e3987a5de59070 | Python | NabeelJava902/Ruby00 | /main.py | UTF-8 | 4,113 | 2.578125 | 3 | [] | no_license | import asyncio
import random
import _json
from discord import client
import requests
from discord.ext import commands
import discord
from discord.ext.commands import bot
import re
import json
from datetime import datetime, time
from keep_alive import keep_alive
token = 'insert token'
bot = commands.Bot(command_prefix=... | true |
44f93ca5f6682ecfa1c0d026b6fa9f92774ab019 | Python | usnistgov/OOF3D | /SRC/engine/solverstats.py | UTF-8 | 4,631 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | # -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... | true |
082ded70264bba62172fee497d8e4d4b3e657ba4 | Python | calllivecn/testing | /http--/http-proxy.py | UTF-8 | 4,552 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# coding=utf-8
# date 2021-03-04 23:26:24
# author calllivecn <c-all@qq.com>
import sys
import socket
import threading
class Header:
"""
用于读取和解析头信息
"""
def __init__(self, conn):
self._method = None
header = b''
try:
while True:
... | true |
7bde9d7cbb0600a856a642bf77891a82c55f918e | Python | longhv19/Python | /PythonProjects/Submit/sub2/bai7.py | UTF-8 | 136 | 3.203125 | 3 | [] | no_license | import numpy as np
A = np.array([[2,4], [5,6]])
print(A)
B = np.array([[3,5],[6,8]])
print(B)
C = A + B
print(C)
D = A.dot(B)
print(D) | true |
f7623cb5b0f1767c56bc1bbca251139ee8deadfe | Python | chsx258/PatchMatch | /code/myalgorithm.py | UTF-8 | 13,177 | 3.15625 | 3 | [] | no_license | # CSC320 Winter 2021
# Assignment 4
# (c) Olga (Ge Ya) Xu, Kyros Kutulakos
#
# UPLOADING THIS CODE TO GITHUB OR OTHER CODE-SHARING SITES IS
# STRICTLY FORBIDDEN.
#
# DISTRIBUTION OF THIS CODE ANY FORM (ELECTRONIC OR OTHERWISE,
# AS-IS, MODIFIED OR IN PART), WITHOUT PRIOR WRITTEN AUTHORIZATION
# BY KYROS KUTULAKOS IS ST... | true |
d8098a357b89f8be7ce6028f798b685f8bba1898 | Python | jketterl/pilight | /src/show/Police.py | UTF-8 | 1,650 | 2.765625 | 3 | [] | no_license | from . import Show
from threading import Event, Thread
import random, time
class PoliceLight(Thread):
def __init__(self, fixtures, color, delay):
super(PoliceLight, self).__init__()
self.color = color
self.fixtures = fixtures
self.delay = delay
self.doRun = True
self... | true |
f3722397ca129d2f78b5780a4db869bf0e0f6a3e | Python | rzane/programming-tests | /python/person_test.py | UTF-8 | 686 | 3.328125 | 3 | [] | no_license | import unittest
from person import Person
class PersonTest(unittest.TestCase):
def setUp(self):
self.jeff = Person('Jeff')
self.susy = Person('Susy')
def test_name(self):
self.assertEqual(self.jeff.name, 'Jeff')
def test_greet_hello_jeff(self):
self.assertEqual(self.jeff.g... | true |
cd16e8f7309e5a0e3cbbbf9b791d2445a8dbca69 | Python | CPLUG/cpc | /Problems/W13/GameOfWar/asdf.py | UTF-8 | 305 | 3.328125 | 3 | [] | no_license | import itertools
import random
cards = ['2','3','4','5','6','7','8','9','10','J','Q','K','A']
suits = ['H','S','C','D']
deck = [a+b for (a,b) in itertools.product(cards, suits)]
d1 = random.sample(deck, random.randint(1,len(deck)))
for a in d1:
deck.remove(a)
print ' '.join(d1)
print ' '.join(deck)
| true |
ce5f7c830267ce14830927449397ded0b1bc53a1 | Python | group5BCS1/O-Glosh- | /src/chapter3/exercise1.py | UTF-8 | 293 | 3.8125 | 4 | [
"MIT"
] | permissive | # this program finds the gross pay
hours = int(input('Enter hours:'))
rate_per_hour = float(input('Enter rate:'))
if hours>40:
gross_pay = 40*(rate_per_hour)+(((hours-40)* 1.5))*rate_per_hour
else:
gross_pay = hours * rate_per_hour
print('The gross pay is:', gross_pay) | true |
5cd5ddc3f3683851e306dd999148c1dc389af276 | Python | Nvaiva/Optimizavimas | /baudos.py | UTF-8 | 992 | 2.96875 | 3 | [] | no_license | from sympy import *
import laboratorinis_2 as op
def createFunctionF():
x, y, z = symbols('x y z')
expr = -x*y*z
func = sympify(expr)
return func
def createFunctionG():
x, y, z = symbols('x y z')
eq = (2*x*y+ 2*x*z + 2*y*z) - 1
return eq
def createFunctionH():
x = symbols('x')
exp... | true |
379bc89e7d6bb92e1c7302a0894598ab74297b7a | Python | sidsharma1990/Python-OOP | /Classes and Objects.py | UTF-8 | 1,081 | 4.40625 | 4 | [] | no_license | ######## Classes and Objects ########
'''Class is a design of object. Like to create a building we need a blueprint, here blueprint is class and building is an object
How we create a class : - Class computer (Same as defining a function)
we put 2 parts, attributes (variables) and behaviour (methods(function))
s... | true |
4507578650402d058aa9147165d30fd83d2b1fe4 | Python | Gerdie/pyahtzee | /server.py | UTF-8 | 1,384 | 2.53125 | 3 | [] | no_license | from flask import (Flask, render_template, redirect, request, flash,
session, jsonify)
from jinja2 import StrictUndefined
from run_pyahtzee import *
app = Flask(__name__)
#Required to use Flask sessions
app.secret_key = "Yahtzeeeeeeeeee!"
#For debugging - see Jinja fails
app.jinja_env.undefined =... | true |
41e229749532da6b3a85d9c7118749769e82e40d | Python | SydneyOtten/qiskit-quantum-knn | /qiskit_quantum_knn/encoding/analog.py | UTF-8 | 1,823 | 3.96875 | 4 | [
"Apache-2.0"
] | permissive | import numpy as np
"""Script encoding classical data to quantum state via amplitude encoding."""
def encode(classical_data):
r"""Encodes the given classical state to a quantum state.
The encoding of a state makes sure that the following rule within quantum
mechanics is met:
.. math:: \langle \psi |... | true |
c3fcff10dd30d8d9a69e85021dba74982e39c1d0 | Python | DarioDaF/ASS_TOP | /scriptHelpers/bestTaker.py | UTF-8 | 7,727 | 2.96875 | 3 | [
"CC-BY-4.0"
] | permissive | '''
The function evaluate the best solution obtained from all the algorithms and take the best algorithm. Than
save the best path for Local Search algortim. Also Write a new ".csv" file with the best solutions found and
other useful informations.
Usage:
python3 ./scriptHelpers/bestTaker.py [bestVer... | true |
8d2413e2777a59f9b78bdf6e52ec9019c064da9f | Python | skrking/A-Very-Big-Sum | /code.py | UTF-8 | 173 | 2.671875 | 3 | [] | no_license | import math
import sys
ans = 0
for linenum, testnum in enumerate(sys.stdin):
if linenum == 1:
for num in testnum.split():
ans += int(num)
print ans
| true |
dfc5ee0b77aad15f69372de3e47b101081b9119d | Python | tidalmelon/addrseg | /entities.py | UTF-8 | 6,119 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import bisect
class Singleton(object):
def __new__(cls, *args, **kw):
if not hasattr(cls, '_instance'):
orig = super(Singleton, cls)
cls._instance = orig.__new__(cls, *args, **kw)
return cls._instance
class AddressType(object):
Country = 0
... | true |
4c75cbdbcd062e7383639ccbbe563c08fe023010 | Python | snail15/AlgorithmPractice | /LeetCode/Python/SecondRound/695_maxAreaOfIsland.py | UTF-8 | 745 | 3.421875 | 3 | [] | no_license | def maxAreaOfIsland(self, grid: List[List[int]]) -> int:
maxArea = 0
rows = len(grid)
cols = len(grid[0])
for row in range(rows):
for col in range(cols):
if grid[row][col] == 1:
maxArea = max(maxArea, self.area(row, col, grid, rows, cols))
return maxArea
d... | true |
c0e58649fd0047218cf4c941755c368730a9ccd6 | Python | UnixJunkie/molenc | /bin/molenc_lead.py | UTF-8 | 2,244 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
#
# Copyright (C) 2022, Francois Berenger
# Tsuda laboratory, The University of Tokyo,
# 5-1-5 Kashiwa-no-ha, Kashiwa-shi, Chiba-ken, 277-8561, Japan.
#
# lead-like filter: only lead-like molecules will be printed on stdout
import sys
from rdkit import Chem
from rdkit.Chem import Descriptors
#... | true |
bb7e72843825249f3aabda78bea9ad4a065bec13 | Python | weezel/top500passwords | /checktop500passwords.py | UTF-8 | 879 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import hashlib
from typing import List
passwords_file = "top500passwords.txt"
encrypts = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']
def do_encrypt(s: str, enc: str) -> str:
h = hashlib.new(enc)
h.update(s.encode("utf-8"))
return h.hexdigest()... | true |
76d20970d91d91af538662556cd9e2ba4a1372aa | Python | nicolasfguillaume/simple_postgresql_python | /postgres_utils.py | UTF-8 | 227 | 2.640625 | 3 | [] | no_license | # coding: utf-8
import pandas as pd
def replace_table(df, table_name, db):
df.to_sql(table_name, db, if_exists='replace')
def query_table(table_name, db):
return pd.read_sql_query('select * from {}'.format(table_name), db) | true |
2e8b44d4f1694019526ff7d3d719f0d23a155893 | Python | otzhora/HackUniversity | /server/audio.py | UTF-8 | 1,531 | 2.84375 | 3 | [] | no_license | import librosa
def get_bmp(file_path, bpm_guess=120):
# on most tracks works fine w\ guess 120
y, sr = librosa.load(file_path, sr=44100)
hop_length = 512
tempo, beats = librosa.beat.beat_track(y=y, sr=sr, hop_length=hop_length, start_bpm=bpm_guess)
return tempo, beats
if __name__ == '__main__':... | true |