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 |
|---|---|---|---|---|---|---|---|---|---|---|
c6d4baf8dd41c0ad6f4f0384db6e581567f3c439 | ishfaq972/rnn2automata | /utils/exceptions.py | UTF-8 | 98 | 2.5625 | 3 | [] | no_license | class BadInput(Exception):
def __init__(self,msg):
super(BadInput, self).__init__(msg) | true |
fde91c47da23352dc02d8c0be04fb7aa3d86dbfc | Mylos97/IDS-Handin | /Weather.py | UTF-8 | 1,786 | 3.0625 | 3 | [] | no_license | import requests as re
import json
## API used in the project
## https://freegeoip.app/json/
## https://www.metaweather.com/api/location/search/?query=london
## https://www.metaweather.com/api/location/554890/
## Get json weather data
class Weather:
## Get the city from the ip
def get_city_from_ip(self, ip)... | true |
9e0870ccf539074c3dd3a3a9ef3ce88eb1c132be | bmize/UCI-RegCheck | /UCI-RegCheck/model/course.py | UTF-8 | 928 | 3.609375 | 4 | [
"MIT"
] | permissive | """course.py
Contains the Course class which is used to represent the basic characteristics
of a UCI course
"""
class Course:
"""Represents a Course object
Attributes:
course_code: int representing a specific course offered by UCI. For
example, 36595 in the Fall Quarter of 2017 represent... | true |
7f2e79a4e89c279b09836094cdc7a813525a38f8 | D40124880/Python-Django-Flask | /FlaskFundamentals/DisappearingNinjas/server.py | UTF-8 | 1,202 | 2.640625 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect
app = Flask(__name__)
@app.route('/')
def index():
return render_template('/index.html')
@app.route('/ninja')
def ninja():
img = "/static/imgs/tmnt.png"
return render_template('ninja.html', img=img)
@app.route('/ninja/<color>')
def color(color):... | true |
d2e2fbde1ce7ed52008ea0fe5d08c39c9c1512de | jkanekunga/Workshops | /PycharmProjects/workshopPart3/file_pract.py | UTF-8 | 547 | 3.78125 | 4 | [] | no_license |
#name = input("Enter your name:")
#open_file = open("name.txt", "w")
#print(file_name, file= open_file)
#---result
#outFile = open("name.txt", "w")
#name = input("What is your name? ")
#print(name, file="outFile") # or outFile.write(name)
#outFile.close()
#------next program
#open_file = open("name.txt", "r")
#f... | true |
08ffea6aafcf68d21a81884e8a832a103fed6fc2 | liamniou/codewars | /simple_encryption_alternating_string.py | UTF-8 | 672 | 3.46875 | 3 | [] | no_license | def encrypt(text, n):
if text and n > 0:
for _ in range(n):
text = "".join(list(text)[1::2] + list(text)[0::2])
return text
def decrypt(encrypted_text, n):
text = encrypted_text
if encrypted_text and n > 0:
for _ in range(n):
second_chars = text[0:(len(text) // ... | true |
331e8420ccb338dae47e22a3352853e82f44420b | kieracawley/vigenere | /vigenere.py | UTF-8 | 564 | 3.046875 | 3 | [] | no_license | import sys
ciphertext = sys.argv[2].upper()
keytext = sys.argv[3].upper()
def vigenere(text, key, encode):
alphabet = list(map(chr, range(65, 91)))
new = ""
for i in range(0, len(text)):
mychar = text[i]
shift = alphabet.index(key[i % len(key)])
if encode != True : shift *= -1
... | true |
119c50f70ba422cb0d1d69a0a0c2fbfd850c169d | pslh/oq-risklib | /openquake/risklib/models/input.py | UTF-8 | 6,452 | 2.9375 | 3 | [] | no_license | # coding=utf-8
# Copyright (c) 2010-2013, GEM Foundation.
#
# OpenQuake Risklib is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
... | true |
7e08981a5600f626941638b702dd1324eb16cc9e | sslshuanglong/Learn-Python | /tools/creat_dir_if_not_exists.py | UTF-8 | 451 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
创建不存在的目录,如果已经存在提示创建成功
'''
MESSAGE = 'This dir already exists'
TESTDIR = 'testdir'
import os
try:
home = os.path.expanduser('~')
print(home)
if not os.path.exists(os.path.join(home, TESTDIR)):
os.makedirs(os.path.join(home, TESTDIR))
pri... | true |
6c959eb295c8da394cd14c4a6dd28bc78d886d00 | gjtjdtn201/practice | /백준/Gold/피리 부는 사나이.py | UTF-8 | 940 | 2.96875 | 3 | [] | no_license | import sys
sys.stdin = open('피리 부는 사나이.txt')
def DFS(sty, stx, cnt):
global ans
stack = [(sty, stx)]
while stack:
a, b = stack.pop()
if matrix[a][b] == 'D':
ny, nx = a+1, b
elif matrix[a][b] == 'U':
ny, nx = a-1, b
elif matrix[a][b] == 'R':
... | true |
d611bf71f9fa9130f44cc27f7b4ce5c32d6ed5e8 | WoolinChoi/WoolinChoi.github.io | /jupyter/aBasic/c_module_class/myfile.py | UTF-8 | 652 | 3.78125 | 4 | [
"MIT"
] | permissive | # 1. 모듈 전체를 참조할 때 import
import mymodule
today = mymodule.get_weather()
print("오늘의 날씨는", today)
print(mymodule.get_date(), "요일입니다")
# 2. 모듈에 별칭 부여
import mymodule as my
today = my.get_weather()
print("오늘의 날씨는", today)
print(my.get_date(), "요일입니다")
# 3. 모듈에서 필요한 부분만 import
from mymodule import get_weather
today = g... | true |
8e4b3da5190b6a530ab012698b6776ce912def52 | H4y0/MyPythonLesson | /work4.py | UTF-8 | 281 | 2.84375 | 3 | [] | no_license | import jieba
import string
with open("诗词.txt","r",encoding="utf-8") as f:
txt=f.read()
lst=jieba.lcut(txt)
d={}
for i in lst:
if len(i)==1:
continue
else:
d[i]=d.get(i,0)+1
t=list(d.items())
t.sort(key=lambda i:(i[1],i[0]),reverse=True)
print(t[:]) | true |
e1e2d50d1f626084694ff26e450acd641c5bb2f6 | Daishijun/InterviewAlgorithmCoding | /leetcodePrac/LongestValidBrackets.py | UTF-8 | 973 | 3.59375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Date : 2019/6/9
# @Time : 12:48
# @Author : Daishijun
# @File : LongestValidBrackets.py
# Software : PyCharm
'''Leetcode 32 最长有效括号'''
'''
dp[i]表示以string[i]为结尾的情况下,最长合法括号字符串长度。
动态规划,遍历到i位置时,如果是‘(’,跳过,如果是‘)’,找到与i位置对应的前面的位置,看是否是‘(’
dp[i] = dp[i-1]+2 + (dp[pre-1] if pre>0 else 0) !!!p... | true |
1e80b9c8a982637a65d71fbf6c47f1bbc6d6214d | chuckma/pythondemo | /func/invokeFunc.py | UTF-8 | 631 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/5/11 下午8:22
# @Author : Lucas Ma
# @File : invokeFunc
# 绝对值函数
print(abs(-20))
print(abs(10))
print(abs(10.22))
# max 函数 返回最大的值
print(max(1, 23, 45))
# Python内置的常用函数还包括数据类型转换函数,比如int()函数可以把其他数据类型转换为整数:
print(int('1231'))
print(int(12.456))
print(flo... | true |
adc6460192670adbfe819ba0d522b5cbd2ea174a | harshmalviya7/LeetCode_Coding_Questions | /addTwoNumber.py | UTF-8 | 802 | 3.46875 | 3 | [] | no_license | # 2. Add Two Numbers
# https://leetcode.com/problems/add-two-numbers/
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
itr1,... | true |
c679af6acd31425916ae78c1a748f233d27acb01 | scandium21/cohort3 | /src/python/comp200/tests/syntax_test.py | UTF-8 | 601 | 3.125 | 3 | [] | no_license | import pytest
import sys
sys.path.insert(0, '../')
import syntax
def test_add():
assert syntax.add(2, 3) == 5
assert syntax.add(0.1, 0.13) == 0.23
def test_subtract():
assert syntax.subtract(2, 3) == -1
def test_divide():
assert syntax.divide(3, 4) == 0.75
# Assert that a certain exception is ra... | true |
7aeb9db5dcc74c1962ed4c83d0ae867cacc77e02 | theturbokhemist/Optimization-Algorithms | /Genetic Algorithm/GAtest.py | UTF-8 | 6,255 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 10 19:22:33 2020
@author: gordid
"""
import numpy as np
from numpy.random import randint
from random import random as rnd
from random import gauss, randrange
import copy
class GA:
"This class is for recording all the data produced from the ge... | true |
60210e6208b63cdf9e33de26abc57853813c9c0b | KirillZorikov/yamdb_final | /api/management/commands/populate_db.py | UTF-8 | 3,246 | 2.5625 | 3 | [] | no_license | import csv
from django.apps import apps
from django.core.management import BaseCommand
from django.db import IntegrityError
from django.utils.dateparse import parse_datetime
from api.models import User
CSV_TABLES = {
'Category': r'data/category.csv',
'Genre': r'data/genre.csv',
'User': r'data/users.csv',... | true |
d5a897a322019da4ad381ec39999a8be971949d8 | marti1125/OD_Veterinarias | /loaddata.py | UTF-8 | 2,447 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import os, time
import wget
import csv
import MySQLdb
from stat import * # ST_SIZE etc
from datetime import datetime
file_url = 'http://datosabiertos.miraflores.gob.pe/rest/datastreams/220665/data.csv'
file_name = wget.download(file_url)
# Se abre la conexion a la base de datos
db = MySQLdb.connect... | true |
0a793f53eea1c1e072098cb23a3f8145868d00bc | srisi/tobacco_analytics | /tobacco/text_passages/text_passages_helper_search.py | UTF-8 | 3,141 | 2.84375 | 3 | [] | no_license | import re
import time
import numpy as np
from tobacco.frequencies_preprocessing.preprocessing_search import wildcard_search
#from tobacco.frequencies_preprocessing.preprocessing_tokens import get_ngram_vector
#from tobacco.utilities.sparse_matrices import csc_to_np_uint8
from tobacco.utilities.vector import Vector
... | true |
432496f1fdde50fa11bc4eba97dce99ade6de77d | xiaowang012/python_learning_code | /python通信协议/telnet/telnet_1.py | UTF-8 | 1,683 | 2.921875 | 3 | [] | no_license | #coding=utf-8
from telnetlib import Telnet
from time import sleep
'''一个简单得telnet 协议的实例
tn对象的方法:
tn.read_until(b'xxx',timeout=x)直到阅读到指定的字符串,或者超时
tn.read_all() 读取所有数据直到EOF
tn.read_some() 至少读取一个数据
tn.read_very_eager() 阅读所有可以在I / O(热切)中不受阻塞的内容。
tn.read_eager() 读取随时可用的数据
tn.read_lazy() 处理并返回队列中已有的数据
tn.read... | true |
9aa9471ab0d062501046d2e432d86a8290348e54 | merubhanot/StructEst_W17 | /Students/DP/ps2/distributions.py | UTF-8 | 3,762 | 3.5 | 4 | [] | no_license | # MACS 40200: PS2
# Name: Dongping Zhang
# Python Version: 3.5
# Seed: None
import numpy as np
import scipy.special as spc
import scipy.stats as sts
def GA_pdf(xvals, alpha, beta):
'''
--------------------------------------------------------------------
Generate pdf values from the Gamma pdf with paramete... | true |
a24fa8a9a3a7f1d7b15c99f0de4cd630995bc28f | zyq507/Pythoncore | /Bosch/regex.py | UTF-8 | 142 | 2.859375 | 3 | [] | no_license | import re
m = re.match('foo', 'foo')
if m is not None:
print m.group()
t = re.findall('foo','foo is very foo and foolish foo.')
print t
| true |
49610c46c434c6a5dc535c9b43dbab8fc83dd62b | DeshErBojhaa/sports_programming | /leetcode/473. Matchsticks to Square.py | UTF-8 | 984 | 2.953125 | 3 | [] | no_license | # 473. Matchsticks to Square
from functools import lru_cache
class Solution:
def makesquare(self, nums: List[int]) -> bool:
if not nums or len(nums) < 4:
return False
total_len = sum(nums)
N = len(nums)
if total_len%4:
return False
side = total_len // ... | true |
807180f4a772ba8bc23e75bcea24c1ff2d76444a | JingDas05/machine-learning | /tool/copy_to_one.py | UTF-8 | 1,885 | 3.375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import os
import shutil
import sys
class Copy(object):
"""Copy classifier.
将源文件的所有文件都拷贝到目标文件夹
Parameters
------------
target_file_path : string 目标文件夹
"""
def __init__(self, target_file_path):
if target_file_path == "":
return
self.targe... | true |
6b3daec39c37d94156bba7361bd1fa497ebcfe4f | TaigoKuriyama/atcoder | /problem/abc165/b/main.py | UTF-8 | 170 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
x = int(input())
ans = 1
m = 100
while True:
m = int(m * 1.01)
if m >= x:
print(ans)
exit()
else:
ans += 1
| true |
669183ed86abcd3a01730bb57710e3010203bb77 | christianbv/EiT | /feature_extraction.py | UTF-8 | 5,771 | 2.5625 | 3 | [] | no_license | from datetime import datetime
import numpy as np
import pandas as pd
import os
from contextlib import redirect_stdout
params = {
"train_split": 0.7,
"val_split": 0.2,
"test_split": 0.1,
"save_path": "/Users/christianbv/PycharmProjects/EiT/final_datasets/",
"load_path": "/Users/christianbv/PycharmP... | true |
f58b11d834f6a18450fec769b87cae6b25bab08c | jeanschuchardt/FGApp | /analise de dados/Servidores/inserter/insert.py | UTF-8 | 5,334 | 2.65625 | 3 | [
"MIT"
] | permissive | import pandas as pd
from sqlalchemy import create_engine
from unidecode import unidecode
from datetime import datetime
def insert_cadastro(cadastro,remuneracao):
chunk = 10000
#le o arquivo csv remuneração
remuneracao_result_set = read_csv(remuneracao)
#remove caracteres especiais da lingua portu... | true |
e485bb39df4aa3fa5b719c686bd218b56fa5e439 | NeuroLaunch/Metis_Submissions | /Project5_Week09_Kojak/Speech_Analysis.py | UTF-8 | 5,135 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Utility functions to process speech waveforms.
For Metis Weeks 9-12, Project Kojak.
@author: Steven Bierer
Created on Wed Nov 28, 2018
"""
import numpy as np
import glob
import pyaudio
#import librosa
import soundfile as sf
from scipy import signal
from sklearn.d... | true |
caea2e4254269f2645e0cd6fe075efa02ac73db6 | sonisultania/StockCode | /corr.py | UTF-8 | 1,739 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 28 11:53:45 2020
@author: sonisultania
"""
import numpy as np
import pandas as pd
#used to grab the stock prices, with yahoo
import pandas_datareader as web
from datetime import datetime
#to visualize the results
import matplotlib.pyplot as plt
imp... | true |
ab877c6fa66920b64f169e6636f7279629f50094 | AkshatUpadhyay/PhoneBook | /FirstPage.py | UTF-8 | 591 | 2.828125 | 3 | [] | no_license | from Tkinter import *
root=Tk()
root.geometry('650x400')
Label(root,text='About The Developer',font='Arial 60').grid(row=0,column=2)
Label(root,text='PYTHON and DBMS Project',font='Comic 30').grid(row=1,column=2)
Label(root,text='The Developer of this program is AKSHAT UPADHYAY who developed the program under guid... | true |
4f7594317865a4ae8d8e42d350ec94e7f2703497 | raplima/transfer_learning_wgui | /user_interface.py | UTF-8 | 30,873 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 14:32:03 2020
@author: rafael.lima
user interface for transfer learning
"""
import os
import PySimpleGUI as sg
import json
import pandas as pd # used to save dataframes
from pathlib import Path
import tensorflow as tf
from tensorflow.keras.preproce... | true |
3be778926eb0cd397afaac52ee8a5547685353bb | thouis/plate_normalization | /randomize_plates.py | UTF-8 | 2,634 | 2.59375 | 3 | [] | no_license | import numpy as np
import xlrd
import xlwt
import sys
import collections
import os.path
# Input:
# Header row, followed by columns of:
# siRNA ID, Control?, Gene, Plate number, Row, Column, Plate Name
# Controls will not be moved
ID = 0
CTRL = 1
GENE = 2
BOUNDARY = 3 # everything before this is randomized
PNUM = 3
... | true |
917a1606914723ee7f2b05b4e6c8bc1e938f6204 | cypai/dungeontiles | /spells.py | UTF-8 | 12,537 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
class Spell:
def __init__(self):
self.tapped = False
self.repeatable = False
self.repeatable_max = 0
self.repeatable_x = 0
self.exhausted = False
def name(self):
return ""
def description(self):
return ""
def tile_reqs(s... | true |
9f6b333906803e5e8091e89bf8ba27cf43d400b4 | ispastlibrary/Titan | /2016/AST2/Bili/letnji/kugla_laksiFojt.py | UTF-8 | 3,313 | 2.6875 | 3 | [] | no_license | from scipy.special import wofz
import numpy as np
import matplotlib.pyplot as plt
def voigt(x,y): #Fojtova funkcija
z = x + 1j*y
w = wofz(z).real
return w
e=1.60217657e-19 #elementarno naelektrisanje [C]
AU=149597871000 #Astronomska jedinica [m]
Na=6.02*1e+23 #Avogadrov broj
M=23*1e-3 #molarna masa Na ... | true |
39f7182104eada0179bb80291de1662fd3272633 | Aasthaengg/IBMdataset | /Python_codes/p02853/s199070032.py | UTF-8 | 159 | 3.15625 | 3 | [] | no_license | x, y = map(int, input().split())
ans = 0
if x < 4:
ans += (4-x)* 100000
if y < 4:
ans += (4-y)* 100000
if x + y == 2:
ans += 400000
print(ans) | true |
fedda425b5e882370b5b930b87d0299b50e0382d | keltoom/Python_programs | /us-states-game/main.py | UTF-8 | 1,093 | 3.421875 | 3 | [] | no_license | import turtle
import pandas
screen = turtle.Screen()
screen.title("U.S. States")
image = "blank_states_img.gif"
screen.addshape(image)
turtle.shape(image)
# def get_mouse_click_coor(x,y):
# print(x,y)
# turtle.onscreenclick(get_mouse_click_coor())
data = pandas.read_csv("50_states.csv")
states = data.state.to_li... | true |
764c796201710e3000c0d173ad4716b80aa56205 | KumarAmbuj/GEEKSFORGEEKS-DYNAMIC-PROGRAMING | /38.MAX SUM INCREASING SUBSEQUENCE.py | UTF-8 | 372 | 2.734375 | 3 | [] | no_license | def findmaxsumlis(arr):
lis=[0 for i in range(len(arr))]
for i in range(len(lis)):
mx=0
for j in range(i):
if arr[j]<arr[i]:
mx=max(mx,lis[j])
lis[i]=mx+arr[i]
mx=0
for i in range(len(arr)):
mx=max(mx,lis[i])
print(mx)
... | true |
5ce78381d62f9797f459f034218627eff2749758 | huxoll/py-reminders | /reminders/models.py | UTF-8 | 1,736 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from . import db
from datetime import datetime
import uuid
def generate_uuid():
return str(uuid.uuid4())
def dump_datetime(value):
"""Deserialize datetime object into string form for JSON processing."""
if value is None:
return None
return value.strftime("%Y-%m-%d %H:%M:%S")
class Timestam... | true |
3274226c51cac4e71ba2f5631891c6f808f91aed | sung3r/Machine-Learining-Security | /web安全之机器学习入门/15-6-DNN-recognise-images-MLP.py | UTF-8 | 2,532 | 2.984375 | 3 | [] | no_license | from datasets import Datasets
from exts import get_one_hot
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
# 多层感知机
def main():
# 加载数据集
train_data, vaild_data, test_data = Datasets.load_mnist()
x_train, y_train = train_data
x_test, y_test = test_data
# one-hot编码又称一位有效编码,其方法是使用N位状态寄存器来对... | true |
72b2cfbfc0ca9bba47f48a2c50e8e58287191d83 | vkoprivica/100_Days_of_Python | /days_28-30_regex/regex_ipynb.py | UTF-8 | 3,078 | 3.4375 | 3 | [
"MIT"
] | permissive | import re
import pprint
from collections import Counter
text = "Awesome, I am doing the #100DaysOfCode challenge"
# print(text.startswith("Awesome"))
# print(text.endswith("challenge"))
# print("100daysofcode" in text.lower())
# print(text.replace("100", "200"))
# print(re.search(r"I am", text))
# print(re.match(r"I... | true |
ccd235a469ca96c8e62ae24d4824ec915fa69a48 | super0xie/Solution | /Python/LargestValuesFromLabels.py | UTF-8 | 881 | 3.203125 | 3 | [] | no_license | from typing import List
class Solution:
def largestValsFromLabels(self, values: List[int], labels: List[int], num_wanted: int, use_limit: int) -> int:
l = []
for i in range(len(values)):
l.append((values[i], labels[i]))
l = sorted(l, key=lambda a: a[0])
count =... | true |
b4e6579b4e71e7ef611c382d997bb6eebee7eb5f | prabhudevguntur/mlops-sample | /test_train.py | UTF-8 | 563 | 2.8125 | 3 | [] | no_license | import numpy as np
from code.training.train import train_model, feature_eng
def test_train_model():
# Arrange
data = pd.read_csv('sample.csv')
y_train = data["median_house_value"].copy()
X_train = data.drop("median_house_value", axis=1)
# Act
full_pipeline = feature_eng(X_train)
housing_p... | true |
53c20de8d0cd230019494548e10a08bf35f6ddcc | Emily-chiu/homework | /class01_homework1.py | UTF-8 | 807 | 4.125 | 4 | [] | no_license | from random import *
b = [] # b 放 20 個隨機抓的數字
x = [] # x 放 兩位數的數字
y = [] # y 放偶數
z = [] # z 放奇數
a=1
while a <= 20:
number = randint(1,201)
if number not in b: #判斷隨機取出的數字有沒有重複
b.append(number) #放進b陣列
if number > 9 and number < 100: #判斷隨機取出的數字是不是二位數
x.append(number) #放進x陣列
... | true |
0960a350d94e90a08ffee37030ac6d188a712ad2 | WeijunZhu31/Rutgers-Master-Courses | /2020Spring/DL/DemoCode/Topic05_Optimization Techniques/mnistCiafarFunctionalValidation.py | UTF-8 | 5,298 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 9 15:42:18 2020
@author: alizadeh
"""
#This code is adopted from "Deep Learning with Python", by F. Chollet, CH. 2
#This is the "functional" form of the model
# In this script we use early stopping approach by using the provided
# callbacks. You can do this ... | true |
fd67aaee66f4ff7a682dc48ff193ee6358b43454 | zhangchizju2012/LeetCode | /634.py | UTF-8 | 3,668 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 1 19:39:30 2017
@author: zhangchi
"""
class Solution(object):
# 看了Fei Wang的代码
def findDerangement(self, n):
"""
:type n: int
:rtype: int
"""
if n == 1:
return 0
if n == 2:
... | true |
b341b0bdf681a882c657374958029e526093c28c | jmederosalvarado/daa-project | /practice/divide-conquer-opt/paper/basic.py | UTF-8 | 442 | 2.859375 | 3 | [] | no_license | def arranging_heaps(weights, k):
n = len(weights)
w = [[0]*n for _ in range(n)]
for i in range(n):
for j in range(i, n):
w[i, j] = weights[i](j-i)
dp = [[0]*n for _ in range(k+1)]
for i in range(1, k+1):
for j in range(n):
dp[i][j] = 1e5 # some big value he... | true |
a67c5cf1b721cce97cc580a2b238eae0cc2d5b12 | GeorgOhneH/WerbeSkip | /deepnet/utils/network/analysis_utils.py | UTF-8 | 4,762 | 3.359375 | 3 | [] | no_license | import numpywrapper as np
import math
class Analysis(object):
"""
The class is responsible for the evaluation
and the validation of the network
"""
def __init__(self, network):
"""
The class is linked with the network
:param network: network object
"""
self... | true |
b1b2ae04cce9808651667d7c3a1ced5988ffc38f | vihtinsky/python-odesk3 | /odesk/__init__.py | UTF-8 | 6,147 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Python3 bindings to odesk API
python-odesk3 version 0.1
(C) 2012 oDesk
"""
VERSION = (0, 1, 0, 'beta', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % ... | true |
d6000768a4b584f1772175bcbf350be074022d9e | ayaland/Advent_of_Code_2018 | /advent_code_3_2.py | UTF-8 | 1,664 | 3.484375 | 3 | [] | no_license | from advent_code_3_1 import parse_data, make_pairs
# parse_data returns list of (x, y) and (w, h) tuples as each item
# note this data is in str form
# [
# ((x1, y1), (w1, h1)),
# ((x2, y2), (w2, h2))
# ]
import itertools
def look_for_overlap():
zipd_data = parse_data()
patches = compare_patch(zipd_data)
... | true |
0184d9f561ff91f0c93e62cc4ea0043b277e391e | neiesc/Problem-solving | /HackerRank/Python/Itertools/itertools-product.py | UTF-8 | 321 | 3.1875 | 3 | [
"MIT"
] | permissive | #!/bin/python3
# itertools.product()
# https://www.hackerrank.com/challenges/itertools-product/problem
from itertools import product
def solve(a, b):
return list(product(a, b))
if __name__ == '__main__':
a = map(int, input().split())
b = map(int, input().split())
print(" ".join(map(str ,solve(a, b)))... | true |
d2829daac25c8f897b179483fb2dd01c2ceac476 | rpytan/glue-ml-models | /mnist_no_layers.py | UTF-8 | 2,773 | 2.9375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
# 3/11:
# try with CIFAR_10, CIFAR_100
# Generate plots of learning
# Hyper-parameters
input_size = 28 * 28 # 784
num_classes = 10
num_epochs = 10
batch_size = 32
learning_rate = 0.001
# MNIST dataset (images and lab... | true |
cb3c9a7d792d5199c79d599779ca01ce450a9c8e | NSkelin/Python-Banking-App | /atm_views/transaction_view.py | UTF-8 | 2,435 | 2.984375 | 3 | [] | no_license | from tkinter import *
class TransactionView:
def __init__(self, master):
self.master = master
# left side of menu
self.desc_text = Label(text='Choose a transaction', font=('Arial', 14), background='#88C9ED')
self.deposit = Button(text='Deposit', width=10, height=3, font... | true |
33d0acfbac5e58c9b3367763e85d041e3ee3b17c | tporter13/Recipe-Doc-Code-Generator | /ParseRecipes.py | UTF-8 | 3,294 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python
# ParseRecipe.csv to html
# Author(s): Dad and Tara
# Version 1 - added css class to all columns except header
import sys
import csv
import operator
if len(sys.argv) < 3:
print ("Usage: csvToTable.py csv_file html_file")
exit(1)
# csv format: title, instructions, tag, order
# Open t... | true |
0a5f265bcef0c5f33f15b77a6fc3834e7afb96cb | ceijhey/clubpythonalm-taller-bots-telegram | /00-Envios al Bot/05-Video.py | UTF-8 | 950 | 3.1875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Ejemplo: 05 - Enviar un video
Libreria: pyTelegramBotAPI 1.4.2 [ok]
Libreria: pyTelegramBotAPI 2.0 [ok]
Python: 3.5.1
"""
import telebot
import sys
TOKEN='AQUÍ EL NUMERO DE VUESTRO TOKEN' # Identificador único del bot
telegram = telebot.TeleBot(TOKEN) # ... | true |
bc577df954f36834cb492679aa7c5cc3e1ff360c | pekkott/pinfu-challenge-advance | /matching/models/user.py | UTF-8 | 1,329 | 2.515625 | 3 | [] | no_license | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from sqlalchemy import Column, Integer, String, Float, DateTime
from setting import Base, ENGINE, session
INITIAL_RATING = 1500
class User(Base):
__tablename__ = 'users'
user_id = Column('user_id', Integer, primary_key = True)... | true |
f1583cb34c71b57ab10adba5fe6299231bc9c56f | fujunguo/learning_python | /old_boy_exercises/week7/类方法.py | UTF-8 | 268 | 4.21875 | 4 | [] | no_license | # __author__: William Kwok
class Dog(object):
name = 'Missy'
def __init__(self, name):
self.name = name
# 类方法只能访问类变量,不能访问实例变量
@classmethod
def eat(self):
print('%s is eating %s.' % (self.name, 'd'))
d = Dog('Lassie')
d.eat()
| true |
1a9f4ea3281653a25261c097bbe616dd6eba9456 | Sergio5714/pybf | /scripts/make_video.py | UTF-8 | 3,345 | 2.625 | 3 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | """
Copyright (C) 2020 ETH Zurich. All rights reserved.
Author: Sergei Vostrikov, ETH Zurich
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LI... | true |
34d246e8c51f727046f291c1e9166435dd532773 | moshchonskiy/apt_inst_tests | /utils/shell_executor.py | UTF-8 | 946 | 2.828125 | 3 | [] | no_license | import subprocess
from log import logger
class ShellExecutor(object):
@staticmethod
def execute_command(cmd):
"""
:param cmd: Command to execute
:return:
"""
if not cmd:
cmd = []
logger.info("executing: {}".format(cmd))
process = subprocess.... | true |
35a5ded7d1e074aab70c394573bab617a126df88 | randompyslices/randomslices | /a_random_sample_of_python/sample_no_repeats.py | UTF-8 | 827 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
from random import randint
import numpy as np
from timeit import timeit
def sample_without_repeats(M,N):
while True:
s = [randint(0,M) for i in xrange(0,2*N)][:N]
if len(set(s)) == N:
return s
def sample_no_repeats(M,N):
while True:
s = np.random.rand... | true |
6a2cf8f7b68326e98e19197330a88ef1cb28aec6 | pekka-aleksi/2020-advent-of-code | /day11xx/d11.py | UTF-8 | 1,315 | 3.125 | 3 | [] | no_license | import itertools
def get_data(filename):
with open(filename, 'rt') as file:
buffer = file.read().splitlines()
return buffer
data = get_data('data.txt')
def get_neighbors(d, datadimension=(99, 93)):
neighbors = list(itertools.product((0, -1, +1), repeat=2))
neighbors = {tuple(min(max(... | true |
e88792c6bea1209a80f232e913fec8768549d772 | NathanaelV/CeV-Python | /Exercicios Mundo 2/ex049_tabuada_v2.py | UTF-8 | 320 | 4.21875 | 4 | [] | no_license | # Class Challenge 13
# Fazer uma tabuada.
print('Fazendo Tabuada!')
t = int(input('Deseja saber a tabuada de qual número? '))
m = int(input('Multiplicando até qual número? '))
print('-' * 15)
for a in range(1, m+1):
print('{} X {:>2} = {}'.format(t, a, a * t))
print('-' * 15)
# Exemplo do professor: Semelhante | true |
7dec850a6d893cf0da6fa93985b8d1d3b7ee7000 | GanonYou/LearnPython | /CourseAlgorithm/matrix_mul_1.py | UTF-8 | 1,045 | 3.1875 | 3 | [] | no_license | import numpy
INF = float("inf")
def MatrixChainOrder(r):
n = len(r)
m = numpy.zeros([n,n])
s = numpy.zeros([n,n])
for i in range(n):
m[i][i] = 0
for x in range(1,n-1):
for i in range(1,n-x):
j = i + x
m[i][j] = INF
for k in range(i,j):
... | true |
db0e89d08020e9dd79bec5306cf9abfc83fda2dd | shteken/music_events | /create_initial_data.py | UTF-8 | 626 | 2.953125 | 3 | [] | no_license | import uuid
import pathlib
import pandas as pd
import random
NUMBER_OF_USERS = 10
country_file = pathlib.Path('./source_files/countries.csv')
user_file = pathlib.Path('./source_files/users.csv')
def generate_users(source, user_to_generate):
country_df = pd.read_csv(source)
countries = country_df.countryCode
... | true |
0ab47b0a5b12dc43dc9d2357907e17650dd7e7fc | ankit4488kumar/Renames-and-drop-of-logs-of-a-datafrmes-with-conditions | /drop_or_rename_logs_values_of_dataframe.py | UTF-8 | 604 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 25 22:42:44 2021
@author: ankit
"""
#import required library
import pandas as pd
#create a dataframe
out = pd.DataFrame({'index':['L8.BRENT_price','L3.BRENT_CO1','L11.BRENT_CO1']})
print(out)#print output
#drop the value "BRENT_price" from the dataframe
out.dr... | true |
54b017d96992e017f1f963d407ba312ca4b42479 | O-Neill/part-II-project | /code/Python/challengeresponsehost/ChallengeResponse.py | UTF-8 | 1,946 | 2.65625 | 3 | [] | no_license | from smartcard.CardType import ATRCardType
from smartcard.CardRequest import CardRequest
from smartcard.util import toHexString, toBytes
# Request any card. Can be more specific using arguments to CardRequest
# contructor.
# Timeout=None means the request waits forever until card is connected.
cardRequest = CardReques... | true |
786af826c01af13932ce881a234d2d047640c8aa | fionanealon/iris-data-set-project | /split.py | UTF-8 | 392 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | # Fiona Nealon, 2018-04-05
# A program that reads and formats the Iris Data set
# Open the data csv file in data sub folder. Also close the data csv file once complete.
with open("data/iris.csv")as f:
# Loop through lines of data csv file
for line in f:
# Prints the first four columns of data
print(lin... | true |
202cbb074cce28299472c45bd138151697bdff47 | jerry9856/StudentReview | /main.py | UTF-8 | 3,748 | 2.84375 | 3 | [] | no_license | import csv, re, jieba, monpa
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from corextopic import corextopic as ct
import _pickle as cPickle
from datetime import datetime
import sys
# datetime object containing current date and time
now = datetime.now()
# dd/mm/YY H:... | true |
df90a5bfcd29f8a5bf72db2afc57231ca6655c67 | ndjman7/fastcampus_web | /python/OOP.py | UTF-8 | 1,209 | 4.6875 | 5 | [] | no_license | # 객체 지향 프로그래밍 (OOP; Object Oriented Programming)
# - Object - 상태(State == data), 행동(Behavior == function)
# Class, |||||| Object == Instance
# 사람 Class
# A는 객체다 ( Object )다.
# A는 사람 Class의 인스턴스 (Instance)다.
class Person:
def __init__(self, name, age): #초기화
print("사람이 생성되었습니다.")
self.name = n... | true |
57443a6ad74c192a01ff7238b48a6568b8dd3f96 | qijiayi0217/Data_mining_pattern_mining | /Jiayi_Qi_proj1/Apriori_final_v2.py | UTF-8 | 4,830 | 2.78125 | 3 | [] | no_license | import datetime
print "minimum support (ex. input 0.5 for 50 %):"
min1=input()
print "scale of data set (ex. input 0.5 for 50%):"
scale=input()
min_support=32561*scale*min1
begin=datetime.datetime.now()
f=open(r'./adult.data.txt')
a=f.read()
f.close()
space=""
list1=list(a)
list2=space.join(list1)
list3=list2.split('... | true |
f033cfbd4775badc2856e0a8ef975001c154cd0e | npex2021rl/rl | /day5/ts/utils.py | UTF-8 | 1,069 | 2.984375 | 3 | [] | no_license | import numpy as np
def value_iteration(P, R):
nS, nA = R.shape
h = np.zeros(shape=(nS, 1), dtype=np.float)
next_h = bellman_update(P, R, 1.0, h)
next_h -= next_h[-1, 0]
while np.linalg.norm(next_h - h, ord=np.inf) > 1e-6:
h = next_h
next_h = bellman_update(P, R, 1.0, h)
ne... | true |
9f6dbfa9518cfa6c409d5e854e8b2491961759cb | jubileemarie/Pandas | /Problem2_Pandas.py | UTF-8 | 314 | 2.984375 | 3 | [] | no_license | import pandas as pd
cars=pd.read_csv('cars.csv')
A=cars.iloc[0:5,0::2]
print(A)
B=cars.loc[cars['Model']=='Mazda RX4']
print(B)
C=cars.loc[cars['Model']=='Camaro Z28',['Model','cyl']]
print(C)
D=cars.loc[cars['Model'].isin(['Mazda RX4 Wag','Ford Pantera L','Honda Civic']),['Model','cyl','gear']]
print(D) | true |
72005cacb498544d24009c1dc72a73b1f361ed89 | nithssh/AU-MuteManager | /src/screen_capture.py | UTF-8 | 313 | 2.625 | 3 | [
"MIT"
] | permissive | #
# This is a simple script to capture part of the screen using Pillow.
# Called from index.js as child_process exec
#
from PIL import ImageGrab
import time, sys
x = 550
y = 430
width = 820
height = 225
outname = "./data/screencap.png"
img = ImageGrab.grab(bbox=(x, y, x + width, y + height))
img.save(outname)
| true |
e93b4a8ad66fdbdea6cec2f53bd02007d048d1ff | iris94999/Python-practice | /2.py | UTF-8 | 1,021 | 3.9375 | 4 | [] | no_license | # coding: utf-8
#题目:企业发放的奖金根据利润提成。利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,
# 高于10万元的部分,可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;
# 60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%提成,从键盘输入当月利润I,求应发放奖金总数?
#程序分析:请利用数轴来分界,定位。注意定义时需把奖金定义成长整型。
i = int(raw_input('净利润:'))
arr = [1000... | true |
ed9794bfc2d075876290ffb6791f36d01b16cc12 | basiliomp/intro_to_python | /Intro_to_Python2019-10-21.py | UTF-8 | 3,272 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Fifteenth session
Created on Mon Oct 21 18:28:53 2019
@author: Basilio M.P.
"""
#########
# MODULES
#########
# Modules are a set of elements bundled together, as packages in R.
# In syntax 'numpy.random.normal()', the first word refers to the directory (numpy),
# the second word refers... | true |
0ca985045718c453f187d45356b12595f3ed2452 | m4tx/MahjongAI | /client/mahjong_meld.py | UTF-8 | 928 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from client.mahjong_tile import Tile
__author__ = "Jianyang Tang"
__email__ = "jian4yang2.tang1@gmail.com"
class Meld:
CHI = 'chi'
PON = 'pon'
KAN = 'kan'
CHANKAN = 'chankan'
NUKI = 'nuki'
def __init__(self, type=None, tiles=None, open=True, called=None, from_whom=None... | true |
7ddee5bc67a97db56b67093b66435daa3059d521 | secano97/cliente-servidor | /Homeworks/Homework2/HomeworC/FinalClient.py | UTF-8 | 3,197 | 2.75 | 3 | [
"MIT"
] | permissive | import zmq
import pyaudio
import threading
import math
import sys
import os
import time
#RECORD GLOBALS
CHUNK = 5120
FORMAT =pyaudio.paInt16
CHANELS = 2
RATE = 20100 # what is it ?
RECORD_SECONDS = 0.3
p = pyaudio.PyAudio()
#CONTEXT
context = zmq.Context()
#RECEIVE
socket_RECV = context.socket(zmq.REP)
#SEND
socke... | true |
e4e0f4a755e3e4de508cab5b44d8957b5422c165 | carl-ellis/adventofcode2018 | /2/checksum.py | UTF-8 | 1,046 | 3.78125 | 4 | [] | no_license | from collections import defaultdict
import sys
def checksum_box(id: str) -> (bool, bool):
""" Takes a box name, and returns a tuple that is:
(F, F) is no letter appears 2 or 3 times,
(T, F) if at least 1 letter appears 2 times,
(F, T) if at least 1 letter appears 3 times,
(T, T) if... | true |
253ac684deb4663c1ae13895725be8de9bcf45b4 | ankile/ITGK-TDT4110 | /Øving 10/sudoku.py | UTF-8 | 468 | 3.90625 | 4 | [] | no_license | import fil
import bruker
print('Yo vil du laste inn et brett?')
brett = fil.load(input('Brettnavn: '))
print('Dette brettet ble lastet:')
bruker.print_board(brett)
print('\nvil du gjøre endringer på brettet?\n')
col = int(input('Hvilken kolonne vil du endre? '))
row = int(input('Hvilken rad vil du endre? '))
nytt... | true |
ec8d2e1d7b13f8789061cae958a2fa4e7752ef42 | gersongroth/maratonadatascience | /Semana 01/04 - Listas/04.py | UTF-8 | 589 | 4.21875 | 4 | [] | no_license | """
Faça um Programa que leia um vetor de 10 caracteres, e diga quantas consoantes foram lidas. Imprima as consoantes.
"""
consoantes = "bcdfghjklmnpqrstvwxyz"
def isConsoante(caractere):
return caractere in consoantes
MAX = 10
array = []
consoantesLidas = []
quantidadeconsoantes = 0
for i in range(MAX):
car... | true |
fc3fb2d4ebc158cd5372f48b46d598e4cd25e589 | e2crawfo/hrr-scaling | /hrr_scaling/extractor.py | UTF-8 | 6,516 | 2.8125 | 3 | [] | no_license | from hrr_scaling.tools.hrr import HRR
import heapq
import random
import collections
import numpy as np
class Extractor(object):
# the associative memory maps from index_vectors to stored_vectors
# index_vectors and stored_vectors must both be OrderedDicts whose values
# are vectors
def __init__(self... | true |
5e8b4b3b875c345b4ed8239760972811f0d88520 | gistable/gistable | /all-gists/247844/snippet.py | UTF-8 | 4,352 | 2.765625 | 3 | [
"MIT"
] | permissive | # post_commit and post_rollback transaction signals for Django with monkey patching
# Author Grégoire Cachet <gregoire.cachet@gmail.com>
# http://gist.github.com/247844
#
# Usage:
# You have to make sure to load this before you use signals.
# For example, create utils/__init__.py and then utils/transaction.py contenin... | true |
d52aa65b3d226a1c1386c251a56c8707f5be5c5a | pda-gb/hw_GB | /notCSharp/test5.py | WINDOWS-1251 | 723 | 3.609375 | 4 | [] | no_license | ## 6 . .1
# -1: ( ).
# ( ).
# :
# * while;
# * for.
# ...
numb = list(input(' ;;ign!;'))
i = 0
while i < len(numb):
strNumb = numb[i]
print(': ', strNumb)
i += 1 | true |
115bc0b84ef722eaa150fcd58e9c5ad71fa0c10a | willguxy/bitmax-python | /bitmax/websocket_client.py | UTF-8 | 3,945 | 2.71875 | 3 | [] | no_license | import json
import time
from pprint import pprint
from threading import Thread
from websocket import create_connection
from os.path import join as path_join
from . import AuthenticatedClient
from .utils import *
class WebSocketClient(AuthenticatedClient):
def __init__(self, symbol, ws_url, api_key=None, secret=No... | true |
850c8cae9815280c3594ea6eea2fe06bb62c851f | jana-choi/PythonCodingTest | /6.StringManipulation/1.valid-palindrome/1_list.py | UTF-8 | 450 | 3.921875 | 4 | [] | no_license | def isPalindrome(s: str) -> bool:
strs = []
for char in s:
if char.isalnum():
strs.append(char.lower())
# 팰린드롬 여부 판별
while len(strs) > 1:
if strs.pop(0) != strs.pop():
return False
return True
if __name__ == "__main__":
# s = input()
# prin... | true |
142fb423afa80aee460932e61b0f8b9f0a458138 | Alekseybykov126/tvz | /test_case_2_2_8.py | UTF-8 | 1,702 | 2.609375 | 3 | [] | no_license | from .page import *
time.sleep(2)
def case_2_2_8(self, full_screen):
self.page.loger('\n Запуск Тест кейс № 2_2_8 tvweb_new-2_2_8: Проверка фильтров поиска на странице Бесплатно(Бесплатно)')
time.sleep(1)
self.page.click_f('Клик_Бесплатно', 35)
time.sleep(4)
self.driver.find_element_by_xpath('.... | true |
3d4596c17f47c9538eab9b221b6a56e8d5022e6d | PeterEFrancis/scrabble-squares | /trie.py | UTF-8 | 1,526 | 3.59375 | 4 | [] | no_license | class Trie:
def __init__(self):
self.leaves = {}
self.leaf = False
def push(self, *words):
for word in words:
l = word[0]
if l not in self.leaves:
self.leaves[l] = Trie()
if len(word) > 1:
self.leaves[l].pus... | true |
400fe39e854a59c4c86471db7299d174e67a0f81 | therj/neosphere-py | /day_05/classs/listM.py | UTF-8 | 465 | 3.578125 | 4 | [] | no_license | x = [1, [2, [8, 9], 3], "Abc"]
print(x[1][1][0])
# test = list(1, 2, 3)
x.append("NewVal")
print(x)
x.extend([1, 2, 3])
week = ["Mon", "Tue", "Wed", "Thu", "Fri"]
weekends = ["Sat", "Sun"]
week.extend(weekends)
print(week)
print(x)
x.insert(1, "Ok")
print(x)
x.remove("Ok")
x.pop()
print(x)
x.pop(2)
print(x)
x.ap... | true |
85a17be16a1b63aa868094f3bfcb1aa4433bc3be | FromSaffronCity/computer-security-sessional | /port-scanner/src/os_fingerprinting.py | UTF-8 | 1,363 | 2.90625 | 3 | [] | no_license | # reference: https://www.tutorialspoint.com/python/python_command_line_arguments.htm
import sys
from scapy.all import *
from scapy.layers.inet import IP, ICMP
print('\n./{}: OS Fingerprinting ({})...\n'.format(sys.argv[0], sys.argv[1]))
# crafting packet & carrying out passive os fingerprinting via icmp echo/ping me... | true |
586b494282b11bf8acc8f8579de8f7b8cd4a8f97 | practicewitharjya/wayToPython | /Day 8/splFuncTut1.py | UTF-8 | 128 | 3.40625 | 3 | [] | no_license | num = 10
def sum(a, b):
print("The sum is",a+b)
print(__name__)
if __name__ == "__main__":
sum(10, 20)
print(num) | true |
4ddf371f6c23d82a000cdf037e187a8670944faf | shotahorii/bareml | /tests/test_linear_regression.py | UTF-8 | 2,604 | 2.796875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression as SklLinearRegression
from sklearn.linear_model import Ridge
import sys
sys.path.append('../')
from bareml.machinelearning.supervised import LinearRegression, RidgeRegression
from bareml.... | true |
7eb04e6b601b0f85718835dec2694063d7a69794 | nirjarigandhi/Sokoban-Probability-Agents | /game_trees/evaluation_functions.py | UTF-8 | 1,810 | 3.734375 | 4 | [] | no_license | from state import *
# Here you will implement evaluation functions. Recall that weighing components of your
# evaluation differently can have positive effects on performance. For example, you could
# have your evaluation prioritize running away from opposing agents instead of activiating
# switches. Also remember that... | true |
e1d94cbff336559b10827c7c1616e5b080f244b3 | aayush-1/Optimization | /Diet_Problem.py | UTF-8 | 771 | 3.28125 | 3 | [] | no_license | #Code by GVV Sharma,
#Jan 13, 2020
#Released under GNU GPL
#Solving a quadratic program using cvx
from cvxpy import *
import numpy as np
import matplotlib.pyplot as plt
#Line parameters
n = np.array([1,2]).reshape(2,-1)
P = np.array([2,1]).reshape(2,-1)
a=np.array([50,70]).reshape(2,-1)
x = Variable((2,1))... | true |
b8c66376b696d87f0891a355722deb9f7ef5bd51 | KevinAS28/Python-Training | /solo3.py | UTF-8 | 383 | 3.421875 | 3 | [] | no_license | #!/usr/bin/python
#integers(tau dah)(1)
oke = "2" + "3" #ini dah biasa
print oke
lagi = int("2")+int("3")
print lagi
#float dan input gabungan (2)
okejadi = (input("angka dong:"))+(input("angka lagi dong:"))
print okejadi
#end (2)
#float lagi
okejadi = float(input("angka dong yg float:"))+float(input("angka... | true |
815dd1715c7b3779f9c2924192f20986564e3f1a | jmbjones/zendesk-loc-scripts | /wp_initial_handoff/map_forums.py | UTF-8 | 2,074 | 2.578125 | 3 | [] | no_license | import sqlite3
import json
import requests
subdomain = 'your_subdomain' # setting
email = 'your_email' # setting
password = 'your_zd_password' # setting
session = requests.Session()
session.auth = (email, password)
session.headers = {'Content-Type': 'application/json'}
# ... | true |
860ebfa7d09a00da9b206e35c73ee610f5ad3dfa | yareddada/Data-Mining | /3/Scatter Plot.py | UTF-8 | 404 | 2.984375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
import re
type = []
legs = []
temp = ""
for line in open('zoo.data').readlines():
temp = line
a = re.findall('\d+', temp)
type.append(int(a[16]))
legs.append(int(a[12]))
x = type
y = legs
plt.title("Types of Animals have ho... | true |
91db3115cfb829e46af139af9a4ceb9a32a7d8d8 | seongmin-mun/PhD_dissertation | /Python/PPMI-SVD/Code/ModelTraining/RecognitionSystem.py | UTF-8 | 848 | 2.859375 | 3 | [] | no_license | class Recognition_System:
def setdata(self, windowsize, postposition, similarity_route):
self.windowsize = windowsize
self.postposition = postposition
self.similarity_route = similarity_route
def Recognition_Processing(self):
# install packages
import numpy as np
... | true |
8687bc9e08ef1d5e9f0b7522c411272292bbed2d | Mrsteveson/Review | /coaching_sessions/wildcard_matching/wildcard_match.py | UTF-8 | 6,941 | 3.421875 | 3 | [
"MIT"
] | permissive | class Solution:
def isMatch(self, s: str, p: str)-> bool:
# use a dynamic programming approach
# think of DP as recursion that is augmented with caching
cache = {}
def recurse(s, p):
# first just think of this with plain old recursion
# what are our... | true |
63b4f9babcf746a6cde1bbaa177096dc12162b83 | mikejt33/Algorithm_examples | /Numerical Optimization Problems/fourth_part2.py | UTF-8 | 526 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 30 15:29:13 2017
@author: Mike
"""
import numpy as np
import matplotlib.pyplot as plt
def first(x):
return (np.cos(x))
def second(p):
return (np.cos(p)-np.sin(p)*p-0.5*np.cos(p)*p**2+(1/6)*np.sin(p)*p**3)
x = np.linspace(-np.pi, np.pi, 256... | true |
27110f02f5c9a28073948e6cb38e2dd9bb420112 | luis-daniel-rico-apaez-2017631321/Compiladores2021B | /Practicas/ASDR/asdr.py | UTF-8 | 738 | 3.734375 | 4 | [] | no_license | #A -> aBa
#B -> bAb
#B -> a
def evaluar(cadena):
i = 0
def consumir(x):
nonlocal i
if(cadena[i] == x):
i += 1
else:
exit()
def A():
consumir('a')
B()
consumir('a')
def B():
nonlocal i
if(cade... | true |