blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
9e20c2b38bae66b28a747edf9953bf6c4de75542 | Python | FavyTeam/Elderscape_server | /data/plugins/quests/monkey_madness.py | UTF-8 | 16,257 | 2.734375 | 3 | [
"MIT"
] | permissive | # Quest Name: Monkey Madness
# Written by Owain for Runefate, 11/02/18
# Quest Length: Medium
# Quest Difficulty: Medium
from game.content.quest import Quest
from game.content.quest import QuestHandler
from game.content.quest import QuestReward
king_narnode_shareen = 1423
karam = 7172
lumdo = 1453
lumo = 7112
def co... | true |
f44326df7ddf6589b72fefe86dc473efd8552e5d | Python | entrymissing/beholder | /beholder/metric/gfit_metric.py | UTF-8 | 1,585 | 2.515625 | 3 | [] | no_license | """Metric holds the base classes in beholder."""
import time
import datetime
from metric.metric import Metric
from metric.datapoint import DataPoint
from libs.google_api import build_service
class GFitMetric(Metric):
"""Base class for all metrics."""
_REQUIRED_PARAMETERS = ['time_windows', 'suffixes']
d... | true |
11da591d2b4f10d75f4ab7098382abce55944c42 | Python | zchenpds/pedmodel | /feature.py | UTF-8 | 18,804 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: mfahad
"""
from state import State
import math
import numpy as np
class Feature():
def __init__(self, state, timestep):
''' construct the feature vector from a state object
state: self state
'''
self.radius = 5000 #radius of influence around p... | true |
a7a33ee3f5f83cb0fd2c15210a6ead4db0070f8d | Python | parshakova/cme211 | /exam1/NextPalindrome.py | UTF-8 | 463 | 3.390625 | 3 | [] | no_license |
def NextPalindrome(palindrome):
# center digit
mid = palindrome // 100 % 10
s = str(palindrome)
if mid < 9:
# we can simply increment the center digit
out = int (s[:2]+str(mid+1)+s[3:])
else:
# deal with 0's
mid2 = int(s[1])
if mid2 < 9:
# increase second and 4-th digits
out = int(s[0] + str(mid2... | true |
3a5a348b95550fcf3e64bf989c252dc57908180e | Python | JoonasSipilae/2021_Python_JoonasSipilae | /Examples/conditions.py | UTF-8 | 912 | 3.6875 | 4 | [] | no_license | print()
a = 10
b = 20
# Vertailuoperaattoreita
# == yhtäsuuruusvertailu
if a == b:
print(a, "equals", b) # sep-parametrillä voidaan määritellä erotinmerkki
else:
print(a, "does not equal", b)
# != erisuuruusvertailu
if a != b:
print(a, "does not equal", b)
else:
print(a, "equals", b)
if not a == b... | true |
2210414ab8547c8578367a70727e73988bdb802c | Python | SleepwalkerCh/Leetcode- | /127_2.py | UTF-8 | 1,191 | 3.09375 | 3 | [] | no_license | #127. Word Ladder
# 组合形成下一跳单词,居然没超时
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList):
old=[beginWord]
step=1
dict={}
for i in wordList:
dict[i]=1
while True:
new=[]
print(old)
for i in old:
... | true |
fd17a73ebd19328e3129a1c552765de893840df1 | Python | thanhlong9x/ML-ImageDetection-Sklearn | /ImageDetection.py | UTF-8 | 2,924 | 2.9375 | 3 | [] | no_license | import os
import cv2
import numpy as np
from sklearn import svm
import matplotlib.pyplot as plt
test_path = '/home/mrtu/Downloads/Misa/ImageDetection/src/test'
training = '/home/mrtu/Downloads/Misa/ImageDetection/src/training'
def show_image(image):
if len(image.shape) == 2:
plt.imshow(image, cmap='gray... | true |
4fc79bdeb46bb9122044132e7ef0cb4533bd3026 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_159/472.py | UTF-8 | 1,152 | 3.15625 | 3 | [] | no_license | #python 2.7
import sys
def solve(input_vals):
const_rate = max( [ input_vals[x] - input_vals[x+1] for x in range(0,len(input_vals) - 1) ] )
min_eaten_var_rate = sum( [ max([input_vals[x] - input_vals[x+1], 0]) for x in range(0,len(input_vals) - 1) ] )
const_eaten = 0
input_vals.pop()
... | true |
b75379dedd08c72e8a53c3e98f5f961f89e8aa02 | Python | 360849048/MyProj | /app/softrefresh.py | UTF-8 | 1,732 | 2.609375 | 3 | [] | no_license | '''
该模块用来处理soft.db各表中torefresh字段,包括:
* 根据表名和行id,对数据进行torefresh字段的标记,写1
* 对数据库内所有表的内容进行搜索,对torefresh字段被写1的数据行的path字段清空
'''
from app.sqljob import TableManager
from app.pathinfo import *
def markToRefresh(table_name, ids):
t_soft = TableManager(table_name, SOFTWARE_VERSION_INFO_DB_PATH)
if isinstance(id... | true |
60d2f300204e84f2689bc90f1aca695a3c5cd1e3 | Python | zscFirefly/ML_From_xx | /14.SVM/04-unbalance.py | UTF-8 | 2,634 | 2.984375 | 3 | [] | no_license |
import numpy as np
from sklearn import svm
import matplotlib as mpl
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score,precision_score,recall_score,f1_score
import warnings
if __name__ == "__main__":
warnings.filterwarnings("ignore")
np.random.seed(0)
c1 =990
c2 =10
N = c1... | true |
6776017f51d6685011bcdacde12e1d446feb5b48 | Python | foincn/hyatt-cn | /HyattCode.py | UTF-8 | 2,473 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
# filename: HyattCode.py
import os
import json
import requests
from bs4 import BeautifulSoup
from urllib.parse import urlencode
from config import temp_dir
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari... | true |
5b5264c4cdcb7dedf5e92f132d5b46dff849b385 | Python | Luni-4/random_works | /python/Exams/autoinit.py | UTF-8 | 761 | 3.171875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import inspect
import re
# TODO usare un decoratore
def inits(*args):
val = re.findall("\w+",str(getattr(inits,args[0].__class__.__name__)))
for x in range(len(args) - 1):
args[0].__setattr__(val[x+1], args[x+1])
class AutoInit(type):
def __new__(meta, classname, supers, classdict):
inits.__setattr__(class... | true |
c993fc1b9414193a7e85aa48fb6973126c2fb0f5 | Python | issacianmutiara/Issacian-Mutiara-Paska_I0320053_Tiffany-Bella_Tugas5 | /I0320053_Exercise 5.2.py | UTF-8 | 282 | 3.625 | 4 | [] | no_license | #Penggunaan if untuk dua kasus
#Menginput tahun ajaran
tahun_ajaran = int(input('Masukkan tahun ajaran: '))
#memeriksa tahun
if tahun_ajaran % 4 == 0:
print(' %d adalah tahun ajaran genap' %tahun_ajaran)
else :
print(' %d adalah tahun ajaran ganjil' %tahun_ajaran)
print () | true |
6a557c1d5befc337cc75c1cbd85044d5f106e025 | Python | ZacheryThomasVanEs/PythonPractice | /ImageBrowser/image_browser.py | UTF-8 | 2,229 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 18 17:04:18 2022
@author: Zachery Van Es
"""
import io
import os
import glob
import PySimpleGUI as sg
sg.theme("DarkAmber")
from PIL import Image, ImageTk
file_types = [("JPEG (*.jpg)","*.jpg"),
("All files (*.*)","*.*")]
def parse_folder... | true |
486cf7487c3187deba0eca09dde419cfdbdeef6b | Python | TanZng/patrones-combinados | /2-Patron/python/FabricaDeMascotas.py | UTF-8 | 292 | 2.578125 | 3 | [
"MIT"
] | permissive | import FabricaDeCriaturas
import MascotaGrande
import MascotaPequeña
class FabricaDeMascotas(FabricaDeCriaturas):
def crearGrande(self, nombre):
return MascotaGrande(nombre, 100, 1000, 1)
def crearPequeña(self, nombre):
return MascotaPequeña(nombre, 10, 100, 1)
| true |
16042f16c913b50e40995caf9f2eaf10f71eccbb | Python | amith1893/parallel-fast-ode-solver | /boost_experiment/BOOST/FastOde.py | UTF-8 | 2,877 | 2.828125 | 3 | [] | no_license | from ParameterEstimator import ParameterEstimator
import configparser
import sys
import itertools
import numpy
#import ode_solver
import ode_solver_modf
from GraphPlot import GraphPlot
class FastOde():
def __init__(self, num_par, param_list, num_iter, init_val, accuracy, dist, num_samples, max_step_size, max_steps... | true |
bf5e9d903a0650e6dd5c9244be31033d3efcfbca | Python | iuriarte/python-exercises-iu | /week_2/fun_sine2.py | UTF-8 | 293 | 3.09375 | 3 | [] | no_license | import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plot
import math as math
from numpy import arange
f = 0
def f(x):
return math.sin(x)
xs = arange(-5, 6, 0.1)
ys = []
for x in xs:
ys.append(f(x))
plot.plot(xs, ys)
plot.savefig('sine2_of_x_plot.png')
plot.close()
| true |
a216a7f1e2a09ae6296e6de1c6804d3f39ca4052 | Python | anthonywritescode/aoc2020 | /day20/part1.py | UTF-8 | 2,860 | 2.703125 | 3 | [] | no_license | import argparse
import os.path
from typing import FrozenSet
from typing import NamedTuple
import pytest
from support import timing
INPUT_TXT = os.path.join(os.path.dirname(__file__), 'input.txt')
class Tile(NamedTuple):
tile_id: int
edges: FrozenSet[str]
back_edges: FrozenSet[str]
def compute(s: str)... | true |
bf914ef1d417608878172db10695bac6b7297358 | Python | Eileen-Nasert/myEx | /ex09.py | UTF-8 | 501 | 4.09375 | 4 | [] | no_license | print "ex09"
print "Printing, Printing, Printing\n"
days = "Mon Tue Wed Thu Fri Sat Sun" # all the days of the week are in single line
months = "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug" # each month is in new line
print "Here are the days: ", days
print "Here are the months: ", months
print """ #three double quotes a... | true |
1934d11a546879195022507bd8574e7a2d6ba88b | Python | marrerap/functions | /phonebook.py | UTF-8 | 514 | 3.5625 | 4 | [] | no_license | phonebook_dict = {
'Alice': '703-493-1834',
'Bob': '857-384-1234',
'Elizabeth': '484-584-2923'
}
phone_list = phonebook_dict
#print only Elizabeth's phone number not name.
print(phonebook_dict["Elizabeth"])
#add a new key and value to the dictionary
phonebook_dict["Kareem"] = "938-489-1234"
#print the changes ... | true |
59e7b55b768cae570db0c44700f14f432c7af3e0 | Python | AlexThePav/StepikBioInfo | /Stepik/1 Finding Hidden Messages/Week 1/CountDict.py | UTF-8 | 349 | 3.296875 | 3 | [] | no_license | from PatternCount import PatternCount
def CountDict(Text, k):
Count = {}
for i in range(len(Text)-k+1):
Pattern = Text[i:i+k]
Count[i] = PatternCount(Pattern, Text)
# print("i: {0}, Pattern: {1}, Count[i]: {2}".format(i, Pattern, Count[i]))
return Count
if __name__ == "__main__":
print(... | true |
c0cec49958bc9fea72f8ead84381e8e476e4de38 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_84/245.py | UTF-8 | 1,611 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import sys
import os
import copy
def pictureToString(picture):
output = ""
for row in range(len(picture)):
for elem in range(len(picture[row])):
output += picture[row][elem]
if row < (len(picture) - 1):
output += "\n"
return output
def hasBlues(picture):... | true |
bf29b7eccb8163d3eb62102fb6cb70c44f6d17ad | Python | EmanuelaMollova/MailList | /mail.py | UTF-8 | 1,686 | 3.625 | 4 | [] | no_license | import mail_list
def say_hello():
return "Hello Stranger! This is a cutting-edge, console-based mail-list!\nType help, to see a list of commands."
def help():
messages = [
"Here is a full list of commands:",
"* show_lists - Prints all lists to the screen. Each list is assigned with a unique i... | true |
d205d8caf17325a2c48360ae8b54ab50c40f5b86 | Python | pgermain/pbda | /pbda_learn.py | UTF-8 | 4,550 | 2.828125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
PAC-BAYESIAN DOMAIN ADAPTATION (aka PBDA)
Executable script to launch the learning algorithm
@author: Pascal Germain -- http://researchers.lille.inria.fr/pgermain/
'''
import common
from pbda import *
from dataset import *
from kernel import *
import sys
import pickle
i... | true |
ad128e9cdce98739ce1c3cd2b12b9d538a4f736d | Python | vintagexav/DeepPavlov | /deeppavlov/core/commands/utils.py | UTF-8 | 3,565 | 2.71875 | 3 | [
"Python-2.0",
"Apache-2.0"
] | permissive | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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/LICENSE-2.0
#
# Unless required by applicab... | true |
88e6198e10e58c3adb336bd481d832984d5b64c3 | Python | RomanFormicola/ecopy | /ecopy/terrain.py | UTF-8 | 3,373 | 3.40625 | 3 | [] | no_license | '''This code was directly copied from https://github.com/hnhaefliger/pyTerrain and
slightly modified for my purposes '''
import graphics.engine
import perlin
import math
class Terrain:
def __init__(self, field_x, field_y):
############ Display variables
self.scale = 6
self.distance = 10... | true |
8baceaf7793b614171be726ad78da464f637be88 | Python | Shivam60/sorting-techniques | /counting sort.py | UTF-8 | 253 | 2.625 | 3 | [] | no_license | import sys
n=input()
arr=[]
for i in range(0,n):
arr.append(input())
cnn=[]
for i in range(0,n+1):
cnn.append(0)
for i in range(0,n):
cnn[arr[i]]+=1
for i in range(0,n+1):
if(cnn[i]):
for j in range(cnn[i]):
print i,
| true |
9956f27bbe96ff85a141794264cfba6e1fc412b1 | Python | muhammad-masood-ur-rehman/Skillrack | /Python Programs/reverse-alphabet-triangle-pattern.py | UTF-8 | 570 | 3.96875 | 4 | [
"CC0-1.0"
] | permissive | Reverse Alphabet Triangle Pattern
The program must accept an integer N as the input. The program must print the desired pattern as shown in the Example Input/Output section.
Boundary Condition(s):
2 <= N <= 26
Example Input/Output 1:
Input:
5
Output:
----a
---ba
--cba
-dcba
edcba
Example Input/Output 2:
Input:
4
Outpu... | true |
9c38b99b5f333c75929047df62b5e9323f1dc761 | Python | iefuzzer/vnpy_crypto | /vnpy/api/coinpark/vncoinpark.py | UTF-8 | 11,674 | 2.515625 | 3 | [
"MIT"
] | permissive |
#!-*-coding:utf-8 -*-
#@TIME : 2018/6/10/0010 11:19
#@Author : incenselee
import hmac
import hashlib
import requests
import sys
import time
import base64
import json
from collections import OrderedDict
class vncoinpark():
def __init__(self,base_url = 'https://api.coinpark.cc/v1'):
self.base_url = b... | true |
af62d77f88471822e4997908cc750497dde4bfcf | Python | tskkst51/lplTrade | /src/manualOveride.py | UTF-8 | 2,216 | 2.703125 | 3 | [] | no_license | '''
manualOveride module
'''
import os
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class ManualOveride:
def __init__(self, pfData, sym, rootPath):
manualOveridePath = rootPath + "/manualOveride"
manualOverideEx = ".mo"
self.overideModes = pfData['over... | true |
ccf4b3a264f36ee359e65383b7769187bda47cd8 | Python | tooyoungtoosimplesometimesnaive/probable-octo-potato | /p_y/298_binary_tree_longest_consecutive_sequence.py | UTF-8 | 1,027 | 3.3125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def __init__(self):
self.result = 0
def longestConsecutive(self, root):
"""
:type root: TreeNode
:rty... | true |
1cc58f8784512838c5b9b40f83b41278e636ad82 | Python | hbianco/EcoData | /EcoData.py | UTF-8 | 17,687 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 21 13:14:18 2017
@author: herve.biancotto
@aim: Implements functions to import, standardise and visualise economic data.
"""
#import bloompy as bp
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotl... | true |
d9eb046e90122f23dca292f113c6728ab7ff12ff | Python | poisoniivy/madlib | /madlibs.py | UTF-8 | 2,578 | 2.96875 | 3 | [] | no_license | """A madlib game that compliments its users."""
from random import choice
from flask import Flask, render_template, request
# "__name__" is a special Python variable for the name of the current module.
# Flask wants to know this to know what any imported things are relative to.
app = Flask(__name__)
AWESOMENESS = [... | true |
f24595eb28501c9c489f7bb9681b4dd8535ecf7d | Python | michaelbell1011/universal_sentence_encoder | /kaggle_news_categories/testing_scripts/testing_api_endpoints_sampledata.py | UTF-8 | 5,595 | 2.78125 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import train_test_split
import requests
import time
# custom modules
import testing_configs
import api_classify_accur
import sample_data
# helper functions
def compile_training_request_obj(x_train_series, y_train_series):
"""
Formats data into json object for ... | true |
74eb9a676fd1cae37a57da78f99027fb062f4eef | Python | jikama93/CCCRewrite | /__banner/myBanner.py | UTF-8 | 792 | 2.578125 | 3 | [] | no_license | import colorama
import random
import sys
def bannerTop():
banner = '''
____ ____ ____ ____ _ _
/ ___/ ___/ ___| _ \ _____ ___ __(_| |_ ___
| | | | | | | |_) / _ \ \ /\ / | '__| | __/ _ \\
| |__| |__| |___| _ | __/\ V V /| | | | || __/_
\____\____\____|_| \_\___| \_/\_/ |_| |_... | true |
bcc99e3d8be53305ddc467259e65f840b36badba | Python | ssuzinn/business_text_mining | /LDA.py | UTF-8 | 3,594 | 2.578125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from gensim.models import Word2Vec
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
from matplotlib import font_manager, rc
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.dec... | true |
b06dcf79ad2e13fcb039ad2f6a27189e706bef49 | Python | faroit/deejaypeg | /examples/encode-decode.py | UTF-8 | 1,431 | 2.5625 | 3 | [] | no_license | import soundfile as sf
import argparse
import deejaypeg as djpg
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'input',
)
args = parser.parse_args()
audio, rate = sf.read(args.input)
mono = True
if mono:
audio = np.atle... | true |
968b514c24f677a1f00d65bd2d1bf7e4165ff4ad | Python | najeex/Competitive-Programming | /18. Divide & Conquer/test.py | UTF-8 | 736 | 3.234375 | 3 | [] | no_license | def inversion_count(arr,s,e):
if(s>=e):
return 0
mid = (s+e)//2
x = inversion_count(arr,s,mid)
y = inversion_count(arr,mid+1,e)
z = merge(arr,s,e)
return x+y+z
def merge(arr,s,e):
mid = (s+e)//2
i = s
j = mid+1
karr = []
cnt = 0
while i<=mid and j<=e:
... | true |
b6975af61de08bb05a2c9cdbbfc459f810158d40 | Python | dewuem/python-bioinf | /check-if-multiple-of-3.py | UTF-8 | 932 | 3.1875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | #!/usr/bin/python2
import sys
import errno
from Bio import SeqIO
# Daniel Elsner
# Check if the input sequence is a multiple of 3, that is the codons add up
def length_check(in_string):
#check if the string is divisible by three
in_length = len(in_string.strip())
if in_length % 3 != 0 and i... | true |
d09ddeac2b95fae1190e1f87736adf06b09a96b1 | Python | MiguelAngelx/TareaFundamentosdeProgramacion | /Estructuras repetitivas tarea/4.22.py | UTF-8 | 1,313 | 3.03125 | 3 | [] | no_license | def calcularsaldoclienteMAQC():
ganacia_por_intereses = 0
n = int (input ('Ingrese el valor de n: '))
for i in range (1, n + 1):
print ('PROCESO ' + repr (i))
compras_realizadas = float (input ('Ingrese el valor de compras realizadas: '))
pago_del_corte_anterior = float (input ('Ingr... | true |
fecd6cb14946a17cd3748c094a209e5233e621c4 | Python | ccrain78990s/Python-Exercise | /0310 函數及物件導向/0310 - 1.py | UTF-8 | 2,605 | 4.3125 | 4 | [
"MIT"
] | permissive | #0310 CH5函數 物件導向
def fun1():
print("fun1")
print("fun1")
print("fun1")
fun1()
print("end")
def fun1a():
print("fun1a")
print("try")
fun1a()
print("end")
def fun1b():
print("Yo")
print("fun1b")
fun1b()
print("end")
#####比較漂亮寫法
def fun1():
print("fun1")
pr... | true |
56fc7574ebbb7bed5838c4e0fea0809a9cf4b8ee | Python | bryson0083/py_test | /20180628-01.py | UTF-8 | 532 | 3.234375 | 3 | [] | no_license | """
Image thumbnail test
Ref:
https://stackoverflow.com/questions/2612436/create-thumbnail-images-for-jpegs-with-python
https://stackoverflow.com/questions/1386352/pil-thumbnail-and-end-up-with-a-square-image
"""
from PIL import Image
size = (36, 36)
data = "test22222.png"
image = Image.open(data)
image.thumbnail(s... | true |
ba830ebf1d9c6ae71cd5dcce5b60e3a6936f3f2b | Python | saimasiddique/Neural-Network-Lab | /single neuron training.py | UTF-8 | 440 | 2.796875 | 3 | [] | no_license | import math
def neuron(x,w,b,target,learn):
z=0
error=0
while True:
l = len(x)
for i in range(l):
z += x[i]*w[i]
z+=b
z=sigmoid(z)
error=target-z
del_weight= learn
def sigmoid(z):
return 1/(1+math.exp(-1*z))
if __name__ == "__main__":
... | true |
afce53d1b14e35acfae7ac730e3048bc6817dc08 | Python | seikom/coverage_test | /list_genes_under_cov30.py | UTF-8 | 2,857 | 3.046875 | 3 | [] | no_license | ### script to report a list of genes with less than 30x at coverage
### Date: 2021/03
### authour: Seiko Makino
### usage: list_genes_cov30.py -f/--file <sambamba_output>
### developed and tested in python 3.6.10
import os
import sys
import magic
import argparse
import pandas
### parse a argument
parser = argparse.A... | true |
55fe29e555b7dc204bba76e9aa796054e5717e27 | Python | aguilerapy/ips_python | /Modulos/verificar_binarios.py | UTF-8 | 1,932 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import psycopg2;
import string;
import sys;
import commands
import re;
import datetime;
import md5;
import os;
from os import listdir
#Nos conectamos a la base de datos
conn = psycopg2.connect("dbname=ips_db user=ips_user password=12345 host=localhost")
cur =... | true |
8b876306ba875ea28a8192bab832fd455f43c90e | Python | ajfabian/Competitive-Programming | /CodeChef/APRIL19B/XORMIN/gen | UTF-8 | 444 | 2.875 | 3 | [] | no_license | #!/usr/bin/python3
from random import randint
T = 2
print(T)
for tc in range(T):
N, Q = randint(200000, 200000), randint(1000000, 1000000)
print(N, Q)
for _ in range(N):
print(randint(1, (1 << 20) - 1), end=' ')
# ~ print(randint(1, 7), end=' ')
print()
for i in range(2, N+1):
print(i, randint(... | true |
6532593c5b34204c2ab02163e4da8e2035a60f8b | Python | imagej/imagej-scripting | /src/main/resources/script_templates/Tutorials/Projections.py | UTF-8 | 1,398 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | #@ OpService ops
#@ UIService ui
#@ Dataset data
#@OUTPUT ImgPlus maxProjection
#@OUTPUT ImgPlus sumProjection
# Run this tutorial using the C0 image generated in the 'Crop Confocal Series' tutorial.
# To generate the C0 image, do the following:
# Go to 'file>Open Samples>Confocal Series' and make sure confoc... | true |
b267bebcbe90ed9a7fd993e1f33bd324dc612855 | Python | RichGit101/Enso | /enso/resample/__init__.py | UTF-8 | 1,519 | 3.1875 | 3 | [] | no_license | from collections import Counter, defaultdict
import random
import numpy as np
def oversample(X, y, max_ratio=50):
"""
Ensure each class occurs with approximately even frequency in the training set by
duplicating examples from relatively rare classes.
:param X: `np.ndarray` of input features
:par... | true |
1fd3ffa9d3f3e80f58b4149aefe024705399a212 | Python | my-temporary-name/Machine-Learning | /Assignment 1/estate-experiments.py | UTF-8 | 1,755 | 3 | 3 | [] | no_license |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tree.base import DecisionTree
from metrics import *
np.random.seed(42)
# Read real-estate data set
# ...
#
def pred_reg(tree,inputs):
node = tree
for i in node.keys():
if i in inputs:
... | true |
28b23fff631795c4e00ecd28200d44b2bfc798bf | Python | DerekvdVen/boom-hoogtes | /functions.py | UTF-8 | 3,346 | 2.546875 | 3 | [] | no_license | import os
import rasterio
from rasterio.plot import show
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import matplotlib.pyplot as plt
from rasterstats import zonal_stats
from rasterio.fill import fillnodata
import zipfile
def get_directory_data_names(directory):
... | true |
801f81f2b4d8935c5fd9e51d37913f9df66b4666 | Python | thedaves97/Esercitazioni | /Exercise 1/similarity.py | UTF-8 | 4,131 | 3.125 | 3 | [] | no_license | import math
from nltk.corpus import wordnet as wn
max_val = max(max(len(hyp_path) for hyp_path in ss.hypernym_paths()) for ss in wn.all_synsets())
def get_synset(word):
'''
Return the synset for the given word
:param word:
:return:
'''
synset = wn.synsets(word)
if not synset:
retu... | true |
03a613f9131085ffc4d9e4deb1f784de24bad2ee | Python | gitblight1/lies | /test_val.py | UTF-8 | 758 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python3
import pytest
import val
@pytest.mark.parametrize("us, expected", [
("What is my name?", False),
("Foo is my name.", True),
])
def test_val_sentence(us, expected):
"""Test sentence validation."""
assert val.validate_sentence(us) == expected
@pytest.mark.parametrize("us, expected"... | true |
70b323c29384cdd550937c8a2ab0929bd52786d8 | Python | zcx-1997/d2l_implement | /07-循环神经网络/01-序列模型.py | UTF-8 | 3,399 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Time : 2021/5/18 15:41
Author : 春晓
Software: PyCharm
"""
import torch
from torch import nn
from torch.utils import data
from matplotlib import pyplot as plt
# 1.data
T = 1000
time = torch.arange(1, T + 1, dtype=torch.float32)
x = torch.sin(0.01 * time) + torch.normal(0, 0.2,... | true |
94f041187d692902f43f85173490e17b7db9114c | Python | klknet/geeks4geeks | /datastructure/linkedlist/compare_numbers.py | UTF-8 | 1,058 | 3.84375 | 4 | [] | no_license | """
Compare numbers represented by linked list.
"""
from datastructure.linkedlist.base_linked_list import LinkedList
def compare(list1, list2):
remove_leading_zero(list1)
remove_leading_zero(list2)
n1, n2 = list1.size(), list2.size()
if n1 != n2:
return 1 if n1 > n2 else -1
cur1, cur2 = li... | true |
6dadc418abfc136a02de7ba7323f0d977bf172b1 | Python | pushkarneo/face_recognition | /lfw_load.py | UTF-8 | 1,962 | 2.65625 | 3 | [] | no_license | import numpy as np
from matplotlib.image import imread
from PIL import Image
import os
import sys
#def rgb2gray(rgb):
# return np.dot(rgb[...,:3], [0.299, 0.587, 0.114])
def load_data(file,storage = np.float32, size = (125,125)):
x = []
y = []
if os.path.isfile("pickled/" + file + "_x.npy") and os.path.isfile("pi... | true |
aaeb4092aaf6eceac9e556be99c0b75566e1e0f6 | Python | DallasMorningNews/nba-roty-tracker | /src/py/nba-roty-scrapper.py | UTF-8 | 12,182 | 2.703125 | 3 | [] | no_license | import json
import math
import pprint
import re
import requests
import sys
from bs4 import BeautifulSoup
from fuzzywuzzy import fuzz
from fuzzywuzzy import process
from operator import itemgetter
# TODO:
# add fifth advance metric
# lambda function and aws hosting
# better commenting
# headers info for requesting ... | true |
c408dd1329c9453d3e4032b4a1382c99dd50d60c | Python | A-Alexander-code/150-Python-Challenges--Solutions | /Ejercicio_N052.py | UTF-8 | 94 | 3.53125 | 4 | [] | no_license | import random
num = random.randint(1,100)
print("Tu número aleatorio entre 0 y 100 es\n",num) | true |
eb9c5a8643fe4145b1b5d725e8576b582f76d1e8 | Python | BonneelP/pyleecan | /pyleecan/Methods/Machine/LamSlotMag/build_geometry.py | UTF-8 | 3,199 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from numpy import pi
from ....Methods.Machine.LamSlot.build_geometry import build_geometry as build_geo
def build_geometry(self, is_magnet=True, sym=1, alpha=0, delta=0, is_simplified=False):
"""Build the geometry of the LamSlotMag
Parameters
----------
self : LamSlotMag
... | true |
f3729fc804749b430c7dee77887e55de89f8e1f7 | Python | NicholasNagy/ALTA | /server/audit/utils.py | UTF-8 | 2,091 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | import itertools as it
from audit_template.models import AuditTemplate
from audit.models import Audit
from inventory_item.models import Item
def fetch_inventory_items(template):
dicts = {}
categories = ['Location', 'Plant', 'Zone', 'Aisle', 'Bin', 'Part_Number', 'Serial_Number']
# Constructing the dict b... | true |
119eaa570e1079751d9f71040cb6cfbc7a21ec2a | Python | smadala/IIIT-PG11 | /sce/slides/python/pra/Python Files/1_intro.py | UTF-8 | 419 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python
print "Python is really a great language,", "isn't it?";
str = raw_input("Enter your input: ");
#Try this as input ! : [x*10 for x in range(1,10)]
print "Received input is : ", str
str = input("Enter your input: ");
#Try this as input ! : [x*10 for x in range(1,10)]
print "Received input is : ", st... | true |
3ca892562b6b6ea15fd098d117c734aa99256d8a | Python | danoco78/oasis | /baseclass/screen_home.py | UTF-8 | 666 | 2.59375 | 3 | [] | no_license | from kivy.uix.screenmanager import Screen
from kivymd.app import MDApp
from baseclass.conexion import conexion
from kivymd.uix.menu import MDDropdownMenu
class ScreenHome(Screen):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.app = MDApp.get_running_app()
try:
w... | true |
51e1260d8cce867f8e3240728d8012b922757ec3 | Python | pkasala/ContinuesControl | /EnvironmentWrapper.py | UTF-8 | 2,041 | 2.9375 | 3 | [] | no_license | import gym
import math
from unityagents import UnityEnvironment
import numpy as np
class EnvironmentWrapper:
def __init__(self):
self.action_dim = -math.inf
self.state_dim = -math.inf
self.action_space_min = 0
self.action_space_max = 0
self.env = None
... | true |
f576f790a05b1f1821b0c993f3ec82c12c9f2aef | Python | CarbonBasedDudeform/PythonPlayground | /ex5.py | UTF-8 | 529 | 3.515625 | 4 | [] | no_license | my_name = "Dom"
my_age = 24
my_height = 1.7 #metres
my_weight = 75 #kg
my_eyes = "brown"
my_teeth = "brown"
my_hair = "brown"
print "Let's talk about %s" % my_name
print "He's %d metres tall" % my_height
print "He's %d kg heavy" % my_weight
print "Actually, that's not too heavy"
print "He's got %s eyes and %s hair" % ... | true |
2ec591c6575a256ede8dd8ca0366bbd4571715bd | Python | MeghaSajeev26/Luminar-Python | /Flow controls/demo5.py | UTF-8 | 506 | 3.140625 | 3 | [] | no_license | #grade of subject marks
num1=int(input("enter sub1 mark"))
num2=int(input("enter sub2 mark"))
num3=int(input("enter sub3 mark"))
num4=int(input("enter sub4 mark"))
num5=num1+num2+num3+num4
if(num5>=180):
print("A+")
elif(num5>=168)&(num5<=179):
print("A")
elif(num5>=140)&(num5<=159):
print("B+")
elif(num5>=... | true |
5ef11aab9be8e603e2d7f484768cba5bcb58a4ab | Python | ekdeguzm/project_euler_problem_1 | /problem_1.py | UTF-8 | 328 | 3.15625 | 3 | [] | no_license |
to_be_added = []
for i in range(1,1000,1):
if ((i % 3 == 0) and (i % 5 != 0)):
to_be_added.append(i)
elif ((i % 5 == 0) and (i % 3 != 0)):
to_be_added.append(i)
elif ((i % 5 == 0) and (i % 3 == 0)):
to_be_added.append(i)
else:
None
print(to_be_added)
print(sum(to_be_... | true |
de64d6f56849d4c1d6d75f500d4a4395d3e6aada | Python | GabrieleMaurina/workspace | /python/GOL/GOL.py | UTF-8 | 1,758 | 3.359375 | 3 | [] | no_license | from graphics import *
import time
#import pymouse
X_SIZE = 200
Y_SIZE = 150
X_RATIO = 5
Y_RATIO = 5
win = GraphWin('Game Of Py', X_SIZE * X_RATIO, Y_SIZE * Y_RATIO)
win.setBackground('black')
'''mouse = pymouse.PyMouse()
print(win.getMouse())
print(mouse.position())'''
m1 = [[False for y in range(Y_SIZE)] for x in... | true |
28f0212f082e9b1bbed6b828ea54e2448273438b | Python | yinruiqing/corpus2graph | /corpus2graph/applications/wordpair_generator_test.py | UTF-8 | 1,523 | 2.65625 | 3 | [
"MIT"
] | permissive | import unittest
import warnings
from corpus2graph.applications import wordpair_generator
from corpus2graph import FileParser, WordPreprocessor, Tokenizer, WordProcessing, \
SentenceProcessing, WordPairsProcessing
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
class TestGenerat... | true |
ef0b85b9f93ce804a1b045831c2828008584ab73 | Python | waynerad/osmlyon | /parseosm.py | UTF-8 | 22,212 | 2.546875 | 3 | [] | no_license | """Analyzes an OpenStreetMap file for Lyon, France"""
from __future__ import print_function
import csv
import xml.etree.ElementTree as ET
import sqlite3
# ----------------------------------------------------------------
# first section: parsing the XML file into CSVs
def split_into_key_and_type(key):
"""The requ... | true |
281f22f37e56da1c3f6cc814fe9462836396b2c2 | Python | Waynexia888/Leetcode-Python | /第二章 性价比之王的宽度优先搜索/4_拓扑排序/算法描述.py | UTF-8 | 1,062 | 3.84375 | 4 | [] | no_license | # 入度与出度
# 在介绍算法之前,我们先介绍图论中的一个基本概念,入度和出度,英文为 in-degree & out-degree。
# 在有向图中,如果存在一条有向边 A-->B,那么我们认为这条边为 A 增加了一个出度,为 B 增加了一个入度。
# 算法流程
# 拓扑排序的算法是典型的宽度优先搜索算法,其大致流程如下:
# 统计所有点的入度,并初始化拓扑序列为空。
# 将所有入度为 0 的点,也就是那些没有任何依赖的点,放到宽度优先搜索的队列中
# 将队列中的点一个一个的释放出来,放到拓扑序列中,每次释放出某个点 A 的时候,就访问 A 的相邻点(所有A指向的点),并把这些点的入度减去 1。
# 如果发现某个点的入度被减去... | true |
9ec2d0ba887bca7128a6c728559fc784d036c45d | Python | daiki1998/atcoder | /ABC/ABC176/C.py | UTF-8 | 174 | 2.71875 | 3 | [] | no_license | N = int(input())
A = list(map(int, input().split()))
res = 0
max_num = A[0]
for i in range(1, N):
max_num = max(max_num, A[i])
res += max(0, max_num-A[i])
print(res) | true |
79f38b41f74f65f27c8135b29250260d458140f6 | Python | kangli-bionic/leetcode-1 | /190.py | UTF-8 | 443 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding=utf-8
class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
a = [0 for i in range(32)]
mask = 1
i = 0
#pdb.set_trace()
while n:
if n & mask: a[i] = 1
n = n >> 1
i += 1
... | true |
a7136f0bdef8c4e497001f73e4390f17aaab6e84 | Python | choiasher/problem-solving | /greedy1_gymsuit.py | UTF-8 | 1,386 | 3.359375 | 3 | [] | no_license |
'''
# Solve the problem within O(n) in each time/space complexities
def solution2(n, lost, reserve):
### initial state of students
students = [list(x) for x in zip(range(1,n+1), [1,]*n)]
for student in students:
if student[0] in lost and student[0] in reserve:
continue
if stud... | true |
b651b12cdfb211b2dc8d0238be61ad91223db313 | Python | tarikkus-lviv/excel-automation | /Excel.py | UTF-8 | 1,985 | 3.296875 | 3 | [] | no_license | import openpyxl
from openpyxl.styles import Font
import datetime
import re
filename = 'spendings.xlsx'
wb = openpyxl.load_workbook(filename)
ws_names = wb.sheetnames
print(wb.sheetnames)
sheetname = input('What sheet do you need? T/O: ')
sheet_index = ws_names.index(sheetname)
wb.active = sheet_index
def counting... | true |
44cfe9a1d5d5d5ab86765cd160608b117b3e3a3f | Python | danwallach/github-classroom-utils | /github_org_teams.py | UTF-8 | 1,346 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # github_org_teams.py
# Stephen Wong <swong@rice.edu>
# Available subject to the Apache 2.0 License
# https://www.apache.org/licenses/LICENSE-2.0
import argparse
from github_config import *
from github_scanner import *
import requests
def main():
"""
List all the teams in a GitHub organization and information... | true |
27a570d6b0ed2cbeae6f76d491b27e9eef2c351b | Python | benediktwerner/AdventOfCode | /2015/day25/sol.py | UTF-8 | 541 | 3.015625 | 3 | [
"CC0-1.0",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/env python3
from os import path
import itertools
import re
def ints(string):
return list(map(int, re.findall(r"-?[0-9]+", string)))
with open(path.join(path.dirname(__file__), "input.txt")) as f:
row, column = ints(f.read())
val = 20151125
for diag in itertools.count(1):
r, c = d... | true |
ced5ba2dab8fb1c9252fbdddceed520712463d1a | Python | mendesbarreto/machine-learing-course | /introdution-to-python/movie_recommendation.py | UTF-8 | 2,426 | 2.75 | 3 | [
"MIT"
] | permissive | import numpy as numpy
import pandas as panda
import matplotlib.pyplot as plot
import seaborn as searborn
import os
dir_name = os.path.dirname(__file__)
column_names = ['user_id', 'item_id', 'rating', 'timestamp']
rating_data_frame = panda.read_csv(dir_name + "/data/u.data",
sep='\t'... | true |
c49b3d15857673aedc4cd76eeb969a7bdd7c3c44 | Python | JakMok/PW_lab2_3_2021 | /zad4.py | UTF-8 | 368 | 3.546875 | 4 | [] | no_license | def is_k_correct(k, size):
if not k.isdigit():
return False
k = int(k)
return k > 0 and k <= size
def kth(elemens):
inupt_is_correct = False
while not inupt_is_correct:
k = input("Enter the number: ")
inupt_is_correct = is_k_correct(k, len(elemens))
return elemens[-int(k... | true |
ddc537f1c7885a7e7f48bf4761a2f527c861a57e | Python | aksharanigam1112/MachineLearningIITK | /packageML04/ML13(n).py | UTF-8 | 228 | 3.359375 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-np.pi , np.pi , 256 , endpoint=True)
print("x = ",x)
s = np.sin(x)
c = np.cos(x)
plt.grid(True)
plt.axis([-4,4,-2,2])
plt.plot(x,s)
plt.plot(x,c)
plt.show()
| true |
79a77b4390c4e81381320ff033876f2d3ed7e953 | Python | seongkyun/DRFBNet300 | /lib/image_mover.py | UTF-8 | 1,071 | 2.90625 | 3 | [
"MIT"
] | permissive | import os
import sys
import shutil
import argparse
parser = argparse.ArgumentParser(description='Merge images into one directory')
parser.add_argument('-f', '--folder_dir', default=None, help='folders')
parser.add_argument('--dest_dir', default=None, type=str,
help='Dir to save images')
args = par... | true |
71e9b41b3e5287571b0c90afce985d3ec6d6506c | Python | scanner-research/face_recognizer | /new_sample.py | UTF-8 | 2,672 | 2.65625 | 3 | [] | no_license | import os
from faceDB.face_db import FaceDB
from faceDB.util import * # only required for saving cluster images
import random
import csv
add_method = 'features' # or "faces"
model_dir= '/Users/parimarjann/openface/models' # not required for features
faceDB = FaceDB(open_face_model_dir=model_dir,num_clusters=10, cud... | true |
5036b8d2287b929154e5def836fbe111f1b64b73 | Python | areaDetector/specsAnalyser | /sim/SimServer.py | UTF-8 | 6,499 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import sys
import SocketServer
class MyTCPHandler(SocketServer.StreamRequestHandler):
"""
The RequestHandler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement communication to the
client.
"""
def loadData(sel... | true |
fb92bb8a96dd5b4eef090d66a7f12f6fd348789e | Python | phugay/leetcodes | /backspace.py | UTF-8 | 1,067 | 3.4375 | 3 | [] | no_license | # Example 1:
# Input: S = "ab#c", T = "ad#c"
# Output: true
# Explanation: Both S and T become "ac".
class Solution(object):
def backspaceCompare(self, S, T):
# S = "ab##", T = "c#d#" , result = ""
i=0
while(S!='' and i<len(S)):
if i==0 and S[0]=="#":
print(S[0])
... | true |
1db3903432d7e6df830c8fd95cc45a3a1b9e2b8d | Python | PengiunDoomsday/lab5A | /lab5.py | UTF-8 | 2,714 | 3.828125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 25 20:04:47 2018
@author: Javier Soon
ID: 80436654
Professor: Diego Aguirre
T.A.: Manoj Saha
Description: Had to created a insert and extract the min for the heap.
after which had to sort the heap.
"""
class Heap:
def __init__(s... | true |
c3414859ee6e205dfeae110fd5c9e211ea6893bf | Python | XiplusChenyu/Object-Location-DQN | /scripts/Read_Annotations.py | UTF-8 | 3,030 | 2.75 | 3 | [] | no_license | import xml.etree.ElementTree as et
import numpy as np
from Setting import *
# @ assign an id for each class
def get_id(class_name):
if class_name == 'aeroplane':
return 1
elif class_name == 'bicycle':
return 2
elif class_name == 'bird':
return 3
elif class_name == 'boat':
... | true |
f71c7859e4f58a3c7a30848285f4e542d714de86 | Python | Bed-Ros/Test_task_CBRF | /features/steps/steps.py | UTF-8 | 2,686 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from behave import *
from features.pages import *
@Given('Зашли на сайт "google.ru"')
def step(context):
context.page = GoogleMainPage(context)
context.page.visit()
@Then('Проверили, что появилось поле "Поиск"')
def step(context):
assert context.page.search... | true |
a06902e21976559e0716d650ec45014241b67e59 | Python | jkbpvsc/jt-hmm | /src/viterbi.py | UTF-8 | 1,561 | 2.703125 | 3 | [] | no_license | import numpy as np
def viterbi(
observations,
states,
starting_probabilities,
sequence_of_observations,
transition_matrix,
emission_matrix,
):
t = len(sequence_of_observations) - 1
z = [0] * (t + 1)
x = [0] * (t + 1)
t1 = [[0] * len(sequence_of_observat... | true |
2f91a2f3d04bb3a0c40ce7aa27edecd3a126f89d | Python | neoniemand/rp4 | /servo_motor/waste.py | UTF-8 | 257 | 2.8125 | 3 | [] | no_license | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
p = GPIO.PWM(12,50)
p.start(0)
p.ChangeDutyCycle(2.5)
sleep(1)
p.ChangeDutyCycle(7.5)
sleep(1)
p.ChangeDutyCycle(12.5)
sleep(1)
p.stop()
GPIO.cleanup()
| true |
fe4a07c0f98d2bb40dcb09af3b2070618e27b573 | Python | liuyibox/ECEN765-Machine-Learning-with-Networks | /programming-02/Perceptron_L1_Avg.py | UTF-8 | 3,986 | 2.65625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
path_train = 'bclass-train'
path_test = 'bclass-test'
data_train = []
data_test = []
#i = 0
try:
with open(path_train) as f:
for line in f:
data_train.append([float(number) for number in line.split()])
# data_train[i][0]... | true |
7a281f71099908ce1dd02902195526ea35e233e3 | Python | demikaiser/BeautifulCodingWithProcessingPyBasic | /10. Interactivity with Mouse/reference_mouseDragged_/reference_mouseDragged_.pyde | UTF-8 | 165 | 2.59375 | 3 | [] | no_license | def setup():
size(640, 320)
def draw():
background(0)
textSize(64)
def mouseDragged():
text("mouseDragged!", 50, 100)
| true |
d885c42466f68b13eeb6eb26709d1cc86f921549 | Python | ImArcangel/Q-Point-Diode | /ensayos.py | UTF-8 | 100 | 2.609375 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
dates = pd.date_range('20130101', periods = 6)
print(dates) | true |
93610926ad94c170b079cfcb1ebcbc003df968b0 | Python | hector81/Aprendiendo_Python | /Modulo_pathlib_y_shutil/Ejercicio7_leer_numero_extensiones_fichero.py | UTF-8 | 1,894 | 3.8125 | 4 | [] | no_license | """
EJERCICIOS MÓDULO pathlib (Y shutil)
7. Liste los ficheros C:\windows\system32 "listado_windows.txt" para determinar
el número de ficheros que tienen igual extensión.
"""
from pathlib import Path
import glob
import os
# FUNCIONES
def leer_devolver_ListaFicheros(ruta):
listaArchivos = []
with op... | true |
96d60c9f4b14e445407e5d5b3005566892c82bed | Python | wthomare/Asso_Comptabilite | /MiniOgl/LinePoint.py | UTF-8 | 3,392 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# This file is part of MiniOgl.
#
# MiniOgl is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# MiniOgl is dis... | true |
e9f713af9b0f5c7156251c55ac570d06c99187f4 | Python | zhangysh1995/python-sockets | /Webserver/WebServer.py | UTF-8 | 1,582 | 2.921875 | 3 | [] | no_license | from socket import *
import os.path
def start():
serverPort = 2222
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('127.0.0.1', serverPort))
serverSocket.listen(1)
# handling request
runServer(serverSocket)
def runServer(ssocket):
while True:
print('Ready to serve...')
try:
client, a... | true |
efa6993cf186d402bc0cce6880f8517545c1b733 | Python | Balowen/python_crashcourse | /5_if/toppings.py | UTF-8 | 777 | 3.09375 | 3 | [] | no_license | available_toppings = ('mushrooms', 'ketchup', 'pineapple',
'onions', 'cheese', 'olives')
requested_toppings = ['mushrooms', 'ketchup',
'onions', 'cheese', 'french fries']
# requested_toppings = []
# if requested_toppings != 'anchovies':
# print("Hold the anchovies!")
#
... | true |
d2d9bcc5880ada904a4ee2ad5802e80cc6a3a4e3 | Python | logicmonkey/python | /skx_zz_s_to_xy.py | UTF-8 | 1,811 | 3.53125 | 4 | [] | no_license | # Zig Zag space filling curve xy to s mapping for a W*W region
#
# Define diagonals as the sum of the x and y coordinates since it is a
# constant. To the right of the main diagonal the calculation needs to be
# aware of the region width, so the function call uses -x and -y to achieve
# a 180 degree flip (effectively a... | true |
b68c6a2958450bd415df4149e1260bdf3e6f3565 | Python | KFranciszek/pylove-2 | /0021/09_odwazniki.py | UTF-8 | 639 | 3.578125 | 4 | [] | no_license | def odwazniki(weight1, weight2):
''' Napisz funkcję, która znajdzie liczbę odważników o wadze A aby
zrównoważyć szale wagi z odważnikami o wadze B. Przykład działania:
>>> odwazniki(2, 8)
4, 1
>>> odwazniki(4, 6)
3, 2'''
if weight1 > weight2:
first_val = weight1
else:
fi... | true |
e04bd3d9525fc5ccde53d0764279889a07a8b59e | Python | CipherCit/module_3 | /c1b3rwall.py | UTF-8 | 1,583 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib, binascii
def pbkdf2sha1hex(x, salt, iters):
h = hashlib.pbkdf2_hmac('sha1', x, salt, iters)
return binascii.hexlify(h)
def pbkdf2sha256hex(x, salt, iters):
h = hashlib.pbkdf2_hmac('sha256', x, salt, iters)
return binascii.hexlify(h)
print... | true |
584518029f86a0b8cf81a5f6aefbea28ec0cb090 | Python | P79N6A/first-reptile | /test/reptile/test.py | UTF-8 | 120 | 2.921875 | 3 | [] | no_license | import datetime
import arrow
def get(inter):
print(arrow.now().shift(months=-inter-1).format("YYYY-MM-DD"))
get(1) | true |
55402d15f6b3f628a66869c5cea57d58c3c2d574 | Python | DomenPozrl/NLP | /CRF/experiment_3_strip1/grid_search.py | UTF-8 | 8,601 | 2.796875 | 3 | [] | no_license | import pickle
import time
import sklearn_crfsuite
from sklearn_crfsuite import metrics
def load_train_test(X_filename: str, Y_filename: str, train: float, test: float):
train_test_limit = train / (train + test)
with open(X_filename, 'rb') as f:
X = pickle.load(f)
train_X = X[:round(train_test... | true |
a3650369e414b7e00f8244855738c935b913bff1 | Python | samratp-zz/Naive-Bayes-Examples | /Gaussian.py | UTF-8 | 534 | 3.046875 | 3 | [] | no_license | # see jupyter notebook to know more about Naive Bayes classifier
''''
Formula of naive bayes
P(H|E) = P(E|H) * P(H) / P(E)
given the evidence.
P(H|E) - Posterior probability of 'H' given the evidence.
p(H) - Prior probability.
P(E) - Prior probability that the evidence itself is true.
P(E/H) - Likelihood of t... | true |