blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
07e5b685cd5755f2713ec02c6ef263a34272c48d | RekaSafira17A1/Python-UAS | /PYTHON/REKA/kalkulator.py | UTF-8 | 267 | 3.375 | 3 | [] | no_license |
def ab(nilai1,nilai2,tugas):
if tugas =="+":
hasil = nilai1+nilai2
elif tugas =="-":
hasil = nilai1-nilai2
elif tugas =="*":
hasil = nilai1*nilai2
elif tugas == "/":
hasil = nilai1/nilai2
return hasil
| true |
59180478b0e00bd4d8286ebd5444a8857a4495e8 | aborger/RockSatX2020-KauIda | /mission_control/detectors/limit.py | UTF-8 | 654 | 3.296875 | 3 | [
"MIT"
] | permissive |
"""
* The Limit class detects when a limit switch is pressed.
* Power is sent through one wire and when the connection is completed, doorShut() returns true.
* Author: Aaron Borger <aborger@nnu.edu (307)534-6265>
"""
import RPi.GPIO as GPIO
POWER_PIN = 22
DETECT_PIN = 27
class Limit:
def setup(self):
... | true |
b85ced472b2681c02720e0d3612a38b38cf836e3 | KRHS-GameProgramming-2018/The-Adventures-of-Spaceman | /CoinCounter.py | UTF-8 | 852 | 2.8125 | 3 | [
"BSD-2-Clause"
] | permissive | import pygame, sys, math
#HealthBar and Power Ups
class CoinCounter(pygame.sprite.Sprite):
def __init__(self, coins=0, pos = [0,0]):
pygame.sprite.Sprite.__init__(self, self.containers)
self.coin = coins
self.font = pygame.font.Font("8-Bit Madness.ttf", 48)
# ~ self... | true |
7b43fe42138239bed416b5ba50ca19a81722b57b | MagneticCocoon/Automatic_scoring_via_neuralNetwork | /Source/ScoreEvaluation.py | UTF-8 | 887 | 3.015625 | 3 | [] | no_license | from sklearn.neural_network import MLPClassifier
import pickle
import spacy
MODEL_FILE = 'pickled_nnmodel'
def LoadModelFromFile(filename: str):
infile = open(filename, "rb")
NN = pickle.load(infile)
infile.close()
return NN
if __name__ == "__main__":
nl_spcy_md = spacy.load("nl_co... | true |
1d5520f7fb2a5fd07db55823b030b16465d74b90 | codernayeem/python-data-science-cheat-sheet | /1_numpy.py | UTF-8 | 16,192 | 3.4375 | 3 | [
"MIT"
] | permissive | # # # *************** Numpy *****************
# NumPy is used for working with arrays
# NumPy is short for "Numerical Python"
# It also has functions for working in domain of linear algebra, fourier transform, and matrices
# In Python we have lists that serve the purpose of arrays, but they are slow to process.
# Num... | true |
fe978ed3553c9605dab1d8b90d56e45c7ed5c3c8 | pauleveritt/wired_injector | /examples/protocols/adherent/models.py | UTF-8 | 723 | 2.765625 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
from wired_injector.decorators import adherent
from .protocols import Customer, Greeter
@adherent(Customer)
@dataclass()
class RegularCustomer:
first_name: str = 'Marie'
@adherent(Customer)
@dataclass()
class FrenchCustomer:
first_name: str = 'Sophie'
@adherent(Greeter)... | true |
ea08fa54dd98ce3b0ca15deca3952d6851a2e70d | GuilhermeUtech/udemy-python | /S16/expressoes_regulares.py | UTF-8 | 758 | 3.734375 | 4 | [] | no_license | #Aula sobre expressões regulares
import re
patterns = ['term1','term2']
text = 'this is a string with term1. This another with term2'
print(re.search(patterns[0], text))
for pattern in patterns:
print('searching for "%s" in "%s"' % (pattern,text))
if re.search(pattern,text):
print('\n')
print('... | true |
129479f4aafd389a5ea0e9a11f2cf36dafd07d28 | hroussille/MA_CURRICULUM_SIMPLE_INTERACTIONS_RNN | /PPO.py | UTF-8 | 12,578 | 2.578125 | 3 | [] | no_license | import torch
import torch.distributions
import copy
import numpy as np
import time
class Actor(torch.nn.Module):
def __init__(self, input_dim, hidden_state_dim, output_dim, recurrent_layers=1):
super(Actor, self).__init__()
self.hidden_state_dim = hidden_state_dim
self.recurrent_layers = r... | true |
0649dbbc492637f853c1ba47cd64173415b67fe3 | NataliaBondarenko/desktop | /exchange_rate.py | UTF-8 | 8,934 | 2.703125 | 3 | [] | no_license | '''
Ukrainian Hryvnia rate
The program that receives currency exchange data
from the National Bank of Ukraine (https://bank.gov.ua)
and CoinMarketCap (https://coinmarketcap.com)
From NBU:
tab1 -> current exchange rate for USD, EUR, PLN
tab2 -> currency rates on a certain date (now 60 currencies)
From CoinMarketCap:
tab... | true |
f8ab22e6d26796cbbe66029b9578362590f9a392 | ljyljy/sleepdetect | /fun.py | UTF-8 | 5,586 | 2.578125 | 3 | [] | no_license |
# coding: utf-8
# In[230]:
from IPython.display import display
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
import math
import numpy as np
import pandas as pd
from scipy import signal,interpolate
import os
import shutil
import wfdb
# In[231]:
# 定义求RR间期的函数
def RR(signal,fs_raw=250):
... | true |
b984a698687abd40ebbc4354aa432c51978d1741 | jnotor/data_encoding_2021 | /q8_rsa/quick_mod_inverse.py | UTF-8 | 116 | 3.03125 | 3 | [] | no_license | e = 7
i = 2
modder = 480
while i < 10000:
if (e * i ) % modder == 1:
print(i)
break
i+=1 | true |
e558873e5d996eb711ed814a36c7762be7eabd33 | lkoval/vawt_env | /learn/trivia/argmax_w_nan.py | UTF-8 | 271 | 3 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.DataFrame({'Date': [0, 1, -2, 0, 1, 2], 'A': [10, 11, -21, 10, 21, 21], 'val': [0, 1, np.nan, 3, 4, -5]})
print(df)
# select row as a Series
a = df.iloc[2]
# return Series of Trues and False
b = np.argmax(a)
print(b)
pass
| true |
af81e0f794bec5e64b111989bb63949f09d92eac | ZNIXS/experimentalExperienceGenerator | /main.py | UTF-8 | 1,500 | 3.671875 | 4 | [] | no_license | class Generate:
def generator(self,topic,ques,solve):
t = topic
q = ques
s = solve
a = t+q
print("经过这次的"+t+"""实验,我个人得到了不少的收获,一方面加深了我对课本理论的认识,另一方面也提高了实验操作本事。我总结了以下的体会和经验。
这次的实验跟之前做的实验不一样,因为这次实验遇到了"""+q+"""的问题。所以是我觉得这次实验我学到的最宝贵、最深刻的经验,就是弄懂这个问题。
我一开始产生了疑问:"""+a+"""是怎么回事呢... | true |
9c1023957f4ef638db338dc5d250fc33d3ccb004 | progressivis/altair_examples | /altair_examples/binned_scatterplot.py | UTF-8 | 445 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Binned Scatterplot
------------------
This example shows how to make a binned scatterplot.
"""
# category: scatter plots
import altair as alt
from vega_datasets import data
from altair_examples import fix_columns
source = data.movies()
fix_columns(source)
(
alt.Chart(source)
.mark_circle()
.encode(
... | true |
052ae38069cbdcca392e014ac41acb2c6fbaf2a1 | Jumpei-Nakajima/hatsudenki | /src/hatsudenki/packages/cache/base/memory/solo.py | UTF-8 | 2,543 | 2.828125 | 3 | [] | no_license | from typing import Type, TypeVar, Iterator, Iterable
from hatsudenki.packages.table.index import PrimaryIndex
T = TypeVar('T')
class CacheBaseTableSolo(object):
class Meta:
table_name: str = None
primary_index: PrimaryIndex = None
_mapped = {}
def __init__(self, **kwargs):
pass... | true |
6c63723afe3018675ef89104299a13eca53f3f6f | fagan2888/kaggle-notebooks-1 | /housing-competition/main.py | UTF-8 | 7,947 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import os
import pandas as pd
from sklearn.base import clone
from sklearn.linear_model import Lasso, LinearRegression, Ridge, SGDRegressor
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
... | true |
1dc508c91ca8a1b0ad4826fe85662a2cb42c7bc5 | raquelmachado4993/omundodanarrativagit | /python/RASCUNHOS/chunking.py | UTF-8 | 1,012 | 2.53125 | 3 | [
"MIT"
] | permissive | # coding=utf-8
import nltk
tagged_sents = nltk.corpus.mac_morpho.tagged_sents()
t0 = nltk.DefaultTagger('N')
t1 = nltk.UnigramTagger(tagged_sents, backoff=t0)
t2 = nltk.BigramTagger(tagged_sents, backoff=t1)
t3 = nltk.TrigramTagger(tagged_sents, backoff=t2)
from pickle import dump
output = open('mac_morpho.pkl', 'wb')
... | true |
a2a0ee8c50cae377f878f34149d2b50bc1ffd7f0 | ebursim/DataScientology | /train_model.py | UTF-8 | 1,522 | 2.75 | 3 | [] | no_license | import pandas as pd
import requests as req
import json
import os
import matplotlib.pyplot as plot
from tpot import TPOTClassifier
from sklearn.model_selection import train_test_split
data = pd.read_csv("./cache")
heroes = pd.read_json("./heroes.json")
for column in data.columns:
print(column)
faction_column, fa... | true |
12a884249f05d20aeb62726b573e755657d8a52f | TravisAGengler/Labyrinth | /src/cell.py | UTF-8 | 2,092 | 3.75 | 4 | [] | no_license | class Cell:
def __init__(self, wallUp, wallDown, wallLeft, wallRight):
# Boolean: Whether there is a wall
self.WALL_UP = wallUp
self.WALL_DOWN = wallDown
self.WALL_LEFT = wallLeft
self.WALL_RIGHT = wallRight
# Cell object: Adjacent cell data
self.cellUp = None... | true |
b204f48063e20b1ea41277728a2762f55e2a8afb | Lancher/coding-challenge | /dp/*min_window_seq.py | UTF-8 | 698 | 2.765625 | 3 | [] | no_license | # LEETCODE@ Minimum Window Subsequence
#
# --END--
def minWindow(self, S, T):
m, n = len(T), len(S)
dp = [[0 for j in range(n + 1)] for i in range(m + 1)]
for j in range(0, n + 1):
dp[0][j] = j + 1
for i in range(1, m + 1):
for j in range(1, n + 1):
if T[i - 1] == S[j - 1... | true |
7ecf2dcfeabd630d403f8786b3ddde587bdeda4d | gyasmeen-ml/multidiv-teachers | /test.py | UTF-8 | 1,253 | 2.515625 | 3 | [] | no_license | from tqdm import tqdm
import torch.nn.functional as F
import numpy as np
import torch
def test(device, dataloader, net, model_path=None, save_softmax_outputs=False, softmax_save_path=None):
total_datapoints = len(dataloader.dataset.data)
total_batches = total_datapoints // dataloader.batch_size
net = net.... | true |
0a3d16826ea175b2a0ed17240d114711ae2e4edd | fitzritz99/python_scripts | /python_filtering_example.py | UTF-8 | 415 | 2.90625 | 3 | [] | no_license | import pandas as pd
data1 = {'ID': [1,2,3,4],
'Latitude' : [45, 46, 47, 48],
'Longitude' : [-120, -121, -122, -123]}
data_df1 = pd.DataFrame(data1)
data2 = {'ID': [1,2,3,4],
'Latitude' : [45, 50, 55, 60],
'Longitude' : [-120, -125, -130, -135]}
data_df2 = pd.DataFrame(data2)
... | true |
32842c1bde7f1393a069c2ea8d483deca17407ca | fahadnayyar/codechef | /july18ISCC/T23.py | UTF-8 | 318 | 3.28125 | 3 | [] | no_license | def gcd(a, b):
if a == 0 :
return b
return gcd(b%a, a)
t=int(input())
for w in range(t):
n=int(input())
arr=list(map(int,input().split()))
flag=0
for i in range(n):
for j in range(i+1,n):
if gcd(arr[i],arr[j])==1:
flag=1
break
if flag==0:
print("NO")
else:
print("YES")
| true |
ae1220f85a772ed2b0e642a4cc8a95dfccdb6613 | withai/PyBasset | /store_data.py | UTF-8 | 2,699 | 2.609375 | 3 | [] | no_license | from itertools import groupby
from sklearn.model_selection import train_test_split
import numpy as np
import os.path
import pickle
import os
import random
def fasta_iter(fasta_name):
fh = open(fasta_name)
faiter = (x[1] for x in groupby(fh, lambda line: line[0] == ">"))
for header in faiter:
# d... | true |
d022b604f4423f6d4a59b988fe0626517ece037a | PatrickTSanders/SimulationThing | /simulation/halfLife.py | UTF-8 | 1,725 | 3.609375 | 4 | [] | no_license | import matplotlib.pyplot as plt
import drawWorld as dw
import runWorld as rw
import pygame as pg
def next_time(half_rate, time_int):
time = 0
counter = 0
time_array = []
while(counter <= time_int-1):
time_array.insert(counter, time)
counter += 1
time += half_rate
return t... | true |
e3759f58ca148700fca5bbcb2f7476dddac56f55 | qgliu/imager | /waveform.py | UTF-8 | 2,536 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# 1) read from a tif movie with multiple frames
# 2) save background histograms
# 3) draw
import sys
from PIL import Image
import numpy
from ROOT import *
import background as bkg
import tracking
from classes.pixel import Pixel
# froot = TFile.Open('results/im.root', 'recreate')
def writeRoo... | true |
ab67e65fb6e88084fa0ea4f66c57638a6b16c942 | navidshaikh/puzzles | /lcs/least_common_substring_count.py | UTF-8 | 294 | 3.375 | 3 | [] | no_license | def lcs(x, y, a, b):
if a == 0 or b == 0:
return 0
if x[a-1] == y[b -1]:
return 1 + lcs(x, y, a-1, b-1)
else:
return max(lcs(x, y, a, b-1), lcs(x, y, a-1, b))
if __name__ == "__main__":
x = "abcdefg"
y = "xayczd"
print lcs(x, y, len(x), len(y))
| true |
fb0efe787a4aa9d1f9076b816fb7c5d51fac0fa5 | jshoham/CS171Sudoku | /src/rw.py | UTF-8 | 1,927 | 3.46875 | 3 | [] | no_license | __author__ = 'jshoham'
# A simple module for reading and writing to files
import os
import traceback
OVERWRITE = 1
def read_file(file_path):
"""Opens the file and returns its contents as a string."""
try:
with open(file_path) as f:
return f.read()
except:
print "Error: Failed ... | true |
3190d1204330092b51a0bcf18178a69085c6c1f2 | RexAevum/Python_Projects | /Data_visualization_bokeh/Motion_detector_graph_app/plot.py | UTF-8 | 1,210 | 2.734375 | 3 | [] | no_license | from bokeh.plotting import figure, show, output_file
from bokeh.models import tickers, HoverTool, ColumnDataSource
import pandas
import datetime
#dtypes = {'motion_start' : datetime, 'montion_stop' : datetime}
# NOTE - get dataFrame as datetime object rather than generic object, otherwise the quad will not generate
d... | true |
8118e86dc4cb4027d470d2df176452536633f776 | huytofu/mushroom_api | /ml_model/train_model.py | UTF-8 | 1,294 | 2.75 | 3 | [] | no_license | import pickle
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import confusion_matrix, accuracy_score
def train_model(df_one_hot_features, df_one_hot_class):
def reshape_clas... | true |
e6b0fdabe8b13ca9f885931fa17e842ceee99b26 | sumukhhk/cnlab1BM17CS106 | /shkclienttcp.py | UTF-8 | 343 | 2.71875 | 3 | [] | no_license | from socket import*
serverPort=12000
serverName='DESKTOP-OC56HS8'
clientSocket=socket(AF_INET,SOCK_STREAM)
clientSocket.connect((serverName,serverPort))
sentence=input("enter sentence")
clientSocket.send(sentence.encode())
modifiedSentence=clientSocket.recv(1024)
print("From server:",modifiedSentence.decode())
... | true |
86bc585497ac45b743e1ac7ea33ce21d22485a87 | thrassat/PIR-Scapy-Network | /lmain_learning_tpsreel.py | UTF-8 | 2,958 | 2.875 | 3 | [] | no_license |
from scapy.all import *
import sys
import time
learned_telnet = 0
try:
interfaceobj = input("[*] Enter Desired Interface: ")
ipobj = input("[*] Enter IP IoT: ")
nport = input("Numéro de port utilisé pour telnet (23 par défault): ")
except KeyboardInterrupt:
print("[*] User Requested Shutdown...")
... | true |
d5f5d881b7a998fbf3f41186efed519ddb8237bb | patelshivang0815/Python-Challenge | /PyBank.py | UTF-8 | 2,170 | 3.359375 | 3 | [] | no_license | #import modules
import os
import csv
#create trackers
months_total = 0
revenue_total = 0
past_revenue = 0
highest_increase = 0
lowest_decrease = 99999999999
#create lists to store revenue change
revChange = []
#create path
budget_csvpath = "budget_data.csv"
#print(budget_csvpath)
#read csv file
with open... | true |
a5e6a08ebe21d6b71918e3c2d90de18981c1925d | Saplyng/Hello-World-redux | /Python/chapter 3/nested ifs.py | UTF-8 | 3,610 | 3.796875 | 4 | [] | no_license | initial_dialog = """Hello User, it's that time of month again!
Yep it's time to pay your phone bill! So much fun, well at least for me.
I do love getting your money, User... (´。• ω •。`)
But before I can get all your precious money, I need to know what package you have.
In case you forgot your packages name, I put all... | true |
5230134593fd7e59605f9ceb87d9215e06911b5e | DhruvDRE/Phone_Country_tracker | /phone_trackers.py | UTF-8 | 658 | 3.09375 | 3 | [] | no_license | #sudo pip3 install phonenumbers
# keep number in one file
import phonenumbers as pn
# to get variable from on python file in same directory
#from file_name import variable_name_from_file
number="+91----------" #number must include country code
from phonenumbers import geocoder # to get location
ch_number=pn.parse(num... | true |
d1afc896231396510c3974109cc985837adf644d | YI-DING/daily-leetcode | /majority_element.py | UTF-8 | 312 | 3.34375 | 3 | [] | no_license | from statistics import median
class Solution:
def majorityElement(self, nums: List[int]):
n=len(nums)
if n%2==1:
return (int(median(nums)))
else:
return (int(median(nums[0:n])))
'''test:
nums=[3,3,4,4,4]
print(majorityElement(nums))
''' | true |
c29c613fa20b12f702dfa90944c206629713f763 | milnux/lucky_unicorn | /05_token_generator_v1.py | UTF-8 | 199 | 3.65625 | 4 | [] | no_license | import random
# main routine
tokens = ["unicorn", "horse", "zebra", "donkey"]
# testing loop to generate 20 tokens
for item in range (0, 20):
chosen = random.choice(tokens)
print(chosen)
| true |
ce0d28f0dce18958251f6c9a4f942a73904ed37c | mircea-negrau/Library-Management | /functionalities/services/rental_service.py | UTF-8 | 20,829 | 3 | 3 | [] | no_license | from datetime import date
from domain.entities.rental_entity import Rental
from functionalities.validation.exceptions import RepoError, ValidError
class RentalService:
def __init__(self, action_service, book_repository, client_repository, rental_repository,
book_validator, client_validator, rent... | true |
30b6829b99a327826f8d19b68b8fb31017618301 | sid1997/SummerTerm2017 | /Liver Disorders/Models Code/liv_log.py | UTF-8 | 2,092 | 2.984375 | 3 | [] | no_license | #importing packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import linear_model
from sklearn.metrics import accuracy_score,f1_score,confusion_matrix,roc_curve,roc_auc_score
from sklearn.model_selection import StratifiedKFold
from sklearn.preprocessing import MinMaxScaler,norm... | true |
c762d635fdf3bc5ba37434b0ed3d789097bf2163 | gihyunkim/A_I-study | /deep_learning_from_scratch/minst_2_02.py | UTF-8 | 931 | 2.609375 | 3 | [] | no_license | import numpy as np
import pickle
import sys, os
sys.path.append(os.pardir)
from datasets.mnist import load_mnist
from perceptron_01 import sigmoid, softmax
def get_data():
(x_train, y_train), (x_test, y_test) = load_mnist(flatten=True, one_hot_label=False, normalize=True)
return x_test, y_test
def init_networ... | true |
b1c6fe2a4181c52518f45440bd97e35f93f0b0bf | TiagoTostas/ASI_MasterThesis2020 | /FieldWiz_Python/SQIs/utils.py | UTF-8 | 15,220 | 3.390625 | 3 | [] | no_license | def bSQI(detector_1, detector_2, fs=1000., mode='simple', search_window=150):
""" Comparison of the output of two detectors.
Parameters
----------
detector_1 : array
Output of the first detector.
detector_2 : array
Output of the second detector.
fs: int, optional
Samplin... | true |
b60fefa9abec9c2e3ae471ae65514ed6623105b4 | fyabc/Toys | /ascii_art/ascii_art.py | UTF-8 | 5,812 | 3.140625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""ASCII art generator."""
import argparse
import os
from bisect import bisect
from pathlib import Path
from PIL import ImageFont, Image, ImageDraw
__author__ = 'fyabc'
SYS_FONT_DIR = Path('C:/Windows/Fonts')
FONT = ImageFont.load_default()
N_COLORS = 256
CHARSET = [chr(i... | true |
fe7db3f73698b4bc24686972e172b6781b4f1671 | legend-exp/CAGE | /motors/motor_movement_beta.py | UTF-8 | 1,986 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
import gclib
from pprint import pprint
import spur
import numpy as np
from source_move_beta import *
from linear_move_beta import *
from rotary_move_beta import *
def main():
print('Hello! Welcome to the super ineractive UI for the CAGE motor movement software! \n')
print('WARNING: Did ... | true |
f7d2ddb8e33c94fcae0b11a329ebd424d301187b | sertoa812/Information-Retrieve | /Sentiment/CommentsToken/GenerateTokenData.py | UTF-8 | 1,380 | 2.75 | 3 | [] | no_license | import thulac
import os
stop_words_path = os.path.join(os.path.abspath('.'), 'stopwords.txt')
path1 = os.path.join(os.path.abspath('.'), 'neg.txt')
path2 = os.path.join(os.path.abspath('.'), 'pos.txt')
def get_stop_words():
with open(stop_words_path, 'rt', encoding='utf-8') as f:
return [line.replace('\n', ... | true |
25b27eb33151430365b110b6ed63c0c7bb2de083 | brainwerkz/SamplePyScripts | /Py2Requests/Requests.py | UTF-8 | 221 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
import requests
r = requests.get('http://136.62.71.28/')
#print (r.status_code)
print (r.url)
if (r.status_code) == 200:
print("The website is up!!")
else:
print("Sorry, the website is down now") | true |
721a8b2127e0b5e682d2b1555b0be786c11a118b | umfranzw/grn-crossover | /config.py | UTF-8 | 888 | 2.828125 | 3 | [] | no_license | #This class holds all of the adjustable parameters that the simulation uses.
#These values remain fixed throughout the simulation.
class Config():
#self-explanetory parameters
pop_size = 2
num_genes = 8
num_initial_proteins = 4
sim_steps = 2
#number of bits in a protein sequence, binding se... | true |
4a21f41f3db132dbca53fc0f1f0667971de0b6b8 | wsq553523944/python | /01.py | UTF-8 | 951 | 3.28125 | 3 | [] | no_license | # 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
import random
import os
def detect_txt():
filename='Activation_code.txt'
if os.path.exists(filename):
os.remove(filename)
def Activation_code(num,length):
f=open('Activation_code.txt','w')
f... | true |
b31dad518b734ee63506caa0995e83a29f39ed0f | petobens/dotfiles | /python/ipython_startup.py | UTF-8 | 1,431 | 2.609375 | 3 | [
"MIT"
] | permissive | """My ipython startup settings."""
# pylint:disable=W0108
from IPython import get_ipython
from prompt_toolkit.filters import emacs_insert_mode, vi_insert_mode
from prompt_toolkit.key_binding.bindings.named_commands import (
backward_kill_word,
backward_word,
beginning_of_line,
end_of_line,
forward_... | true |
13e591d9bbd9aa47df8b76439d93bad4cd2caaa1 | maanya125/FindAndReplace | /findAndReplace.py | UTF-8 | 1,259 | 3.609375 | 4 | [
"MIT"
] | permissive | """ 1/25/2018:
Problem: Have loads of log files with multiple 'keys'.
The log file processing tool does not recognize 'key' strings but wants 'code' strings!
Solution: Write a python based tool, were a user can define list of strings that they want
replaced over mutiple files in one directory """
import os
import csv... | true |
46a9cc765c0e32111934ca7043b5f650083a2a8f | wxqhphy/udacity | /nerual_network/gradient_descent.py | UTF-8 | 502 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 26 16:42:36 2019
@author: wxq
"""
import numpy as np
def sigmoid(x):
return 1/(1+np.exp(-x))
def sigmoid_prime(x):
return sigmoid(x) * (1-sigmoid(x))
learnrate = 0.5
x = np.array([1,2])
y = 0.5
w = np.array([0.5,-0.5])
nn_output = sigmoid(np.dot(x,w))
error =... | true |
2048112f0683455a9538415986b381495ef70692 | DMilmont/mode | /Mode/roadster/spaces/~Archived Reports/Express Visitor Early Warning System.8fbd8e9bc111/notebook/cell-number-4.f6343f294676.r | UTF-8 | 334 | 2.65625 | 3 | [] | no_license | glimpse(data_grouped)
data_grouped <- data_grouped %>% mutate(perc_difference = round((`Current Week` - `Previous 7-8 Weeks`) / `Previous 7-8 Weeks`, 2))
data_grouped <- data_grouped %>% arrange(perc_difference, desc(`Previous 7-8 Weeks`))
data_grouped <- data_grouped %>% mutate(`Previous 7-8 Weeks` = round(`Previous 7... | true |
76d9f21062b6540c78f88dc0cb8869f939b118af | Deep-Spark/DeepSparkHub | /cv/distiller/CWD/pytorch/mmrazor/tests/utils/set_torch_thread.py | UTF-8 | 489 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) OpenMMLab. All rights reserved.
import torch
class SetTorchThread:
def __init__(self, num_thread: int = -1) -> None:
self.prev_num_threads = torch.get_num_threads()
self.num_threads = num_thread
def __enter__(self):
if self.num_threads != -1:
torch.set_num... | true |
03dcd89c0288a7aeed56c2b28160a5b40b401191 | hobu/laspy | /laspy/compression.py | UTF-8 | 1,975 | 2.71875 | 3 | [
"BSD-2-Clause"
] | permissive | """ The functions related to the LAZ format (compressed LAS)
"""
import enum
from typing import Tuple
class LazBackend(enum.Enum):
"""Supported backends for reading and writing LAS/LAZ"""
# type_hint = Union[LazBackend, Iterable[LazBackend]]
LazrsParallel = 0
"""lazrs in multi-thread mode"""
Laz... | true |
064a25390a4cef2761240302b11a8a1441ad69e5 | alicejuan1208/sc-projects | /stanCode_Projects/4_my_searching_system/babygraphics.py | UTF-8 | 6,493 | 3.390625 | 3 | [
"MIT"
] | permissive | """
SC101 Baby Names Project
Adapted from Nick Parlante's Baby Names assignment by
Jerry Liao.
YOUR DESCRIPTION HERE
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt', 'data/full/baby-1930.txt',
... | true |
02eeb2b7803e138e330f47222eb29d2a44e311b9 | dhamodaran-pandiyan/CoWin-Slot-Finder | /Cowin_slot_finder.py | UTF-8 | 1,985 | 3.203125 | 3 | [
"MIT"
] | permissive | '''
Script Owner: Dhamodaran Pandiyan
Contact: dhamodaranpandiyan@gmail.com
Script Overview: Fetching Covid vaccine slots information.
'''
import requests
import datetime
import logging
#Constants
PUBLIC_API = "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByPin?pincode={}&date={}"... | true |
1612161140d6b332fede56ab7f9fca2a2a89eba9 | Roagen7/phy | /src/classes/Force.py | UTF-8 | 264 | 2.734375 | 3 | [] | no_license | class Force:
#value - coeficcient's value
def __init__(self,direction, value):
self.direction = direction
self.value = value
def reevaluate(self, param):
return Force(self.direction, self.value*param)
| true |
a5bb8fedff3dd3e5068f6b0e86d8fdad3cbbad18 | Igalia/browserperfdash | /docs/read-json-results | UTF-8 | 3,561 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
import json
import argparse
utils_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'dashboard', 'core', 'bots', 'reports', 'utils')
sys.path.append(utils_dir)
from benchmark_results import BenchmarkResults
from pprint import pprint
if __name__ == '__main... | true |
f2a5bbb3673bffae47c0cf4f61ccf59d3249e421 | Ratansingh648/ML101-Machine-Learning-from-Scratch | /Classification/LogisticRegression/ComputeEntropyCost.py | UTF-8 | 280 | 2.625 | 3 | [] | no_license | import numpy as np
# code to compute L2 Cost
def computeEntropyCost(y,yp):
# Write your code here
y = np.array(y).ravel()
yp = np.array(yp).ravel()
m = len(y)
J = -1*np.sum(y*np.log(yp+0.0000001)+(1-y)*np.log(1+0.0000001-yp))/m
return J
| true |
dba9ad60a2680c18876c140cad15a882fdc0d100 | fluckydog232/corpusNotcorpse | /src/topic_modelling/lemmatizer.py | UTF-8 | 1,211 | 3.140625 | 3 | [] | no_license | from nltk.stem import WordNetLemmatizer
from sklearn.feature_extraction.text import CountVectorizer
op_wrds = []
lemm = WordNetLemmatizer()
'''
Extend the sklearn implementation into the Vectorizer.
this tokenize input raw texts while discarding all single chracter terms('a', 'w')
Also built-in english stopwords is ... | true |
2dd1b343d75f2a185a787af7c2e9406984350216 | sebaszayas/Programas | /31-08-15 _Trabajo Practico Arreglos_/31-08-15--ej03.py | UTF-8 | 1,681 | 4.375 | 4 | [] | no_license | #!/usr/bin/env python3
'''
Leer una serie de números enteros positivos. Imprimir los números que conforman
la secuencia de números pares contiguos más larga.
Si existen dos secuencias de la misma longitud tener en cuenta aquella donde la
suma de los elementos de la serie sea la mayor (se sabe que la suma siempre es
d... | true |
84b73b593d5c554fd7222ad720b92decc27c4348 | isuru-m/RL_labs | /ex_1_spyder.py | UTF-8 | 3,104 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 1 09:07:42 2019
@author: Isuru
"""
import numpy as np
class Gridworld:
def __init__(self):
self.num_rows = 5
self.num_cols = 5
self.num_fields = self.num_cols * self.num_rows
self.gold_reward = 10
s... | true |
c3c61a2bc153135c23cf15905a3ef3bdac096654 | mmuqiitf/Fire-Forest-Project | /rgb_hsv.py | UTF-8 | 1,716 | 3.109375 | 3 | [] | no_license | import math
def bgr_to_hsv(b, g, r):
b, g, r = r / 255.0, g / 255.0, b / 255.0
print('r\' : ' + str(r))
print('g\' : ' + str(g))
print('b\' : ' + str(b))
mx = max(r, g, b)
mn = min(r, g, b)
print('cmin : ' + str(mn))
print('cmax : ' + str(mx))
df = mx - mn
print('delta : ' + str(... | true |
0761ced6f375f112fa5eeeeca39f655e9a3d41d9 | kcyu2014/nas-landmarkreg | /visualization/dot.py | UTF-8 | 5,669 | 2.6875 | 3 | [
"MIT"
] | permissive | """
From https://github.com/szagoruyko/pytorchviz/blob/master/torchviz/dot.py
Just put here to modify myself.
"""
from collections import namedtuple
from distutils.version import LooseVersion
from graphviz import Digraph
import torch
from torch.autograd import Variable
Node = namedtuple('Node', ('name', 'inputs', 'a... | true |
7b449576ae604458cfc4a07a60b0f5b270936a1f | KarenCBrown/EasyTranslate | /EasyTranslate.py | UTF-8 | 1,940 | 3.125 | 3 | [] | no_license | import re
numsOnly = re.compile("^\d[.\\\/,]?\d*$")
numsTest = re.compile("[.\s]*([.\/\d]+)(?:\s|\Z)")
tvarNum = 0
def identify_numbers(line):
alphaOnly = line.isalpha()
if alphaOnly:
return (line)
elif numsOnly.match(line):
out = "{{formatnum:" + line + "}}"
return(out)
else... | true |
0ab8c142518aefef4db37b5818e9aeb3af9d0373 | umalavasic/eAUrnik | /Parser.py | UTF-8 | 2,014 | 2.53125 | 3 | [
"MIT"
] | permissive | #
# Parser.py
# eAUrnik
#
from lxml import html
def parse_block(block):
if not block.xpath("table/tr/td[1]"):
return
title = block.xpath("table/tr/td[1]")[0].text.strip()
class_attribute = block.get("class")
if "ednevnik-seznam_ur_teden-td-odpadlo" in class_attribute:
return
# if... | true |
e6e59a2c5180c2342eacaa6bc9c36e6bf5f99dc1 | AgileMathew/AnandPython | /Module II/pgm34.py | UTF-8 | 571 | 3.8125 | 4 | [] | no_license | """Problem 34: Improve the above program to print the words in the descending order of the number of occurrences."""
def word_frequency(words):
frequency = dict()
for w in words:
frequency[w] = frequency.get(w, 0) + 1
return frequency
def read_words(filename):
return open(filename).read().split()
def sortf... | true |
793186c66457898326f3e3fa1f62dcb33797081a | pastormt/March-Madness-Predictions | /analysis.py | UTF-8 | 19,382 | 3.15625 | 3 | [] | no_license | import csv
import copy
import matplotlib.pyplot as plt
# create hash table
# expects csv file with ID in column 1, and Value in column 2, with new lines per each ID & Value
# (these are exported as CSVs from the Google Spreadsheets and put in the same directory as this file, analysis.py)
def create_id_score_dict(file_... | true |
e6173d1759a805c5887f70af6cd3ec0e2ef70fde | aytuncilhan/NLP-Web-Scraping | /Step4.py | UTF-8 | 2,499 | 3.390625 | 3 | [
"MIT"
] | permissive | # Import packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
#Schritt 4:
def main():
# Read pickled data from
readPkl = '/Users/aytuncilhan/Projects/bugcrowd_bounties.pkl'
df = pd.read_pickle(readPkl)
# Clean data before plotting
df ... | true |
82072b69ad49202e3c1ced9c98db14195ae647d2 | Aasthaengg/IBMdataset | /Python_codes/p02730/s963485648.py | UTF-8 | 130 | 3.484375 | 3 | [] | no_license | s = list(input())
if s == list(reversed(s)) and s[:len(s)//2] == list(reversed(s[:len(s)//2])):
print("Yes")
else:
print("No") | true |
1e88d88cf994d88bd3514584b13ba13d77232b2b | GuoYunZheSE/Leetcode | /Contest/19072020/5464.py | UTF-8 | 656 | 3.40625 | 3 | [] | no_license | # @Date : 10:32 07/19/2020
# @Author : ClassicalPi
# @FileName: 5464.py
# @Software: PyCharm
class Solution:
def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
drunk=numBottles
emptyBottles=numBottles
while emptyBottles>=numExchange:
numBottles=emptyBottle... | true |
8aed8217a98d8c1334943efe889020884c63dac6 | CormacS/Python_Year2 | /Week 7 Test/Cormac Smith Test 1.py | UTF-8 | 2,029 | 4.5 | 4 | [] | no_license | def kaprekar(upper): # Checks all the numbers to see if they are Kaprekars or not
n = 10
list1 = []
while n <= upper: # while loop to make sure it goes through all number from 10 to the users input
m = n*n
m = str(m) # turns into string to get length ... | true |
a193e9f4b76f05942e4a05f55b25f01114a2874c | Johnlky/DC-Boxjelly | /app/core/models.py | UTF-8 | 25,134 | 3.046875 | 3 | [] | no_license | """
This file contains the models representing a job, an equipment and a run.
Each model controls a folder in /data.
Data consistency is not guaranteed if a folder is access by multiple instences
(such as multiple devices accessing the same folder) at the same time.
"""
from pathlib import Path
from typing import Di... | true |
9aa9f57eefcbb764de542422e82b1f60b1fc2d16 | vbalogh-ultinous/reinforcement_learning-stormmax | /ddpg/ddpg.py | UTF-8 | 2,112 | 2.625 | 3 | [
"MIT"
] | permissive | # Deep Deterministic Policy Gradient
# following paper: Continuous control with deep reinforcement learning
# (https://arxiv.org/pdf/1509.02971.pdf)
#
# ---
# @author Yiren Lu
# @email luyiren [at] seas [dot] upenn [dot] edu
#
# MIT License
import numpy as np
import tensorflow as tf
class DDPG(ob... | true |
a7c66dc21638907fffd85ad2fbe8584628cdea04 | jarbus/neural-mmo | /speed.py | UTF-8 | 863 | 2.875 | 3 | [
"MIT"
] | permissive | from pdb import set_trace as T
import time
class Foo:
def __init__(self):
bar = 0
n = 10000
foo = Foo()
start = time.time()
for i in range(n):
foo.bar = 1
print(time.time() - start)
start = time.time()
for i in range(n):
foo.__dict__['bar'] = 1
print(time.time() - start)
start = time.time()
for i i... | true |
ac94cbf351157816978be9ecdfc468f52bb68dc9 | chenyanqa/example_tests_one | /test_03.py | UTF-8 | 322 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?
import math
for x in range(1, 10000):
y1 = int(math.sqrt(100+x))
y2= int(math.sqrt(268 + x))
if(x + 100 == y1*y1) and (x + 268 == y2*y2):
print(x) | true |
c2766b6295d506cb9cd2e4edb3d02e1e0c698f53 | MattBadet/batprojet | /Prof/1 Cours/programmes/serveur_ecrire_valeur_dans_client_udp.py | UTF-8 | 3,411 | 3.390625 | 3 | [] | no_license | # Ecrire les valeurs d'un capteur de température et d'humidité
# dans une page HTML. Déclarer un serveur HTTP. Quand ce serveur
# reçoit une requête, il renvoie dans une page HTML les valeurs du capteur
import time
import network # module permettant la communication sur un réseau Wifi
import socket ... | true |
634d0866de016758b75ab5d88579ff602042d0e3 | 13299118606/computer-vision | /Project4/denoise_sliding.py | UTF-8 | 4,040 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
import math
import skimage
import sklearn.preprocessing
import numpy
from PIL import Image
from skimage.util import view_as_windows as viewW
def read_image(file_name):
return normalize_image(skimage.io.imread(file_name))
def normalize_image(img):
ret = skimage.img_as_ubyte(skimage.transfor... | true |
5d21037c315dc207fec1a54c53ef5dfb2bd2c4ea | aobo-y/leetcode | /657.robot-return-to-origin.py | UTF-8 | 311 | 2.515625 | 3 | [] | no_license | #
# @lc app=leetcode id=657 lang=python3
#
# [657] Robot Return to Origin
#
# @lc code=start
from collections import Counter
class Solution:
def judgeCircle(self, moves: str) -> bool:
counts = Counter(moves)
return counts['L'] == counts['R'] and counts['U'] == counts['D']
# @lc code=end
| true |
7c408d02620969031f0a3403c8eb5ce72763bade | PengZhang2018/LeetCode | /algorithms/python/LongestSubstringWithAtMostTwoDistinctCharacters/LongestSubstringWithAtMostTwoDistinctCharacters.py | UTF-8 | 1,461 | 3.828125 | 4 | [
"MIT"
] | permissive | # Brutal Force
# c c a a b b b
# c a a b b b
# a a b b b
# a b b
# b
#
# 4 3 5 4 3 2 1
# return the max number from all combination
class Solution1:
def lengthOfLongestSubstringTwoDistinct(self, s: str) -> int:
res = []
for i in range(0, len(s)):
t = {}
t[s[i]] = s[i]
... | true |
c93977cb8c620ac2764f385a458f8020287ad71a | mgould1799/Intro-To-Python | /CSCI220/code from class/10.24selectionStatements.py | UTF-8 | 2,448 | 4.15625 | 4 | [] | no_license | ##selection statements
##ex) say'hello'
## if your eyes are brown:
## raise left hand
## else:
## raise your right hand
## say goodbye
##print("hi")
##if eyeColor="brown": if true it will return True if false will return False
## raise("left")
##else:
## raise("right")
##print("bye")
## if boolean exp... | true |
95a614db5fa4d09709e39baa286862190ee5b177 | shahshivam058/TextUtils.io | /TextUtils/views.py | UTF-8 | 1,444 | 2.5625 | 3 | [] | no_license | from django.http import HttpResponse
from django.shortcuts import render,redirect
def index(request):
return render(request,"index.html")
def analyze(request):
dj_text = request.POST.get("text","default")
removepunc = request.POST.get("removepunc","off")
fullcaps = request.POST.get("fullcaps","off")
... | true |
165f7f73c5af72d459fcaa9eb39131a7a87c6247 | nirae/darkly | /7_XSS_data_parameter/Ressources/exploit.py | UTF-8 | 357 | 2.625 | 3 | [] | no_license | #! /usr/bin/env python3
import requests
import base64
from bs4 import BeautifulSoup
payload_html = b"<script>alert(1);</script>"
b64_payload = base64.b64encode(payload_html).decode()
ret = requests.get('http://192.168.1.48/?page=media&src="data:text/html;base64,%s' % b64_payload)
soup = BeautifulSoup(ret.text, 'html.... | true |
6cd0e79135cf85f74075a56cd85d2bd0783fff7f | influencegamesservice/cryptoutil | /standalone_plaintext2encryption.py | UTF-8 | 523 | 2.609375 | 3 | [] | no_license | from argparse import ArgumentParser
import encryption_utility
def get_option():
argparser = ArgumentParser()
argparser.add_argument("--plainstring", '-p', required=True)
argparser.add_argument("--savekeypath", "-s", required=True)
argparser.add_argument("--saveencryptionpath", '-e', required=True)
... | true |
90dbe10d9be3ce8320454fb3fcb3776fa0893fa5 | rootAir/selenium-python | /python-intro/exercicios/problem8.py | UTF-8 | 1,232 | 3.921875 | 4 | [
"CC0-1.0"
] | permissive | dia = input('Dia: ')
mes = input('Mês: ')
ano = input('Ano: ')
if mes == '1':
print(f'Você nasceu no dia {dia}, de janeiro do ano de {ano}')
elif mes == '2':
print(f'Você nasceu no dia {dia}, de feveiro do ano de {ano}')
elif mes == '3':
print(f'Você nasceu no dia {dia}, de março do ano de {ano}')
elif mes... | true |
784bf0ac3e4423d3679618eba62dfd8164ac1be7 | ttomchy/LeetCodeInAction | /sliding_window/q283_move_zeroes/solution.py | UTF-8 | 778 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
FileName: solution.py
Description:
Author: Barry Chow
Date: 2020/11/19 4:22 PM
Version: 0.1
"""
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
def swap(... | true |
a7da820936d1f5254b7edfd96b29d8cad0ace518 | carnellj/presentations | /pylady-june-2018/contact-api/DB.py | UTF-8 | 4,381 | 2.734375 | 3 | [] | no_license | import uuid
import psycopg2
class ContactDB:
##Need to put this in a secret
def __init__(self, _user, _password, _dbname, _host):
self.conn = psycopg2.connect(user=_user, password=_password,dbname=_dbname, host=_host)
def createContactTable(self):
cursor = self.conn.cursor()
... | true |
20fa83e13118b93554f404fba6de5146a4160335 | KeserOner/testtechpeopledoc | /api_restaurant/restaurant/models.py | UTF-8 | 310 | 2.96875 | 3 | [] | no_license | from django.db import models
class Restaurant(models.Model):
"""Class that represent an restaurant"""
name = models.CharField(max_length=255, null=False)
city = models.CharField(max_length=255, null=False)
def __str__(self):
return f"Restaurant {self.name} located in {self.city}."
| true |
1633783b7a8c6f65adec869952c0663b870c2d38 | FairTraxx/snkrs-monitor | /bot.py | UTF-8 | 2,767 | 2.515625 | 3 | [] | no_license | import discord
import os
from free import snkrsmonitor
from premium import snkrsmonitorpremium
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
... | true |
5422829a5c42f4e72725044d5685f095a18cfb0a | hyeonjong-kim/AttentionVisualizeForDGA | /dke/cs/knu/models/Attention_model_preprocess.py | UTF-8 | 2,890 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import re, os
import json
from string import printable
from sklearn import model_selection
from keras.preprocessing import sequence
from keras.utils import np_utils
from keras import backend as K
from pathlib import Path
class Preprocessor:
def __init__(self):
self.i... | true |
af7fa2d3dd8e1baeff85669d04e7204d84fb50d4 | kantawat1156-github/allelab-procon | /Labทบทวน_11.py | UTF-8 | 222 | 3.03125 | 3 | [] | no_license | x = int(input())
d = 1
y_total = 1
while d <= x:
y = (x%(d*10))//d
if y % 2 == 0:
y_total=y_total*y
d = d*10
if y_total == 1:
y_total = -1
if x >= 1 and x <= 4000000000:
print(y_total)
elif x == 0:
print(0) | true |
4f7058716ad1a320fd5e20df545787c9c0a9b868 | qptrwa/World_Of_Games | /Score.py | UTF-8 | 494 | 2.78125 | 3 | [] | no_license | from Utils import SCORES_FILE_NAME
import os
def add_score(difficulty):
points_of_winning = (difficulty*3) + 5
base_points = 0
if os.path.exists("./"+SCORES_FILE_NAME):
f = open("./"+SCORES_FILE_NAME, "r")
content_of_file = f.read()
if content_of_file != "" :
base_points... | true |
3fbc3ff3e06704d91c08066e7bbf1694abe8b7cf | kombarar/QA | /питон3.1.py | UTF-8 | 182 | 4.0625 | 4 | [] | no_license | time = input("Введите кол-во минут" )
hours = int(time) / 60
sec = int(time) * 60
print("Это " + str(hours) + " часов и " + str(sec) + " секунд")
| true |
53f75f19cbc2caf830d3d5592b16c04f30fa3e60 | mikestrain/PythonGA | /PROJECT 2 - OH SBIR/OHIO_SBIR_R1.py | UTF-8 | 1,135 | 2.78125 | 3 | [] | no_license | # To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
from IPython import get_ipython
# %%
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import geocoder
import geopy.distance as gp
# set the plots to display in the Jupyter notebook
get_ipython().run_line_m... | true |
43b4d6a0af52c89d15f6db7b467be75c184d65bd | SiyiGuo/Titan-V | /AlphaPubg-Zero/Pubg/AlphaBetaPlayer.py | UTF-8 | 4,406 | 2.90625 | 3 | [] | no_license | import numpy as np
import math
import operator
import time
infinity = 999999
class AbpPlayer():
abpDepth = 7 # actual depth = abpdepth + 1
max = {}
min = {}
def __init__(self, game, player, abpDepth = 2):
#Player will always be White(1/friend), as we pass in canonical board
self.game... | true |
a0299c01ae59e49774d8c0a556b0b180f1a5af85 | cedias/Hierarchical-Sentiment | /utils.py | UTF-8 | 3,455 | 2.640625 | 3 | [
"MIT"
] | permissive | #utils.py
import torch
from tqdm import tqdm
from torch.autograd import Variable
from fmtl import FMTL
def tuple2var(tensors,data):
def copy2tensor(t,data):
t.resize_(data.size()).copy_(data,async=True)
return Variable(t)
return tuple(map(copy2tensor,tensors,data))
def new_tensors(n,cuda,type... | true |
d39fc359fcc1f398e6ba390684c94b6d2cb04583 | roosniclas/thinkful-describe | /stats.py | UTF-8 | 1,019 | 3.15625 | 3 | [] | no_license | import pandas as pd
from bs4 import BeautifulSoup
import urllib.request
url = 'http://lib.stat.cmu.edu/DASL/Datafiles/AlcoholandTobacco.html'
html = urllib.request.urlopen(url).read()
soup = BeautifulSoup(html, 'html.parser')
raw_text = soup.pre.string
raw_list = [row.split('\t') for row in raw_text.split('\n')]
... | true |
7a0e7d256b4f49924602cb5a6ccc1f7ea6bb9408 | aiviaghost/Cryptopals | /Set-2/CBC-bitflipping-attacks/Encryption_service.py | UTF-8 | 1,323 | 2.921875 | 3 | [] | no_license | import re
from secrets import token_bytes
from Crypto.Cipher import AES
class Encryption_service:
__BLOCKSIZE = 16
def __init__(self):
self.__SECRET_KEY = token_bytes(self.__BLOCKSIZE)
self.__IV = b'\x00' * self.__BLOCKSIZE
def __pad_pkcs7(self, msg: bytes) -> bytes:
pad = self._... | true |
f6be4499bf00879a5e092451a9d66a44c9cc8829 | ashupeeyush/summertraining | /peeyush_goyal66.py | UTF-8 | 1,109 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 12:39:50 2018
@author: Peeyush Goyal
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
df=pd.read_csv("banknotes.csv")
features = df.iloc[:,1:-1]
label = df.iloc[:,-1]
from sklearn.model_selection import train_test_split
feature_train, featu... | true |
d3ed4bc89fec295b39430295afce217aec9da7cb | snowyTheHamster/cryptocurrency_historical_value_scrapper | /assisted_historal_prices.py | UTF-8 | 2,806 | 2.984375 | 3 | [] | no_license | # this version uses pyautogui to generate the table with desired date range.
# use web scrapping at your own risk.
# make sure you have chrome web driver installed on your workstation.
# csv data will be saved as strings, you need to clean up the datatypes afterwards.
from datetime import date
from time import sleep
i... | true |
352d1fc1a55a47730263597e730533ef4cb0219d | duk1edev/projects | /PythonExamples/PythonHomeWork_7(lists,classwork)/PythonLists/list_slicing.py | UTF-8 | 104 | 3.015625 | 3 | [] | no_license | # new_list = my_list[start:end:step]
my_list = [5,7,9,1,1,2]
print(my_list[2::2] )
print(my_list[:-2:]) | true |