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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
12648d227fc7ba4ee9197bcc3d64838a83908874 | Python | froggengoing/LeetCodeInPython | /20210819[496]Next Greater Element I.py | UTF-8 | 4,185 | 3.5625 | 4 | [] | no_license | # The next greater element of some element x in an array is the first greater el
# ement that is to the right of x in the same array.
#
# You are given two distinct 0-indexed integer arrays nums1 and nums2, where nu
# ms1 is a subset of nums2.
#
# For each 0 <= i < nums1.length, find the index j such that nums1[i... | true |
87832cbfdd220247c915e8f5bb1cfae804ef1304 | Python | durgesh-agrhari/coderspree | /ML/Ayushsingh07_Ayushkumarsingh_2024cse1037_2/gettingstarted/gcdlcm.py | UTF-8 | 125 | 3.140625 | 3 | [] | no_license | a=int(input())
b=int(input())
c=1
for i in range(1,a+1):
if a%i==0 and b%i==0:
c=i
l=int(a*b/c)
print(c)
print(l) | true |
229938614f9d193ef45032d8aea7f02e41c715d8 | Python | davidmorck/Phyton-test | /kap5,1.py | UTF-8 | 694 | 3.140625 | 3 | [] | no_license | namn = ["Daniel Radcliffe", "Rupert Grint", "Emma Watson", "Selena Gomez"]
kön = ["man", "man", "kvinna", "kvinna"]
ögon = ["brun","blå","brun","brun"]
hår = ["brun","röd","brun","brun"]
rättnamn=[]
Akön = input("ange kön> ")
Ahårfärg = input("ange hårfärg> ")
Aögonfärg = input("ange ögonfärg> ")
Akön = Akön.lower()
... | true |
977c05928f1cb401d071531d66eb66cc0540b2bc | Python | DREAMToBeSucessfulDataAnalytics/Data-Analytics-Project | /Superstores Sales Analysis project/ARIMA module.py | UTF-8 | 5,866 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import warnings
import itertools
import numpy as np
import matplotlib.pyplot as plt
warnings.filterwarnings("ignore")
plt.style.use('fivethirtyeight')
import pandas as pd
import statsmodels.api as sm
import matplotlib
matplotlib.rcParams['axes.labelsize'] = 14
matplotli... | true |
3ac85fb428da23dee796134a6b3ddb322bd23aa5 | Python | EnjiRouz/IntelligentSystems | /NeuralNetwork/neural_network.py | UTF-8 | 2,025 | 3.5 | 4 | [] | no_license | import numpy as np
# входной и выходной слои
input_layer = np.array(([0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1, 1]), dtype=float)
output_layer = np.array(([0], [1], [1], [0]), dtype=float)
# логистическая активационная функция (функция активации сигмоиды)
def sigmoid(t):
return 1 / (1 + np.exp(-t))
# производная ... | true |
99b3ee9d016348996f41de34379d66a5909a35f1 | Python | Josephine-coding/Brazilian_ecommerce | /data.py | UTF-8 | 3,692 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import mysql.connector
import csv
import sqlalchemy
import pymysql
engine = sqlalchemy.create_engine("mysql+pymysql://student:mdpSQL2021@localhost/e_commerce")
#Connect to database
mydb = mysql.connector.connect(
host="localhost",
user="student",
password="mdpSQL2021",
database='e_commerce'... | true |
01ff5885130f13a6926944c70ab559330af69f62 | Python | friedrich-schotte/Lauecollect | /serial_port_emulator_windows.py | UTF-8 | 3,664 | 3.0625 | 3 | [] | permissive | #!/usr/bin/env python
"""
Setup:
- Install the software package 'com0com' from https://sourceforge.net/projects/com0com
- Run: Start > Programs > com0com > Setup
- Create pairs of emulated com ports: COM3 & COM4, COM5 & COM6, ....
Author: Friedrich Schotte
Date created: 2021-10-03
Date last modified: 2021-10-03
Revisi... | true |
6a4c93792fd731bc03ed82f7304c5c032aa2b511 | Python | RustPython/RustPython | /Lib/test/test_sys_setprofile.py | UTF-8 | 13,771 | 2.640625 | 3 | [
"CC-BY-4.0",
"MIT",
"Python-2.0"
] | permissive | import gc
import pprint
import sys
import unittest
class TestGetProfile(unittest.TestCase):
def setUp(self):
sys.setprofile(None)
def tearDown(self):
sys.setprofile(None)
def test_empty(self):
self.assertIsNone(sys.getprofile())
def test_setget(self):
def fn(*args):
... | true |
77cbc7abd5ec5ae0d6be283131be27b2d816332c | Python | omnomnomot/bookmark-sync-kindle-tinycards | /kindleSync.py | UTF-8 | 645 | 2.53125 | 3 | [] | no_license | from tinycards import Tinycards
from tinycards.model import Deck
from PyDictionary import PyDictionary
import yaml, json, sys
import config
dictionary=PyDictionary()
tinycards = Tinycards(config.TINY_CARDS_CREDENTIALS['email'], config.TINY_CARDS_CREDENTIALS['password'])
deck = Deck('12 Rules Of Life')
deck = tin... | true |
9d143e2ab98cad71f133f6d8664b6110f28d29c1 | Python | chenjie5612816/japanese | /chapter1/cha2-1.py | UTF-8 | 681 | 4.0625 | 4 | [] | no_license | # -*- coding: utf8 -*-
# 根据给定的年月日以数字形式打印出日期
months = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'June',
'July',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
]
endings = ['st','nd','rd'] + 17 * ['th']\
... | true |
d7695f3b6cd1c1a8aba03478f9e9c17c11bbffb3 | Python | Joaodevgit/Reccomender-System | /AlgoritmoML/CleanAndTransformData.py | UTF-8 | 13,479 | 3.5 | 4 | [
"MIT"
] | permissive | import csv
import json
import pandas as pd
import ast
def read_data(filename, qty_users):
"""
Method that reads from a csv file and returns a list movies rated from the users
:param filename: csv file path where all user ratings are is located (this file must be in csv format and must
... | true |
7b31b4c146006ab7f820d0af460a3ac44a45faaa | Python | Merrouni/Exercism | /python/bank-account/bank_account.py | UTF-8 | 1,375 | 3.453125 | 3 | [] | no_license | STATUS_CLOSED = 'closed'
STATUS_OPEN = 'open'
class BankAccount(object):
def __init__(self):
self.status = STATUS_CLOSED
self.transactions = []
pass
def get_balance(self):
if self.status == STATUS_CLOSED:
raise ValueError("The account is closed !!!")
return ... | true |
b20980cbe53466ee0cedae71c9aaab54c1aac0fc | Python | josiane-sarda/CursoPythonHbsisProway | /Aulas Marcello/exercicio 49 - questao a mais.py | UTF-8 | 494 | 3.90625 | 4 | [] | no_license |
print('Média geral dos alunos')
print('Qual a quantidade de alunos?')
qtd_alunos = int(input())
print('Quantas notas por aluno?')
qtd_notas = int(input())
soma_notas = 0
for aluno in range(0, qtd_alunos):
# aluno [0, 1, 2]
for nota in range(0, qtd_notas):
# nota [0, 1]
print('Aluno {} ... | true |
5c92e308d8233bdcb5d8fa1863572967433535dd | Python | hodurie/Algorithm | /SWExpertAcademy/src/D2/SW_1984.py | UTF-8 | 177 | 3.484375 | 3 | [] | no_license | T = int(input())
for t in range(T):
lst = [int(n) for n in input().split()]
lst.remove(max(lst))
lst.remove(min(lst))
print(f'#{t+1} {round(sum(lst)/len(lst))}') | true |
862898176d7e6bf5a835141fa2b1315e7fcdf2ac | Python | sev-94/introPy | /39_decorators.py | UTF-8 | 450 | 4.21875 | 4 | [] | no_license | #Decorators are used when a function is used as an argument for another function
def my_decorator(func):
def wrap_func(*args, **kwargs):
print('*********')
func(*args, **kwargs)
print('*********')
return wrap_func
#This is a 'decorator'
#Decorators are declared with a '@' in front of th... | true |
78ac8919e8c7f0f5191b553d00c04a760985bfbc | Python | RNabel/InterviewPreparation | /Python/CTCI/ShortestReachInGraphBellmanFord.py | UTF-8 | 1,807 | 3.609375 | 4 | [] | no_license | # Contains Bellman-Ford algorithm.
import sys
class Graph(object):
def __init__(self, size):
self.vertexes = [0] * size
self.edges = []
self.size = size
def find_all_distances(self, start_node_index):
def add_if_not_in_set(q, s, el):
if el not in s:
... | true |
1edf3c41f422d4e85af439e7cc44192ff623c733 | Python | isi-nlp/unitok | /scripts/ffpredict2bio.py | UTF-8 | 2,306 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import sys
import codecs
if sys.version_info[0] == 2:
from itertools import izip
from collections import defaultdict as dd
import re
import os.path
import gzip
import tempfile
import shutil
import atexit
scriptdir = os.path.dirname(os.path.abspath(__file__))
reader = codecs.getr... | true |
d1b16e3971e86725bfd6469e71fbcc697bd98e83 | Python | VinayagamD/PythonTrainingBatch1 | /netwroking/server.py | UTF-8 | 997 | 3.609375 | 4 | [] | no_license | # first of all import the socket library
import socket
# next create a socket object
s = socket.socket()
print("Socket successfully created")
# reserve a port on your computer in our
# case it is 12345 but it can be anything
port = 12345
# Next bind to the port
# we have not typed any ip in the ip field
# instead we... | true |
bee76d0a7d3cb6ac57f6c742e74582c916acaeb4 | Python | biotite-dev/biotite | /doc/examples/scripts/structure/leaflet.py | UTF-8 | 4,082 | 3.015625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | """
Identification of lipid bilayer leaflets
========================================
This script implements the *LeafletFinder* algorithm
:footcite:`Michaud-Agrawal2011` used by *MDAnalysis*. The algorithm
detects which lipid molecules belong to the same membrane leaflet, i.e.
the same side of a lipid bilayer, irresp... | true |
2531610341105a54c4e38b01f08bee4c6d017227 | Python | ryutaro-kodama/kifu_app | /add_kifu/lib/conversion.py | UTF-8 | 2,131 | 3.1875 | 3 | [] | no_license | class NumberConvert():
kansuji_list = ['0', '一', '二', '三', '四', '五', '六', '七', '八', '九']
zenkaku_list = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
@staticmethod
def number2kansuji(num):
return NumberConvert.kansuji_list[num]
@staticmethod
def number2zenkaku(num):
... | true |
bcd0155816eae8339c4e9967fba7242d3054121c | Python | kongjunli/Module-GRU- | /LSTM.py | UTF-8 | 4,415 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 02 11:08:57 2017
@author: kjl
"""
import gensim
import numpy as np
import pandas as pd
import jieba
import mysql.connector
from gensim.models import word2vec
import logging
from sklearn.cross_validation import train_test_split
from gensim.models.word2vec import Word2Vec
f... | true |
d74719d167ef15bf36b920955933c7b174096ea4 | Python | tdstyrone/LeetCode-Solutions | /PythonSolutions/Medium/Sort-Characters-By-Frequency/sort_characters_frequencey_solution.py | UTF-8 | 180 | 2.953125 | 3 | [] | no_license | class Solution:
def frequencySort(self, s: str) -> str:
from collections import Counter
return "".join([char * freq for char, freq in Counter(s).most_common()]) | true |
13e119ac74f5831d411aeab9be68185e5e836f09 | Python | imao03/Chapter-01 | /su_cai_demo/test_select.py | UTF-8 | 685 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3.7.9
# -*- coding:utf-8 -*-
# @Time : 2021/10/9 14:11
# @Author : Kitty
# @File : test_select.py
# @SoftWare: PyCharm
from selenium import webdriver
from time import sleep
driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(30)
# 注册A.html
url = "file:///Users/kitty/P... | true |
db73d76340c422ef718a00124287f5fd1006272a | Python | tatHi/common | /common/dataset/wordSegmentation.py | UTF-8 | 865 | 2.703125 | 3 | [] | no_license | '''
json for input:
train:
[{
text: abcdefgh
label: [3,2,3] //lenth
label: [0,0,1,0,1,0,0,1] //01
}]
'''
from common.dataset import dataset
class Dataset4WordSegmentation(dataset.Dataset):
def __init__(self, path, labelType='length', useBEOS=False, vocab=None):
if labelType ... | true |
495bf167d2e4e158d8adfbd1cbb33bb89b0969cb | Python | ali8261/Election_Analysis | /python_practice.py | UTF-8 | 81 | 3.34375 | 3 | [] | no_license | counties = input ( " name of county ?")
print(" name of county is " + counties )
| true |
fb300c3a76d8529b44def4bffe3ea15a6bdf2d4a | Python | cristianvalenz/Python | /Colecciones/Pilas.py | UTF-8 | 187 | 4.03125 | 4 | [] | no_license | pila = [1,2,3]
#Agregar elementos por el final
pila.append(4)
pila.append(5)
print(pila)
#Sacando elementos por el final
n = pila.pop()
print(f"Sacando el elemento : {n}")
print(pila)
| true |
dd91c6bff83a7873b885c43d3fc118413f11d422 | Python | ignaziocapuano/workbook_ex | /cap5/ex_126.py | UTF-8 | 776 | 3.390625 | 3 | [] | no_license | #Dealing Hands of Cards
from ex_125 import createDeck, shuffleDeck
def deal(num_giocatori, carte_mano, mazzo):
mani=[]
top_mazzo=len(mazzo)
for i in range(num_giocatori):
mani.append([""]*carte_mano)
#Assembla mani
for j in range(carte_mano):
for i in range(num_giocatori):
... | true |
9ee7e3bceec54223599c4f8a49d3e734cf2f2d32 | Python | anupamkaul/deeplearning | /gans/exercises/6.ae_1.py | UTF-8 | 523 | 2.546875 | 3 | [] | no_license | '''
Exploring variational auto-encoders
(https://arxiv.org/pdf/1312.6114.pdf)
Let's first build a standard autoencoder and then
a variational ae. VAEs are fundamental to building
GANs. I will also highlight / pick apart both
AEs and VAEs to understand how to build & manipulate
autoencoder models an in particular VAEs... | true |
e202a56a3ff7190f0db88bfbc46cdf8795dc8273 | Python | 1Ricklu/Topology_Optimization | /comp_plot.py | UTF-8 | 1,263 | 3.03125 | 3 | [] | no_license | import matplotlib.pyplot as plt
class compliance():
'''
This module is to plot the change of compliance during optimization based on the Matlab calculation
'''
def extract(module_name):
for file_id in range(1,6):
file_name = "m"+str(module_name)+"_"+str(file_id)+".txt"... | true |
81d02426e2f4d268458d1b351dff0986c4f3be1b | Python | jebrunnoe/Project-Euler | /problem6.py | UTF-8 | 847 | 4.25 | 4 | [] | no_license | #PROBLEM:
# 6
#
#NAME:
# "Sum Square Difference"
#
#PROMPT:
# The sum of the squares of the first ten natural numbers is,
# 1^2 + 2^2 + ... + 10^2 = 385. The square of the sum of the first
# ten natural numbers is, (1 + 2 + ... + 10)^2 = 552 = 3025
# Hence the difference between the sum of the squares of the fir... | true |
1e59e5f65f2f57d7533c4b8120ec2fad676ccf4f | Python | tronje/mms | /Uebung_06/06.py | UTF-8 | 2,301 | 3.34375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Aufgabe 2. a)
def fft2(s):
X = np.fft.fft(s,axis=0)
Result = np.fft.fft(X,axis=1)
return Result
def Aufgabe2a():
x = np.arange(-np.pi, np.pi,0.1)
y = np.arange(-np.pi, np.pi,0.1)
X,Y = np.meshgrid(x,y)... | true |
ce8c8be2d4e7a8d40551552e439d4c5a732330b3 | Python | Praveenk8051/python-scripts-projects | /scripts/rename_files.py | UTF-8 | 1,739 | 2.9375 | 3 | [] | no_license | import ntpath
import os
import argparse
from tensorflow.python.platform import gfile
def create_file_list(path):
"""Create list of file paths
Args:
path: folder containing image files
Returns:
list: list of image file paths
"""
file_list = []
extensions = ['jpg', 'jpeg', 'JPG',... | true |
8537bd596b7722966c4b0c0f106fb44470953bb0 | Python | s-christian/Schoolwork | /Introduction to Cryptography/RSA.py | UTF-8 | 1,237 | 3.640625 | 4 | [] | no_license | def modular_exponentiation(base, exponent, n):
# base^exponent (mod n)
ans = 1
while exponent > 0:
if exponent % 2 == 0:
exponent /= 2
base = (base * base) % n
else:
exponent -= 1
ans = (ans * base) % n
return ans
def encrypt(m, e, n):
... | true |
481b35b7e88d0be31ecba848718db9b22473000d | Python | saikumar3011/appointment | /hospitalapp/views.py | UTF-8 | 2,863 | 2.59375 | 3 | [] | no_license | from django.shortcuts import render
from django.contrib.auth import authenticate,login
from .form import LoginForm
from django.http import HttpResponse
from rest_framework import viewsets
from .models import *
from .serializers import *
from django.contrib.auth.models import User
from datetime import datetime
# Create ... | true |
ddc30cf9b3063be7b81df6bfb5827c0ae18a2653 | Python | Timothy-Kornish/MachineLearningPython | /machineLearning/TensorFlow_DeepLearning/bank_data_project.py | UTF-8 | 3,694 | 2.96875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import tensorflow as tf
import tensorflow.contrib.learn as learn
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, confusion... | true |
f0004a71f6fe3fb5c0d77e30b4d5eddeb91b4c7b | Python | reyn0149/CST9279-Lab-6 | /Test Program.py | UTF-8 | 1,222 | 3.390625 | 3 | [] | no_license | from displayObject import displayObject
x = 0
y = 0
inputInt = 1
inputString = ""
f1 = [
[1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1],
[0,1,1,1,1,1,1,0],
[1,0,1,1,1,1,0,1],
[1,0,0,1,1,0,0,1],
[1,0,0,1,1,0,0,1],
[0,0,0,1,1,0,0,0],
[0,0,0,0,0,0,0,0]
]
pm = [[0,0,0,1,1,1,1,1,0,0,0],
[0,0,1,1,1,1,1,1,1,0,0],
[0,1,1,1,1,1,1,1,1,1,... | true |
ea766a6ac105ba1627f0dc98c4bc73b3ee1092e7 | Python | IMDCGP105-1819/portfolio-ShmigabornDungiedoo | /ex5.py | UTF-8 | 283 | 3.6875 | 4 | [] | no_license | beer= 99
while beer>0:
print(str(beer) + " bottles of beer on the wall, " + str(beer) + " bottles of beer.")
beer = beer -1
print("no more bottles of beer on the wall, no more bottles of beer.")
print("Go to the store and buy some more, 99 bottles of beer on the wall...")
| true |
07869989b7de98acfc2b437471912da5de99182a | Python | ihlavsya/image_captioning | /helper.py | UTF-8 | 4,022 | 2.65625 | 3 | [] | no_license | """module with helper functions that are used in many places in project"""
import os
import numpy as np
import torch
import matplotlib.pyplot as plt
from coco_dataset import CocoDataset, collate_fn
from storage import Storage
def get_imgs_dir_filename(data_dir, data_type):
"""get name of images directory"""
... | true |
8b6ccdb6ff1d143fe0cd152e53b1789b34aad076 | Python | ArjanVermeulen97/waterstanden | /waterstanden_melder.py | UTF-8 | 1,272 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 31 23:13:01 2020
@author: Arjan
"""
import pandas as pd
from datetime import date
from pushtocal import push_event
data = pd.read_csv('./waterstanden.csv', delimiter=';', index_col=False)
for index in data.index:
data['Meting'][index] = float(data['Me... | true |
1fdb3a5036d3b5c3eb1b1ad60f9b97ba03ba2c46 | Python | cenzwong/HackUST2021 | /Sorting_Possible_Airport.py | UTF-8 | 2,746 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
import pandas as pd
import requests
import json
import datetime
import time
response = requests.get("https://raw.githubusercontent.com/mwgg/Airports/master/airports.json")
raw_transport_code = json.loads(response.text)
pd_raw_transport_code = pd.DataFrame(raw_transport... | true |
75e6f5d11b4db0b07a410858353181a41ae5a86a | Python | ZymHedy/code_practice | /offer/52match.py | UTF-8 | 4,935 | 3.828125 | 4 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
class Solution:
# s, pattern都是字符串
# 暴力法(用于帮助理解思路)
# 虽然暴力法思路容易理解,但是当字符串过长,递归过深的时候复杂度极大,超出可运行时间
# 动态规划则不会出现这个问题,效率还是更高
def match(self, s, pattern):
# write code here
if not s and not pattern:
return True
elif s and not pattern:
re... | true |
8104ba2324f6f7f8af81264802184ea7c6321cb4 | Python | wiresboy/6.111-Minesweeper | /custom_fs/fs_write.py | UTF-8 | 1,698 | 2.8125 | 3 | [] | no_license | import wave
import sys
from math import ceil
from struct import pack
filenames = sys.argv[1:]
print("Loading files: ",filenames)
#Open disk
print("wmic diskdrive list brief")
print("Did you check that \\\\.\\PhysicalDrive2 is the correct drive???? THIS CAN KILL YOUR LAPTOP!")
a=input()
if "yes" not in a:
1/0... | true |
ecbeaca584a4f8dfeddb5e1a240742282a5a5438 | Python | olekmali/eTCP_Python | /30_intro_to_sockets/304_append_together.py | UTF-8 | 777 | 3.71875 | 4 | [] | no_license | import sys
"""
This program demonstrates how to append data together
and then how to split it using the first occurrence of an empty line
"""
buffer = b"";
print( "Enter several lines of text followed by EOF character - Ctrl+Z")
while True:
data = bytes( sys.stdin.readline(), 'UTF-8' ) # data chunk, e... | true |
6cfe8a340a12bc40816b0a3584c475104ec8db4a | Python | Rusllan/PyxelTest | /PyxelTest.py | UTF-8 | 3,955 | 3.25 | 3 | [] | no_license | import pyxel
COL_BACKGROUND = 0
TILE_SIZE = 8
SCREEN_WIDTH = 160
SCREEN_HEIGHT = 120
def draw_tile(x, y, image_num, color):
i = image_num // 10
j = image_num % 10
pyxel.pal(7, color)
pyxel.blt(x*TILE_SIZE, y*TILE_SIZE, 0, j*TILE_SIZE, i*TILE_SIZE, TILE_SIZE, TILE_SIZE)
pyxel.pal()
class Object:... | true |
00eb00c411b7fe4a8ca5ce3964aff627e48fdf10 | Python | sahilkamboj3/research | /localguides/user_info/csv_funcs.py | UTF-8 | 3,092 | 2.6875 | 3 | [] | no_license | import pandas as pd
from os import path
import os
users_columns = [
'id',
'name',
'level',
'total_messages_posted',
'total_likes_received',
'total_likes_given',
'description', # None means no description
'total_badges',
'badges' # array
]
likes_given_to_posts_columns = [
'id... | true |
68ee32332e1335a133a94008794a7494ed228a26 | Python | CollinJ/Robin | /Robin/Simulation/Graph.py | UTF-8 | 6,462 | 3.015625 | 3 | [] | no_license | import pygraphviz as pgv
from ucb import interact
class Graph:
def __init__(self, *nodes):
self.nodes = list(nodes)
self.G = pgv.AGraph(resolution="75", overlap='scale', splines="True")
def __iter__(self):
return self.nodes.__iter__()
def __repr__(self):
string... | true |
08b372e35c21d27e477980c88333cd6771415ead | Python | israel-dryer/woodberry-chapel-interface | /src/controllers/mixins.py | UTF-8 | 532 | 3.046875 | 3 | [] | no_license | import webbrowser
import tkinter as tk
from tkinter.ttk import Widget
class Navigation:
"""A mix-in class to enable control view and web navigation"""
@staticmethod
def navigate_to_url(url: str):
"""Open url in a new browser tab"""
webbrowser.open(url, new=2)
@staticmethod
def na... | true |
7dae33c9d101a1be473d76b9a8a3a3fe3dd8ff11 | Python | Vladis466/Homework | /Spring 2016/CS 325/HW1/fibo.py | UTF-8 | 835 | 3.859375 | 4 | [] | no_license | import time
def fiboIterative(x):
num1 = 0
num2 = 1
temp = 0
if x == 0:
return 0
elif x == 1:
return 1
else:
for i in xrange(2, x):
temp = num2
num2 += num1
num1 = temp
return num2
def fiboRecursive(x):
if x == 0:
return 0
elif x == 1:
return 1
else:
return fiboRecursive(x-1) + fibo... | true |
803c880a9cffc6f77f526808650afbd79d8ea6e9 | Python | Hyun-mo/2021-Data-Analysis | /merge_dust_month.py | UTF-8 | 928 | 2.9375 | 3 | [] | no_license | import os
import pandas as pd
def mergeDust(filePath):
print(filePath)
data = pd.read_csv(filePath)
data.fillna(0, inplace=True)
out = {}
for idx in range(len(data)):
day = data.iloc[idx][0]
dust = data.iloc[idx][1]
day = str(day)
if day in out:
out[day... | true |
fc04dfaa1a0db559d134e03dbf9579b7a30965fd | Python | phantom-5/ANN_Parameter_Tuning | /parameter_tuning.py | UTF-8 | 2,066 | 2.96875 | 3 | [] | no_license | #data preprocessing
#classification into whether or not a person buys from into age,sal
#imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#getting dataset
dataset=pd.read_csv('Churn_Modelling.csv')
X=dataset.iloc[:,3:13].values
Y=dataset.iloc[:,13].values
#mising data - fine
#categoric... | true |
c97b310321b7d6d6d7732f7d96e024e42c9f8257 | Python | qijiamin/learn-python | /test2-1.py | GB18030 | 552 | 2.890625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
#########ѧϢ############
#:
#ѧ:1403050116
#༶ͨ14-1
##############Ŀ###############
#12.8
#############################
import math
p,k,T,M,NA,n,m,R=1.013e5,1.38e-23,300.15,32e-3,6.022e23,2.45e25,5.31e-26,8.31
n=p/(k*T)
print 'n=p/(k*T)=',n
n=M/NA
print 'n=M/NA=',n
rho=n*m
print 'rho=n*m=',rho
v=math... | true |
8e583e3761c49c4abb6871252fd774e68888392e | Python | andrewfandy/time_mover | /movetimeV2.py | UTF-8 | 2,771 | 3.71875 | 4 | [] | no_license | def leapYear(year):
if year%400 == 0:
return False
if year%100 == 0:
return False
if year%4 == 0:
return False
return True
def checkMonth(day, month, year):
if day > 31 and (month in [1, 3, 5, 7, 8, 10, 12]):
return False
elif day > 30 and (month in [... | true |
9a4cfd2c41a92a47b04efc8e4dd447da98a95e3e | Python | quinzel25/Capstone-Week-3 | /camelCase.py | UTF-8 | 972 | 4.375 | 4 | [] | no_license | # Lab 1 Part 3
import re
# function to convert a string into camelCase
def camelCase(snake_str):
components = snake_str.split(' ')
# capitalize the first letter of each component except the first one
# with the 'title' method and join them together.
return components[0] + ''.join(x.title() for x in ... | true |
43e3f972ae84781d4f30d6bd73456fe87b93f068 | Python | TadejPanjtar/GrowRoom | /pyzapiski.py | UTF-8 | 1,703 | 2.6875 | 3 | [] | no_license | LOGGING=True
def log(msg):
if LOGGING: print strftime("%Y-%m-%d %X"), msg
from time import strftime,sleep
from stgs import stgs
lightHours=[]
lightOldOn=False # read light status
LIGHT_HOURS_LEAP=24
LIGTH_HOURS_START=stgs.lightStart
LIGTH_HOURS_DURATION=stgs.lightDuration
tenMinutesRun=False
blinkTick=0
if (LIGT... | true |
74cafb2bee5b280cdff113d19e94ec73e063dd7d | Python | everett-j/python_stack_2 | /flask/flask_fundamentals/understanding_routing/understanding.py | UTF-8 | 637 | 3.09375 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
#KEEP THIS CODE ABOVE
@app.route('/')
def hello_world():
return 'Hello World!'
@app.route('/dojo')
def success():
return 'Dojo!'
@app.route('/say/<name>')
def hello(name):
return (f"Hi {name} !")
@app.route('/repeat/<rep>/<phrase>')
def repe... | true |
25118c4481fe1d53d82f84470cd5a6a6d727db97 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/bob/6c55cbd247b7409598fdf547f06b2368.py | UTF-8 | 279 | 3.46875 | 3 | [] | no_license | import string
def hey(what):
if what.strip() == "":
return "Fine. Be that way!"
if any(c in string.ascii_letters for c in what) and what.isupper():
return "Whoa, chill out!"
if what.endswith("?"):
return "Sure."
return "Whatever."
| true |
acd2bb18e10dce1b7271eb749e3f2619106c118c | Python | visHUSTLE/Asynchronous_Message_Server | /socket_client.py | UTF-8 | 6,591 | 2.84375 | 3 | [] | no_license | #Vishnu Raju Nandyala
#ID: 1001670678
# socket connection reference : https://www.journaldev.com/15906/python-socket-programming-server-client
#https://github.com/YashAvlani009/Sockets-and-Thread-Management
#https://www.geeksforgeeks.org/socket-programming-multi-threading-python/
from tkinter import *
from tkinter im... | true |
93f1788c3bd7096f2a2a5c379ba93ef918d3f59e | Python | StevenJW/some-cscircles-solutions | /chap7/string-shaving.py | UTF-8 | 38 | 2.90625 | 3 | [] | no_license | x = input()
print(x[1:int(len(x)-1)])
| true |
774828a11053e1b7f2e4bb10c63b38b2545ecbee | Python | ThomasZumsteg/project-euler | /problem_0006.py | UTF-8 | 275 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python
def sum_square_difference(the_list):
sum_square = 0
square_sum = 0
for i in the_list:
square_sum += i**2
sum_square += i
return sum_square**2 - square_sum
if __name__ == "__main__":
the_list = range(1,101)
print(sum_square_difference(the_list))
| true |
dbd72848fb99fbd29a20f0321bbaad377eecad69 | Python | kvantetore/PyProp | /examples/combined/hd+_vibration/constants.py | UTF-8 | 443 | 2.6875 | 3 | [] | no_license |
#Physical constants
eV_to_au = 0.036764706
au_to_eV = 27.2114
inverse_cm_to_au = 4.5563276e-06
au_to_inverse_cm = 219475.
volt_per_metre_to_au = 1.944689e-12
femtosec_to_au = 41.36338
def ReducedMass(M1, M2):
return M1 * M2 / (M1 + M2)
mass_proton_au = 1836.152666
mass_deuteron_au = 3670.482954
hdp_reduced_mass... | true |
be9820ffd3b67288510bc2e7cda21b0a545e490a | Python | ptasior/tal | /tools/dataGenerator/bin2cpp.py | UTF-8 | 1,478 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
import binascii
import sys, os
from string import Template
templateHederStart = Template('''// File auto generated
#pragma once
namespace EmbeddedData
{
extern const unsigned char $varName[];
extern const uint32_t ${varName}_size;
}
''')
templateStart = Template('''// File auto generated
#inc... | true |
0af28267cb872a902a05ea1e00ae8103c1a46287 | Python | mleitejunior/urionlinejudge | /python/iniciante/uri1014.py | UTF-8 | 83 | 3.453125 | 3 | [] | no_license | x = input()
y = input()
km_l = int(x)/float(y)
print ("{:.3f} km/l".format(km_l)) | true |
a006796ed19d0a1700de16cecf638e648efc9298 | Python | DanielFabian/DataStructuresAndAlgorithms | /Python/main.py | UTF-8 | 168 | 3.671875 | 4 | [
"Apache-2.0"
] | permissive | __author__ = 'Daniel'
print("Hello World")
def sum_of_n(n):
result = 0
for i in range(1, n + 1):
result += i
return result
print(sum_of_n(10))
| true |
77d998470835397b6bc14a70f72f987240fecccc | Python | VivekPandey09032002/coding_setup | /eyantra/countChar.py | UTF-8 | 388 | 3.53125 | 4 | [] | no_license | #count character
if __name__ == '__main__':
t=int(input())
while t>0:
s=input()
l=list(s.split(" "))
print(l)
for i in range(0,len(l)):
if i==0:
print(len(l[i])-1,end=",")
elif i==len(l)-1:
print(len(l[i]),end="\n")
... | true |
2cf139eea372d3ada917619626da83191c11dd99 | Python | 4rth4S/qradar4py | /qradar4py/endpoints/api_endpoint.py | UTF-8 | 2,751 | 3.09375 | 3 | [
"MIT"
] | permissive | import requests
class QRadarAPIEndpoint:
""""
The parent class for a QRadar API endpoints providing a constructor and several classmethods.
"""
def __init__(self, baseurl, header, verify):
self._baseurl = baseurl
self._header = header
self._verify = verify
def get_header(s... | true |
9717f39fcc1f52c07f5e13bb0af65ace751c45a2 | Python | kekemuyu/linewatch | /ports/esp32/extracttar.py | UTF-8 | 542 | 2.515625 | 3 | [
"MIT"
] | permissive |
import sys
import os
import shutil
import utarfile
import time
def run(src,dest_dir):
t = utarfile.TarFile(src)
prefix=dest_dir
for i in t:
i.name=i.name.rstrip('/')
print(i,i.name)
i.name=prefix+i.name
print(i.name)
if i.type == utarfile.DIRTYPE:
try:
os.mkdir(i.name)
... | true |
156fcbdf724ca90aa0a3ca27ca58fa90f60bded5 | Python | lizhuoxuan/TensorFlow | /TensorFlow-Course/第一部分:TensorFlow深度学习的第一课 【季老师】/第三章:卷积介绍 【季老师】/cnn_how.py | UTF-8 | 1,920 | 2.875 | 3 | [] | no_license | import cv2
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
i = misc.ascent()
plt.grid(False)
plt.gray()
plt.axis('off')
plt.imshow(i)
plt.show()
i_transformed = np.copy(i)
size_x = i_transformed.shape[0]
size_y = i_transformed.shape[1]
print(i_transformed.shape)
my_filter = [[-1, -2, -1], ... | true |
0c655157825ce06ee0a0f9b396bc108364d0043f | Python | Praneeth33/Hindi-Medium | /Scripts/audiosplit.py | UTF-8 | 679 | 2.625 | 3 | [] | no_license | from pydub import AudioSegment
import os
import wave
import contextlib
from math import ceil
def audiosplit():
fname = './audio.wav'
if not os.path.exists('./Splits/'):
os.mkdir('Splits')
with contextlib.closing(wave.open(fname,'r')) as f:
frames = f.getnframes()
rate = f.getframerate()
duration =... | true |
21064b4048cf6e3dc2eea0ef7e1b14801f60dfbf | Python | u1i/azure-appservice-sample-api-app | /routes.py | UTF-8 | 455 | 2.53125 | 3 | [
"MIT"
] | permissive | """
Routes and views for the bottle application.
"""
from bottle import route, view, response
from datetime import datetime
from random import randint
@route('/')
@route('/home')
@view('index')
def home():
"""Renders the home page."""
return dict(
year=datetime.now().year
)
@route('/api-request'... | true |
f6024c539d30e1e9aa309e699950c4f0a1a09385 | Python | shen-huang/selfteaching-python-camp | /19100402/cjh20040088/d10/mymodule/stats_word.py | UTF-8 | 644 | 3.1875 | 3 | [] | no_license | import jieba
import collections
import re
def stats_text_en(txt,count):
if type(txt)==str:
txt=re.sub('[^A-Za-z]','',txt)
txt=txt.lower()
txt=txt.split()
print(collections.Counter(txt).most_common(count))
else:
raise ValueError
def stats_text_cn(txt,count):
if type(t... | true |
bb3ea3282093ea447cd85b04d9e7c19d28b40456 | Python | KinoriSR/Deep-Learning | /Speech_to_Text/models.py | UTF-8 | 21,282 | 2.609375 | 3 | [] | no_license | import torch
import numpy as np
import torch.nn as nn
import torch.nn.utils as utils
from torch.nn.functional import softmax, pad, gumbel_softmax # log_softmax
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence, pad_sequence
from util import plot_attn_flow, plot_grad_flow
from torch.utils.data im... | true |
474bae745b0c49d7ba38f7219978cef4f7a48eec | Python | jangocheng/Beijing-Subway-System | /get_timecost.py | UTF-8 | 2,757 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: MarkJiYuan
# @Date: 2019-05-28 21:13:47
# @Last Modified by: MarkJiYuan
# @email: zhengjiy16@163.com
# @Last Modified time: 2019-05-29 14:06:30
# @Abstract:
import json
def get_time_cost(f):
for id in range(0, 20):
line_name = response.xpath('//div[@id="sub' + str(id) + '"]/d... | true |
0bee479c13183ad8686e2cd8ebb90c69ed09e47e | Python | jmcharter/advent_of_code_2020 | /day_04/day_04_part_one.py | UTF-8 | 372 | 2.671875 | 3 | [
"MIT"
] | permissive | required = [
'byr',
'iyr',
'eyr',
'hgt',
'hcl',
'ecl',
'pid'
]
with open("day_04/day_04.txt", "r") as f:
data = f.read().strip().split('\n\n')
count = 0
for entry in data:
valid = True
for item in required:
if not item in entry:
valid = False
if valid ==... | true |
b9717ba3f5a16a771cb4ac77d385f64f45d86eef | Python | jschmacht/xtandem_result_analyzer | /SearchAccessions.py | UTF-8 | 3,771 | 2.609375 | 3 | [] | no_license | import gzip
import re
import logging
from pathlib import Path
import multiprocessing as mp
class SearchAccessions:
def __init__(self, path_to_db, db):
"""
:param path_to_xml: path to the protein database
:param db: database format, 'ncbi' or 'uniprot' )
"""
sel... | true |
bf13f566d2836e8eb7c5fcafc225bf2c994026d1 | Python | marc2982/pypark | /pypark/peep.py | UTF-8 | 3,279 | 3.171875 | 3 | [] | no_license | import random
from constants import BLUE, TILE_SIZE, RED, PATH_COLOUR
from vector import Vector2d
import pygame
class Peep(object):
def __init__(self, position):
# position is world coordinates
self.position = position
self.destination_tile = None
self.path = None
self.s... | true |
5ca76314319a578485d5deece45c472c3ad76a37 | Python | SuzyQuant/randomWalk_v2 | /randomWalk_plot.py | UTF-8 | 5,324 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import matplotlib
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
data = np.loadtxt('quantitiesVStime2.txt')
time = data[:, 0] + 1
MSDth = time #<x^2> analytical ; ALSO THE SECOND COLUMN
MSDnum = data[:, 1] #<x^2> numerical / computer s... | true |
8b942aff7f794c912cc3a6212efa7c96e64632e8 | Python | souviksamanta95/machine_learning_examples | /tf2.0/xor3d.py | UTF-8 | 658 | 2.90625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def get_label(x, i1, i2, i3):
# x = sequence
if x[i1] < 0 and x[i2] < 0 and x[i3] < 0:
return 1
if x[i1] < 0 and x[i2] > 0 and x[i3] > 0:
return 1
if x[i1] > 0 and x[i2] < 0 and x[i3] > 0:
retu... | true |
209e802539c822c1d974de6f3021b761eab9efd9 | Python | FrenCompany/TastelessKingdom | /static/maps/level1.py | UTF-8 | 2,041 | 2.625 | 3 | [] | no_license | from settings.GUI import SCREEN_HEIGHT, SCREEN_WIDTH, CANNON_SIZE, COIN_SIZE
from settings.Game import CHAR_SPEED
block_width = 30
platform_width = 200
platform_height = 6
height_fourth = (SCREEN_HEIGHT - 2 * block_width) / 4
floor3 = height_fourth + block_width
floor2 = height_fourth * 2 + block_width
floor1 = heigh... | true |
644f287b3a166cb6b5af6f8358b2c9289bd71340 | Python | Hoseung/pyRamAn | /scripts/SAMI/lambda_mp_galaxy.py | UTF-8 | 15,224 | 2.53125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import matplotlib.pyplot as plt
def save_result(savedir, galid, data):
"""
parameters
----------
savedir : str
galid : int
"""
# savedir = 'simulation/galaxyXXXX/'
header = "NOUT ID X Y Z[Mpc] \
Vx Vy Vz[km/s] Reff[... | true |
c96656a9e9a79cbccc83f4b487a7b83e94b06c76 | Python | jabc1/ProgramLearning | /python/python-Michael/ErrorPdbTest/err.py | UTF-8 | 3,446 | 4.15625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 错误处理:Python内置了一套异常处理机制,来帮助我们进行错误处理
# 调试: Python的pdb可以让我们以单步方式执行代码。
# 测试:编写测试也很重要,可以在程序修改后反复运行,确保程序输出符合我们编写的测试
# 错误处理:高级语言通常都内置了一套try...except...finally...的错误处理机制
# 除零错误
try:
print('try begin...')
r = 1 / 0 #division by zero
print('result:', r)
except ZeroDivisionError as e:
print('e... | true |
3a29db16fd30979c0e10e58dca635db6e766d1c0 | Python | UAdenisyu/ANTLR4-parser | /main.py | UTF-8 | 905 | 2.6875 | 3 | [] | no_license | #main.py
from antlr4 import *
from antlr4_files.TestLexer import TestLexer
from antlr4_files.TestListener import TestListener
from antlr4_files.TestParser import TestParser
import sys
class TestPrintListener(TestListener):
def enterProg(self, ctx):
print('Syntactic and lexical analyzes are completed.')
... | true |
753b9418054e3ba951604cc0375ba9dcc2ad09b1 | Python | Thainahelena/python3-cursoEmVideo | /Mundo I/ex013.py | UTF-8 | 237 | 4.1875 | 4 | [] | no_license | salario_0 = float(input('Digite o salário do funcionário: R$ '))
salario_1 = salario_0 * 1.15
print('Um funcionário que recebe um salário de R$ {:.2f}, passa a receber R$ {:.2f}, com um aumento de 15%!'.format(salario_0, salario_1)) | true |
c937565696aac2e187518df8250f65c089052e8c | Python | saifsm7877/QuestionNumber01_saif-momin | /Question03_saif momin | UTF-8 | 176 | 3.171875 | 3 | [] | no_license | a = input()
level = 0
count = 0
for step in a:
if step == 'U':
level += 1
if level == 0:
count += 1
else:
level -= 1
print(count)
| true |
e0d6d57d0a24c9e523fd8aa05adc274d07ebcd78 | Python | mahehu/SGN-41007 | /code/pca_example.py | UTF-8 | 9,257 | 2.59375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 16 13:41:05 2016
@author: hehu
"""
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 11:01:16 2015
@author: hehu
"""
import matplotlib.pyplot as plt
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC, LinearSVC
from sklear... | true |
8ecf500026b370e19cd97aa9d1ab6767a025d0f9 | Python | VorTECHsa/python-sdk | /vortexasdk/endpoints/attributes.py | UTF-8 | 3,448 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | """
Try me out in your browser:
[)
matrix = []
for _ in range(n):
matrix.append(input().split())
matrix = [[int(el) for el in sublist] for sublist in matrix]
command = input()
while not command == "END":
if command.startswith("Add"):
useless, row, col, value = command.split()
row, col, value = in... | true |
5297c3dae55554c756de31190948d4134e0abb2a | Python | wayne2015/deeplearning | /dA.py | UTF-8 | 4,240 | 2.65625 | 3 | [] | no_license | import numpy
import theano
import theano.tensor as T
import cPickle,gzip
import utils
import Image
from theano.tensor.shared_randomstreams import RandomStreams
class dA(object):
def __init__(self,input,n_visible,n_hidden,
w_init=None,bVisible=None,bHidden=None):
numpy_rng = numpy.random.Ra... | true |
c45778084b8e62bce72eff4d0ced5bd55df4b69b | Python | ficksjr/programas-no-desktop | /Aula Python - Curso em video/Exercícios/desafiosiniciais/desafio053.py | UTF-8 | 557 | 4.46875 | 4 | [] | no_license | # Exercício Python 53: Crie um programa que leia uma frase qualquer e diga se ela é um palíndromo, desconsiderando os
# espaços. Exemplos de palíndromos:
frase = str(input('Digite a frase: ')).strip().upper()
frase_separada = frase.split()
print(frase_separada)
frase_junta = ''.join(frase_separada)
print(frase_junta)... | true |
132c93735dfe9a60f514f6b8f28f26bf79d6e7f0 | Python | JarvanIV4/pytest_hogwarts | /练习/CMB/02_04 list_dict_test/深拷贝与浅拷贝.py | UTF-8 | 1,285 | 3.640625 | 4 | [] | no_license | import copy
aList1=[2,3,["23",32]]
aList2=aList1 #直接复制,aList2等同于aList1
aList3=copy.copy(aList1) #浅拷贝,aList3的地址与aList1不同,但是里面的所有元素的地址也是一样的
aList4=copy.deepcopy(aList1) #深拷贝,aList4的地址与aList1不同,里面的可变元素地址也不一样,不可变元素的地址一样
print("列表内存地址:",id(aList1),id(aList2),id(aList3),id(aList4))
print("列表可变元素地址:")
print... | true |
40bbcbb09a2c8e6f065e2b52eb4a90bc7beb6597 | Python | ZordoC/How-to-Think-Like-a-ComputerScientist-Learning-with-Pytho3-and-Data-Structures | /alice.py | UTF-8 | 920 | 3 | 3 | [] | no_license | import string
import re
with open('alice_in_wonderland.txt', 'r') as file:
data = file.read().replace('\n', '')
def remove_punctation(phrase):
text_sans_punct = ""
for letter in phrase:
if letter not in string.punctuation:
text_sans_punct += letter
return text_sans_punct... | true |
bff4fc0573edba60b486d1cc105dff7572c44706 | Python | mayankgureja/TwistedChatServerClient | /twistedChatClient.py | UTF-8 | 1,245 | 2.859375 | 3 | [] | no_license | """
twistedChatClient.py
Mayank Gureja
02/14/2013
ECEC 433
"""
from twisted.internet import reactor, protocol, stdio
from twisted.protocols.basic import LineReceiver
class Server(LineReceiver):
def connectionMade(self):
self.factory = ChatClientFactory()
self.connector = reactor.connectTCP('loca... | true |
e327f567713264b6d36f1b095f81af3651508834 | Python | bemu/diagnosis_covid19 | /radiomics/lasso_try.py | UTF-8 | 2,539 | 2.578125 | 3 | [
"MIT"
] | permissive | import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import Lasso,LassoCV,LassoLarsCV
from sklearn.model_selection import cross_val_score
def rmse_cv(model):
rmse= np.sqrt(-cross_val_s... | true |
369a9d97fef179f3eec057598085dae206065326 | Python | sotkahey/myfirstproject | /zadanie1.py | UTF-8 | 386 | 3.5 | 4 | [] | no_license | import random
b = input('введите число')
a = random.randint(0, 50)
if a<b:
print('случайное число меньше пограничного')
else:
if ((a*3)>b):
print('случайное число больше пограничного в 3 раза')
else:
print('случайное число больше пограничного')
| true |
d16a704922d3efe9726a8a921082db6001ac8e40 | Python | Arun44/Fundamentals-Of-Computing-Specialization | /Course1/Week3/Guess-The-Number.py | UTF-8 | 2,852 | 3.875 | 4 | [] | no_license | # template for "Guess the number" mini-project
# input will come from buttons and an input field
# all output for the game will be printed in the console
import simplegui
import random
reset = 1;
secret_number = 0;
num_of_guess = 0;
# helper function to start and restart the game
def new_game(range):
# initializ... | true |
f4423c13680a8864c320325f934282c1ae26f685 | Python | shen-huang/selfteaching-python-camp | /exercises/1901100100/take_num_from_string.py | UTF-8 | 2,626 | 3.3125 | 3 | [] | no_license | import re
symlist = ["/","*"]
string=input("请输入运算等式")
#re.findall(r"\d+\.?\d*",string)
num = (re.findall(r"\d+\.?\d*",string)) #获取列式中的数字
print(num)
sym = re.findall(r"\W*",string) #获取列式中的运算符
sym.remove("")
for i in sym:
sym.remove("")
print(sym)
#symbol = re.findall(r"\[/-]*",string)
#print (re.findal... | true |
a6a39f4e91c0cee2444ce2028455a6dbe38f9a3c | Python | leducanh300795/c4e17-New-Cause-old-one-got-retk-so-bad- | /Fundamental/Session2/sum.py | UTF-8 | 115 | 3.203125 | 3 | [] | no_license | n = int (input("Enter a number ? " ))
a = range (n + 1) #khoang, day so
b = sum(a) #khong chay: sum (0,n)
print(b)
| true |
35e07ae72030c74215f81f9a696ab06797cd06c0 | Python | hlku/ooxx-variation | /ooxx_ab.py | UTF-8 | 5,756 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import random
import sys
difficulty = 0
def calculate(tsumeru, limit):
for i in range(0, 9) : # optimization for only move
if tsumeru[i] != 0 : continue
pos = list(tsumeru)
pos[i] = max(pos) + 1
if check(pos) : return i # win move!
... | true |
93a0b6ddc0fe94aa5bb6a8a47c6b84250c152708 | Python | yeeSilver/mogja.github.io | /practice.py | UTF-8 | 190 | 2.71875 | 3 | [] | no_license | lion_we_know = ['colin' ,'shawn', 'zayn mailk']
lion_meet = ['chris' , 'lion' ,'kelly']
for lion in lion_meet:
if lion in lion_we_know:
print("hi")
else:
print("harry potter") | true |
ba362d5181f8d2c542911aa3ac10de0873882a25 | Python | a7031x/e-net | /preprocess.py | UTF-8 | 5,466 | 2.6875 | 3 | [] | no_license | import re
import spacy
import ujson as json
import numpy as np
import tensorflow as tf
import config
import pickle
from tqdm import tqdm
from collections import Counter
from utils import mkdir, save_json
nlp = spacy.blank("en")
def remove_invalid_chars(text):
return text.replace("''", '" ').replace("``", '" ')
... | true |
0613048efd949826945c95b4e873d86b8ac01716 | Python | papaganesha/prog3 | /Heranca/01/Gerente.py | UTF-8 | 427 | 3.046875 | 3 | [] | no_license | from Funcionario import *
class Gerente(Funcionario):
def __init__(self, cod_func, nome, salario, departamento):
Funcionario.__init__(self, cod_func, nome, salario)
self.departamento = departamento
def get_Gerente(self):
print("Gerente:\n cod_func: {}\n nome: {}\n sa... | true |