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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3259c905e1328cb3d38e47a91d244fe4f9b4bdb1 | Python | turczytj/My_Machine_Learning_Playground | /test_harness.py | UTF-8 | 12,232 | 3.125 | 3 | [] | no_license | ################################################################################
# #
# Author: Todd Turczynski #
# Create Date: Oct 24, 2019 ... | true |
8472bca0692edd2313ce6c9f139f8f88e70a1b24 | Python | sanielfishawy/soloshot | /tk_canvas_renderers/video_postion_indicator.py | UTF-8 | 3,263 | 3.125 | 3 | [] | no_license | import sys
import os
import tkinter as tk
sys.path.insert(0, os.getcwd())
class VideoPositionIndicator:
'''Widget that is a line with a dot which slides back and forth along the line
used to indicate where in a scrub the current position is'''
def __init__(self,
canvas: tk.Canvas,
... | true |
967f574303dbda8c9b87e08b6f230e0f6a65db7a | Python | chaodongqu/py_research | /ana_Rx.py | UTF-8 | 2,914 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 1 10:25:16 2020
分析获利情况
@author: quchaodong
"""
#import numpy as np
import pandas as pd
#import matplotlib.pyplot as plt
class StockProfile:
code=''
start_buy_date=''
end_date=''
max_pay=0
buy = 0;
vol_hold = 0;
... | true |
16aa0dcfea8ecacb0ffdff000204b532503b0104 | Python | rahulasnani/TvSeriesReminder | /Scraper_main.py | UTF-8 | 5,494 | 2.765625 | 3 | [] | no_license | # Please all the instructions in Readme file.
import json
import requests
import bs4
import string
import datetime
import config
import db
from dateutil.parser import parse
import dateutil.parser as parser
import mail
class Scraper:
tv_series = []
original_series = []
running_year = []
email_i... | true |
0848522d778c564e4e6e5a8f9e755dfef2a91bfa | Python | garrisonblair/capstone-reservation | /server/apps/util/tests/testComparators.py | UTF-8 | 1,539 | 3.109375 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from datetime import time
from ..comparators import *
class TestComparators(TestCase):
def testBooleanComparatorTrueIsBetter(self):
comparator = BooleanComparator()
self.assertGreater(comparator.compare(True, False), 0)
self.assertLess(comparator.compare(Fa... | true |
90f85f642aee36d851314d35747aa1c747a2f876 | Python | Jich1123/Python- | /网络编程/UDP/v02.py | UTF-8 | 308 | 2.515625 | 3 | [] | no_license | import socket
def clientFun():
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
text = "Hi 你好吗!"
data = text.encode()
sock.sendto(data,("127.0.0.1",7582))
data,addr = sock.recvfrom(200)
data = data.decode()
print(data)
if __name__ == "__main__":
clientFun() | true |
d0be390e5ae54d6a70224be1fa95d00da2d60e3b | Python | recuraki/PythonJunkTest | /atcoder/Google/2021CodeJamR1A1.py | UTF-8 | 4,059 | 2.734375 | 3 | [] | no_license | import sys
from io import StringIO
import unittest
import logging
logging.basicConfig(level=logging.DEBUG)
def resolve():
def solve1(prev, cur):
# pythonなら間に合いそう
# retは(足した数, できた数)
# 前提としてprev > curである
pstr = str(prev)
cstr = str(cur)
plen = len(pstr)
... | true |
f9aa9a9ce7989de4c7644578e0ccad03fe37b4bd | Python | RomanShen/text-clustering | /hieclustering_mean.py | UTF-8 | 3,427 | 2.5625 | 3 | [] | no_license | from pca import pca
import numpy as np
from sklearn.metrics import pairwise_distances
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
import seaborn
seaborn.set()
class HierarchicalMeanClustering:
def __init__(self, X, classes=3):
self.X = X
self.classes = classes
... | true |
8773162d6ae67e4b4e74b8c8944259a32e05bb8b | Python | tash-had/UofTHacksV | /server/Clothing.py | UTF-8 | 332 | 3.59375 | 4 | [] | no_license | class Clothing:
def __init__(self, color, type, id):
"""
Iniitalize clothing object.
:param color: Color
:param type: str
:param id: int
"""
self.color, self.type, self.id = color, type, id
def __str__(self):
return str(self.type) + ", " + str(... | true |
35d730882b696af731ac93184fc033e5e9ada587 | Python | stevenlee87/python | /s14/day5/ternary_operator.py | UTF-8 | 168 | 3.53125 | 4 | [] | no_license | __author__ = "Steven Lee"
a=0
b = a and 1 or 2
c = 0 and 1
print("0 and 1:", c) # print 0 , 0和任意数做and 运算都是0
d = 0 or 2
print("0 or 2:", d) # print 2 | true |
ea5012b830593be191dcf8a2f2f8203cbf7f710f | Python | Jody-Lu/Array | /27_remove_element/remove_element.py | UTF-8 | 427 | 3.234375 | 3 | [] | no_license | class Solution(object):
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
nums[:] = [nums[i] for i in range(0, len(nums)) if nums[i] != val]
return len(nums)
if __name__ == '__main__':
sol = Solution()
val ... | true |
d9f70ba6b529b1f699937f7a813417cb2bab73a8 | Python | sorcare/ML2017 | /hw4/pca.py | UTF-8 | 3,091 | 2.53125 | 3 | [] | no_license | import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
#load data
data = []
for i in range(10):
filename = "./p1_data/A" + "0" + str(i) + ".bmp"
im = Image.open(filename)
p = np.array(im)
p = p.reshape(4096)
p = p.tolist()
data.append(p)
for i in range(10):
filename = "./p1_data/B" + "0" + str... | true |
f42360fbec94228a2a1626a5938f88517c8347fe | Python | nishiwakki/aoj | /itp1/circle.py | UTF-8 | 149 | 3.421875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from math import pi
# 入力
r = float(input())
# 出力
print('{:.06f}'.format(r ** 2 * pi), '{:.06f}'.format(2 * r * pi)) | true |
a49597f33deaf0c778da2a31c8ff9f2775961892 | Python | thakuranurag/Library | /models.py | UTF-8 | 4,803 | 2.578125 | 3 | [] | no_license | import sqlite3 as sql
from flask import session
from passlib.hash import sha256_crypt
from flask import jsonify
import os
import json
import random
from datetime import datetime
def insertUser(request):
con = sql.connect("LibraryData.db")
print("yaha tak chal raha hai")
print("user name " + request.form['u... | true |
9a863a6917a11d6ed939b51d59339be3a0f5f580 | Python | protocol7/advent-of-code | /aquaq/20/foo.py | UTF-8 | 515 | 3.078125 | 3 | [] | no_license | import sys
from collections import *
from itertools import *
from util import *
xs = sys.stdin.read().strip().split()
wins = 0
scores = [0]
for x in xs:
if x in "JQK":
s = [10]
elif x == "A":
s = [1, 11]
else:
s = [int(x)]
ns = []
for ss in s:
for score in scores:... | true |
2746c8c29badb995b3d0d678ca70fb666726e777 | Python | swapnilsaxena/Udacity-Nanodegree | /Data Lakes with Spark/etl.py | UTF-8 | 6,374 | 2.640625 | 3 | [] | no_license | import configparser
from datetime import datetime
import os
from pyspark.sql import SparkSession
from pyspark.sql.functions import udf, col, to_timestamp, monotonically_increasing_id
from pyspark.sql.functions import year, month, dayofmonth, hour, weekofyear, date_format,dayofweek
config = configparser.ConfigParser()... | true |
91c5598167404e1809ed08ece6ba85583fc22eb8 | Python | htc1159/python | /d01/hello.py | UTF-8 | 180 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
print('hello,world')
# print 输出 带换行
print(100)
# input 输入
name = input('input your name:\n')
print(name)
print('1024 * 768 = ',1024*768)
| true |
bba8b3c67b44bd50084db456945fe726cd661e00 | Python | resistzzz/GNRRW | /rwr.py | UTF-8 | 3,930 | 2.53125 | 3 | [] | no_license |
import pickle
import numpy as np
import networkx as nx
import argparse
import time
import datetime
import os
parser = argparse.ArgumentParser(description='Mine potential topic distribution of items')
parser.add_argument('--data_path', default='data', help='dataset root path.')
parser.add_argument('--data... | true |
675134f1bbf19aa5caa02dbfbef63e8f1f0ffd87 | Python | shayenne/vocaldetection | /vocaldetection/spectral.py | UTF-8 | 3,036 | 3.015625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
from scipy.signal import chebwin
def bandwise_contraction(X_log, freq_ax_log, f_start=164, f_end=10548, n_bands=17, bandwith=240, bands_offset=30):
# get indices for frequency range E3 (164 Hz) to E9 (10548 Hz)
f_start_idx = np.argmin(np.abs(freq_ax_log - f_start))
f_end_idx ... | true |
257ef2f16811963c90fa076d8eaf7107a5050f12 | Python | herbetyp/Exercicios_Python | /Mundo 1 - Fundamentos/ex022-analisador de texto}(MANIPULANDO TEXTO).py | UTF-8 | 380 | 4 | 4 | [] | no_license | nome = str(input('\nDigite seu nome completo: ')).strip()
print('-' * 64)
print('Seu nome em letras maiuscúlas é {}'.format(nome.upper()))
print('Seu nome em letras minuscúlas é {}'.format(nome.lower()))
print('Seu nome completo tem ao todo {} letras'.format(len(nome) - nome.count(' ')))
sep = nome.split()
print(... | true |
4d4926e9d08d4a8ec48e4608fd684ae1ad5b7336 | Python | ajinkyaT/data_science_cheat_sheets | /voting_majority.py | UTF-8 | 3,179 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 21:42:34 2017
@author: ajinkya
"""
import pandas as pd
import numpy as np
from sklearn.utils import class_weight
from sklearn import preprocessing
from sklearn.metrics import accuracy_score,confusion_matrix
train=pd.read_csv("train_sum.csv")
tr... | true |
c1ae7ec39c4905d56760e89947f6475c20208ed3 | Python | 1987617587/lsh_py | /basics/day22/math_text.py | UTF-8 | 1,122 | 4.03125 | 4 | [] | no_license | """
# author Liu shi hao
# date: 2019/12/3 14:21
# file_name: math_text
"""
import math
# 数学模块math
# python中math模块中提供的基本数学函数
# 角度和弧度的换算
print(math.radians(180))
print(math.degrees(math.pi))
# sin(x) :求x的正弦
print(math.sin(math.pi / 2))
# cos(x) :求x的余弦
print(math.cos(math.pi))
# asin(x):求x的反正弦
print(math.degrees(math.a... | true |
8a8a49a1f647ad04ed531f6cddf4264ee6eb07c1 | Python | rogeralexei/Programacion-III | /Proyecto II/Regex.py | UTF-8 | 1,538 | 4.09375 | 4 | [
"MIT"
] | permissive | '''
Sistema de validacion de Cedulas. Se tomaran a consideracion los siguientes valores como validos:
E: Extranjero
PE: Panameño Nacido en el extranjero
PI: Panameño Indigena
N: Naturalizado
'''
import re
def instrucciones():
print("Bienvenido al sistema de Validacion de Cedulas con Regex. Es importante recalcar q... | true |
e471b93ea8c582317851632ca95140d04f29e460 | Python | xhuaustc/cloud-sdk | /cloudsdk/models/eip_model.py | UTF-8 | 2,339 | 2.609375 | 3 | [] | no_license | # coding=utf8
"""
-------------------------------------------------
File Name: eip_model
Description :
Author : 潘晓华
date: 2017/9/21
-------------------------------------------------
"""
from cloudsdk.models import ApiModel
class EipModel(ApiModel):
@classmethod
def... | true |
865072c891f2ba01b55a6c24d733251fc568a24e | Python | samh99474/Python_Final_Project_RecommenderSystem | /Python_Final_Project/Client/GUI_Practice/test_function/Rating.py | UTF-8 | 2,728 | 3.140625 | 3 | [
"MIT"
] | permissive | import json
class Rating():
def __init__(self, socket_client):
self.socket_client = socket_client
def execute(self, userName = None, userId = None, movieId = None, rating = None):
try:
rating_dict = dict()
rating_list = list()
print("用戶姓名")
#userN... | true |
9a88842f89693aac7443aa3831004fba8873d517 | Python | gubenkoved/daily-coding-problem | /python/dcp_391_longest_contiguous.py | UTF-8 | 1,802 | 3.890625 | 4 | [] | no_license | # This problem was asked by Facebook.
#
# We have some historical clickstream data gathered from our site anonymously using
# cookies. The histories contain URLs that users have visited in chronological order.
#
# Write a function that takes two users' browsing histories as input and returns the
# longest contiguous se... | true |
1c7db675141829fa29eb8889b58116d9ccb59c1e | Python | chinhTEO/node-red-API | /hardware/network.py | UTF-8 | 1,845 | 2.65625 | 3 | [] | no_license | import random
####################################################### start MQTT section ###########################################################################
from paho.mqtt import client as mqtt_client
################# start MQTT config ####################
broker = 'broker.emqx.io'
port = 1883
c... | true |
52d427e87698e3293c146470e84e297b4f874eb0 | Python | liacov/FLTR-Rgg | /save_parameters.py | UTF-8 | 1,063 | 2.890625 | 3 | [] | no_license | import numpy as np
from math import pi
N = [ 10**3, 5*10**3, 10**4 ]
lc = 2.0736
def main():
# termodinamycal threshold
rt = lambda n: np.sqrt(lc/n)
# connectivity threshold
rc = lambda n: np.sqrt(np.log(n)/(n*pi))
for n in N:
if n == 10**3: x = 6e-2
else: x = 4e-2
# defin... | true |
6188d8e3a003c6bd07e62e49f59ce184583ed601 | Python | eukevintt/curso-em-video-pyhton | /Mundo 1/PythonExercicios/ex006.py | UTF-8 | 355 | 4.28125 | 4 | [] | no_license | print('===== EXERCICIO 006 =====')
print('Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raiz quadrada')
n = int(input('Digite um número: '))
dobro = n * 2
triplo = n * 3
raiz = n ** (1/2)
print('O número escolhido foi {}, o dobro dele é {}, o triplo dele é {} e a raiz quadrada dele é {:.2f}'. fo... | true |
e327a98e85b1632529e357e6f579e844f22a1795 | Python | A-Pranesh/Django-Middleware-TokenAuthentication | /views.py | UTF-8 | 925 | 2.765625 | 3 | [] | no_license | import json
import jwt
from django.http import HttpResponse
from django.shortcuts import render
from .models import Employee
def post(request):
if request.method == "POST":
data = json.loads(request.body.decode('utf-8'))
obj = Employee()
obj.name = data['name']
obj.age = data['age'... | true |
90e43c5f276f174276c4de17e83ea3c41edfd485 | Python | galmoyal10/StockMarketSonifier | /data_streamer/data_streamer.py | UTF-8 | 1,430 | 2.921875 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
class DataFetchingException(Exception):
pass
class SonifiableDataStreamer(object):
"""
interface for sonifiable data stream
"""
__metaclass__ = ABCMeta
@abstractmethod
def get_data_params(self):
"""
returns a list of parameters for... | true |
605172d25b56151875a74ed4dc121afe69ef40d3 | Python | eihsu/dsslite | /scripting/gen_people.py | UTF-8 | 1,885 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/Users/eric.hsu/anaconda2/bin/python
from faker import Faker
# "Census in Brief: Ethnic and cultural origins of Canadians: Portrait of a rich heritage"
#https://www12.statcan.gc.ca/census-recensement/2016/as-sa/98-200-x/2016016/98-200-x2016016-eng.cfm
locale_tallies = [
('en_CA', 64), # Canadian (First Nations? ... | true |
f86e17d85d4a407d0603c5b805d949b721a0214e | Python | Leod-hub/91977930 | /Assignment1/sonar.py | UTF-8 | 4,672 | 3.453125 | 3 | [] | no_license | # In order to help you with the first assignment, this file provides a general
# outline of your program. You will implement the details of various pieces of
# Python code grouped in functions. Those functions are called within the main
# function, at the end of this source file. Please refer to the lecture slides
# fo... | true |
17177b35cfba7a75642035516ba849e1d3d64fed | Python | Supporter09/C4T-B05 | /python/section9/Part6/popdensity.py | UTF-8 | 247 | 2.859375 | 3 | [] | no_license | name = ["ST","BĐ","BTL","CG","ĐĐ","HBT"]
population = [150300,247100,333300,266800,420900,318000]
km2 = [117.43,9.224,43.35,12.04,9.96,10.09]
MDDC =[]
for i,pop in enumerate(population):
MDDC.append(km2[i]/pop)
for m in MDDC:
print(m)
| true |
69fa915686e16e0944415198c15e40e9d4f1c5b4 | Python | Alukardz/project-lab | /final_data.py | UTF-8 | 5,632 | 3.4375 | 3 | [] | no_license | import sys
import os
from utility import read_char, read_int, perso_sort, search_age
from encapsulated import Person, ComPerson
def main():
option = 0
while option == 0:
selected = input('''
Elige la opción deseada:
[1] Agregar
[2] Listar
[3] Buscar
[4] Editar
[5] Eliminar
[6] Salir
''')
if... | true |
c84d3825efcab9d4949d7e109a5e2755c91a9080 | Python | nitkagoshima-sysken/Eagle | /processor/run.py | UTF-8 | 1,337 | 2.875 | 3 | [
"MIT"
] | permissive | import sys
from subprocess import Popen, PIPE
from optparse import OptionParser
def one_input_and_one_output(command, input_string, suffix="\n"):
p = Popen(command, stdin=PIPE, stdout=PIPE)
p.stdin.write(input_string + suffix)
status_code = p.wait()
return (status_code, p.stdout.read())
def some_input... | true |
dd61397f4cb7cc001353ee60ba7cf422c74e6d33 | Python | JoshCoop1089/Private-Projects | /Python/2018/Sudoku-Project/Sudoku Stage 3b - My Sudoku Game.py | UTF-8 | 23,035 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 1 12:34:48 2018
@author: joshc
Stage 1 (Base Game)
-- Complete -- (5/27/18)
Print Board
Unique Identifiers
Undo
Number Placement
Occupied Spot
Win State
Stage 2 (Practice Data Import)
--Complete-- (6/3/18)
Import ... | true |
198a429a67d0a408b00f155b4a944c3f1a2b10dc | Python | Thomd209/Convert_RGB_to_Hex | /convert_rgb_to_hex.py | UTF-8 | 1,028 | 3.625 | 4 | [] | no_license | def convert_nums_to_letters(nums):
new_nums = []
for num in nums:
if num == 15:
num = 'F'
elif num == 14:
num = 'E'
elif num == 13:
num = 'D'
elif num == 12:
num = 'C'
elif num == 11:
num = 'B'
... | true |
4b6b62a3e43a9f15e2522264951b38823f0fe3ae | Python | LLNL/fudge | /pqu/Check/t12.py | UTF-8 | 441 | 2.515625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # <<BEGIN-copyright>>
# Copyright 2022, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
import sys
sys.path.insert( 0, '../../' )
from pqu.PQU import PQU
t = PQU( "314159.", 's')
print(t.info( significantDigits ... | true |
050e428dabe9a980e8babf0b47821b26ebce487a | Python | cnlab/counterargue | /tasks/people_should_task/keyboard/people_should_NCfix_keyboard.py | UTF-8 | 7,789 | 2.609375 | 3 | [
"MIT"
] | permissive | ##############################
# Self Localizer for Project One #
##############################
#############################
# 6 conditions
# AGREE-pos, AGREE-neg, INFAVOR-pos, INFAVOR-neg, AGAINST-pos, AGAINST-neg
#
# Import PsychoPy
from psychopy import visual, core, event, data, gui, logging
# Import modul... | true |
745337e28f025b5ae3e85b1e0d75d483159b9ea6 | Python | alexgreendev/UserDataBase | /auth/src/controllers/access_controller.py | UTF-8 | 308 | 2.921875 | 3 | [
"MIT"
] | permissive | class AccessController:
methods = dict()
@classmethod
def add_method(cls, name: str, level: int):
cls.methods[name] = level
return cls
@classmethod
def is_access_allow(cls, method: str, level: int):
return method in cls.methods and cls.methods[method] <= level
| true |
37a86d091e19c57c315d151431f546a6ff8ef2f4 | Python | sureshchandras3kar/python-tutorial | /project 5/grayscale_image.py | UTF-8 | 273 | 2.875 | 3 | [] | no_license |
import cv2
#image loads as input
image=cv2.imread('test.jpg')
cv2.imshow('original',image)
cv2.waitKey()
#cvt to color 2 to grayscale
grayscale = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
cv2.imshow('greyimage',grayscale)
cv2.waitKey()
cv2.destroyAllWindows()
| true |
03fea772809cc365bda4a6acb57d7be79ff887d3 | Python | GetAlice/spider | /xpath-2.py | UTF-8 | 1,796 | 2.609375 | 3 | [] | no_license | from lxml import etree
import urllib.request
import urllib.parse
import requests
#https://tieba.baidu.com/f?kw=%E7%BE%8E%E5%A5%B3&ie=utf-8&pn=0 第一页
#https://tieba.baidu.com/f?kw=%E7%BE%8E%E5%A5%B3&ie=utf-8&pn=50 第二页
#https://tieba.baidu.com/f?kw=%E7%BE%8E%E5%A5%B3&ie=utf-8&pn=100 第三页
#https://tieba.baidu.com/p/57856... | true |
2d99c5ec05ca50900f71adb52d5e85b3b49e4c8e | Python | premnathkulal1/git_workshop | /add.py | UTF-8 | 38 | 2.734375 | 3 | [] | no_license | def add(a,b):
print(a+b)
add(10,20)
| true |
6030c820e8d5e8622f78f4c288fa1e20a2355d7f | Python | josephxsxn/diceroller | /diceroll.py | UTF-8 | 3,391 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | #nWoD Dice roller#
#Version 1#
##########
import random
import optparse
from urllib.parse import urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
import time
#PARSE CLI or use Defaults
def build_parser():
parser = optparse.OptionParser(usage='Roll Some Dice!')
parser.add_option("-s", "--sides", ... | true |
e7f538a90bc0161ae039420f8753e5560aa4ef7a | Python | Yongcheng123/ChimeraX_dl_window | /ChimeraX/batches.py | UTF-8 | 7,282 | 2.5625 | 3 | [] | no_license | #import numpy as np
import os
#import sys
from functools import cmp_to_key
from pathlib import Path
import torch
import sys
sys.dont_write_bytecode = True
def removeOutlierChains(batches):
minSize = 16
maxSize = 100
culledBatches = []
for batch in batches:
_, _, orig, _= batch
xLength, y... | true |
0441dc8fefc3d07760fbdb3c6272f7d2dfbb014c | Python | gjwei/machine-learning-in-action | /neuralnet/NerualNet.py | UTF-8 | 4,896 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
created by gjwei on 9/21/17
"""
import numpy as np
class NeuralNet(object):
"""对神经网络模型进行设计"""
def __init__(self, sizes):
"""
初始化
:param sizes: list类型: 存储每层神经元数目
sizes = [2, 3, 2] 表示输入层有两个神经元、
... | true |
433c3970859cbc92a582c32fbdfa70fdd02d001c | Python | webmiss/python | /framework/MySQL.py | UTF-8 | 2,797 | 2.828125 | 3 | [] | no_license | #
# MySQL类
# ----------------------------------------------
import mysql.connector
# 配置文件
from app.database import config
class MySQL(object):
# 构造函数
def __init__(self):
# 配置文件
self.config = config
# SQL
self.__sql=[]
# 查询
def find(self,parm=''):
sql = self.__select(parm)
# 游标
cursor=self.__curso... | true |
7541f137566c3e9a5a52c69cc071d952ebc4c74e | Python | AI4S2S/lilio | /lilio/calendar_shorthands.py | UTF-8 | 9,234 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | """Shorthands for calendars, to make generating commonly used calendars a one-liner."""
import re
import pandas as pd
from .calendar import Calendar
def daily_calendar(
anchor: str,
length: str = "1d",
n_targets: int = 1,
n_precursors: int = 0,
allow_overlap: bool = False,
) -> Calendar:
"""In... | true |
d0947e1e3485c22afd50a13c9e11322203938f06 | Python | HimanshubhusanRath/basics-all-in-one | /main.py | UTF-8 | 693 | 2.65625 | 3 | [] | no_license | #################### 1. MODULE IMPORT ####################
# Importing function from another python file from the same folder
from helperfunctions1 import helper1
# Importing function from another python file available under another folder
from helpers import helperfunction2
from helpers.helperfunction2 import h... | true |
4cb39fbeb098a20cbd3696dafb0cc15e3acba8e4 | Python | ZDawang/leetcode | /729_My_Calendar_I.py | UTF-8 | 788 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#author : zhangdawang
#data: 2018-3
#difficulty degree:
#problem: 729_My_Calendar_I.py
#time_complecity:
#space_complecity:
#beats:
#分别用start以及end来代表开始日期与截止日期。
#若一个新的日历插入的位置不同,则说明有重复。
class MyCalendar(object):
def __init__(self):
self.startC = []
self.... | true |
c2f8b0c653b9b2a632f09ab0bc003b304ab84694 | Python | KB-perByte/CodePedia | /local/RH/decoratorPython.py | UTF-8 | 824 | 3.953125 | 4 | [] | no_license | def first(func):
print("ABC")
def second():
print("DEF")
return None
return second
@first
def third(): #call a method but don't call it in python
print("GHI")
third()
def run_once(f):
def wrapper(*args, **kwargs):
if not wrapper.has_run:
wrapper.has_run = True
... | true |
0049dd96673e7dad254fb83cb2146005acde5f25 | Python | null-none/OMDb-client | /omdb/client.py | UTF-8 | 620 | 2.671875 | 3 | [
"MIT"
] | permissive | import requests, json
class OMDb(object):
def __init__(self, key, type='movie', plot='full', r='json'):
self.key = key
self.url = 'http://www.omdbapi.com/?apikey={0}&'.format(key)
self.type = type # movie, series, episode
self.plot = plot # short, full
self.r = 'json' # js... | true |
4e51cd89b3cb8af4e144448d88a50ab666115001 | Python | Aasthaengg/IBMdataset | /Python_codes/p03044/s100921878.py | UTF-8 | 685 | 3.171875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**7)
def dfs(s, to, color):
for next_v, step in to[s]:
if color[next_v] == -1:
if step % 2 == 0:
color[next_v] = color[s]
else:
color[next_v] = color[s] ^ 1
dfs(next_v, to, color)
def solve():
N =... | true |
4ac7aaf37fe12bee0acedb0119411ff1e98da8f0 | Python | SilvesterHsu/ESP_micropython | /main.py | UTF-8 | 2,214 | 2.546875 | 3 | [] | no_license | def Voltage(i2c,oled,t=50):
from PCF8591 import PCF8591
address = i2c.scan()
if len(address)==0:
return
v={}
for i in range(t):
oled.fill(0)
for i in range(4):
v[i]= str(PCF8591(i2c,address[0]).read(inc=True)[i])
oled.text("Voltage_{:}: {:.3}v".format... | true |
2caf2e1fe88bd376b11f1598fee827309cc54be4 | Python | PemLer/Journey_of_Algorithm | /leetcode/剑指offer/T18_deleteNode.py | UTF-8 | 491 | 3.296875 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteNode(self, head: ListNode, val: int) -> ListNode:
first = ListNode(-1)
first.next = head
dummy = first
while head:
... | true |
d43507c6820743600601136924cbc0067fc7e5ea | Python | ZyablikiPro/ComputerVision | /roll_test.py | UTF-8 | 1,265 | 2.828125 | 3 | [] | no_license | import cv2
import numpy
def caption(img, caption):
imgc = img.copy()
if type(caption) is list:
for i in xrange(len(caption)):
cv2.putText(imgc, str(caption[i]), (10,25 + i * 25), cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0))
else:
cv2.putText(imgc, caption, (10,25), cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0))
retur... | true |
5daaae488c58ee9afc2e3a812697e7888afb5a61 | Python | xiaogaogaoxiao/deeprl_segmentation | /convex_hull.py | UTF-8 | 1,247 | 2.765625 | 3 | [] | no_license | from scipy.spatial import ConvexHull
import numpy as np
class ConvexHullPolicy():
def __init__(self, img_size):
self.done = True
self.pen_up = False
self.img_size = img_size
self.mask = None
def get_action(self, state, true_segmentation):
if self.mask is None or not np.... | true |
93e268186c4f3f8dc9389f39604ddec0e5f87384 | Python | tapumar/Competitive-Programming | /Uri_Online_Judge/1069.py | UTF-8 | 351 | 3.4375 | 3 | [] | no_license | casos = int(input())
for i in range(casos):
linha = input().strip()
linha = linha.replace(".","")
aux = linha
soma = 0
while(True):
soma += linha.count("<>")
linha = linha.replace("<>","")
if aux == linha or len(linha) == 0:
break
else:
aux = ... | true |
3ebe696ad5291cd48fac42cb722b4511d4f639e4 | Python | bahar99/Ticket | /client.py | UTF-8 | 6,830 | 2.90625 | 3 | [] | no_license | import os
import platform
import requests
import time
import sys
HOST = "localhost"
PORT = "1104"
CMD = token = ''
def __api__():
return 'http://' + HOST + ":" + PORT + "/" + CMD
def printres(res):
array = res["tickets"].split('-')
c = 0
while c < int(array[1]):
temp = re... | true |
df1eca40b55098a7ccb079d9bfed09eec08fa967 | Python | Cantrianbear/youtubeToMp3 | /youtubeToMp3/youtube_to_mp3.py | UTF-8 | 1,838 | 2.6875 | 3 | [] | no_license | from __future__ import unicode_literals
import sys, getopt, os
import youtube_dl
class Audio:
def __init__(self, argv):
self.argv = argv
self.links = None
self.output = '%(title)s.%(ext)s'
self.folder = os.path.join(os.getcwd(), 'Unknown')
def __parse_arguments(self):
... | true |
ffd6c155602b54b54b57835033028298a13e0266 | Python | fagan2888/PyAssignmentSolution | /Level7_BenjaminLiu/Solution/Part3_Main.py | UTF-8 | 4,741 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#!/usr/bin/env python
'''
Student name: Beier (Benjamin) Liu
Date: 2/22/2018
Project Part 3
Remark:
Python 2.7 is recommended
Before running please install packages *numpy
Using cmd line py -2.7 -m install [package_name]
'''
import os, time, logging
import copy, math
import functools, itertool... | true |
f55747969cb0b719d5a39f12d88b453f93c66e85 | Python | theAfricanQuant/audio_analysis | /common/audio.py | UTF-8 | 4,399 | 3 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
import wave
# ensure essentia imports occur before numpy imports. for reasons un-investigated, importing numpy and then
# anything from essentia causes a seg fault. This is likely an essentia bug.
from essentia.standard import Resample, MonoLoader, MonoWriter
import numpy as np
imp... | true |
812fa35cc444dc53f20dc8ac59ae86747e061935 | Python | rockingrohit9639/pythonBasics | /dict.py | UTF-8 | 219 | 3.375 | 3 | [] | no_license | d1 = {
"Rohit":"Saini",
"Lalit":"Singh",
"Abhinav":"Baliyan",
"Shubham":"Singh",
"Khushi":"Sharma"
}
#print("Surname of Rohit is",d1["Rohit"])
x = d1.setdefault("Khushi", "Sharma")
print(x)
print(d1) | true |
46584afe3fc8815d601198e76f5441d2bd7b94dc | Python | dog2humen/ForTheCoffee | /suqing/fuckal/python/binarytree/bst/convert-bst-to-greater-tree.py | UTF-8 | 1,697 | 4.1875 | 4 | [] | no_license | # coding:utf8
"""
538. 把二叉搜索树转换为累加树
给出二叉 搜索 树的根节点,该树的节点值各不相同,请你将其转换为累加树(Greater Sum Tree),使每个节点 node 的新值等于原树中大于或等于 node.val 的值之和。
提醒一下,二叉搜索树满足下列约束条件:
节点的左子树仅包含键 小于 节点键的节点。
节点的右子树仅包含键 大于 节点键的节点。
左右子树也必须是二叉搜索树。
链接:https://leetcode-cn.com/problems/convert-bst-to-greater-tree
"""
# Definition f... | true |
3bed7c867d1be831fd80706c37ea35f06cf0fe9c | Python | asim3/kfupm-pledge | /pledge/student/utils.py | UTF-8 | 2,121 | 2.53125 | 3 | [] | no_license | from django.contrib.staticfiles import finders
from django.conf import settings
from django.template.loader import get_template
from xhtml2pdf import pisa
from io import BytesIO
import posixpath
import os
def template_to_pdf(template_name, context=None):
template = get_template(template_name)
html = template... | true |
894d40577adb37a73aa43e457912399049c9fd9f | Python | LucasLima337/CEV_Python_Exercises | /exercicios/ex046.py | UTF-8 | 528 | 2.9375 | 3 | [
"MIT"
] | permissive | # Contagem Regressiva
from emoji import emojize
import time
e = emojize(':boom:', use_aliases=True)
for i in range(10, 0, -1):
if 5 < i:
print(f'\033[1;31m{i}\033[m')
elif i <= 5:
print(f'\033[1;33m{i}\033[m')
time.sleep(1)
print('')
print(f'\033[1;32m{e * 5} FELIZ ANO NOVOOOOO!!! {e * 5}')
... | true |
f6cd4673626711256cabbd9769971634e7c68254 | Python | talktobrent/AirBnB_clone | /tests/test_models/test_engine/test_file_storage.py | UTF-8 | 1,128 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python3
""" engine module unittest
"""
import unittest
import os
from models.engine.file_storage import FileStorage
from models.base_model import BaseModel
from models import storage
class testStorage(unittest.TestCase):
"""tests FileStorage class
"""
@classmethod
def setUpClass(cls):
... | true |
54f061bc651ff4f0036d94d65203880b2ea8ecb9 | Python | CRSilkworth/path_nn | /mnist/train.py | UTF-8 | 10,558 | 2.625 | 3 | [] | no_license | """Trainer function and estimator defintion."""
from __future__ import division
from __future__ import print_function
from typing import Optional, Dict, List, Text, Any, Callable
import tensorflow as tf
import tensorflow_transform as tft
from tensorflow_metadata.proto.v0 import schema_pb2
from mnist import model
fro... | true |
8371e594038975d396f276f91cd3cb285487bdd0 | Python | nathanriojas/CrackingCodingInterview | /Chapter3Stacks/3_5StackSort.py | UTF-8 | 2,003 | 4.40625 | 4 | [] | no_license | # Cracking the coding interview problem 3.5 - Sort a stack, use of temporary
# stack (I am using two temporary stacks) allowed. Cannot store in any other data structure.
# Only push, pop, peek, and isEmpty are available
# Implementation of Stack Class
class Stack (object):
def __init__ (self):
self.stack = []
... | true |
7e387bd592c3e797048c1ad0009d4550be94ab3d | Python | IoanFilip2/Demo-project-stock-price-patterns | /StockDataProcessing.py | UTF-8 | 3,468 | 3.46875 | 3 | [] | no_license | ### Takes as input two files containg the historical closing
### prices of a list of stocks and the volumes traded and
### runs data analysis to identify high-level trends
import sys
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
## Inputting the data:
# Expect: Historical price data
... | true |
a0058e0a3b89cbbbc13f7328cb0e75452dd6f88c | Python | Abtinz/AUT-Python-Summer | /listmax.py | UTF-8 | 747 | 3.796875 | 4 | [] | no_license | def listMaxDuplicated(myList):
index=0
secondeIndex=0
counter=0
while index<len(myList) :
while secondeIndex < len(myList) :
if index != secondeIndex :
if(myList[index] == myList[secondeIndex]): counter-=-1
secondeIndex-=-1
if counter ... | true |
d93ff9d690f5f334b98f99076d65a2eb77d2c0b1 | Python | Arvolear/Visualizers | /Fractals_infinite/fractals/Mandelbrot.py | UTF-8 | 717 | 3.21875 | 3 | [] | no_license | import math
from interfaces.IFractal import IFractal
class Mandelbrot(IFractal):
def __init__(self):
self.MAX_ABS = 2.0
self.realBeg = -2.5
self.realEnd = 1.5
self.imagBeg = -1.2
self.imagEnd = 1.2
def compute(self, num, maxIterations):
iteration = 0
c... | true |
7ac6e28f4369c8da9d4a9a581ce77446e1c015c8 | Python | mbiokyle29/geno-browser | /tests/test_model.py | UTF-8 | 1,291 | 2.609375 | 3 | [
"MIT"
] | permissive | import unittest
from gb import db,app
from gb.models import *
import logging
logging.basicConfig()
LOG = logging.getLogger(__name__)
class TestSetUp(unittest.TestCase):
def setUp(self):
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
db.create_all()
def tearDown(self):
db.sessio... | true |
18d9fb903157353d4e1ddebeb50e4a989a73bb1b | Python | Aasthaengg/IBMdataset | /Python_codes/p02269/s540408991.py | UTF-8 | 1,055 | 3.15625 | 3 | [] | no_license | import sys
M = 1046527
def h1(key):
return key % M
def h2(key):
return 1 + (key %(M-1))
def h3(key, i):
return (h1(key) + i*h2(key)) % M
word_dic = {'A': 1, 'T': 2, 'G': 3, 'C': 4}
def getkey(text):
sum = 0
p = 1
for c in text:
sum += p*word_dic[c]
p *= 5
return sum
dict... | true |
f85dc1aa24356bf3422ffb9035a8abc70faee93b | Python | Xevion/exercism | /python/word-count/word_count.py | UTF-8 | 297 | 2.9375 | 3 | [] | no_license | import string, re
def count_words(sentence):
sentence = [x.strip(string.punctuation) for x in [word for word in re.split(r'[_,\s]+', sentence.casefold()) if len(word.strip(string.punctuation + string.whitespace)) >= 1]]
return {k : sentence.count(k) for k in list(dict.fromkeys(sentence))} | true |
4d99485bf9c353f9b83e56b168d21b63731ddc03 | Python | pranavsankhe/website_load_speed | /webpage.py | UTF-8 | 443 | 3.078125 | 3 | [] | no_license | from urllib.request import urlopen
import time
''' get the load time of a website'''
def download_webpage():
url = input("Feed me the website name to chew on: ")
#url = 'http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf'
respones = urlopen(url, timeout = 60)
return respones.read()
def calc_time():
... | true |
92dd245a6914c6afa7b09d2c5e6ce6c59d124c9a | Python | higorcos/Aprendendo_python | /Exercicios/02.py | UTF-8 | 253 | 3.546875 | 4 | [] | no_license | var = 2
var2 = var ** (1/2)
print('Vidente \n')
print('Número {} \nO antecessor é {} o sucessor é {}'.format(var,(var-1),(var+1)), end="") #\n quebra de linha #end linga os dois prints
print("")
print('Rais quadrada de {} é {}\n'.format(var,var2)) | true |
961501b21be5eb822bcce1e6f0b7cb5d1bdd8ad8 | Python | s-gerrity/hb-demos | /debugging/cat.py | UTF-8 | 350 | 3.03125 | 3 | [] | no_license | class Cat(object):
"""Common household feline."""
def eat(self, food):
"""Eat food product."""
def meow(self, volume=9999):
"""Make loud noise."""
def scratch(self, draw_blood=True):
"""Injure human."""
def bite(self, ferocity=9999):
"""Bite into human flesh."""
... | true |
8738f77b4f97000414b784aa23c7483f568845d9 | Python | itzmesatheesh/playerlevel | /even factors.py | UTF-8 | 102 | 3.140625 | 3 | [] | no_license | b=int(input())
for j in range(1,j+1):
if b%j==0:
if j%2==0:
print(j,end=" ")
| true |
815d753ecec9f0a815174e95bf88b2049c252c30 | Python | larstonder/proglab | /p6-visualization/isomap.py | UTF-8 | 2,144 | 3.4375 | 3 | [] | no_license | """
Nonlinear reduction algoritm which computes the datasets geodesics and
performs multidimensional scaling to reduce dimensons
"""
import numpy as np
import sklearn.utils.graph_shortest_path as sg
from dimred import DimRed
from kNN import k_nearest
from scipy.sparse.linalg import eigs
class IsoMap(DimRed):
... | true |
ef35c0260f358a6b26dd8bbb83430b582c9d3f25 | Python | PaulinaSz122/rozdzial3 | /rzut_kostka.py | UTF-8 | 237 | 4.09375 | 4 | [] | no_license | import random
dice1 = random.randint(1,6)
dice2 = random.randrange(6) + 1
total = dice1 + dice2
print("Wyrzuciłeś", dice1, "oraz", dice2, "i wyrzuciłeś sumę", total)
input("\n\nAby zakończyć program, naciśnij klawisz Enter.") | true |
1555f405dc37353f28d4007401182fd359755f50 | Python | qiaowenfanggithub/smartbi_check | /statistic/more_independent_KWH.py | UTF-8 | 2,605 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import scipy
import scipy.stats as stats
import os
def Kruskal_Wallis_H_describe(data: pd.DataFrame,X):
data = data.astype(float)
res = []
for i in range(len(X)):
res.append(["{:.0f}".format(data[X[i]].count()),"{:.4f}".format(data[X[i]].mean()),"{:.4f}... | true |
db233226db40a1428008008037356a34ef544bfc | Python | shenxudeu/deuNet | /demos/cifar_10_mlp.py | UTF-8 | 1,922 | 2.625 | 3 | [
"MIT"
] | permissive | """
Example of train a 2-layers Neural Network classifier on CIFAR-10 dataset
"""
import numpy as np
import sys
np.random.seed(1984)
sys.path.append("../../deuNet/")
from deuNet.utils import np_utils
from deuNet.datasets import cifar10
from deuNet.models import NN
from deuNet.layers.core import AffineLayer, Dropout
f... | true |
7011d19140d4a0273d6a7cf8c5b97ee9675b3de4 | Python | blackplusy/0706 | /例子-0722-03.文件操作.py | UTF-8 | 427 | 3.609375 | 4 | [] | no_license | #coding=utf-8
#读文件
#定义一个变量接受open函数打开文件后的内容
file=open('f:\\1.txt','r',encoding='utf8')
print(file)
for i in file:
print(i)
file.close()
#写文件
str1='oh my dear mom!!!'
file=open('f:\\2.txt','w')
file.write(str1)
file.close()
print('已经写入')
#追加文件
file=open('f:\\2.txt','a')
file.write('\ncome on baby!... | true |
c8418fee14ed8497ef1ae91a3832a203188a88ca | Python | takayuk/lab | /util/unigram.py | UTF-8 | 1,748 | 2.640625 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-
import re
import sys, os
import numpy
import bagofwords as bow
#
# Unicode ひらがな [ 3041 - 309F ]
# Unicode カタカナ [ 30A1 - 30F9 ]
# Unicode 漢字 [ 4E00 - 9FBB ]
#
kigou = re.compile( u'[^\u3041-\u309f|\u30a1-\u30f9|\u4e00-\u9fbb]' )
hiragana = re.compile( u'[\u3041-\u3... | true |
c2376953c30dfcc1a7b2b2679d70d2aa3d25bc16 | Python | Lucifer-ww/Coding-Notes | /Project/PYT/$Github精选/AircraftBattle-master/main.py | UTF-8 | 33,303 | 2.6875 | 3 | [] | no_license | import pygame
import sys
import traceback
from pygame.locals import *
import myplane
import enemy
import bullet
import supply
from random import *
##############
import tkinter as tk
import tkinter.messagebox
import pickle
pygame.init()
bg_size = width, height = 1000, 700
screen = pygame.display.set_mode(bg_size)
pygam... | true |
7c8ce106757c6fc2f030ef36e7449362b1439fdf | Python | anishakadri/nuoscillation | /parameters.py | UTF-8 | 1,097 | 2.765625 | 3 | [
"MIT"
] | permissive | import numpy as np
#oscillation parameters
theta12 = 0.58677969
theta13 = 0.1490511
theta23 = 0.8237954
deltacp = 4.084
#uncertainty intervals
pm12 = [0.0136136,-0.0132645]
pm23 = [0.0331613,-0.0680678]
pm13 = [0.002617994, -0.002617994]
pmcp = [.75,-0.54]
#pmns terms
c12 = np.cos(theta12)
s12 = np.sin(theta12)
c13 ... | true |
0309c81cc258abd73fd6652bfb0b3b16ae6e59be | Python | SonamBothra/PythonLearning | /FirstTwoLastTwo.py | UTF-8 | 104 | 3.59375 | 4 | [] | no_license | str=raw_input("Enter the string!!")
if(len(str)==1):
out=""
else:
out=str[:2]+str[-2:]
print out | true |
bf7a53bc46f7e3a1c561c428368145bb8e71590d | Python | geekmj/fml | /projects/01-explore-us-bikeshare-data/utilities.py | UTF-8 | 3,150 | 3.875 | 4 | [
"Unlicense"
] | permissive | # Constants tuple for display time calculation
INTERVALS = (
('Weeks', 604800), # 60 * 60 * 24 * 7
('Days', 86400), # 60 * 60 * 24
('Hours', 3600), # 60 * 60
('Minutes', 60),
('Seconds', 1),
)
def get_user_choice(choices, choice_type, default_value=""):
"""
A common method to take user ... | true |
44df425ff8bee08d0b9de4f19958bd896c004137 | Python | KseniyaTonko/BSUIR-PYTHON-2020 | /Solutions/Task2/853502_Катя_Жевняк/tasks/Singleton.py | UTF-8 | 401 | 2.984375 | 3 | [] | no_license | class MetaSingleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(MetaSingleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
class TestClass(metaclass=MetaSingleton):
pass
if __name__ == "__... | true |
24409bc4f649b5ac6934a1a4eeae4d8a2525786e | Python | Checkmate50/LJNN-Torch | /bin/lammpstrjToData.py | UTF-8 | 9,714 | 2.625 | 3 | [] | no_license | #!/usr/local/bin/python
"""
USAGE:
python LAMMPS_to_NNP.py out_filename thermo_filename lammpstrj_filename
Given a thermo file and a split of lammpstrj-styled files
This script creates a compiled data file with the given output file name
Written by Nathan Fox
Edited by Dietrich Geisler
"""
import re
from sys import a... | true |
f294dfbd338b67feefcfcb1971013b2c9b2e6e8b | Python | nlitsme/pyCryptoAdapter | /tests/test_modes.py | UTF-8 | 4,131 | 3.203125 | 3 | [
"MIT"
] | permissive | """
Tests for the various ciphering mode wrappers.
"""
import unittest
from binascii import a2b_hex
import Crypto.Cipher.AES
from TestCiphers.Modes import CBC, CFB, OFB
class TestCBC(unittest.TestCase):
"""
unittests for CBC mode wrapper.
tests AES in ECB mode, wrapped with CBC wrapper,
and AES with ... | true |
9dba00bb41a6e18a971fa24456a80ec83a1c2c03 | Python | paulvee/GPSDO-Monitoring | /serial_bb_counter.py | UTF-8 | 14,537 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3.7
#-------------------------------------------------------------------------------
# Name: Serial_bb.py
# Purpose: Serial port monitoring on a RaspberryPi Zero-W by
# using the pigpio bit-banging software to get access to more
# serial ports.
# Thi... | true |
dac9aec02b8c43e0b76db78c8208f5d304a44309 | Python | giovany-silva/Banco-de-Dados | /Projeto Final BD II/TRAB/Interface/ConexaoComBD.py | UTF-8 | 595 | 2.796875 | 3 | [] | no_license | import psycopg2
con = None
def startConnection(value,senha):
#Conectar no database
global con
usuario=value
try:
con = psycopg2.connect(
host = "localhost",
database = "Projeto_BD",
user = usuario,
password = senha,
port = "5432"
... | true |
999c933ab734a841c2140124634fad941ea5c4d1 | Python | siddhx/big-data-analytics | /Queue.py | UTF-8 | 578 | 3.8125 | 4 | [] | no_license | # q = Queue([])
class Queue:
def __init__(self, aList = []):
self.aList = aList
self.index = 0
# add item to queue
def enqueue(self, item):
self.aList.append(item)
def dequeue(self):
return self.aList.pop(0)
def __iter__(self):
return self
def __next__(self):
num = self.index
i... | true |
c6bad725a61ea0ee65a0cc5f883f57a76c3f5c35 | Python | ramendez28/Analysis | /GraphNeuralNetwork/ExampleCode/GraphNeural/PythonImplementation/BaseFunctions/Calculators.py | UTF-8 | 521 | 2.828125 | 3 | [] | no_license | import torch
def LinkProbability(Node_i, Node_j):
Node_i_T = torch.transpose(Node_i, 0, 0)
scalar_prod_i_j = torch.dot(Node_i_T, Node_j)
return float(torch.sigmoid(scalar_prod_i_j))
def TopologicalProbabilities(Results):
Pairs = []
for i_s in range(len(Results)):
node_s_f = Results[i_s]
... | true |
39880a9d9db55971218551a7facfbd7b50fc34e2 | Python | castorini/meanmax | /meanmax/stats/test.py | UTF-8 | 5,951 | 2.515625 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass, field
from typing import Any, Dict
from scipy import stats
import numpy as np
from .estimator import QuantileEstimator
from .utils import compute_pr_x_ge_y
from .tables import MANN_WHITNEY_UP010
@dataclass(frozen=True)
class TwoSampleHypothesisTest(object):
options: Dict[str, ... | true |
1af59e38951cc3bddc173e356ad22173e6123ea6 | Python | dgandrewc/etc | /arm_test.py | UTF-8 | 1,110 | 2.59375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import re
import networkx as nx
from matplotlib import font_manager, rc
import matplotlib.pyplot as plt
from apyori import apriori
import random
'''
datass=[]
data=[]
def getRand():
return random.choice(data)
for i in range(0, 10):
datas=[]
for j in range(0, 10):
rnd=random... | true |
bb342a9b204bd8adf0fec6de5c619af37fe409e0 | Python | allenxzy/Data-and-Structures-and-Alogrithms | /python_data/Chapte 5/table.py | UTF-8 | 953 | 3.28125 | 3 | [] | no_license | #-*-coding: utf-8 -*-
"""
Table 5.1
"""
"""
Code C Data Type Typical Number of Bytes
'b' signed char 1
'B' unsigned char 1
'u' Unicode char 2 or 4
'h' signed short int 2
'H' unsigned short int 2
'i' signed int 2 or 4
'I' unsigned int 2 o... | true |