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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d78586e2b5684c7eae8df87da8c1dbd60e7645eb | Python | Unix-Code/pygeocodio | /tests/test_data.py | UTF-8 | 6,040 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_geocodio
----------------------------------
Tests for `geocodio.data` module.
"""
import json
import os
import unittest
from geocodio.data import Address
from geocodio.data import Location
from geocodio.data import LocationCollection
class TestDataTypes(unitt... | true |
3fea4d6ab04e3e03eb622b4a9920c9bff44fb2d9 | Python | lsl980628/DMNN | /utils.py | UTF-8 | 7,851 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 25 16:01:32 2019
@author: xxw
"""
import numpy as np
import pandas as pd
#%%
def minmaxscaler(data):
'''
Normalized function
data: input data
'''
min = np.amin(data)
max = np.amax(data)
return 10*(data-min)/(max-min)
#%%
def seg_new_data(d... | true |
7732639a7c95f4d045c3f52a0d097ecfeca88580 | Python | g33kroid/Spector | /loading.py | UTF-8 | 388 | 2.828125 | 3 | [] | no_license | from __future__ import print_function
import sys
import time
from pyspin.spin import Spin5, Spinner
def loading():
# Choose a spin style.
spin = Spinner(Spin5)
print("Loading All Modules, Please wait ...")
# Spin it now.
for i in range(50):
print(u"\r{0}".format(spin.next()), end="")
... | true |
b2d62958773f6b6dc5844ba5565782dc90fbbed4 | Python | sariya/macpro_server | /rdp_core_data/filtering_seqs/find_Ns.py | UTF-8 | 1,843 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = "Sanjeev Sariya"
__date__= "23 August 2016"
__maintainer__= "Sanjeev Sariya"
__status__= "development"
long_description= """
Find sequence identifiers which have Ns in them
How many Ns
Max Ns
Minimum Ns
"""
import sys, os, re, argparse,glob
import subprocess as sp
from Bio impo... | true |
fc1564d0ac84ad1dd24f357613eb0e899ee82442 | Python | massi92/DIP-Project_MGFF | /Project_KPCat/preprocess.py | UTF-8 | 1,278 | 2.828125 | 3 | [] | no_license | import numpy as np
import cv2
import os
class Preprocess(object):
""" Classe con operazioni di preprocessing su immagini """
def adaHistEq(self,img):
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
cl1 = clahe.apply(img)
return cl1
def removeNoise(self,img):
kernel = np.ones((5,5),np.float32)/... | true |
b2285ea6c224c4c20fada46fb3b51cf0ad411d04 | Python | lldhliu/ZolarPushService | /app/forms/user.py | UTF-8 | 611 | 2.828125 | 3 | [] | no_license | from wtforms import PasswordField, Form, StringField
from wtforms.validators import DataRequired, Regexp, Length
class LoginForm(Form):
phone = StringField(validators=[Regexp(r'1[85347]\d{9}', message='手机号码格式不正确')])
password = PasswordField('密码', validators=[
Regexp(r'^[a-zA-Z0-9][a-zA-Z0-9_]{5, 15}$... | true |
3daf0d2595f9b45377669b30968d658383a7cae4 | Python | aoloe/py-zahlen-und-codes | /main.py | UTF-8 | 3,196 | 2.640625 | 3 | [
"MIT"
] | permissive | import zahlen_code
import os
from tkinter import Tk, Button, Label, filedialog
print()
def codes_clicked(ignore = None):
# print(os.environ)
if 'PWD' in os.environ:
initialdir = os.environ['PWD']
elif 'HOME' in os.environ:
initialdir = os.environ['HOME']
# TODO: there does not seem to ... | true |
58a9407aeca076cca34d864b0c15258a16c2c2a5 | Python | gschen/where2go-python-test | /1906101103王自强/蓝桥杯测试/5.py | UTF-8 | 939 | 3.609375 | 4 | [] | no_license | '''标题:书号验证
2004年起,国际ISBN中心出版了《13位国际标准书号指南》。
原有10位书号前加978作为商品分类标识;校验规则也改变。
校验位的加权算法与10位ISBN的算法不同,具体算法是:
用1分别乘ISBN的前12位中的奇数位(从左边开始数起),用3乘以偶数位,乘积之和以10为模,10与模值的差值再对10取模(即取个位的数字)即可得到校验位的值,其值范围应该为0~9。
输入:978-7-301-04815-3
输出:true
解释:该ISBN的第13位校验和是3,结果计算正确,返回true。
输入:978-7-115-38821-5
输出:false
解释:该ISBN的第13位校验和是6,结果计算错误,返回f... | true |
5f255941decc6078669b0aa684e0e26142107b80 | Python | EvanWheeler99/kochSnowflake | /kochSnowflake.py | UTF-8 | 938 | 3.203125 | 3 | [] | no_license | import turtle
window = turtle.Screen()
t = turtle.Turtle()
t.speed = 0
t.hideturtle()
t.pu()
t.goto(0,200)
t.pd()
t.color('green')
def koch (t, size):
if size <= 10:
t.forward(size)
else:
for angle in [60,-120,60,0]:
koch(t, size / 3)
t.left(angle)
def snowflake(t,size):
for i in... | true |
045fb6632d1929c7c105174d8d0bc59ebf92e00f | Python | nvaccess/wxPython | /wxPython/samples/wxPIA_book/Chapter-05/generictable.py | UTF-8 | 837 | 2.921875 | 3 | [] | no_license | import wx
import wx.grid
class GenericTable(wx.grid.PyGridTableBase):
def __init__(self, data, rowLabels=None, colLabels=None):
wx.grid.PyGridTableBase.__init__(self)
self.data = data
self.rowLabels = rowLabels
self.colLabels = colLabels
def GetNumberRows(s... | true |
e0d540e04ca8ffbcf4e33dba399e90b9597e252f | Python | victoriaogomes/Unicorn.io | /lexical_analyzer/token_list.py | UTF-8 | 2,290 | 3.265625 | 3 | [] | no_license | import operator
from lexical_analyzer import tokens
# Classe utilizada para a manipulação da lista de tokens que é resultado da análise léxica
# e dos erros gerados pela análise sintática
class TokenList:
def __init__(self):
# Método utilizado para inicializar os atributos presentes nesta classe
... | true |
76ef6980e896b01603461f83c9f660bd2d271825 | Python | vitoriabf/FC-Python | /Lista 1/Ex17.py | UTF-8 | 959 | 3.953125 | 4 | [] | no_license | '''Uma certa firma fez uma pesquisa para saber se as pessoas gostaram ou não de um
novo produto lançado no mercado. Para isso, forneceu o sexo do entrevistado e sua
resposta (sim ou não). Sabendo-se que foram entrevistadas 2.000 pessoas, crie um
algoritmo que calcule e escreva:
a) o número de pessoas que responderam s... | true |
fe8ca87c58774693640484c1e1d13f91e2ae9436 | Python | hamburgerguy/insight | /quantum_miner_v4.py | UTF-8 | 5,018 | 3.078125 | 3 | [] | no_license | #import libraries
import datetime
import operator
import hashlib
import math
from math import sqrt, pi
from collections import OrderedDict
from statistics import mean
from pylab import plot, ylim, xlim, show, xlabel, ylabel, grid, legend
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
#define li... | true |
26143ad1ce3407ea0c91b2d871f390bc58c313d9 | Python | GuanHsu/Python_Next_Level | /Python-Beyond the Basic/labs/py3/generators/sqare_hard_way.py | UTF-8 | 444 | 3.78125 | 4 | [] | no_license | '''
This is the hard way to create an efficient of iterator
'''
class Squares:
def __init__(self, max_root):
self.max_root = max_root
self.root = 0
def __iter__(self):
return self
def __next__(self):
if self.root == self.max_root:
raise StopIteration
... | true |
289aeb72204722dba7cb1f31b45726db321b14c2 | Python | jason12360/AID1803 | /pbase/day04/practise/unicode.py | UTF-8 | 319 | 3.984375 | 4 | [] | no_license | # 输入一个Unicode的开始值 用变量begin绑定
# 输入一个。。。。。结束值,用变量stop绑定
# 打印开始值至结束值之间的所有对应文字
begin = int(input('请输入开始值: '))
stop = int(input('请输入结束值: '))
for i in range(begin,stop+1):
print(chr(i),end = ' ') | true |
0e29c265b90fa6052fe3b5c45dd9469cfad4226e | Python | kampaitees/Ethical-Hacking-Basic-using-Socket-Programming | /Basic programs of Socket Programming/Chat application/client.py | UTF-8 | 674 | 3.296875 | 3 | [
"MIT"
] | permissive | import sys
import socket
#creating a socket having IP version as IPv4 and TCP/IP as working protocol in Transport layer
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#Initilizing host to out IP address and port number as 9999
host = '10.53.125.187'
port = 9999
count = 0
#connecting to the socket by... | true |
3b94bfd9bab6479ca3a0009b7c5786d9369fd491 | Python | quyencao/TensorFlow-MNIST | /MNISTPrediction.py | UTF-8 | 7,317 | 2.640625 | 3 | [] | no_license | import numpy as np
import os
from PIL import Image, ImageFilter
from random import randint
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
# Utility packages
class TFUtils:
def __init__(self):
return
# Xavier initialization
@staticmethod
def xavier_init(shape, name='', uniform=True... | true |
ee5cc9c811e9ff4d4e6641520b953abe9e7d625e | Python | ichise-lab/uwkgm | /api/dorest/dorest/libs/django/decorators/permissions.py | UTF-8 | 3,550 | 3.109375 | 3 | [
"BSD-3-Clause"
] | permissive | """Extensions to Django's permission validation mechanism
The Dorest project
:copyright: (c) 2020 Ichise Laboratory at NII & AIST
:author: Rungsiman Nararatwong
"""
from django.utils.translation import ugettext_lazy as _
from rest_framework.views import APIView
from rest_framework.request import Request
from rest_fr... | true |
5da6ac66b7af26fc817ce3f3d21a9ff51f460bdd | Python | Aasthaengg/IBMdataset | /Python_codes/p03304/s620661258.py | UTF-8 | 264 | 2.625 | 3 | [] | no_license | import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)
n, m, d = map(int, input().split())
if d == 0:
ans = (m - 1) / n
else:
ans = 2 * (n - d) * (m - 1) / (n * n)
print(ans)
| true |
e7e0c5aef7a6acc85dbd1cde028deaa6ae0b69f1 | Python | carolinetm82/AchatVoiture | /app.py | UTF-8 | 1,257 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
df = pd.read_csv('carData... | true |
84e9864e6da87c13ffba48ced675040afda80d6f | Python | target/setupcfg2nix | /setupcfg2nix/cli.py | UTF-8 | 1,355 | 2.578125 | 3 | [
"MIT"
] | permissive | from setuptools.config import read_configuration
from pkg_resources import Requirement
import argparse
import setuptools
requires_sets = [ "install_requires", "setup_requires", "tests_require" ]
def main():
"""Parses a setup.cfg file and prints a nix representation to stdout.
The path to the setup.cfg is par... | true |
07e777b6f3b0381a40dda671657f4a1d968a0eb8 | Python | inteljack/EL6183-Digital-Signal-Processing-Lab-2015-Fall | /project/Examples/Examples/PP2E/Internet/Ftp/getpython.py | UTF-8 | 1,455 | 2.734375 | 3 | [] | no_license | #!/usr/local/bin/python
###############################################################
# A Python script to download and build Python's source code.
# Uses ftplib, the ftp protocol handler which uses sockets.
# Ftp runs on 2 sockets (one for data, one for control--on
# ports 20 and 21) and imposes message text formats... | true |
1990b0540637244e17e13b704adf865abd5b0062 | Python | GianlucaPal/Python_bible | /cinema.py | UTF-8 | 741 | 3.90625 | 4 | [] | no_license | films = {
'Finding Dory':[3,5],
'Bourne':[18,5],
'Tarzan':[15,5],
'Ghost Busters':[12,5]
}
while True:
choice = input('What film would you like to watch?:').strip().title()
if choice in films:
age = int(input('How old are you?:').strip())
#check users ag... | true |
dc5dcb064ce3332a6dfe87ba9e87af55373cda5a | Python | kvanderwijst/New-damage-curves-and-multi-model-analysis-suggest-lower-optimal-temperature | /utils/colorutils.py | UTF-8 | 1,538 | 2.734375 | 3 | [] | no_license | """
Functions to transform between RGB, HEX and HLS and to lighten/darken a color
"""
import colorsys
import numpy as np
# Bugfix for Plotly default export size
import plotly.io as pio
pio.kaleido.scope.default_width = None
pio.kaleido.scope.default_height = None
colors_PBL = [
"#00AEEF",
"#808D1D",
"#B6... | true |
ce4f7aad1d46c77492313b7afc36a3cf71919db3 | Python | GitMajonerGT/MoreZut | /Python/PTD/ptd_lab6.py | UTF-8 | 1,880 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 17 15:09:55 2019
@author: Paweł
"""
import numpy as np
from operator import xor
def haminga(bity):
S=0
wyjscie=[0,0,0,0,0,0,0]
if(len(bity)==4):
print('Sygnał wejsciowy: ',bity)
wyjscie[0]=bity[0]... | true |
22102e50e83e6ba485044cb8fbb94fa1da2827f7 | Python | kkyoung28/Programming-Python- | /Function.py | UTF-8 | 1,825 | 3.875 | 4 | [] | no_license | numbers = [1, 5, -2, 0, 6]
print(numbers, "중 가장 큰 값은", max(numbers))
print(numbers, "중 가장 작은 값은", min(numbers))
print(numbers, "합계는", sum(numbers))
print("2의 10승은", pow(2,10))
pi=3.14152
print(pi, "의 소수점 1자리 반올림은", round(pi))
print(pi, "의 소수점 1자리 반올림은", round(pi,0))
print(pi, "의 소수점 2자리 반올림은", round(pi,1))
print(pi, "... | true |
6ed278d6363b386057bcdab01d3e44a3d0bdbdec | Python | pandas-dev/pandas | /pandas/tests/copy_view/test_core_functionalities.py | UTF-8 | 3,185 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import pytest
from pandas import DataFrame
import pandas._testing as tm
from pandas.tests.copy_view.util import get_array
def test_assigning_to_same_variable_removes_references(using_copy_on_write):
df = DataFrame({"a": [1, 2, 3]})
df = df.reset_index()
if using_copy_on_write:
... | true |
39686357e96e5d7a581e1ca2f6438c5f5db2d947 | Python | markosolopenko/python | /oop/numbers.py | UTF-8 | 712 | 3.828125 | 4 | [] | no_license |
class Numbers:
MULTIPLIER = 5
def __init__(self, x, y):
self.x = x
self.y = y
def add(self):
return self.x + self.y
@classmethod
def multiply(cls, a):
return cls.MULTIPLIER * a
@staticmethod
def subtract(b, c):
return b - c
@property
de... | true |
10b5da08ae1099b625faa71cce6e9049db59fed2 | Python | dkoh12/gamma | /google/minmax.py | UTF-8 | 1,028 | 3.65625 | 4 | [] | no_license | def maxsearch(lst):
mid = int(len(lst)/2)
#print(mid, lst[mid], lst)
if len(lst) == 2:
return max(lst)
if lst[mid] > lst[mid-1] and lst[mid] > lst[mid+1]:
return lst[mid]
#ascending
elif lst[mid] > lst[mid-1] and lst[mid] < lst[mid+1]:
return maxsearch(lst[mid:])
#descending
elif lst[mid] < lst[mid-1] and... | true |
9d5bf72dc375e1bfa673d77e7dfbf6ee73cbcc00 | Python | DARRENSKY/COMP9021 | /assignment/assignment_1/highest_scoring_word.py | UTF-8 | 2,491 | 3.359375 | 3 | [] | no_license | from itertools import combinations, permutations
dic = {'a':2, 'b':5, 'c':4, 'd':4, 'e':1, 'f':6, 'g':5, 'h':5, 'i':1, 'j':7,\
'k':6, 'l':3, 'm':5, 'n':2, 'o':3, 'p':5, 'q':7, 'r':2, 's':1, 't':2,\
'u':4, 'v':6, 'w':6, 'x':7, 'y':5, 'z':7}
#list(permutations([1, 2, 3], 2))
def get_score(word):
sco... | true |
2077f78de21fcc16d19289bcf1852aef7c9a6328 | Python | Rolemodel01291/HackerRank-Python-Solutions | /hackerrank_minion_game.py | UTF-8 | 3,015 | 4.59375 | 5 | [] | no_license | """
HACKERRANK THE MINION GAME
URL: https://www.hackerrank.com/challenges/the-minion-game/problem
TASK: Kevin and Stuart want to play the 'The Minion Game'.
RULES:
1) Both players are given the same string, S
2) Both players have to make substrings using the let... | true |
e23943b29f7605f3b8d1260060fd8d2600130ce2 | Python | Kalantri007/OOP | /class2.py | UTF-8 | 196 | 3.359375 | 3 | [] | no_license | class room:
student_count = 10
def marks(self):
a = 5
b = 6
c = 7
print(room.student_count)
Teacher = room()
read = Teacher.marks()
print(read.b) | true |
8ce08a9ac0f8b9b1c1641172cb37a9a2d1edc86c | Python | mirajaber1990/datasciencecoursera | /convert_json.py | UTF-8 | 595 | 2.84375 | 3 | [] | no_license | def convert_json(json_data):
import json
from pprint import pprint
print ('json data:\n')
pprint(json_data)
# Changing a value in the json
json_data["blocks"][0]["messages"][0]["0x420"]["signals"]["FUEL_FLOW"]["value"] = 0.9999999999
print ('\n\nChanged File: \n')
pprint (json_data)
# outputting json to file... | true |
315c2d4c592918876c5410064a883d174624b32e | Python | kokoaespol/kokoa-calendario | /kokoaCalendar/webapp/models.py | UTF-8 | 2,613 | 2.5625 | 3 | [] | no_license | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
'''
Estudiante (username[first_name], -PK- matricula[last_name]) using User from django.contrib.auth.models
Materias Disponibles (ForeignKey[Estudiante], codigo, nombre, paralelos[String])
Curso (codigo_materia, paralel... | true |
7198e5ed874fb806bfae7418bebebbb5f794947d | Python | williamqin123/python-sudoku | /Clash-Royale-Scripts/paper-extender.py | UTF-8 | 726 | 3.484375 | 3 | [] | no_license | import random
sentences = ["hemophilia is a disease", "hemophilia could potentially be deadly", "hemophilia is not a common disease", "hemophilia is genetic"]
fillers = ["the previous fact clearly indicates this statement's credibility", "many people commonly believe the following sentence to be true"]
befores = ["A... | true |
7ab20d8f270e82860b95a34175263e6ded9723f4 | Python | Runki2018/CvPytorch | /src/optimizers/__init__.py | UTF-8 | 3,534 | 2.515625 | 3 | [
"MIT"
] | permissive | # !/usr/bin/env python
# -- coding: utf-8 --
# @Time : 2021/2/5 14:16
# @Author : liumin
# @File : __init__.py
import torch
import torch.nn as nn
from copy import deepcopy
from torch.optim import SGD, Adam, AdamW, RMSprop, Adadelta
from .radam import RAdam
from .ranger import Ranger
from .adabelief import Ad... | true |
2b6d06d84888e1dcd59803556407ec0df15e0e64 | Python | syurskyi/Algorithms_and_Data_Structure | /Cracking Coding Interviews - Mastering Algorithms/template/Section 2 Arrays and Strings/unique-characters.py | UTF-8 | 470 | 3.515625 | 4 | [] | no_license | # # Implement an algorithm to determine if a string has all unique characters.
#
# # "abc" -> True
# # "" -> True
# # "aabc" -> False
#
# # Brute Force - O(n^2)
# # Sorting - O(nlogn + n) -> O(nlogn)
# # Hashset - O(n)
#
# ___ unique_characters word
# visited_chars _ s..
#
# ___ i __ r.. l.. ?
# letter _ ? ?
#
# ... | true |
7c9975696e0fc8eaa3401cfb9f94324d554ad39a | Python | qrfaction/leetcode | /leetcode/LongestSubstringWithoutRepeatingCharacters_3.py | UTF-8 | 577 | 2.828125 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if len(s)==0:
return 0
prevIndex = {
s[0]:0
}
result = [1]
maxlen = 1
for i,c in enumerate(s[1:]):
last_res = result[-1]
if prevIndex.get(c,-1) == -1:
... | true |
3b975712747b4b74097d08124e5b7cf741b8eb67 | Python | laszlothebrave/Unshrederator2 | /Unshrederator2/ArrayManipulation.py | UTF-8 | 314 | 2.65625 | 3 | [] | no_license | from PIL import Image
from PIL.ImageShow import show
from cv2.cv2 import imwrite, imread
def show_from_array(array):
img = Image.fromarray(array, 'RGB')
show(img)
def make_image_from_array(matrix):
image = Image.fromarray(matrix, 'RGB')
imwrite('temp.png', matrix)
return imread('temp.png')
| true |
ddcd6d3fc5ed9477013c9d8ee759f2619cddfa93 | Python | nekonbu72/easyfox_server | /2to3/modified/marionette_driver/transport.py | UTF-8 | 9,499 | 2.8125 | 3 | [] | no_license | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import socket
import time
class SocketTimeout(object):
def __init__(self, socket, timeout):
se... | true |
d3a86e2c7e76feb986295aa138faf3b39c2cb8aa | Python | ozerelkerem/Project-Eular-Solutions | /python/problem25.py | UTF-8 | 668 | 4.1875 | 4 | [] | no_license | print("""
1000-digit Fibonacci number
Problem 25
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first te... | true |
16e3632fd024ba68cc8d3e3fb2d38ce83594c398 | Python | kavyakammaripalle/Advance-Python | /AdvancePython_Day9.py | UTF-8 | 739 | 3.875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
#syntax for dataframe
# pandas.DataFrame(data,index,columns,dtype,copy)
#creating and empty datafarame
import pandas as pd
a=pd.DataFrame()
print(a)
# In[5]:
#creating dataframes with a list
data=[1,2,3,4,5,6,7]
d=pd.DataFrame(data)
print(d)
# In[17]:
x=[['kavya... | true |
f5dec8cb61316d29f753687906f323f56ec194f2 | Python | THUsatlab/AD2021 | /ncmmsc2021_baseline_svm/train_ad.py | UTF-8 | 3,386 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/7/5
# @Author : guyu
import pandas as pd
import os
import numpy as np
from sklearn import svm
from sklearn.metrics import accuracy_score,f1_score, precision_score, recall_score
from sklearn.model_selection import train_test_split
from sklearn.p... | true |
713722f4059b611d3e1dae0160c20cb7809debed | Python | nocibambi/ds-practice | /CS fundamentals/Random Walk with Python/2D_random_walk.py | UTF-8 | 734 | 3.71875 | 4 | [
"MIT"
] | permissive | import numpy as np
import pylab
import random
# number of steps
n = 100000
# two arrays containing the x and y coordinates
x = np.zeros(n)
y = np.zeros(n)
# filling coordinates with random variables
for i in range(1, n):
val = random.randint(1, 4)
if val == 1:
x[i] = x[i - 1] + 1
... | true |
2b5b08a884765f29f946a6f68cb33d203f840b8e | Python | lo-tp/leetcode | /dp/689MaximumSumOf3Non-OverlappingSubarrays.py | UTF-8 | 1,161 | 2.796875 | 3 | [] | no_license | class Solution(object):
def maxSumOfThreeSubarrays(self, nums, k):
size = len(nums)
data = []
sum = 0
for i in xrange(0, k-1):
sum += nums[i]
for index, i in enumerate(nums[k-1: size]):
sum += i
data.append((index, sum))
sum -= ... | true |
366280feb26bc5a77ca54ed3e3007fbd99644708 | Python | qwerboo/sec | /main_0810.py | UTF-8 | 4,684 | 2.96875 | 3 | [] | no_license | """."""
import re
import w3lib.html
import requests
import nltk
import pandas as pd
def clean(rawdata):
r"""清洗原文.
去除数字字符占比超过%25的tbale
去除所有tag
html entity 转义
替换\xa0
"""
while True:
# table = re.search('<table(?!.*<table).*?</table>', rawdata)
table = re.search('<table.*?</t... | true |
ab09dfa6714877f46c0549c58bbeaff05316bd7b | Python | alirezazahiri/WorkShop-Lecture | /essentials/strings.py | UTF-8 | 1,004 | 4.65625 | 5 | [] | no_license | #TODO: make title
# """
# given a string, you should make it title;
# 1 < len(string) < 1000
# example :
# helLoWoRLd -> Helloworld
# """
print('non-pythonic way : ')
string = 'helLoWoRLd' # input()
string = list(string)
string[0] = string[0].upper()
for i in range(1, len(string)):
... | true |
98d5da4d3fd96d3fbc065e0fde2fdf792baf5a07 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2812/60753/234751.py | UTF-8 | 257 | 2.921875 | 3 | [] | no_license | import sys
import re
s=sys.stdin.read()
digits=re.findall(r"\d+",s)
listline= [int(e) for e in digits ]
del(listline[0])
filter=list(set(listline))
ways=len(filter)
for i in range(len(filter)):
if filter[i]==0:
ways-=1
break
print(ways) | true |
e38bc85b7d4ad6a888917203c03ff17a96cd6765 | Python | isjeffcom/coronavirusDataGlobal | /init.py | UTF-8 | 5,878 | 2.75 | 3 | [
"MIT"
] | permissive | '''
Create By JeffWu
https://isjeff.com
IMPORT ALL DATA INTO DATABASE BY MAIN()
CACHE ALL DATA TO JSON BY CACHE()
PLEASE CLEAN DATA FOLDER AND CLEAN DATABASE BEFORE RUN THIS SCRIPT
FOR INIT ONLY
MAKE SURE YOU HAVE GIT CLONED AT ROOT https://github.com/CSSEGISandData/COVID-19
'''
imp... | true |
3bbb054d86280e44c98cc1ea8e9dfa8904fb50c0 | Python | jellis505/IMDB_Utilities | /IMDBUtilities.py | UTF-8 | 9,298 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
# Created by Joe Ellis
# Columbia University DVMM Lab
# Standard Libs
import os
import json
# Extended Libs
import argparse
from bs4 import BeautifulSoup
import requests
class IMDBUtils():
def __init__(self, imdb_id=False):
""" This function contains the initlialization for the
... | true |
bb6d21d7bf617db1f01184604cc84ce49609ed23 | Python | afilipch/nrlbio | /graphics/nontemplate_differential.py | UTF-8 | 2,706 | 2.625 | 3 | [] | no_license | # /usr/bin/python
'''Draws a plot of nontemplate addiction to miRNAs for wt versus ko'''
import sys
import argparse
from collections import defaultdict
import math
from pybedtools import BedTool
import matplotlib.pyplot as plt
import numpy as np
from nrlbio.pyplot_extension import remove_top_left_boundaries
parser ... | true |
6155f2c5709bb1d62bcd788067bc664b7586c470 | Python | Aasthaengg/IBMdataset | /Python_codes/p02577/s555919261.py | UTF-8 | 80 | 2.859375 | 3 | [] | no_license | N = list(map(int,input()))
if(sum(N) % 9 == 0):
print("Yes")
else:
print("No") | true |
51b5de9096bdb80ec0674c108b54c380d9396a7b | Python | pfeffer90/lykkex-cli | /lykke/commands/services/lykkex_service.py | UTF-8 | 4,134 | 2.796875 | 3 | [] | no_license | import datetime
import logging as log
import lykkex
from lykke.commands.services.time_service import get_current_time
class LykkexService(object):
@staticmethod
def get_balance(api_key):
log.info("Retrieve current balance.")
time_stamp = get_current_time()
balance = lykkex.get_balanc... | true |
c63f8d5556fd41d46d6241eb1c800399c26aaff0 | Python | zahmdf/Materi_Python | /operasilogika.py | UTF-8 | 1,120 | 4.1875 | 4 | [] | no_license | # OPERASI LOGIKA ATAU BOOLEAN
# ada NOT, OR, AND, XOR
# NOT
print('====NOT====')
a = False
c = not a
print('Data a =',a)
print("NOT")
print('Data c =',c)
# OR (|) (jika salah satu nilai terpenuhi atau true, maka hasilnya = true)
print('====OR====')
a = False
b = False
c = a | b
print(a,'OR',b,'=',c)... | true |
76a536d9e532dc5842895a2f259f13067489c449 | Python | VisionAlex/odds-comparison | /odds/scrapers/tonybet.py | UTF-8 | 3,163 | 2.6875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
import time
options = Options()
option... | true |
c715019dc7e961c4c729c149d26b26a9628f37c1 | Python | ykpgkh/pythonReview | /data structures/linkedListsInfo.py | UTF-8 | 3,000 | 4.875 | 5 | [] | no_license | # Sources:
# https://realpython.com/linked-lists-python/
# https://www.tutorialspoint.com/python_data_structure/python_linked_lists.htm
# https://stackoverflow.com/questions/6256983/how-are-deques-in-python-implemented-and-when-are-they-worse-than-lists
# This is an overview on what linked lists are and how to impleme... | true |
f40612dd242e31452a851dc9e0a58a60d2f14ef3 | Python | iwotastic/srt4_website_bot | /bot_session.py | UTF-8 | 5,125 | 2.796875 | 3 | [] | no_license | from math import sin, pi
from selenium.webdriver.common.by import By
from selenium.webdriver import ActionChains
from utils import rand_email, rand_text, move_mouse_based_on_func
from random import random, randrange, shuffle, uniform
from rich.progress import track
import time
class SequentialBotSession:
def __init_... | true |
2785b77d63cdeb0c2e037f79c93dab12524aacaf | Python | urands/cp2020 | /server/datasets.py | UTF-8 | 2,340 | 2.828125 | 3 | [] | no_license | import pandas as pd
def load():
# LOAD POWER
power = pd.read_csv('./datasets/gen_and_use7.csv', parse_dates=['M_DATE', 'M_DATE_DAY'])
power = power.drop(power[power.E_USE_FACT == 0].index).set_index('M_DATE')
power['DAY'] = power.index.year * 1000 + power.index.dayofyear
power['M_DATE'] = power.in... | true |
b99a12ba7021422b2e46fb5549edc280d7c959e9 | Python | metsi/metsi.github.io | /examples/kod5.py | UTF-8 | 4,041 | 2.59375 | 3 | [
"MIT"
] | permissive | # ------------------------------------------------------------------------
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
clfs = {
'GNB': GaussianNB(),
'SVM': SVC(),
'kNN': KNeighbors... | true |
46d8207a84050087d0d0dec33c29cdbfa408e00b | Python | akash988/comprehension | /comprehensionmethod.py | UTF-8 | 666 | 4.15625 | 4 | [] | no_license | list=[]
a=int(input("HOW MANY ELEMENT YOU WANT TO PRINT IN THIS LIST\n"))
for i in range(a):
b=int(input(f"Enter your element you want to add in this list{i}\n"))
list.append(b)
print(list)
print("Enter your choice 1.list comprehension 2.set comprehension 3.dictionary comprehension")
ch=int(input(" "))
... | true |
a3b41dd7d8cb2069437739d782d4e4f5e0ca784d | Python | serapred/academy | /ffi/goldbach.py | UTF-8 | 2,026 | 4.3125 | 4 | [] | no_license |
"""
German mathematician Christian Goldbach (1690-1764) conjectured that every even number greater than 2 can be represented by the sum of two prime numbers. For example, 10 can be represented as 3+7 or 5+5.
Your job is to make the function return a list containing all unique possible representations of n in an increa... | true |
d4a712dee7d351e9b641bf97e212b964f4b2b116 | Python | PatrickWilke/ANN_RL | /FourInARow.py | UTF-8 | 3,384 | 3.125 | 3 | [] | no_license | import numpy as np
import ANN
class FourInARowBoard:
def __init__(self):
self.board = np.zeros((2, 6, 7), dtype=bool)
self.hights = np.zeros((7), dtype=int)
self.next_move = 0
self.number_of_moves = 0
def SiteIsOccupied(self, row, column):
return self.board[0][row][col... | true |
7feaca4a15326d6d61827278548da3b33fb8d9f3 | Python | TwilioDevEd/automated-survey-flask | /tests/parsers_tests.py | UTF-8 | 1,458 | 3.109375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import unittest
from automated_survey_flask import parsers
from automated_survey_flask.models import Question
class ParserTests(unittest.TestCase):
def setUp(self):
self.survey_as_json = '{"title": "TDD Survey", "questions": [\
{"body":"What is your name?", "type":"text"},\
... | true |
eefdec737e292792fc7480b8545e4e9ccb50a605 | Python | pythonistic/FixMp3 | /FixMp3.py | UTF-8 | 3,249 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import eyeD3
import os
import os.path
import shutil
def sanitize(s):
if s == None or len(s) == 0:
s = "Unknown"
s = s.strip()
s = s.replace('/', '_')
s = s.replace('"', '_')
s = s.replace("'", '_')
s = s.replace('*', '_')
s = s.replace('&', '_')
s = s.repl... | true |
94a6586b3f726d8070343c57ab198f2250f18dc5 | Python | GLAMOS/dataflow | /dataflow/DataReaders/VawFileReaders/VolumeChangeReader.py | UTF-8 | 7,423 | 2.8125 | 3 | [
"MIT"
] | permissive | '''
Created on 11.07.2018
@author: yvo
'''
import re
from dataflow.DataReaders.VawFileReaders.VawFileReader import VawFileReader
from dataflow.DataObjects.Exceptions.GlacierNotFoundError import GlacierNotFoundError
from dataflow.DataObjects.VolumeChange import VolumeChange
from dataflow.DataReaders.Exceptions.Invali... | true |
c06677c98c60b73a01bb9b4f71c978e45dddf31f | Python | Mortal/inlining | /example.py | UTF-8 | 544 | 2.859375 | 3 | [] | no_license | def foo(a, b, c, *d, **k):
dict(**k)
print(*d)
if c:
print(a, b)
if not c:
print(b, a)
if True:
print("if True")
if False:
print("if False")
elif a:
print("elif a")
if False:
print("if False")
elif True:
print("elif True")
e... | true |
616d59d1499ee0db79ea672bdcee367ecc975c47 | Python | miglesias91/dicenlosmedios | /test/test_eldestape.py | UTF-8 | 591 | 2.53125 | 3 | [
"MIT"
] | permissive | import unittest
import newspaper as np
from medios.diarios.eldestape import ElDestape
class TestElDestape(unittest.TestCase):
def test_entradas_feed(self):
ed = ElDestape()
url_fecha_titulo_categoria = ed.entradas_feed()
return len(url_fecha_titulo_categoria) == 50
def test_parsear_... | true |
04a58c0b63de090fd6337c89cd9a72260517a7b0 | Python | dlfosterii/python103-small | /print_a_square.py | UTF-8 | 219 | 4.15625 | 4 | [] | no_license | #Print a 5x5 square of * characters
#setup
side = 5
y = 0
#Code to make it work
while(y < side):
x = 0
while(x < side):
x = x + 1
print('*', end = ' ')
y = y + 1
print('')
#end | true |
0242c721ba9be4956f132e65f02269181f7035b8 | Python | qbitkit/qbitkit | /qbitkit/provider/leap/provider.py | UTF-8 | 1,926 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | from dwave.system import DWaveSampler as __DWSampler__
from dwave.system import DWaveCliqueSampler as __DWCSampler__
from dwave.system import LeapHybridSampler as __LHSampler__
from dwave.system import LeapHybridDQMSampler as __LHDQMSampler__
class Annealing:
def get_sampler(self=str('DWaveSampler'),
... | true |
32e1fe7df484dd37a4ddd7dc80d427b3f789ad41 | Python | maugryn/RollDice | /RollDice.py | UTF-8 | 252 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | #!-*- conding: utf8 -*-
import random
from pip._vendor.distlib.compat import raw_input
while True:
for x in range(1):
print(random.randint(1, 6))
resp = raw_input("Voce quer jogar novamente? s/n ")
if resp == 'n':
break
| true |
bf8944b72ab3ff0f93584bc907457977fa553c1e | Python | tremaru/pyiArduinoI2Cexpander | /pyiArduinoI2Cexpander/examples/reset.py | UTF-8 | 2,199 | 3.203125 | 3 | [
"MIT"
] | permissive | # Данный пример демонстрирует программную перезагрузку модуля.
# $ Строки со знаком $ являются необязательными.
from pyiArduinoI2Cexpander import * # Подключаем модуль для работы с расширителем выводов.
from time import sleep # Импортируем функцию ожидани... | true |
5b66ed95304dd717e850d3d3df784422430dfca5 | Python | leaxpm/piaPC | /autoNmap.py | UTF-8 | 1,025 | 2.71875 | 3 | [] | no_license | import logging
try:
import nmap
except:
logging.error("Falta la libreria nmap \n pip install python-nmap")
import requests
import socket
def publicIP():
"""
**PublicIP**
This Module find the public IP from the User
"""
req = requests.get("http://ifconfig.me")
retur... | true |
af6b2f72b14a7038804b97ceb5d0bea58dea01d9 | Python | benkeanna/pyladies | /08/ukol6moje.py | UTF-8 | 287 | 2.78125 | 3 | [] | no_license | zvirata = ['pes', 'kočka', 'králík','had', 'andulka']
nova_zvirata = []
for zvire in zvirata:
prvek = zvire[1:], zvire
nova_zvirata.append(prvek)
print(nova_zvirata)
nova_zvirata.sort()
zvirata = []
for klic, zvire in nova_zvirata:
zvirata.append(zvire)
print(zvirata)
| true |
cff4a94d7f50472ab68699e5e8654733546d28b6 | Python | tamirez3dco/ThingsMaker | /quest/explorer/explore/test.py | UTF-8 | 375 | 2.65625 | 3 | [] | no_license | def all_params_perms(params):
if len(params) <=1:
return map(lambda x: [x], params[0])
else:
all_perms = []
for v in params[0]:
for perm in all_params_perms(params[1:]):
np = [v] + perm
all_perms.append(np)
return all_perms
pp = all_p... | true |
e149c25bb220b072370b4dcbf260acb1c3eafbd3 | Python | d-nalbandian0329/Python | /gomi11.py | UTF-8 | 556 | 3 | 3 | [] | no_license | #! /usr/bin/python
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
xmin, xmax = -np.pi, np.pi
x = np.arange(xmin, xmax, 0.1)
y_sin = np.sin(x)
y_cos = np.cos(x)
# sin plot
plt.subplot(2, 1, 1)
plt.plot(x, y_sin)
plt.title("$\sin x$")
plt.xlim(xmin, xmax)
plt.ylim(-1.3, 1... | true |
f3f51cab352a7207a68b6c7b17ececf7ad8a7c04 | Python | Awawdi/IDvalidator | /IDvalidator.py | UTF-8 | 2,166 | 3.78125 | 4 | [] | no_license | MAX_NUMBER = 999999999
class IDIterator:
def __init__(self, id):
self._list_of_ids = []
self._starting_point = id
self._pointer = -1
self._id = int(id)
# self._id = '{:09d}'.format(id)
#self._id = int(str(id).zfill(9))
# for i in range(999... | true |
2e2bfdb98ff5d551a0320eb9c22dbeb34d9afb99 | Python | losnikitos/coursera | /course3/week4/bellman.py | UTF-8 | 2,173 | 3.453125 | 3 | [] | no_license | # python 3
inf = float("inf")
def read_graph():
n_vertices, n_edges = map(int, input().split())
edges = [map(int, input().split()) for _ in range(n_edges)]
return Graph(n_vertices, edges)
class Graph:
def __init__(self, n_vertices=0, edges=[]):
self.vertices = set(range(n_vertices))
... | true |
15d8b5cad319a16d72598937bcb3cc02632abd3c | Python | lsjsss/PythonClass | /PythonBookAdditional/第02章 Python序列/code/Stack.py | UTF-8 | 1,670 | 3.75 | 4 | [
"MIT"
] | permissive | '''
Author: Dong Fuguo
QQ: 306467355
Wmail: dongfuguo2005@126.com
Date: 2014-11-10, Updated on 2015-12-13
'''
class Stack:
def __init__(self, size = 10):
self._content = [] #使用列表存放栈的元素
self._size = size #初始栈大小
self._current = 0 #栈中元素个数初始化为0
... | true |
e65a4776cbbfe0a7d4567bbf4a9f3d8bdef37b3d | Python | LARC-CMU-SMU/fullmoon | /scripts/simulate_occupants.py | UTF-8 | 2,366 | 2.765625 | 3 | [] | no_license | import random
import time
from pprint import pprint
import json
from scripts.m_util import execute_sql_for_dict
OCCUPANCY_SQL= """INSERT INTO occupancy(timestamp, occupancy, cam_label, cubical_label, occupant_coordinates) VALUES (%s, %s, %s, %s, %s)"""
OCCUPANCY_CACHE_SQL = "INSERT INTO occupancy_cache(timestamp, occ... | true |
2963282f8427c8cbd078d0b5f1e3a216b33b2d7e | Python | storrealba09/citiy_mean | /puzzle.py | UTF-8 | 536 | 3.203125 | 3 | [] | no_license | #Import Libraries
import pandas as pd
import plotly.express as px
#Format floats on panda
pd.options.display.float_format = '${:,.2f}'.format
#Read and uppercase dataframe
df = pd.read_csv('Data+for+TreefortBnB+Puzzle.csv')
df['City'] = df['City'].str.upper()
#Group Dataframe by City and aggregate the price m... | true |
490fd095d9b0cd83f8412a852e23124e809685c1 | Python | ilkhem/market-report | /volume-index.py | UTF-8 | 14,843 | 2.859375 | 3 | [] | no_license | """
Script for calculating a 'volume-index' equal to the volume normalized by the spread i.e. the volume for a
constant spread of 1USD.
Data to extract from dumps:
from trade dumps: id,exchange,symbol,date,price,amount,sell (14698813,bf,btcusd,1451606422000,429.17,1.6817,false)
- price per minute: price of last t... | true |
091373057df3ad63001d3a0bbd8a522c224490fa | Python | ljanzen17/cmpt120janzen | /guessing-game.py | UTF-8 | 850 | 4.09375 | 4 | [] | no_license | #guessing-game.py
animal = 'dog'
end = 'quit'
while animal != 'guess':
print('The program is thinking of an animal. Please try to guess the name of the animal')
guess = input()
if (guess.lower() != animal and guess.lower()[0] != end[0]) :
print("Sorry that is the wrong animal, please try again. If y... | true |
539059c3ac72ce24e927d6fd00c4be155cd5e292 | Python | aroberge/talks | /pycon-2021/turtle.py | UTF-8 | 90 | 3.609375 | 4 | [
"MIT"
] | permissive | # Draw a square
import turtle as t
for i in range(4):
t.forward(100)
t.left(90)
| true |
6e88c87c1621abdc56219685f0a47c95210f847b | Python | GinnyGaga/2019.11-LJ-CODE | /PythonTest/class02.py | UTF-8 | 450 | 4.15625 | 4 | [] | no_license | # ==================== 进阶:能掌握就掌握,不能掌握就算了 ==============================
# 类的构造方法
class Person():
name = "李博宇"
sex = "男"
# 构造方法,固定的写法:初始化类
def __init__(self, xb, mz):
self.sex = xb
self.name = mz
self.test()
def test(self):
print("这是test方法")
d = Person("女", "王广发")... | true |
9ad8aa9dcc2c91be866c5ec84d49b7501858ba27 | Python | RevelcoS/RegionOlimp | /hw_1/p_3/input.py | UTF-8 | 116 | 2.71875 | 3 | [] | no_license | from union import union
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(*union(a, b)) | true |
572195aa606705dcfb2811caf7a59aea63ce1875 | Python | zhaoqian3355/WebScraping | /wikiPedia/testCode.py | UTF-8 | 1,703 | 2.984375 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
import unittest
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver import ActionChains
class TestAddition(unittest.TestCase):
def setUp(self):
print("Setting up the test")
d... | true |
e3d75c003c99371b7547289e92b60c1adb7ada2d | Python | vwvolodya/ads | /GRAPHs/graphs/maze/python/maze.py | UTF-8 | 15,283 | 3.671875 | 4 | [] | no_license | import random
import time
from Tkinter import *
def main():
height = 25
width = 40
maze_cell_size = 25
animation_delay = 0.005
def begin_simulation():
def on_cell_created(new_cell, previous_cell):
ui.draw_cell(new_cell)
if previous_cell is not None:
... | true |
51c007fc8956397457b7d2a00dafbffde028a164 | Python | wtfwsk05/pyqt5-20200207 | /test_file/FirstMainWin.py | UTF-8 | 1,006 | 3.03125 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QApplication,QMainWindow # 应用程序,主窗口
from PyQt5.QtGui import QIcon # 图标
class FirstMainWin(QMainWindow):
def __init__(self,parent=None):
super(FirstMainWin, self).__init__(parent)
# 设置窗口标题
self.setWindowTitle('第一个主窗口应用')
... | true |
b4cb685977ec9024d2a728e1ba67b3684fbd621e | Python | harpribot/ML-basics | /basics 3 - MCMC Sampling/simulation.py | UTF-8 | 7,270 | 2.84375 | 3 | [] | no_license | import numpy as np
from random import gauss
from scipy.stats import norm,multivariate_normal
import matplotlib.pyplot as plt
class Sampling:
def __init__(self,num_samples):
self.total_samples = num_samples
def metroplis_1D(self,proposal_var,total_samples=1000):
self.sampling_method = "metropo... | true |
86debed96aa6bba69a3c4838b5f2a2eeeb447074 | Python | blackJack1982/h | /code_exploit.py | UTF-8 | 560 | 2.5625 | 3 | [] | no_license | # Zero days
# Metasploit
# a basic example of overwhelming the app/programme design with binary code exploit
import binascii
f = open('exploit.bin','wb')
f.write(b'\x0a\x0b\x0c' * 10)
f.close
# if you wanna read it, use library of binascii
f = open('exploit.bin','rb')
bytes = f.read()
print(binascii.b2a_uu(bytes))... | true |
de3407358677560ae2ad3b337d9d2c7b6e812c9e | Python | facelessuser/pyspelling | /pyspelling/plugin.py | UTF-8 | 2,655 | 3.15625 | 3 | [
"MIT"
] | permissive | """Base plugin class."""
from collections import OrderedDict
import warnings
class Plugin:
"""Base plugin."""
def __init__(self, options):
"""Initialization."""
self.config = self.get_default_config()
if self.config is None:
warnings.warn(
"'{}' did not pr... | true |
871f7a9bf9a0582c29f036a95670fa0b7b4ff915 | Python | venachescu/psyclab | /psyclab/utilities/osc.py | UTF-8 | 4,077 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
psyclab/utilities/osc.py
Vince Enachescu 2019
"""
from functools import wraps
from itertools import chain
from threading import Thread
from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import ThreadingOSCUDPServer
from pythonosc.udp_client import ... | true |
d1362a83394c38bc26b1f1328b4be06ea6fcec86 | Python | bioJain/python_Bioinformatics | /Rosalind/Bioinformatic-textbook-track/BA1D_PatternMatch.py | UTF-8 | 269 | 3.3125 | 3 | [] | no_license | # BA1D
# Find All Occurrences of a Pattern in a String
def PatternMatch(pattern, genome):
matchList = []
i = 0
while i <= len(genome)-len(pattern) :
j = genome.find(pattern, i)
if j == -1 :
break
else :
matchList.append(j)
i = j+1
return matchList
| true |
dadde424a8ee1ca7a33d6aeb6162f76dac2d1c58 | Python | ajaysingh13/Python-Projects- | /forloops.py | UTF-8 | 527 | 3.96875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 5 17:23:03 2021
@author: vijay
"""
import matplotlib.pyplot as plt
fruitlist = ['banana', 'orange', 'apple', 'watermelon']
"""
# for loop
for x in fruitlist:
print (x)
if (x == 'apple'):
print('this is an apple')
for x in range (1,11):
print... | true |
75faaf6504e05ae11d617e0383af6e1c476669fa | Python | milger/DEVFUNDA | /movie_rental_store/tests/membership/membership_test.py | UTF-8 | 1,432 | 3.234375 | 3 | [] | no_license | import sys
sys.path.append('../../src/modules/membership')
import unittest
from membership import Membership
class MembershipTest(unittest.TestCase):
def setUp(self):
"""Setup method to instance an object of Membership class """
code = 9
name = "Gold"
discount = 10
self.me... | true |
07e70addb02320eda7c144b2a098546dc7487eee | Python | BaeMinCheon/street-fighter-agent | /src/agent/Agent.py | UTF-8 | 3,447 | 2.578125 | 3 | [] | no_license |
import agent.Model as Model
import numpy as np
import tensorflow as tf
import random
import collections
def GetStacks(_main, _target, _batch):
stack_x = np.empty(0).reshape(0, _main.size_input)
stack_y = np.empty(0).reshape(0, _main.size_output)
for curr_state, decision, reward, next_state in _batch:
... | true |
d96e4868bb86696bffdcb58a0311bce1d2e3926d | Python | daniel-reich/ubiquitous-fiesta | /9Q5nsEy2E2apYHwX8_2.py | UTF-8 | 625 | 3.21875 | 3 | [] | no_license |
class programer:
def __init__ (self, sallery, work_hours):
self.sallary = sallery
self.work_hours = work_hours
def __del__ (self):
#code
return "oof, " + str(self.sallary) + ", " + str(self.work_hours)
def compare (self, other_programmer):
#code
if self.sallary == other_pr... | true |
2335441e5e84cd6da4adab5eb0fa4d9ffdaec0d6 | Python | ifcheung2012/sampletor | /test/deco.py | UTF-8 | 802 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'ifcheung'
def check(name):
def checkwrapper(func):
def checking(self):
print "check is %s." % name
print "start checking"
result = func(self)
print "end checking"
return result
return checking
retu... | true |
8d5e0fdf710f562a44acc4c6e3f1f6a69173b72b | Python | estuelke/cure-center-tools-backend | /backend/members/routes.py | UTF-8 | 1,533 | 2.53125 | 3 | [] | no_license | from flask import Blueprint, jsonify, request, make_response
from .. import db
from .models import Member
from .schemas import MemberSchema
member_api = Blueprint('members', __name__)
member_schema = MemberSchema()
members_schema = MemberSchema(many=True)
@member_api.route('/members', methods=['GET', 'POST'])
def me... | true |
ade1f1af1b4f081a41eb93385960488edf9c5cbe | Python | syyxtl/Reinforcement_learning | /MountainCar/PLAY_QLearning_PLOY.py | UTF-8 | 2,113 | 2.96875 | 3 | [] | no_license | import time
import pickle
import gym
import numpy as np
# weights = np.zeros( (num_of_action, pow(num_of_param + 1, 2)) )
# 加载模型
with open('MountainCar_QLeaning-POLY.pickle', 'rb') as f:
Q = pickle.load(f)
print('model loaded')
env = gym.make('MountainCar-v0')
state_1_low, state_2_low = env.ob... | true |