blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ea805ac9d3700f4fed3e9bc78c5b92a310a69428 | Python | neuralfilter/hackerrank | /Hacker_Rank/Python/itertoolsproduct.py | UTF-8 | 139 | 2.59375 | 3 | [] | no_license | from itertools import product
k = map(int, raw_input().split())
l = map(int, raw_input().split())
print(" ".join(map(str, product(k,l))))
| true |
00a2968587f2f0f1d740cc5e237439b588af0319 | Python | pauleveritt/wired_components | /tests/samples/simple/test_views.py | UTF-8 | 756 | 2.96875 | 3 | [
"MIT"
] | permissive | import pytest
from bs4 import BeautifulSoup
@pytest.fixture
def app(registry) -> None:
from wired_components.samples.simple import wired_setup
wired_setup(registry)
@pytest.mark.parametrize(
'path, heading',
[
('/', 'Root: My Site'),
('/f1', 'Folder: The Folder At The Root'),
... | true |
7f217fc7786c0099255dae847b8f70fd2b87baf2 | Python | fran-bravo/socketpy | /socketpy/templates.py | UTF-8 | 15,724 | 3.359375 | 3 | [
"MIT"
] | permissive | MODEL = """#ifndef MODELOS_H_
#define MODELOS_H_
typedef struct {
int length;
char *data;
} t_stream;
// Header de stream
typedef struct {
uint8_t tipoEstructura;
uint16_t length;
} __attribute__ ((__packed__)) t_header;
// Modelos
#endif"""
PACKC = """#include "paquetes.h"
// Paquetizacion
t_st... | true |
78d0284b1b7941663ac179a0859aadfd49f69bdb | Python | Cjbeleta/CSC-184 | /server.py | UTF-8 | 1,014 | 2.796875 | 3 | [] | no_license | from flask import Flask, request, jsonify
app = Flask(__name__)
anime = [{'title': 'Ao No Exorcist'},
{'title': 'Boku No Hero Academia'},
{'title': 'Code Geass'},
{'title': 'Danganronpa'},
{'title': 'Fairy Tail'},
{'title': 'HunterXHunter'}]
@app.route('/anime', methods = ['GET'])
def show... | true |
8ab9264b6c556d50afc215dd2449d951c67b6952 | Python | BrianPavillarCIS/2348HW | /HW3/11.18/main.py | UTF-8 | 336 | 3.734375 | 4 | [] | no_license | # Name: Brian Pavillar
# ID: 1863509
input_vals = input()
numbers = input_vals.split()
list_vals = []
for number in numbers:
list_vals.append(int(number))
new_list = []
for number in list_vals:
if number >= 0:
new_list.append(int(number))
new_list.sort()
for i in new_list:
... | true |
24f7f84e5d55f08423c4fea2c53d3eea38ac9ed9 | Python | jeremander/AttrVN | /nominate.py | UTF-8 | 9,874 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | """After obtaining all the desired embeddings, stacks them and applies supervised learning to nominate nodes whose nomination_attr_type value is unknown. Optionally uses leave-one-out cross-validation to nominate the known nodes as well.
Usage: python3 nominate.py [path]
The directory [path] must include a fi... | true |
46e720d29d1df25fe74433a6bae45e7064d36ab6 | Python | 873490374/startracker | /program/tracker/main_program.py | UTF-8 | 2,083 | 2.875 | 3 | [] | no_license | import numpy as np
from program.tracker.image_processor import ImageProcessor
from program.tracker.attitude_finder import AttitudeFinder
from program.tracker.star_identifier import StarIdentifier
from program.tracker.tracker import Tracker
class StarTracker:
def __init__(
self,
image_pro... | true |
940b1cfc804762d6fd008dc7be473960539a2581 | Python | cobymotion/PythonCourse | /001_Introduccion/EjerciciosClases/008_ciclos.py | UTF-8 | 596 | 4 | 4 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 29 12:56:37 2019
Manejo de ciclos
@author: Luis Cobian
"""
contador = 0
while contador<=10:
if contador%3==0 and contador!=0:
contador+=1
continue
elif contador==7:
break
print (contador)
contador+=1
else:
print ("Fin del cic... | true |
7e64916e19b3169ea942e9f5376ee9f1b739bcf8 | Python | sodiqafolayan/asorock_100days_pythoncode | /day_47_force.py | UTF-8 | 3,102 | 4.625 | 5 | [] | no_license | # In this problem, you're going to use that class to calculate
# the net force from a list of forces.
#
# Write a function called find_net_force. find_net_force should
# have one parameter: a list of instances of Force. The
# function should return new instance of Force with the total
# net magnitude and net angle as t... | true |
b8a197a9065f6f8e8fb0ad9ad7d79d70fb9bafe3 | Python | sauerBT/PersonalRepo | /BrianPersonalCodingRepo/005_PracticeScripts/Python_Scripts/03_Web_Scraping/webScraping_yahooToCSV.py | UTF-8 | 232 | 2.671875 | 3 | [] | no_license | import yfinance as yf
import pandas as pd
import re
msft = yf.Ticker("MSFT")
print(msft)
yahooMSFTHistorical = msft.history(period="max")
OpenType = type(yahooMSFTHistorical["Open"])
Open = yahooMSFTHistorical["Open"].toList() | true |
815a48cacad5c1fe8e086892721fee174dbc2de8 | Python | Escaity/Library | /python/atcoder/ABC/C/解説AC/c169a.py | UTF-8 | 158 | 3.328125 | 3 | [] | no_license | from decimal import Decimal
# decimal型は文字列で渡す
a, b = [Decimal(i) for i in input().split()]
# decimal型→int型に変換
print(int(a * b))
| true |
14ae9c05237aa140029fca163985c578f4d1d673 | Python | tomsoutherland/vbm.py | /FileLock.py | UTF-8 | 1,315 | 3 | 3 | [] | no_license | import os
class FileLockException(Exception):
pass
class FileLock(object):
def __init__(self, file_name, timeout=10, delay=.05):
""" Prepare the file locker. Specify the file to lock and optionally
the maximum timeout and the delay between each attempt to lock.
"""
if time... | true |
3b33c30e6992b323e17eb1dd4b8b1237419fad64 | Python | avneetsingh/ecommerce-recommender | /Products.py | UTF-8 | 10,998 | 2.53125 | 3 | [] | no_license | from Tkinter import*
import requests
import sys
from bs4 import BeautifulSoup
import Tkinter as tk
import urllib
from PIL import ImageTk, Image
import os
import json
import io
import base64
import turtle
import image_file
import create_table
import product_reviews
import time
from glob import glob
from cStringIO import... | true |
d23605d1b17c3635f0d00a227536595a4964c087 | Python | szabgab/slides | /python/examples/sqlite/sql_insert.py | UTF-8 | 971 | 3.40625 | 3 | [] | no_license | import sqlite3
sql = 'INSERT INTO companies (name, employees, established) VALUES (?, ?, ?)'
def insert_one(conn, crs):
company_name = 'Hostlocal'
employee_count = 1
year_of_establishment = 2000
try:
crs.execute(sql, (company_name, employee_count, year_of_establishment))
except sqlite3.In... | true |
6caa7f4769cd1fb01bf5239b605cd38c54466f01 | Python | vyankateshgithubber/speech-analyer | /Complete_Project/Payment/togther.py | UTF-8 | 9,408 | 3.03125 | 3 | [] | no_license |
import pandas as pd
import numpy as np
import nltk
nltk.download('stopwords')
train_df = pd.read_csv("/content/drive/MyDrive/PROJECT/Audio_text/Datasets/train.txt",sep=';')
train_df.columns = ["Sentance","Emotion"]
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
ps = PorterStemmer()
from keras... | true |
65a82c6f2b384087c4b198c26bb5665226a89c7f | Python | ItamarHavenstein-zz/Python | /Exercicios11a20/ex014.py | UTF-8 | 187 | 3.984375 | 4 | [
"MIT"
] | permissive | temperatura = float(input('Informe a temperatura em °C:'))
farenheit = (temperatura * 9 / 5) + 32
print('A temperatura de {}°C corresponde a {:.2f}°F'.format(temperatura, farenheit))
| true |
03aff826e6f2c7ca3c21637d082e40641f0aff84 | Python | iandersen/drone-car | /ClientSide_Python/irTest.py | UTF-8 | 204 | 2.9375 | 3 | [] | no_license | import pigpio
import time
pi = pigpio.pi()
for i in range(2,27):
pi.set_mode(i, pigpio.OUTPUT)
while 1:
for i in range(2, 27):
if pi.read(i) > 0:
print pi.read(i)
time.sleep(1)
| true |
e2c335767d651849f326e3ccc04972a59e4518fd | Python | Alasdair-Roddick/Image-Pixel-Encription | /Decript.py | UTF-8 | 389 | 2.984375 | 3 | [] | no_license | from PIL import Image
import itertools
x = input("Plaese enter file directory (including extenstion): ")
img = Image.open(x)
pixel = img.load()
code = []
finalcode = []
for x in range(img.size[0]):
print(pixel[x,0])
code.append(pixel[x,0])
for a_tuple in code:
finalcode.append(a_tup... | true |
8ce8db81c319da4f219a0a674322a8274e059700 | Python | perestoandr/hackerrank-challenges | /morgan-and-string.py | UTF-8 | 1,565 | 3.25 | 3 | [] | no_license | __author__ = 'Andrey Perestoronin'
def commonprefix(m):
"Given a list of pathnames, returns the longest common leading component"
if not m: return ''
s1 = min(m)
s2 = max(m)
for i, c in enumerate(s1):
if c != s2[i]:
return s1[:i]
return s1
def solve(f_str, s_str):
# """... | true |
41e647a789e3159ae579e2054ce1889c0e24084b | Python | gabriellaec/desoft-analise-exercicios | /backup/user_086/ch48_2019_09_11_13_16_23_258190.py | UTF-8 | 165 | 3.421875 | 3 | [] | no_license | strmes=input('qual o nome do mês escolhido? ')
contador=0
while contador<len(listastr):
if strmes==listastr[contador]:
print(contador+1)
contador+=1 | true |
08e2e9cd7a9984f154df3ac687c52dff06072fc5 | Python | DongjiY/Kattis | /src/temperature.py | UTF-8 | 199 | 3.328125 | 3 | [] | no_license | x, y = [int(i) for i in input().split()]
if y == 1:
if x == 0:
print("ALL GOOD")
elif x != 0:
print("IMPOSSIBLE")
else:
intersection = (-1*x)/(y-1)
print(intersection) | true |
476779304e28e90f8cf876c8b750e341d0c3e528 | Python | ZoranPandovski/design-patterns | /Behavioral/ChainOfResponsability/Python/ChainOfResponsibility.py | UTF-8 | 1,281 | 3.125 | 3 | [
"CC0-1.0"
] | permissive | class Handler:
def __init__(self):
self.next = None
#execute chain
def execu(self, obj):
if self.next is None:
return self.handle(obj)
else:
return self.next.execu(self.handle(obj))
#chain handler
def handle(self, obj):
raise NotImplementedError("You MUST implement this method!")
#adds handler a... | true |
f9876d25c7e5c881cb3a8732dfeb2fefd3a714f1 | Python | hinklej/CSCI-400-Cloud-Computing | /Project4/wordFreq.py | UTF-8 | 730 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import mincemeat
# Don't forget to start a client!
# ./mincemeat.py -l -p changeme
file = open('mobydick.txt','r')
data = list(file)
file.close()
# The data source can be any dictionary-like object
datasource = dict(enumerate(data))
def mapfn(k, v):
for word in v.split():
word = wor... | true |
3fa8252939de3b6a62a445edc9dac8f7a756feea | Python | ryantupo/twitch-bot | /pagan.py | UTF-8 | 5,391 | 3.515625 | 4 | [] | no_license |
#boardT = ['_0_','_1_','_2_',
# '_3_','_4_','_5_',
# _6_','_7_','_8_'
# 012 , 345, 678 - landscape wins
# 036 , 147 , 258 - portrait wins
# 048 ,642 - diagonal wins
def win_clause(boardT):
#---------------------------------------------------------------------... | true |
c89ef12fa6c269c773f816a0a3cd06a88121c09e | Python | Namenaro/iter12-mnist | /show_motif.py | UTF-8 | 3,631 | 2.703125 | 3 | [] | no_license | import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from motif import *
from logger import *
from sensors import *
from create_motif import *
from init_motif import *
from data import *
def visualise_on_pic(motif, pic, desired_num_of_full_sprouts, logger):
# росток это последовател... | true |
9b0aa681a0446c64e3656d94917840e35033b0ce | Python | pjputzel/dyn_surv_global_with_shifts | /src/loss/WeibullLogProbCalculatorDeltaIJ.py | UTF-8 | 2,099 | 2.546875 | 3 | [] | no_license | from loss.DeltaIJBaseLogProbCalculator import DeltaIJBaseLogProbCalculator
import torch
import torch.nn as nn
class WeibullLogProbCalculatorDeltaIJ(DeltaIJBaseLogProbCalculator):
def compute_shifted_times(self, deltas, batch, eps=1e-20):
#deltas.register_hook(print_grad)
# deltas.register_hook(... | true |
8e137cdce8f38dcf750236f3d0134ed155b8080c | Python | bsimps01/Herd-Immunity-Simulation | /virus.py | UTF-8 | 1,028 | 3.390625 | 3 | [] | no_license | class Virus(object):
'''Properties and attributes of the virus used in Simulation.'''
def __init__(self, name, repro_rate, mortality_rate):
self.name = name
self.repro_rate = repro_rate
self.mortality_rate = mortality_rate
def test_virus_instantiation():
#TODO: Create your own tes... | true |
6db2e8b30d50d13fbfd1b6ec32653238bba7596f | Python | Desklop/ipapy | /ipapy/tests/test_kirshenbaummapper.py | UTF-8 | 5,254 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding=utf-8
import unittest
from ipapy.kirshenbaummapper import KirshenbaumMapper
from ipapy.ipastring import IPAString
class TestKirshenbaumMapper(unittest.TestCase):
def test_can_map_ipa_string(self):
mapper = KirshenbaumMapper()
values = [
(u"", True),
... | true |
91715956eb35dfe2f6d612d5537330e0e8a4144a | Python | EricLee523/VehicleSteeringDirection | /test.py | UTF-8 | 2,630 | 3.015625 | 3 | [] | no_license | import pickle
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
file=open('trajectories.pickle','rb')
a_dict1=pickle.load(file)
df = pd.DataFrame(a_dict1)
sli=df.loc[ :,['pos_x','pos_y']]
plt.figure('trajectories')
for i in range(100):
posx=sli.iloc[i,0]
posy=sli.iloc[i,1]
... | true |
14190abadc81cced1376ea7a16eb00b7ea9f2920 | Python | green-fox-academy/FarkasLaszlo | /week-04/day-03/Counter.py | UTF-8 | 156 | 3.3125 | 3 | [] | no_license | def counter(string):
lista = []
for i in range(len(string)):
lista.append(string[i:i + 1])
return {x: lista.count(x) for x in lista}
| true |
10c73b61b2d06d2f3d53916a478712efec025731 | Python | dixonaws/kafka_etl | /generate_records.py | UTF-8 | 1,705 | 3.15625 | 3 | [] | no_license | from record import Record
import csv
import sys
import argparse
import os
def main():
parser=argparse.ArgumentParser(description="Specify the number of records to generate and the filename to write, e.g. generate_records.py 1000 my_csv_file.csv")
parser.add_argument("Records", help="The number of records to write (... | true |
1c9d751d83b8249152cf4ace0cd6a62e4cb65d82 | Python | VLD62/PythonFundamentals | /00.EXAMS/11August2018/Problem 1 – Gladiator Expenses.py | UTF-8 | 697 | 3.8125 | 4 | [] | no_license | if __name__ == "__main__":
lost_fights_count = int(input())
helmet_price = float(input())
sword_price = float(input())
shield_price = float(input())
armor_price = float(input())
shield_broken = 0
total_expenses = 0
for n in range(1, lost_fights_count+1):
if n % 2 == 0:
... | true |
023d3ca764cf1b41f9c766c05c0c6d84ae72a7b6 | Python | Guilherme-Schwann/Listas-de-Exercicios-UFV-CCF-110 | /Lista05/ex002.py | UTF-8 | 409 | 3.59375 | 4 | [
"MIT"
] | permissive | saldo = float(input('Insira seu saldo médio do último ano: '))
if 0 < saldo <= 500:
print(f'Saldo médio: {saldo:.2f}\nCrédito: Nenhum crédito.')
exit()
elif 501 < saldo <= 1000:
cred = (30 / 100) * saldo
elif 1001 < saldo <= 3000:
cred = (40 / 100) * saldo
elif 3001 <= saldo:
cred = (50 / 100) * sal... | true |
c0315cdbdca6a370875e00cb7e18af72fd04eb4b | Python | mkp-in/codefights-py | /intro/level2/shape_area.py | UTF-8 | 76 | 3.234375 | 3 | [] | no_license | def shapeArea(n):
return (n ** 2) + ((n-1) ** 2)
print(shapeArea(3))
| true |
5659d077ec7d362421ebc156cbe9054ab3a64b7d | Python | dinysen/python-learning | /(5)函数式编程/5_偏函数.py | UTF-8 | 705 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding : utf-8 -*-
#偏函数
import functools
int2 = functools.partial(int,base=2);
int_test = int2("01000000");
print(str(int_test));
#functools.partial的作用就是,把一个函数的某些参数给固定住(也就是设置默认值),返回一个新的函数
#已经固定住的参数,也可以在函数调用时传入其他值
int_test_2 = int2("01000000",base=10);
print(str(int_test_2));
#创建偏函数,其实就是接... | true |
fa9e53a978b830475a0f867677d65e1a29c4a097 | Python | bql20000/GMM_Ace_Challenge | /main.py | UTF-8 | 7,114 | 2.71875 | 3 | [] | no_license | import numpy as np
from scipy.io import loadmat
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
import Visualization
import Optimize_nCluster
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from sklearn.datasets import make_spd_matrix
# todo part1: load data
data = loadmat('ca... | true |
5753a59fbf980165774551fdeef1856279361d27 | Python | gaustin/Walk-Score-Coding-Challenge | /digraphing/digraph.py | UTF-8 | 1,680 | 3.5625 | 4 | [] | no_license | class Digraph:
def __init__(self):
self.graph = dict()
def items(self):
return self.graph.items()
def addArc(self, fromNode, toNode):
if not self.graph.has_key(fromNode):
self.graph[fromNode] = set()
if not self.graph.has_key(toNode):
self.graph[toN... | true |
474c6e1eff4d7be5bea0590fe70b614bccfe1232 | Python | igortereshchenko/amis_python | /km72/Burova_Anastasiya/3/task1.py | UTF-8 | 124 | 3.359375 | 3 | [] | no_license | num1=float(input("number1= "))
num2=float(input("number2= "))
num3=float(input("number3= "))
a=num1+num2+num3
print(a)
| true |
f2484ab2c165cedfad30a521b73e0190fbc317c0 | Python | dairof7/holbertonschool-higher_level_programming | /0x0C-python-almost_a_circle/tests/test_models/test_base.py | UTF-8 | 616 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python3
"""
Unittest for Base class
"""
import unittest
import os
import json
from models.base import Base
from models.rectangle import Rectangle
from models.square import Square
class Test_Base(unittest.TestCase):
"""Base tests"""
def setUp(self):
"""setup of unittest"""
Base._B... | true |
b96b9f0978e7c842ec74ba8714ec9c4aae770ec5 | Python | yining0713/CS221-Language-Classification | /scripts/sklearn_test.py | UTF-8 | 1,560 | 2.78125 | 3 | [] | no_license | #from sklearn.datasets import fetch_mldata
from sklearn.preprocessing import StandardScaler
from sklearn import metrics
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
import pandas as pd
import numpy as np
from Log import Log
import os
import sys
topdir = os.... | true |
f80de75727869048e5e0411a9fceae7384e16e9c | Python | Abarna13/Py_script | /Dictionary/Create.py | UTF-8 | 64 | 2.828125 | 3 | [] | no_license | a = {1:"one",2:"two"}
print("To create a dictionary")
print(a) | true |
0abc326579ddcc21de5a64cf0b08b61a5222f045 | Python | ZAKERR/-16-python- | /软件第四次作业/软件162/2016021185吴明洋/asdsaad.py | UTF-8 | 321 | 3.953125 | 4 | [] | no_license | i = int(input("请选择运算类型:(1代表加法 2代表减法 3代表乘法 4代表除法)"))
a1 = eval(input("请输入第一个数:"))
a2 = eval(input("请输入第二个数:"))
if i == 1:
a1 = a1 + a2
elif i == 2:
a1 = a1 - a2
elif i == 3:
a1 = a1 * a2
else:
a1 = a1 / a2
print(a1)
| true |
38b4310cc40bccf1f6f62a764c6fa2c3a2dbd2ed | Python | jaykaneriya6143/python | /day5/overloading.py | UTF-8 | 247 | 3.34375 | 3 | [] | no_license | class Myclass():
def sum(self, n1,n2):
ans = n1 + n2
print("Ans is :",ans)
def sum(self, n1,n2,n3):
ans = n1 + n2 + n3
print("Ans is :",ans)
j = Myclass()
#j.sum(40,50)
j.sum(20,30,50)
| true |
ae0db61cb7fde8c073f28103bbb0e266550d7e82 | Python | DoaaY98/Mancala-Game-AI-Project | /play_now.py | UTF-8 | 414 | 3.015625 | 3 | [] | no_license | import keyboard
class PlayNow():
def __init__(self, play_now=0):
self.play_now = play_now
def keyPressed(self):
while True:
if keyboard.is_pressed('p'): # if key 'q' is pressed
self.play_now = 1
break # finishing the loop
def set_playN... | true |
99b9e015fd69a261d933bfd93520e56e29747edd | Python | clarisli/RL-Easy21 | /mc_prediction.py | UTF-8 | 1,844 | 2.859375 | 3 | [] | no_license | from rl_agent import *
from utils import *
import sys
class MCPrediction(RLAgent):
def __init__(self, environment, N0=100, discount_factor=1, _lambda=0.1):
super().__init__(environment, N0, discount_factor, _lambda)
self.returns_sum = self._init_tenor()
self.returns_count = self._init_tenor()
self.V = self._... | true |
d43e84094a57566a8632db78c7ba6b4f0e0017d2 | Python | pmaslankowski/rushing-turtles-backend | /tests/test_player.py | UTF-8 | 3,119 | 3.125 | 3 | [] | no_license | import pytest
from rushing_turtles.model.person import Person
from rushing_turtles.model.player import Player
from rushing_turtles.model.turtle import Turtle
from rushing_turtles.model.card import Card
def test_has_card_should_return_false_when_user_has_no_cards(person, turtle):
cards = []
player = Player(pe... | true |
b5d0daeb66c89b151e9f701a5ab73c75e38c31a8 | Python | PeterPirog/PRT_calculations | /calculate_abc7.py | UTF-8 | 1,382 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive |
#calculation a,b,c coefficient in range 7 from 0.01 C to 660.323 C
# with no uncertainties,
import ITS90
import numpy as np
# STEP 1 - DATA FROM CERTIFICATE
Wt = np.array([3.37543469, 2.56855103, 1.89259628])
t = np.array([660.323, 419.527, 231.928])
Wrt=np.array(list(map(ITS90.calculate_Wr,t)))
deltaW=Wt-Wrt
prin... | true |
f15e6c41db751eb95b0db3928ab34fcd7b96124f | Python | colin0000007/seq2seq | /Tasks_nmt/nmtWithBasicSeq2Seq.py | UTF-8 | 3,108 | 2.578125 | 3 | [] | no_license | #encoding=UTF-8
import tensorflow as tf
from seq2seqV2.BasicSeq2seqModel import BasicSeq2SeqModel
#使用beam search必须添加这个导入
from tensorflow.contrib.seq2seq.python.ops import beam_search_ops
from utils.dataPreprocessing import source_seq_list_2_ids
from utils.dataPreprocessing import load_data
import pickle
import numpy as... | true |
40919f1a09fe6af143c9bcc9a01eb186a8b59333 | Python | wcmaclean/home-repo | /Python_Ruby/analyze_firefox_cache/domains.py | UTF-8 | 1,236 | 2.96875 | 3 | [] | no_license | # domains.py
#
# Will MacLean
# CSPP51060
import subprocess
import sys
import re
# grab coche directory from command-line input
if (len(sys.argv) == 2):
cache_dir = sys.argv[1]
else:
print "Usage: python domains.py <cache filepath>"
sys.exit(0)
# read all filenames in directory
find_files = subprocess.Popen(['ls'... | true |
c967613d7c4d41d2db5af4c964903d87c5660f3e | Python | RoopeKeto/Predicting-Company-In-News | /NER_on_goodnews.py | UTF-8 | 4,041 | 3.5625 | 4 | [] | no_license | from flair.data import Sentence
from flair.models import SequenceTagger
import pandas as pd
import sys
import itertools
import operator
import os
import csv
# # # Predicting what organization/company is talked about in a news article # # #
# Loading previously scraped good news finland data. (Scraped every news art... | true |
75587a5843e7166a6a76b5be115f6cd0a80d285b | Python | rorik302/sp-test | /bonus_cards/views.py | UTF-8 | 2,658 | 2.5625 | 3 | [] | no_license | import json
from django.core.exceptions import FieldError, ValidationError
from django.core.serializers import serialize
from django.db import IntegrityError
from django.http import HttpResponse
from django.utils.dateparse import parse_date
from django.views.decorators.csrf import csrf_exempt
from django.views.decorat... | true |
dcf360cef450886c6702c6a7e7fb7c9b8a689984 | Python | ommprasad99/Python-program2 | /Fibonacci.py | UTF-8 | 134 | 3.21875 | 3 | [] | no_license | import time
list1=[0,1]
while(True):
n=len(list1)
list1.append(list1[n-1]+list1[n-2])
print(list1)
time.sleep(2) | true |
48c94012e57269ba599f49b491c580232baa7f6d | Python | Romualdi-Lab/brewerix-cli | /workflow/guess_loi/merge_vcfs.py | UTF-8 | 1,074 | 2.75 | 3 | [] | no_license | from argparse import ArgumentParser
from os.path import join
from subprocess import check_call
from tempfile import TemporaryDirectory
def merge_vcfs():
parser = ArgumentParser(description="""
Merge VCFs into a single VCF
""")
parser.add_argument('output', help="output file nam... | true |
e101cc0c9c7923f46decf665d65d0a99e9661b29 | Python | sammous/spacy-lefff | /tests/test_leffflemmatizer.py | UTF-8 | 1,299 | 2.875 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import pytest
import spacy
from spacy_lefff import LefffLemmatizer
"""
Test suite coming from spacy.
Link: https://github.com/explosion/spaCy
/blob/master/spacy/tests/lang/fr/test_lemmatization.py
"""
def test_lemmatizer_verb(nlp):
tokens = nlp("J'ai une maison à Paris.")
assert tokens[1]._.... | true |
4ce195b9fdf2f9db935c413e578e195cf21ee5c4 | Python | tomas-cortez/Projects | /simple_python/IA_PRO1_TP7.py | UTF-8 | 2,703 | 3.84375 | 4 | [] | no_license | def MostrarSueldos():
archivo = open("IEFI.csv","r")
datos = archivo.readlines()
print ("Apellido".ljust(11),"Nombre".ljust(11),"S.Bas".ljust(7),"S.1°Aum".ljust(9),"S.2°Aum","\n")
for x in datos:
x = x.replace("\n","")
x = x.split(";")
a1 = ( (int(x[5]))+( (int(x[5])*(15/100) ))... | true |
ffb33670aa171d0e62ebb40cd4c0fe28c0605106 | Python | lobZter/HW_in_NCTU | /Machine_Learning/HW2/HW2_2.py | UTF-8 | 724 | 3.40625 | 3 | [] | no_license |
file_path = raw_input("File path: ")
a = input("intial a: ")
b = input("intial b: ")
with open(file_path.strip()) as f:
lines = f.readlines()
lines = [line.strip() for line in lines]
for line in lines:
N, m, p = observe(line)
print 'MLE: {} | Prior a: {}, b: {} |'.format(p, a, b),
# a = m + a
# b... | true |
d7f97a8805855816aa947807b1def1e6205a173f | Python | LemonChocolate/Web_Scrolling_img | /py_format/Pintersest.py | UTF-8 | 4,623 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ### Pinterest
# In[1]:
### Pinterest scrolling
"""Before execute code below, check out your kernel or jupyter notebook kernel environment
If you have problem, just copy this code and paste to yout jupyter notebook (recommended)
Also, before execute this page, execute this ... | true |
b20d1594f6f7588835ce5d1a0a40f50223ae366f | Python | juechengxi/tf_uniform_loss | /tf_uniform_loss.py | UTF-8 | 1,566 | 2.5625 | 3 | [] | no_license | import os
import sys
import numpy as np
import tensorflow as tf
def uniform_loss(features, labels, num_class):
centers = tf.get_variable(name='features_centers', shape=[class_num, features.get_shape().as_list()[-1]],
dtype=tf.float32,
initializer=tf.const... | true |
7bedec1174bc9534ef186d28b4d6e18c2f1b2ac4 | Python | HuangPayoung/angr_learning | /angr_ctf/03_angr_symbolic_registers/03_exp.py | UTF-8 | 1,607 | 2.84375 | 3 | [] | no_license | import angr
'''
def main():
project = angr.Project('./03_angr_symbolic_registers')
initial_state = project.factory.entry_state()
simulation = project.factory.simgr(initial_state)
def is_good(state):
return b'Good Job.\n' in state.posix.dumps(1)
def is_bad(state):
return b'Try aga... | true |
98f191c788688b4832114b8be9eef8154fa860b2 | Python | GreaterGoodCorp/SuperHelper | /src/SuperHelper/Modules/Stenographer/__main__.py | UTF-8 | 16,325 | 2.75 | 3 | [
"MIT"
] | permissive | import bz2
import functools
import io
import logging
import re
import sys
import click
import cryptography.fernet
from PIL import Image
from SuperHelper.Core.Config import Config, pass_config
from SuperHelper.Core.Utils import BitOps, Cryptographer
MODULE_NAME: str = "Stenographer"
pass_config_no_lock = functools.pa... | true |
c316331bb475edbfa99fcd1afbec4f7ebabd8548 | Python | Rasoolaghd/House_Pricing | /pipeline_all_fields.py | UTF-8 | 428 | 2.953125 | 3 | [] | no_license |
from sklearn.base import BaseEstimator, TransformerMixin
# a transformer that gets the desired attributes and converting Dataframe to numpy array.
class DataFrameSelector(BaseEstimator, TransformerMixin):
def __init__(self, attribute_names):
self.attribute_names = attribute_names
def fit(self, ... | true |
6b3329029769b55219afe00e0ba99575e1103dc7 | Python | DeltaForce14/Python_Training | /Functions_Basics.py | UTF-8 | 1,462 | 4.25 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 13:42:28 2018
@author: ditapeskova
"""
# Functions
# Structure of Simple Function
# output = function_name(input)
# Finding max value of a list
expenses = [3.21, 67.76, 87.64, 54, 6.1, 78.4]
max(expenses)
# Round number
round(1.34)
# Round nu... | true |
5c8b44daea83ee8c9e220a72284f1e7c8824b658 | Python | tekktonic/programming | /ops.py | UTF-8 | 582 | 2.53125 | 3 | [
"ISC"
] | permissive | import hw
def none():
pass
def ldx():
pc += 1
regx = mem[pc]
def ldy():
pc += 1
regy = mem[pc]
def ldz():
pc += 1
regz = mem[pc]
def rtx():
pc += 1
mem[mem[pc]] = rtx
def rty():
pc += 1
mem[mem[pc]] = rty
def rtz():
pc += 1
mem[mem[pc]] = regz
def add():
r... | true |
1c20baf0fdd8108570900e2e4f2949005f0539dd | Python | twinkle-zp/tensorflow-basis | /tensorflow框架/tf3_2.py | UTF-8 | 231 | 2.875 | 3 | [] | no_license | import tensorflow as tf
x=tf.constant([[1.0,2.0]]) #一行两列的张量
w=tf.constant([[3.0],[4.0]]) #两行一列的张量
y=tf.matmul(x,w) #矩阵乘法
print y
with tf.Session() as sess: #计算
print sess.run(y)
| true |
6298786b32be8d79c96ae5b61fb255d46997556e | Python | ytree-project/ytree | /doc/source/examples/halo_significance.py | UTF-8 | 1,737 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | """
Calculate a halo's significance, defined as the time
integrated mass of all a halo's progenitors.
NOTE: this script includes extra code to make it run within
the test suite. To run conventionally, remove the following
lines and return the code block in the middle to the proper
tabbing (i.e., 4 spaces to the left).... | true |
8faef9f572bc298aeb04990772125ef98ea2dae8 | Python | jzkelter/SAFTE | /compare_safte_methods.py | UTF-8 | 4,555 | 3.28125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from safte_help import SAFTE_1, SAFTE_mult, repeat_safte_1
import basic_math as bm
from operator import add
#global variable
# sleep_times = [[1.28,8.98],[23.4,5.33], [23.4,5.33], [23.4,5.33]]
sleep_times2 = ([[0,8]] * 8)
# sleep_times = [[1.28,8.98],[23.4,5.33],[23.71,6.01],[22.15,5... | true |
ef5eb1de79201ee35d9440f4e71e4238355924c7 | Python | luisesanmartin/crypto-ML-predictor | /scripts/utils/data_fetching_utils.py | UTF-8 | 3,024 | 2.96875 | 3 | [] | no_license | from datetime import datetime, timedelta
import requests
import json
import pandas as pd
URL = 'https://rest.coinapi.io/'
FMT = '%Y-%m-%dT%H:%M:%S'
def get_api_key(text='../../data/key.txt'):
with open(text) as file:
key = file.read()
return key
def time_in_datetime(time):
'''
Transforms a... | true |
c0a3f333b59c6936cc6fd4fa553e810a2b640267 | Python | hong-hanh-dang/tkt4140 | /src/src-ch5/wave.py | UTF-8 | 1,385 | 2.9375 | 3 | [] | no_license | from numpy import*
from Tkinter import *
import time
dt = 0.0001
dx = 0.1
v = 100 #Courant condition says dx/dt >= v
gamma = 0
c1 = (v**2) * (dt**2) / (dx**2)
c2 = gamma*dt / dx**2
nodes = 30
source_node = nodes/3 #point of application of initial pulse
x = arange(0, nodes, 1)
u_new = zeros(nodes)
u = zeros(nodes)
u_o... | true |
9b1a594d86d405083a5d7c9c7ba7fd229b8c2cf9 | Python | jrobchin/this-game-does-not-exist | /scripts/utils.py | UTF-8 | 4,138 | 2.6875 | 3 | [
"MIT"
] | permissive | import random
random.seed(42)
from typing import Tuple, List, Optional
from enum import Enum
from dataclasses import dataclass
import logging
import pandas as pd
from transformers import GPT2LMHeadModel, GPT2TokenizerFast
import torch
from torch import nn
import numpy as np
from PIL import Image
from scripts.models i... | true |
29317edc880d50284cb533080ce04c56ae434a54 | Python | Brovarets/ICS-11-Brovarets | /process_data.py | UTF-8 | 3,044 | 3.078125 | 3 | [] | no_license | from data_service import get_dovidnik, get_prices
zmina = {
'name market' : "", # найменування ринку
'name product' : "", # найменування товара
'Unit' : "", # одиниця виміру
'price level in 2007' ... | true |
4579f5c21e95864766152be034191da1a1061a4e | Python | sumithkumarEsap/Python | /Source/ICP5/TShirt.py | UTF-8 | 3,063 | 3.453125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import random
#creatig a cluster at the start like random one
def create_cluster(X, centroid_pts):
cluster = {}
for x in X:
value = min([(i[0],np.linalg.norm(x - centroid_pts[i[0]]))for i in enumerate(centroid_pts)], key=lambda s:s[1])[0]
try:
... | true |
38cc85eda8c053ebc45f535dc03cbbf4cfefbad3 | Python | kanade788/myCode | /Triangle.py | UTF-8 | 676 | 4.15625 | 4 | [] | no_license | #Perform operator overloading for triangle in a way that add function adds
#length of three sides and greater operator returns the side with highest length
class Triangle:
def __init__(self,a=0,b=0,c=0):
self.a=a
self.b=b
self.c=c
def __add__(self,other):
self.l=self.a+self.b+... | true |
c94b89b98f67d06a29d05f97d4d6e98186c38beb | Python | zoezirlin/E-Commerce-Shopper-Intentions | /Python code 6.9.2020 | UTF-8 | 5,433 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 9 18:55:53 2020
@author: zoezirlin
"""
# Importing relevant libraries
import pandas as pd #Data manipulation and analysis
import numpy as np #Data manipulation and analysis
import seaborn as sns #Data visualization
from matplotlib import pyplot a... | true |
0656d5af993ac181762d5ad7f05a401abf04d3f8 | Python | microsoft/qlib | /qlib/model/interpret/base.py | UTF-8 | 1,133 | 3.078125 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""
Interfaces to interpret models
"""
import pandas as pd
from abc import abstractmethod
class FeatureInt:
"""Feature (Int)erpreter"""
@abstractmethod
def get_feature_importance(self) -> pd.Series:
"""get feature import... | true |
cb121c1ba497056825f981fae07b4d4199b21a8a | Python | MonaBeikirch/neurobotics | /neuro_deep_planner/src/ros_handler.py | UTF-8 | 2,449 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
import numpy as np
from neuro_local_planner_wrapper.msg import Transition
from geometry_msgs.msg import Twist, Vector3
class ROSHandler:
def __init__(self):
# Initially assumed Input size, since init is false these values will be updated with the first received msg
... | true |
61c694b92e777ddab5bb30cbd89846a63fbbc0e1 | Python | WhaleHippo/2018-1 | /dataStructureStudy/heap.py | UTF-8 | 2,997 | 3.28125 | 3 | [] | no_license | class node :
def __init__(self, data, parent = None, left = None, right = None):
if isinstance(data, node):
self.data = data.data;
self.parent = data.parent;
self.left = data.left;
self.right = data.right;
else :
self.data = data;
self.parent = parent;
self.... | true |
a2d12810d70bb471cebe13288c4da74ff8d688a5 | Python | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | /students/ShinTran/lesson06/water-regulation/waterregulation/test.py | UTF-8 | 1,749 | 2.890625 | 3 | [] | no_license | """
Unit tests for the water-regulation module
"""
import unittest
from unittest.mock import MagicMock
from pump import Pump
from sensor import Sensor
from .controller import Controller
from .decider import Decider
ACTIONS = {
'PUMP_IN': 1,
'PUMP_OFF': 0,
'PUMP_OUT': -1
}
class DeciderTests(unittest.... | true |
b79ca57bcd34ad4e51fc7901d25361ac8808226c | Python | databill86/HyperFoods | /venv/lib/python3.6/site-packages/gensim/matutils.py | UTF-8 | 54,711 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Math helper functions."""
from __future__ import with_statement
from itertools import chain
import logging
import math
from gensi... | true |
eff8eba6cf12ea7bb75d0b97dcdfb06a7af2bfbf | Python | Dainius-P/scrapyd-dash | /scrapyd_dash/operations/versions_delete.py | UTF-8 | 425 | 2.625 | 3 | [
"MIT"
] | permissive | import requests
"""
Delete a project version.
If there are no more versions available for a given project, that project will be deleted too.
"""
def delete_version(server, project, version):
url = "http://{}/delversion.json".format(server)
data = {
"project": project,
"version": version
}
with requests.Sess... | true |
8f2c621cedb94d9f1b82e5037a520b6e1409b000 | Python | steinstadt/Python_Algorithm | /chapter6/exam_2.py | UTF-8 | 1,009 | 4.03125 | 4 | [] | no_license | # 式の木
class TreeNode():
def __init__(self, left, ope, right):
self.left = left
self.ope = ope
self.right = right
def gentree(p, w):
n = len(w)
p.ope = w[n-1] # 文字の後ろを取り出す
s = w[:n-1]
if not (p.ope=='-' or p.ope=='+' or p.ope=='*' or p.ope=='/'): # 文字が定数であれば
p.left ... | true |
699b989fec92d4d68781fb792d6d3cc671a850c4 | Python | lkwatson/hack-a-wall | /cam_client/cam_client_sim.py | UTF-8 | 949 | 2.53125 | 3 | [] | no_license | from socketIO_client_nexus import SocketIO, LoggingNamespace
import json
import time
import random
import math
sock_client = SocketIO('localhost', 3000, LoggingNamespace)
i = 0
while True:
if i < 10:
x_1, x_2 = (25*math.sin(i/10.) + 50), (10*math.sin(i/89.) + 20)
y_1, y_2 = (10*math.cos(i/80.) +... | true |
9d100e83391cb071b7818126ca4c5f4f902abba9 | Python | devin730/OfficeAutomation | /EditWordFile.py | UTF-8 | 2,206 | 3 | 3 | [] | no_license | #!/usr/bin/python
# coding: utf-8
from docx import Document
from convDoc2Docx import convDocToDocx as cnv
#! there are mainly three parameters in this class:
# @params in_dict is a dictionary,key: origin string,value: replaced string.
# @params origin_word_file: the path of origin docx file (or template word file).
... | true |
e695e78c4a4a2c6c18e53da38bbc5da3b5fd7f69 | Python | Embot2000/IE_playground | /first_model/backend/manager.py | UTF-8 | 672 | 3.546875 | 4 | [] | no_license | from pathlib import Path
import os
def save_to_file(file_name, text):
""" A method to save input to a file.
:param file_name: (str) The file name.
:param text: (str) Input string obtained from GUI.
:return: (str , str) Returns a string message and a string file path.
"""
file = Path(file_nam... | true |
fbc29f2d4190c90e7d597cb317a31e473008b196 | Python | AlexKurs/seo-helpers | /url_status_checker.py | UTF-8 | 904 | 3.21875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
# Wordpress SEO Yast Sitemaps Checker
def checker():
website = 'https://' #Your Wordpress Website
sitemap = website + '/sitemap_index.xml'
# Kategorie parsen
r = requests.get(sitemap)
doc = BeautifulSoup(r.text, 'html.parser')
links ... | true |
19cab517ebdbba5d2027525325be9760efb12cb8 | Python | alanbly/ProjectEuler | /56.py | UTF-8 | 271 | 3.296875 | 3 | [
"MIT"
] | permissive | def digitSum(num) :
value = num
total = 0
while value > 0 :
total += value % 10
value /= 10
return total
maxSum = 0
for i in range(1,100) :
for j in range(1,100) :
value = digitSum(i**j)
if value > maxSum :
maxSum = value
print maxSum
| true |
9ad55b7d3fd3a61ab1188187b226306b4837cf00 | Python | mverrilli/python_snippets | /sql_functions.py | UTF-8 | 6,181 | 3.140625 | 3 | [
"MIT"
] | permissive | import re
def regexp_flags(regexp_modifier=None):
flags = 0
set_unicode = True
for c in regexp_modifier:
if c == 'b':
# Treat strings as binary octets rather than UTF-8 characters.
set_unicode = False
elif c == 'c':
# Forces the match to be case sensitive... | true |
b2e32b1103441ba725904f1d73c07de2c91ab0f6 | Python | JoshBradshaw/AOC2020 | /day19.py | UTF-8 | 1,845 | 3.078125 | 3 | [] | no_license | import fileinput
import re
from functools import lru_cache
def rules_to_regex(rules):
@lru_cache(maxsize=None)
def to_regex(rule_idx):
current_rule = rules[rule_idx]
if isinstance(current_rule, str):
return current_rule
else:
alternative_rules = []
fo... | true |
95fe6a2fd3f0b8e32cabd39896d1535e1252e421 | Python | anthony-symphony/symphony-api-client-python | /sym_api_client_python/loaders.py | UTF-8 | 3,681 | 2.734375 | 3 | [
"MIT"
] | permissive | import logging
import os
from .auth.auth import Auth
from .auth.rsa_auth import SymBotRSAAuth
from .configure.configure import SymConfig
def load_from_env_var(env_var, delimiter=":"):
"""Look for an environment variable with the format:
env_var=[RSA|CERT]:/path/to/config
E.g. SYMPHONY_CONFIG=RSA... | true |
384b390d3d8ad62cb3e98493a1ccf46a6efdee88 | Python | ricardoleopoldo/crackSenhaUserLinux | /crackSenhaUserLinux.py | UTF-8 | 653 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python
#coding: utf-8
import crypt
import sys
import time
hash = raw_input('Digite o hash completo: ')
salt = raw_input('Digite o salt:')
file = open('wl.txt','r') #carrega a wordlist
senhas = file.read().split('\n')
inicio = time.time()
print "\nTestando as senhas, por favor aguarde ..."
for senha in sen... | true |
f5bd5fbeb3daaacc1dd030b15d56e874436212ce | Python | miroslavvidovic/gcalcli-gui | /gcalcli-gui.py | UTF-8 | 4,392 | 2.65625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
import sys
from subprocess import call
from PyQt4.QtCore import pyqtSlot
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import QFormLayout, QHBoxLayout, QFrame
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from Task import Task
class TaskForm(QtGui.QWidget):
... | true |
666d472013c59cd6ad7452b5826994e9db2d0622 | Python | thacdtd/AAI | /IRM/irm.py | UTF-8 | 6,150 | 3.390625 | 3 | [] | no_license | """Chinese Restaurant Process Infinite Mixture Model
This implementation assumes that the likelihood function and the prior distribution
over the parameters are conjugate pairs.
"""
import random
import numpy
import scipy.stats as stats
import scipy.cluster.vq as vq
class CRPClusterModel(object):
"""Chinese Rest... | true |
acd2b2538dda1b3c5bd5fd0ae8151c7047862299 | Python | prensing/fll_scheduling | /schedulingModel.py | UTF-8 | 36,419 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import datetime
import math
import re
import csv
import copy
import functools
from dateutil.parser import parse as dateparse
from random import shuffle, seed
# from pprint import pprint
@functools.total_ordering
class EventTime(object):
# share startT across all instances
eventS... | true |
9e83cfca28dfcdbeeef01f52082f359c143724a6 | Python | fengyehong123/Python_skill | /22-字典按照key和value进行排序.py | UTF-8 | 1,265 | 3.5 | 4 | [] | no_license | d = {
'zhao': 68,
'qian': 80,
'sun': 72,
'li': 90,
'zhou': 83,
'wu': 79,
'zheng': 62,
'wang': 87
}
# 字典.items()可以获取出 可迭代对象
print(d.items())
"""
dict_items([('zhao', 68), ('qian', 80), ('sun', 72), ('li', 90), ('zhou', 83), ('wu', 79), ('zheng', 62), ('wang', 87)])
"""
# print(d.items()... | true |
c67d58844943c4ce33da4270fce0e91b3ee4b09b | Python | amolika20424/Simple_assembler_simulator | /Simple-Assembler/main.py | UTF-8 | 9,051 | 2.890625 | 3 | [] | no_license | import sys
output = []
error = {}
label_error = {}
REGISTERS = {"R0": "000", "R1": "001", "R2": "010", "R3": "011", "R4": "100", "R5": "101", "R6": "110", "FLAGS": "111"}
ISA = {
"add": "00000",
"sub": "00001",
"mov": "00010",
"ld": "00100",
"st": "00101",
"mul": "00110",
"div": "00111",
... | true |
0f53cd5c9fbafcb5ef4e9772b885f5ff950392ca | Python | umika/NonBlockingReaderThread | /NonBlockingReaderThread.py | UTF-8 | 2,077 | 2.859375 | 3 | [] | no_license | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''NonBlockingReaderThread
SetConsoleMode
http://msdn.microsoft.com/en-us/library/ms686033%28v=vs.85%29
ENABLE_LINE_INPUT = 0x0002
'''
import sys, os
import time
import threading
import Queue
class NonBlockingReaderThread(threading.Thread):
def __init__(self, pin, *ar... | true |
934d0e773b9c9d5166d0a9f62431c2c09f585919 | Python | bestchanges/hello_python | /sessions/22/pavel_shchegolevatykh/philosophers_waiter.py | UTF-8 | 2,809 | 3.609375 | 4 | [] | no_license | # solution using waiter (arbitrator) to limit taking forks if only one left
# that way deadlocks are prevented but less people can eat at the same time
# compared to monitor (philosophers_better) solution
import threading
import time
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
lo... | true |
5dd17002be58e6709f030fb201e97c56fe999a25 | Python | IrshadBadarpura/Web-Search-Engine | /pr.py | UTF-8 | 2,368 | 2.546875 | 3 | [] | no_license | import pickle, os
def loadPickle(name):
with open(name, 'rb') as f:
return pickle.load(f)
def inlinkFunc(tfidf,crawled):
inlink ={}
for url in tfidf:
inlink[url] = []
for crawlUrl in crawled:
if url in crawled[crawlUrl][2]:
inlink[url].append(crawled[crawlUrl][0... | true |
78140e0002fa352afbddd1210b7de254afc23db6 | Python | prawnrao/NeuralNet | /NN/NeuralNet.py | UTF-8 | 6,631 | 3.4375 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | from NN.Matrix import Matrix
import math
from random import choice
def __sig(x):
"""f(x) = 1 / (1 + e^(-x))"""
return 1 / (1 + math.e**(-x))
def __dsig(x):
"""f'(x) = f(x) * (1 - f(x))"""
return x * (1 - x)
def __relu(x):
"""f(x) = 0 for x < 0 \n\t = x for x >= 0"""
return max(0, x)
... | true |
a5490b04eff403732becd302fcf6b79b43470db7 | Python | buq2/autopi-additions | /test_my_network.py | UTF-8 | 4,291 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | import my_network
import pytest
import datetime
import numpy as np
use_real_time = True
fake_time = datetime.datetime.now()
def faked_current_time(usage_reason):
global use_real_time
global fake_time
if use_real_time:
return datetime.datetime.now()
else:
return fake_time
class FakedN... | true |
a3fb88ab15c8dff974f7463781ad2743e22aea51 | Python | MSnaker/Djinnerator | /key.py | UTF-8 | 713 | 2.53125 | 3 | [
"Unlicense"
] | permissive | import password
import base64
from cryptography.fernet import Fernet
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
# Generate key, start fernet.
with open('salt.txt','rb') as fsalt:
salt = fsalt.readlines()[0]
pwd = b'banananas'
kdf = PBKDF2HMAC(... | true |