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 |
|---|---|---|---|---|---|---|---|---|---|---|
8cd4dfe731cc4b8f2f254dfbcce3e2b2a5bed003 | mehmaniayaz/credit_default | /test/test_setup.py | UTF-8 | 1,624 | 3.140625 | 3 | [
"MIT"
] | permissive | import unittest
from pandas._testing import assert_frame_equal
from src.setup import *
class TestSetUp(unittest.TestCase):
def test_generate_cat_num_dataframe(self):
df = generate_cat_num_dataframe(n_samples=100, n_features=10, n_cats=2)
# generated dataframe will in fact have 11 features with the... | true |
758d2421117559dde52b1533aaa6de7943a4c815 | LalHan/pyqt5 | /demo.py | UTF-8 | 2,527 | 2.53125 | 3 | [] | no_license | import sys
import serial
import re
import binascii
import _thread
import time
import serial.tools.list_ports
from UI1 import Ui_MainWindow
from PyQt5 import QtWidgets
class PC_software(QtWidgets.QMainWindow,Ui_MainWindow):
def __init__(self):
super(PC_software,self).__init__()
self.setupUi(se... | true |
2750592eae8b4238977d1cfccf9eadaaaec118f1 | sagarkukreja/Python-and-Data-Structures | /Lab3/polygons.py | UTF-8 | 3,334 | 3.84375 | 4 | [] | no_license | __author__ = 'sk'
"""
CSCI 603 = Assignment 03
File: polygons.py
Language: python3
Author: Sagar Kukreja sk3126@rit.edu
The program draws polygons using recursion and returns the total length of sides drawn.
"""
import turtle
import sys
#constants for color used at each depth
COLORS = 'red','orange','... | true |
429db64546868639750ee3855bfa047efa1f1c0c | laurelton/CtCI-6th-Edition-Python | /Chapter1/4_Palindrome Permutation/PalindromePermutation.py | UTF-8 | 967 | 3.65625 | 4 | [] | no_license | # O(N)
import unittest
def pal_perm(phrase):
odd_count = 0
counts = {}
for char in phrase:
if not char.isalpha():
continue
lttr = char.lower()
if lttr not in counts:
counts[lttr] = 0
counts[lttr] += 1
odd_count += 1 if counts[... | true |
b8164244d48590b5a01fc1870c0089b912493bba | Jahsmine/flaskrestapi | /resources/user.py | UTF-8 | 902 | 2.734375 | 3 | [] | no_license | from flask_restful import Resource
from flask_restful import reqparse
from models.user_model import UserModel
class UserRegister(Resource):
parser = reqparse.RequestParser()
parser.add_argument("username",
type=str,
required=True,
help="T... | true |
f1f18c123b221d78d1d23feadd9eccde81b06d18 | BruceHi/leetcode | /month4/pick.py | UTF-8 | 1,520 | 3.8125 | 4 | [] | no_license | # 398. 随机数索引
from typing import List
from collections import defaultdict
from random import choice
# class Solution:
#
# def __init__(self, nums: List[int]):
# self.dic = defaultdict(list)
# for i, num in enumerate(nums):
# self.dic[num].append(i)
#
# def pick(self, target: int) ->... | true |
864f699af43e70ffbd5a2fb3886d0ac00a0f90c4 | Jackson-Sherman/Misc | /python/Audio_visual/image_altering.py | UTF-8 | 726 | 2.75 | 3 | [] | no_license | from PIL import Image
def reflect(ima, xaxis=False, yaxis=False):
assert isinstance(ima, Image)
im = Image.new("RGBA", ima.getBBox()[2:])
imgStr = '/Users/jacksonsherman/Downloads/lil-nas-x-7-ep.png' # '/Users/jacksonsherman/Downloads/montero.png'# input("filepath to the png: ")
width = 8 # int(input("... | true |
456d455fa81f260773e630e614d061639964d535 | NiklasKroeger/project_euler | /python/problem021.py | UTF-8 | 393 | 3.875 | 4 | [] | no_license | #!/usr/bin/python3
def divisorsum(n):
"""Returns the sum of the divisors of n"""
summe=0
for i in range(1,(int((n/2)+1))):
if n%i==0:
summe+=i
return summe
def main(n):
sums=[0]
while len(sums)<n:
sums.append(divisorsum(len(sums)))
summe=0
for i in range(0,len(sums)):
for j in range(i+1,len(sums)):
... | true |
436c39c83205e9be4309bbaff646de0108e1e2cc | daniel-reich/ubiquitous-fiesta | /hfBoDAN8YMz7cxGqB_18.py | UTF-8 | 834 | 2.84375 | 3 | [] | no_license |
def validations(hh, hw, hd, rh):
maxHeight = 20
if (hh + rh) > maxHeight :
return "No permission."
landwidth = 50
pathwaySize = 3
if (hw + (2 * pathwaySize)) > landwidth \
or (hd + (2 * pathwaySize)) > landwidth:
return "House too big."
windowWidth = 4
if ((2 * windowWidth) + 3) > hd \
... | true |
90ac3156565b8788074ca01145c730bc01dff134 | ZeNobral/pydeepltranslator | /pydeepltranslator/__init__.py | UTF-8 | 3,586 | 2.703125 | 3 | [] | no_license | import requests
import json
from concurrent.futures import ThreadPoolExecutor
from time import sleep
from pydeepltranslator.exceptions import *
class DeepLTranslatorApi:
_API_ENDPOINT = 'https://api.deepl.com/v1/translate'
_ACCEPTED_LANGUAGES = {'EN', 'DE', 'FR', 'ES', 'IT', 'NL', 'PL'}
_ACCEPTED_TAG_HAN... | true |
38be9f13ad19b0fb784098716c5414180f978cf4 | Aasthaengg/IBMdataset | /Python_codes/p04005/s453084230.py | UTF-8 | 294 | 3.3125 | 3 | [] | no_license | # 2020/04/30
# AtCoder Grand Contest 004 - A
# Input
abc = list(map(int,input().split()))
# Even Check
evenflg = False
for i in range(3):
if abc[i] % 2 == 0:
evenflg = True
break
if evenflg:
ans = 0
else:
abc.sort()
ans = abc[0] * abc[1]
# Output
print(ans)
| true |
ccff847e3e4523e86f589f68aae90d04279d543d | foss-np/e-barnamala | /eBarnamala/tests/testCalc.py | UTF-8 | 8,506 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# calculator.py
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, wx.ID_ANY, "Testing", wx.DefaultPosition, wx.Size(300, 250))
sizer = wx.BoxSizer(wx.VERTICAL)
self.display = wx.TextCtrl(self, -1, '', style... | true |
607238f2e32056053e9982de109c3586e5b55c7b | Max0601/Kernel-Methods-Challenge | /bioKernel.py | UTF-8 | 6,506 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 15:12:41 2021
@author: maxim
"""
#spectrum and mismatch kernels
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy.special import expit
from itertools import product
#spectrum and mismatch kernels
def char_combin(n, ... | true |
c233b2635d8a2bdc65a237883d527501913e9659 | viikkkas/MLpractice | /unsupervised.py | UTF-8 | 941 | 2.78125 | 3 | [] | no_license |
import pandas as pd
from mlxtend.preprocessing import TransactionEncoder
from mlxtend.frequent_patterns import apriori
dataset=[['Milk', 'Butter', 'Bread', 'Eggs'],
['Onion', 'Potato', 'Eggs', 'Salt'],
['Milk', 'Bread', 'Potato', 'Salt'],
['Milk', 'Bread', 'Potato', 'Salt', 'On... | true |
50a55fabeb70d51796749056e93f506d03df36db | SmartCord/Jarvis-V2 | /startup_modules/test.py | UTF-8 | 63 | 2.5625 | 3 | [
"MIT"
] | permissive | import time
while True:
print("YEETUS")
time.sleep(5)
| true |
8689671d97582f7596fb76994f581bd2a848f9b9 | Aasthaengg/IBMdataset | /Python_codes/p03345/s328053171.py | UTF-8 | 146 | 2.984375 | 3 | [] | no_license | a,b,c,k= map(int,input().split())
s = a+b+c
ans = a - b
if ((-1)**k)*(a-b) <= 10 **18:
print(((-1)**k)*(a-b) )
else:
print('Unfair') | true |
d52340a447ccd234210894a1fcf519cf328ca39f | Egahi/csc320 | /InsertionSort.py | UTF-8 | 1,564 | 4.53125 | 5 | [] | no_license | '''
Insertion Sort
Given an array, A
InsertionSort(A)
for i = 2 to A.length
key = a[i]
// insert key into sorted array A[1..i-1]
j = i - 1
while j > 0 and A[j] > key
A[j + 1] = A[j]
j = j - 1
A[j + 1] = key
Runtime:
Best case -> O(n)
Worst case ->... | true |
bee3c7d4961de377bc1fe697ff57d4958d463cba | poojithayadavalli/codekata | /maxprofit.py | UTF-8 | 135 | 3.09375 | 3 | [] | no_license | n=int(input())
s=input().split()
l=[]
for i in range(n-1):
for j in range(i+1,n):
l.append(int(s[j])-int(s[i]))
print(max(l))
| true |
06f21d729b47248228095c623494067489b2cf41 | salujaharkirat/ds-algo | /string/anagrams.py | UTF-8 | 585 | 3.4375 | 3 | [] | no_license | """
https://leetcode.com/problems/group-anagrams
"""
class Solution:
def hashmap_approach(self, strs):
temp_map = {}
for element in strs:
count = [0] * 26
for c in element:
count[ord(c) - ord('a')] += 1
count = str(count)
if count in ... | true |
bde7c8ee9eec674f6d7b27b59b0616e6798130ab | jennhu/cards-agent | /plot.py | UTF-8 | 3,760 | 2.984375 | 3 | [] | no_license | '''
THIS FILE IS CURRENTLY NOT IN USE.
'''
# import matplotlib.pyplot as plt
# import numpy as np
# import time
# import game
# if __name__ == '__main__':
# numTrials = 50
#
# alphas = [[1,1,1], [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]
# ps = [0, 0.25, 0.5, 0.75]
#
# # create plot... | true |
3b9c6f72b3d1a8b53e7defc9e62bb428188a39aa | LeATeP/100-days-of-code | /day29-password-manager/main.py | UTF-8 | 4,260 | 3 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox as ms
import random
import json
import pyperclip
# ---------------------------- PASSWORD GENERATOR ------------------------------- #
# Password Generator Project
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's'... | true |
d225116f77eec2df6742525ac6ea85a32af6077d | ashish-srivastava92/GladmindsAshish | /src/gladminds/wsgi_wrapper.py | UTF-8 | 1,245 | 2.671875 | 3 | [] | no_license | """
This is not used anymore. but keeping it in project, perhaps we need it in future
"""
from spyne.server.wsgi import WsgiApplication
from spyne.util.wsgi_wrapper import WsgiMounter
class GladmindsWsgiMounter(WsgiMounter):
"""Simple mounter object for wsgi callables. Takes a dict where the keys are
uri frag... | true |
cda2088f53932e5661f94c932cc6c67987171923 | mouyleng2508/PycharmProjects | /week02:ex/23_make_list.py | UTF-8 | 209 | 3.1875 | 3 | [] | no_license | import json
def make_list(a, b, c):
list = []
new_list = list.append(a)
new_list = list.append(b)
new_list = list.append(c)
return json.dumps(list)
a = make_list(21, "Hello", 45)
print(a)
| true |
a76525a80aa0fddad7c6b2b52550f74feff7fa59 | offbynull/offbynull.github.io | /docs/data/learn/Bioinformatics/output/ch7_code/src/Stepik.7.7.ExerciseBreak.CreateNeighbourJoiningMatrixForMatrices.py | UTF-8 | 2,994 | 3.78125 | 4 | [] | no_license | from itertools import product
# EXERCISE BREAK
# --------------
# Exercise Break: Before implementing the neighbor-joining algorithm, try applying it to the additive and non-additive
# distance matrices shown below.
#
# v1 v2 v3 v4 v1 v2 v3 v4
# v1 0 13 21 22 v1 0 3 4 3
# v2 13 0 12 13 ... | true |
bd0cf08ba176323cfa973ab5deb2b092d3e46a6a | gsorianob/excelutils | /tests_string_utils.py | UTF-8 | 3,168 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from django.test import TestCase
from excelutils.string_utils import agregar_espacios_luego_de_cada_coma_y_cada_punto, get_short_text
class StringUtilsTest(TestCase):
def test_agregar_espacios_en_blanco_a_string_con_comas(self):
expected = u'Esto, debería, estar, separado, por, com... | true |
99b662585ee5f74fd86578679bd5f2a288065e4c | linitachi/LeetCode_Practice | /easy/7.整数反转.py | UTF-8 | 988 | 3.078125 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=7 lang=python3
#
# [7] 整数反转
#
# @lc code=start
class Solution:
def reverse(self, x: int) -> int:
# if x < 0:
# x = -x
# x = '-'+str(x)[::-1]
# else:
# x = str(x)[::-1]
# x = int(x)
# if x < -2**(31) or x > 2**31-1:
... | true |
841cb4b9758bcd8c65c6feedb68cdc44d3a9638f | ebete/MC_HiC | /subsample_fasta.py | UTF-8 | 2,053 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import gzip
import logging
import os
import random
from Bio import SeqIO
import utils
random.seed(1337)
def subsample_fasta(fasta_file, out_dir, n):
"""
Splits a FASTA file into n FASTA files, randomly distributing the records
in a balanced fashion.
:param f... | true |
0b345fba72e584da35160cd1d4c0c8323c2e64c8 | SubhamKumarPandey/DSA | /algorithms/Python/strings/longest_common_subsequence.py | UTF-8 | 633 | 3.265625 | 3 | [
"MIT"
] | permissive | class Solution:
def longest_common_subsequence(self, text1: str, text2: str) -> int:
n,m = len(text1),len(text2)
grid=[[0] * (m+1) for z in range(n+1)]
for i in range(n):
for j in range(m):
if text1[i]==text2[j]:
... | true |
1c250e742b8471b0251be82071f3a3969c1c7352 | kartikmehta09/pvfactors | /pvfactors/view_factors.py | UTF-8 | 13,013 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from future.utils import iteritems
from shapely.geometry import LineString
import numpy as np
import logging
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
np.set_... | true |
6facaa35c12388f77b89cb95e165d5edc1bb8f3d | andreef1981/cnCameraAndPipeline | /calGain1.py | UTF-8 | 2,850 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 09:45:58 2018
@author: Andre Fehlmann (afehlmann@nso.edu)
Revision history
----------------
"""
import numpy as np
from astropy.io import fits
from cnPipeline import *
from ddLinearity import *
def calGain1(data,
stagePositio... | true |
93a8c2e471510339b1c78770ce243f27aa4c4751 | coinse/pyggi | /example/repair_java.py | UTF-8 | 3,207 | 2.703125 | 3 | [
"MIT"
] | permissive | """
Automated program repair ::
"""
import sys
import random
import argparse
import os
from pyggi.base import Patch
from pyggi.line import LineProgram
from pyggi.line import LineReplacement, LineInsertion, LineDeletion
from pyggi.tree import TreeProgram, XmlEngine
from pyggi.tree import StmtReplacement, StmtInsertion, ... | true |
ada9dfe61f6f24df00584302521e29ff87753dd8 | sarguhl/Exyls-Bot-LOL | /lib/cogs/commands.py | UTF-8 | 1,714 | 2.625 | 3 | [] | no_license | import datetime
import platform
import time
from datetime import datetime, timedelta
from platform import python_version
from time import time
import discord
from discord import __version__ as discord_version
from discord.ext import commands
class Commands(commands.Cog):
def __init__(self, bot):
self.bot ... | true |
006044eec3b1c3ddcb182710ade3728117c50078 | structuralbioinformatics/SPServer | /SBI/structure/atom/AtomOfAminoAcid.py | UTF-8 | 659 | 2.515625 | 3 | [
"MIT"
] | permissive | """
AminoAtom
author: jbonet
date: 02/2013
@oliva's lab
"""
from . import Atom
class AtomOfAminoAcid(Atom):
"""
An {AtomOfAminoAcid} is simply a point in space defined by 3 coordinates
WITH specific functions for atoms in amino acids
"""
backbone_atoms = set(['N', 'CA', 'C'])
#
# BO... | true |
4ed1928c1913d43bf988617abbbce340746601a3 | DonMushr00m/scion | /tools/pktprint.py | UTF-8 | 1,086 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
# Copyright 2016 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/LICENSE-2.0
#
# Unless required by applicable law or agreed... | true |
ac11db47ff060be49530f20757598216e46bb7c8 | 89Mansions/AI_STUDY | /ml/m31_pca_mnist.py | UTF-8 | 14,453 | 2.984375 | 3 | [] | no_license | # 실습
# pca를 통해 0.95 인 것은 몇 개인가?
# pca 배운 거 넣어서 코드 완성
import numpy as np
from tensorflow.keras.datasets import mnist
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline
#1. DATA
(x_train, _)... | true |
50742833d53555db8170af757eaffdc34cded96b | jokfletc/Informatics_I210 | /Home Work/jokfletc_homeowrk2.py | UTF-8 | 2,597 | 4.59375 | 5 | [] | no_license | #John Fletcher
#Homework 2
###3.19
a,b,c = 3,4,5
##a
# if statement, for if a is less than b it prints "OK".
if a < b:
print("OK")
#Else statement so that when a is not less than b it prints "NOT OK"
else:
print("NOT OK")
##b
# if statement, for if c is less than b it prints "OK".
if c < b:
prin... | true |
0ea6016da8a658394e731b3bc126db17fd907c04 | carlcortright/OpenSourceMiners | /code/clean.py | UTF-8 | 621 | 2.921875 | 3 | [] | no_license | #
# Cleans each of the main datasets.
#
import os.path as path
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import missingno as msno
import sys
# Open the file to be cleaned
fpath = sys.argv[1]
if(path.isfile(fpath)):
f = pd.read_csv(fpath, low_memory=False)
else:
print("ERROR: %s is an inval... | true |
f228947ccf4f2de31538a1f3e6391e1955fc0f34 | huyuan95/Learn-Python | /Python Crash Course/chapter15/cube.py | UTF-8 | 383 | 3.328125 | 3 | [] | no_license | import matplotlib.pyplot as plt
x_values = list(range(1, 5000))
y_values = [x**3 for x in x_values]
plt.scatter(x_values, y_values, c=y_values, cmap=plt.cm.Blues,
edgecolor = 'none', s = 4)
plt.title("Cube Numbers", fontsize = 24)
plt.xlabel("Value", fontsize = 14)
plt.ylabel("Cube of Value", fontsize = 1... | true |
d3715f988a3ebbc4175b1222e168f6fef7aad0fb | xuxiaoyu89/python | /dynamic_programming/123_188_best_time_to_buy_and_sell_stock.py | UTF-8 | 1,061 | 3.859375 | 4 | [] | no_license | '''
123.
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
'''
'''
buy1 -> keep it as low as possible -> max(buy1, -i)
sell1 -> keep it as high as possible -> max(sell1, buy1 + i)
buy2 -> k... | true |
06adc4eaf076bb0dcc38d35d3c8d3bc70dde1750 | kpietrow/Regex | /RegSearcher_withDatabase.py | UTF-8 | 7,326 | 3.59375 | 4 | [] | no_license | # Kevin Pietrow
# Regex searching on large text file
import re
import sys
import os
# set up global array for storing results
allSearchResults = []
# set up global counter for amount of searches
totalSearches = 0
# Class for searches
class Reg_Search(object):
def __init__(self, search_number, expression, resu... | true |
7b285b5cb3a661298ba0bfd99ff50cccba51d4b2 | karekear/nlp100 | /chap2/016.py | UTF-8 | 862 | 3.71875 | 4 | [] | no_license | """
hightemp.txtは,日本の最高気温の記録を「都道府県」「地点」「℃」「日」のタブ区切り形式で格納したファイルである.
以下の処理を行うプログラムを作成し,hightemp.txtを入力ファイルとして実行せよ.
さらに,同様の処理をUNIXコマンドでも実行し,プログラムの実行結果を確認せよ.
016
自然数Nをコマンドライン引数などの手段で受け取り,入力のファイルを行単位でN分割せよ.同様の処理をsplitコマンドで実現せよ
"""
N = int(input(">>"))
with open("hightemp.txt","r") as f:
l = f.readlines() #... | true |
77d787eff9e9dca00c88c36e391b4c31bbbf3963 | richardstartin/richardstartin.github.io | /assets/2020/04/4k-aliasing/benchmarks.py | UTF-8 | 2,362 | 2.546875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
def rename_columns(name):
if name == 'Score Error (99.9%)':
return 'error'
else:
return str.lower(name).replace('param: ', '')
def plot(input):
df = pd.read_csv(input)
df = df.rename(rename_columns, axis='columns')\
.drop(co... | true |
1d11816d406702615ffb9a98107773cfb3779542 | gut/mc910-labs | /trab1/exercise1.py | UTF-8 | 8,672 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2009 - Gustavo Serra Scalet <gsscalet@gmail.com>
# This program 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 3 of the L... | true |
2f18181c5878ad2d375d1404348d6b892a93003b | 108krohan/codor | /hackerrank-python/contests/101_hack_20_august/editorial/editorail - grid_maze.py | UTF-8 | 2,852 | 3.640625 | 4 | [] | no_license | """
Let's denote the maze border as B. Cost to move to a cell containing wall is one and cost to move to an empty cell is zero.
Now look at the optimal S−P−B path. First, we destroyed some walls to get from S to P. We want to get to B not necessarily from P but from any cell in path S−P, because every cell on this... | true |
1f76fd50573d4a6ca9b6758aefae350dafa4067a | myungjunChae/algorithm | /samsung/[D4]미로/main.py | UTF-8 | 1,177 | 3.0625 | 3 | [] | no_license | import sys
def solution(A):
x = 1
y = 1
visit = [[0 for i in range(0,16)] for j in range(0,16)]
def dfs(x,y):
#end 조건
if A[x][y-1]==3 or A[x][y+1]==3 or A[x-1][y]==3 or A[x+1][y]==3:
return 1
if y-1 >= 0 and A[x][y-1] == 0 and visit[x][y-1] == 0:
visit[... | true |
4f6315bc4cb9102e690539cb8e73af95a0404940 | walede/Tweepy-Stream-and-Store-Tweets | /build/elastic_search.py | UTF-8 | 2,119 | 3.21875 | 3 | [] | no_license | from elasticsearch import Elasticsearch
import requests
import json
def connect_elasticsearch():
"""Connects to the elasticsearch server
and returns the ES object.
"""
_es = None
_es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
if _es.ping():
print('Connected!')
else:
... | true |
fe97058cbf9d498753c4315ffa438a6c06c13fff | Yukkiasuna-sao/sklearnML | /NB.py | UTF-8 | 1,029 | 2.96875 | 3 | [] | no_license | # coding=utf-8
# 从sklearn.datasets里导入新闻数据抓取器fetch_20newsgroups。
from sklearn.datasets import fetch_20newsgroups
# 与之前预存的数据不同,fetch_20newsgroups需要即时从互联网下载数据。
news = fetch_20newsgroups(subset='all')
# 查验数据规模和细节。
print len(news.data)
# print news.data[0]
from sklearn.model_selection import train_test_split
X_train, X_te... | true |
efe2c97697fc5cccefbec1d6184cda8acc6c2f01 | ansjcy/clode | /blockchain/blockchain.py | UTF-8 | 14,338 | 2.796875 | 3 | [
"MIT"
] | permissive | import hashlib
import json
import time
from urllib.parse import urlparse
from uuid import uuid4
import requests
from flask import Flask, jsonify, request
import config
import socket
from multiprocessing import Process
import pickle
import random
import math
from Crypto.PublicKey import ElGamal
from Crypto.Util.number i... | true |
2deb464d9be46391f381827830602a4c30a99b7a | PandoraLS/python_toys | /RegexNFA/test.py | UTF-8 | 733 | 3.09375 | 3 | [
"MIT"
] | permissive | from Regex import Re
prog = Re.compile('[pj]ython')
result = prog.match('python')
if result:
print('separate compile and match success')
result = Re.match('[pj]ython', 'jython')
if result:
print('match success')
pattern = Re.compile("d")
if pattern.search("dog"): # Match at index 0
print('Found it')... | true |
9a70405eaf6925e88ed9ffaaaca62070d2697344 | loggar/py | /py-core/List/list.unpack.4.py | UTF-8 | 110 | 3.484375 | 3 | [] | no_license |
string = "Let's learn Python"
# We want to assign the unpacked result in var1
var1 = [*string]
print(var1)
| true |
c32b02b80389cc267d641aee51323b5323646bef | strongSoda/gopy | /gopy/search/bsearch.py | UTF-8 | 1,267 | 4.03125 | 4 | [
"MIT"
] | permissive | """
Binary search is the most popular Search algorithm. It is efficient and also
one of the most commonly used techniques that is used to solve problems.
If all the names in the world are written down together in order and you want
to search for the position of a specific name, binary search will accomplish
this in... | true |
8b8480407b1f0ad3ad60e4497a97a2e5adb9d8dd | Konohayui/Codewars | /python/Maximum subarray sum.py | UTF-8 | 229 | 2.96875 | 3 | [] | no_license | def maxSequence(array):
if array == []:
return 0
m = array[0]
M = m
for i in range(1, len(array)):
m = max(array[i], m + array[i])
M = max(M, m)
if M < 0:
return 0
return M
| true |
7d898e83887dcb5ead1a83e719fa9b4c9ec5a0cc | HeDefine/LeetCodePractice | /Q198.打家劫舍.py | UTF-8 | 1,432 | 3.96875 | 4 | [] | no_license | #!/usr/bin/env python3
# https://leetcode-cn.com/problems/house-robber
# 你是一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响你偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,
# 如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。
#
# 给定一个代表每个房屋存放金额的非负整数数组,计算你在不触动警报装置的情况下,能够偷窃到的最高金额。
#
# 示例 1:
#
# 输入: [1,2,3,1]
# 输出: 4
# 解释: 偷窃 1 号房屋 (金额 = 1) ,然后偷窃 3 号房屋 (金额 = 3)。
# 偷窃到的最高金... | true |
61c04d76d9ba31f2aab84609f47c648e5af557ab | BerserkerMother/SnowFall | /snowfall/nn/network.py | UTF-8 | 1,282 | 2.546875 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
from snowfall.core import SnowObject
class Network(nn.Module, SnowObject):
def __init__(self):
super().__init__()
self.modules = []
def add_layer(self, layer):
name = None
if isinstance(layer, tuple):
if len(layer) == 1:
modul... | true |
4ce0513849f11756c703c799184acc127047f34e | kungbob/Leetcode_solution | /python/728_Self_Dividing_Numbers.py | UTF-8 | 479 | 2.953125 | 3 | [] | no_license | class Solution:
def selfDividingNumbers(self, left: int, right: int) -> List[int]:
result = []
for i in range(left, right + 1):
temp = i
selfDivide = True
while temp:
div = temp % 10
if not div or i % div != 0:
s... | true |
07ca54c19a46b46f188847e9162865cc3918c49c | CapucineBrft/PHYS512-tuto | /FinalProject/Part3/nbody_bounded.py | UTF-8 | 1,719 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 09:23:21 2020
@author: capucinebarfety
"""
from new_part_class import particle
import matplotlib.pyplot as plt
import numpy as np
if __name__=='__main__':
# softening parameter
soft = 0.3
# size of the grid
n = 20
#number of... | true |
8f5caba492d650f8f1488d6f1c2a7bf9bc549549 | fumer555/vocabularyTraining | /thisMain.py | UTF-8 | 1,018 | 3.171875 | 3 | [] | no_license | import json
import random
def file_len(fname):
with open(fname) as f:
for i, l in enumerate(f):
pass#Do I need to close the file?
return i + 1
# def random_line(afile):
# line = next(afile)
# for num, aline in enumerate(afile, 2):
# if random.randrange(num):
# c... | true |
02b13a9be21422515da530c5eb7b8102d9ab9373 | callmefrancis/google | /TIC-TAC-TOE python code | UTF-8 | 2,781 | 2.90625 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
def findturn():
count=0
for i in range(3):
for j in range(3):
if board[i][j] == '_':
count=count+1
return count
def evaluate(player,opponent):
for row in range(3):
if (board[row][0] == ... | true |
559a51068b3fee5c5f0ad62b004d0d9498dd637d | sallum/restaurants-kaggle | /checkDistribution.py | UTF-8 | 6,193 | 2.578125 | 3 | [] | no_license | __author__ = 'emulign'
import pandas as pd
import matplotlib.pyplot as plt
train = pd.read_csv('sources/train.csv', index_col=0)
predictions = pd.read_csv('pending-submissions/submission20150410-150349.csv', index_col=0)
# Histograms
#plt.hist(train.revenue, bins=20, label='Real')
plt.hist(predictions['Prediction'],... | true |
9f6ba1707b77d3f0820e0fe143c74ed16e6945b3 | joakimlustig/python-gp | /gp.py | UTF-8 | 3,144 | 2.671875 | 3 | [
"MIT"
] | permissive | import pylab as pb
import numpy as np
from math import pi
from scipy . spatial . distance import cdist
from scipy.stats import multivariate_normal
import matplotlib.pyplot as plt
import math
def kernel(xi,xj,sigma,lengthscale):
return (np.power(sigma,2)*np.exp(-np.power(xi-xj,2)/np.power(lengthscale,2)))
def plot... | true |
c267148019833b51cc42db4caf5f7421859272db | Twynzen/Python_udemy | /moduloPandas/ordenar_clasificarSeries.py | UTF-8 | 350 | 3.375 | 3 | [] | no_license | import pandas as pd
import numpy as np
listaValores = range (4)
listaIndices = list ('CABD')
serie1 = pd.Series(listaValores, index=listaIndices)
print(serie1)
#ordenar una serie1
print("ordenado por la serie",serie1.sort_index())
print("ordenado por los valores",serie1.sort_values())
print("ordenado por el ranking... | true |
7a4c940144f73f279b1237b446d6f26676fa2ab2 | sukeesh/Jarvis | /jarviscli/plugins/visit_website.py | UTF-8 | 2,297 | 3.140625 | 3 | [
"MIT"
] | permissive | import webbrowser
import os
import socket
from urllib.parse import urlparse
from plugin import plugin, alias, require
FILE_PATH = os.path.abspath(os.path.dirname(__file__))
@require(network=True)
@alias("visit website")
@plugin("website")
class OpenWebsite:
"""
This plugin will visit a website using some par... | true |
a11120db6b0a93c8ff2e0ed475b331dd2649db5c | hamiddimyati/stacking-regression-comparative-study | /src/skoptimize.py | UTF-8 | 8,400 | 2.71875 | 3 | [] | no_license | import numpy as np
np.warnings.filterwarnings('ignore')
from sklearn.metrics import mean_squared_error
from scipy.optimize import minimize
import scipy.stats as sc
from sko.DE import DE
from sko.GA import GA
from sko.PSO import PSO
from sko.SA import SA
from sko.AFSA import AFSA
class RandomSearch:
def __init__(s... | true |
205731c1399542a35bfb8e785325fc583f57d46e | jlopezbi/ScallingArrays | /ScaleCurve.py | UTF-8 | 755 | 3.125 | 3 | [] | no_license | import rhinoscriptsyntax as rs
# Iteratively scale down a curve until it becomes shorter than a certain length
def fitcurvetolength():
curve_id = rs.GetObject("Select a curve to fit to length", 4, True, True)
if curve_id is None: return
length = rs.CurveLength(curve_id)
length_limit = rs.GetReal("Len... | true |
87c2b3dc091962d644286bc401196ff8e745d7cc | hsbummy/multicampus_lecture | /1. Python-django/day04/p229.py | UTF-8 | 178 | 3.203125 | 3 | [] | no_license | st = {'name':'james', 'major':'it', 'age':20}
ks = st.keys()
for x in ks:
print(x)
vs = st.values()
for y in vs:
print(y)
item = st.items();
for z in item:
print(z)
| true |
319e38a0bd440fe54c92aa7b3e82261c069f8259 | sergio-gimenez/ieMaps | /app/tools/get_weather.py | UTF-8 | 5,599 | 2.8125 | 3 | [] | no_license | import forecastio
import os
from datetime import datetime
from dateutil.relativedelta import relativedelta
import pytz
import pandas as pd
import numpy as np
def output_by_list_of_columns(df):
df.time = df.time.map(lambda x: datetime.strftime(x, '%Y-%m-%dT%H:%M:%S.000Z'))
return df.to_dict("list")
def already... | true |
324b5a14f8061953626784589b98ff8efb7bae62 | sunnysinghdev/A-Gold-Crown | /GoldenCrown/crypto.py | UTF-8 | 686 | 3.671875 | 4 | [] | no_license | ALPHABET_START = 65
ALPHABET_END = 90
def encrypt(key, msg):
encryptedMsg = ""
for letter in msg:
encryptedMsg = encryptedMsg + str(get_next_letter(key, letter))
return encryptedMsg
def get_next_letter(length, letter):
nextChar = ord(letter)+length
if(nextChar > ALPHABET_END):
ret... | true |
427472aecdde9ae3611d6ba2ab6772e5018aa069 | bradgwest/paap | /art/scripts/image_dimensions.py | UTF-8 | 1,407 | 2.75 | 3 | [] | no_license | import argparse
import json
import os
import numpy as np
from skimage import io
def is_bw(image):
if len(image.shape) == 2:
return True
if image.shape[2] == 1:
return True
r, g, b = image[:, :, 0], image[:, :, 1], image[:, :, 2]
return np.array_equal(r, g) and np.array_equal(g, b)
... | true |
cf8784314619528044d83853516b3cfae636194f | behdad/afdko | /FDK/Tools/SharedData/FDKScripts/FinishInstallWindows.py | UTF-8 | 2,764 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | """
FinishInstallWindows.py v1.3 July 28 2014
"""
__copyright__ = """
Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/).
All Rights Reserved.
"""
import sys
import os
import _winreg
def isNotFDKDir(dirPath):
if not os.path.isdir(dirPath):
if "FDK" in dirPath:
print "Note: Removing old FDK path ... | true |
76e5885d49d6e9a16dc2cba08840fb4c459474d0 | yuanz4/Codeforces | /2019-2020 Pacific Northwest (Div. 1)/editorial/J. Interstellar Travel/wrong_answer/interstellartravel_hamerly_sweep.py | UTF-8 | 2,731 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python2
# compute the three types of events for each "star", which arrive in this
# order (by angle):
# - enter: the star just started contributing to the ship
# - middle: the ship is perfectly aligned with the star
# - leave: the star just finished contributing to the ship
#
# sort the events by ... | true |
3a2bafcf67cc90636fb4621f5f19be43b29fefa2 | sbbug/film-recommendation | /film_recommend/randomData.py | UTF-8 | 2,156 | 2.859375 | 3 | [] | no_license | import numpy as np
import random
import pandas as pd
import matplotlib.pyplot as plt
from pylab import mpl
from matplotlib.ticker import MultipleLocator,FormatStrFormatter
import time
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 指定默认字体
mpl.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题
# times = [1... | true |
127ef332d753d0689426d5ee33b4a8db55dc885b | eleanor-em/comfycon20-crypto | /python/exercise-2-solution/exercise2.py | UTF-8 | 3,841 | 2.609375 | 3 | [] | no_license | import os
import socket
import threading
from time import sleep
import base64
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.asymmetric import dh
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
from cryptogra... | true |
7c1ab96da029cb24f3f4654a1e068e676f3f79f2 | nikosnikitas/BongGame | /pygame_colors.py | UTF-8 | 784 | 3.1875 | 3 | [] | no_license | # pygame_colors - A set of ready-made colors for pygame
#-------------------------------------------------------
# Author: Nikos-Nikitas
# GitHub: nikosnikitas
#-------------------------------------------------------
# Just import them like this:
# from pygame_colors import *
# and use them anywhere you'd like!
# RGB
... | true |
d3211f037e4074b4b57270787699b056c19e2309 | RobStarek/QOLO_devices | /TTi1906/Tti1705.py | UTF-8 | 1,077 | 3.078125 | 3 | [
"MIT"
] | permissive | from serial import Serial
from time import sleep, time
class TTiMinimal():
"""
Minimal class for TTi1705 multimeter
Example use:
S = TTiMinimal("COM6")
x = S()
"""
dt = 1 # sleep tiem
def __init__(self, port, mode=b"IDC"):
self.port = Serial(port, baudrate=9600, timeo... | true |
918089c07a72cebd633bb529c7ac207a58e55e04 | sharadbhat/Competitive-Coding | /HackerRank/Algorithms/Luck_Balance.py | UTF-8 | 988 | 3.203125 | 3 | [] | no_license | # HACKERRANK
# https://www.hackerrank.com/challenges/luck-balance/problem
import sys
def luckBalance(n, k, contests):
luck = 0
impo_count = 0
impo_weights = []
for i in contests:
if i[1] == 1:
impo_weights.append(i[0])
impo_count += 1
else:
luck += i... | true |
20e9d36b535beab42991e7e66686f97350fd2d36 | dhvalden/flocking_sim | /boid.py | UTF-8 | 4,503 | 3.125 | 3 | [] | no_license | import random
import math
import pygame
import miscFunctions
from miscFunctions import rotatePolygon, constrainMin, mapVal
def init(width, height, surface):
global the_width, the_height, the_surface
the_width = width
the_height = height
the_surface = surface
class Boid(object):
def __init__(self, ... | true |
a67a58ec0cd7f0478dcfdd3c58ac2399dbad9bdc | Yihhao/python-1000-day | /Day-33/main.py | UTF-8 | 790 | 2.609375 | 3 | [] | no_license | import requests
from datetime import datetime
MY_LAT = "24.813829"
MY_LONG = "120.967484"
# responses = requests.get("http://api.open-notify.org/iss-now.json")
# responses.raise_for_status()
#
#
# data = responses.json()
#
# longitude = data["iss_position"]["longitude"]
# latitude = data["iss_position"]["latitude"]
#... | true |
e28f54ecde0229198f9de2146c246c8d9aa903f5 | iserranoz/credit-risk | /credit.py | UTF-8 | 9,614 | 2.765625 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import numpy as np
from xgboost import XGBClassifier
import plotly_express as px
import plotly.graph_objs as go
import seaborn as sns
import plotly.graph_objs as go
from sklearn.preprocessing import LabelEncoder
import matplotlib.pyplot as plt
import warnings
from sklearn.ex... | true |
d624b350aa3c0ef7112449a3358fec1d415bc614 | maye1996/LeetCode | /Python/Roman To Integer/roman_to_integer.py | UTF-8 | 829 | 3.46875 | 3 | [] | no_license | class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
roman_value = [1, 5, 10, 50, 100, 500, 1000]
roman_symbol = 'IVXLCDM'
result_arr = []
result = 0
for i in range(len(s)):
for j in range(len(r... | true |
ad2e4497b81a31b8786126f0471e9033472e5262 | alexisVivier/rendu_tests_unitaire | /ex4/heater.py | UTF-8 | 525 | 2.8125 | 3 | [] | no_license | from utils import PoolUtils
class Heater():
def __init__(self, functions: PoolUtils):
super().__init__()
self.pool_utils = functions
def init_heater(self):
average = self.list_average(self.functions.get_last_days_temps())
actual_temp = self.functions.get_actual_temp()
... | true |
360a4c789efc6762f13125803c70ca72a101013c | barkdoll/100-algo | /alphabeticShift/alphabetic_shift.py | UTF-8 | 330 | 3.90625 | 4 | [] | no_license |
def alphabetic_shift(input_string: str) -> str:
return ''.join(
# return 'a' if the Unicode code point is for 'z' (122)
chr(ord(char)+1) if ord(char) != 122 else 'a'
for char in input_string
)
print(alphabetic_shift('crazy'))
print(alphabetic_shift('bonkers'))
print(alphabetic_shift('w... | true |
99aba968e90af956a6e01b08e606bd91a4293057 | washing1127/LeetCode | /Solutions/1802/1802.py | UTF-8 | 870 | 2.78125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# Author: washing
# DateTime: 2022/1/4 10:50
# File: 1802.py
# Desc:
class Solution:
def maxValue(self, n: int, index: int, maxSum: int) -> int:
top = (n+1)*n//2
if top >= n: top = 0
rest = (maxSum-top) - n + top
su = 0
height = (maxSu... | true |
aff820c9e48954f62cedfadd9806de5d76766df3 | date333cs/mathematical_neuroscience | /mn_asm102.py | UTF-8 | 997 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import random
import matplotlib.pyplot as plt
random.seed(20160422)
def make_matrix(a, b, fill=0.0): # make m[a][b] NumPy を使って高速に処理する方法がある
m = []
for i in range(a):
m.append([fill]*b)
return m
class ASM:
def __init__(self, n, m):
self.n = n
... | true |
0cd49e20650c3d29b9207843e81f103ba391c06a | rjdeus/marquee | /pricetest.py | UTF-8 | 324 | 2.609375 | 3 | [] | no_license | from datetime import datetime
from iexfinance.stocks import get_historical_data
def historicalPrice(ticker, dStart, dEnd):
df = get_historical_data(ticker, dStart, dEnd, output_format='pandas')
df = df.drop('open', axis=1)
df = df.drop('high', axis=1)
df = df.drop('low', axis=1)
df.index = range(len(df))
return... | true |
39f8ffa46814a6dd175b17a32e4de684c0a08d86 | thearchduke/cuterpg | /cuterpg/collision.py | UTF-8 | 3,224 | 3.140625 | 3 | [] | no_license | import pyglet
###Collision detection!
##will_be_inside is much more useful right now for walls; can_touch probably good for doors & stuff.
def will_be_inside(player, direction, walls):
collide = False
if direction == "UP":
for wall in walls:
if (player.x + 30) >= wall['x'] and player.x <= (wall['x'] + wall['w'... | true |
3c7bf9a239b1378091896de74c0444d12233b8f2 | alexandraback/datacollection | /solutions_5688567749672960_0/Python/gilesg/A.py | UTF-8 | 412 | 3.03125 | 3 | [] | no_license | def ints():
return map(int, raw_input().split())
N = 10 ** 6 + 3
A = [0] * N
def reverse(n):
s = str(n)
return int(s[::-1])
A[1] = 1
for n in range(2, N):
A[n] = A[n-1] + 1
if n % 10:
m = reverse(n)
if m < n:
A[n] = min(A[n], A[m] + 1)
num_cases, = ints()
for case_n... | true |
1833879fee8c76a0d126892f82da058d743f8825 | Abdulkadir31/Grapholearning | /career_predict.py | UTF-8 | 1,654 | 2.96875 | 3 | [] | no_license | def career(traits):
pressure = traits[3]
LetterSize = traits[1]
Margin = traits[0]
LineSpacing = traits[2]
Slant = traits[4]
Characteristics = []
## Realistic
if LetterSize == 2 or Slant == 1:
Characteristics.append(" Food Preparation, Agriculture, Safety & Law Enforce... | true |
19e44ef5df95245d7078a4bb213f960789a93eef | Maguilera85/154-2_stgo_full_stack_python | /20201105-m2-clase-6.py | UTF-8 | 4,609 | 4.21875 | 4 | [] | no_license | import modulos as mod
import time
mod.play_me()
# 1 ==================================================================
# función simple con dos parámetros y con variable global
def sumador_de_dos_numeros(a, b):
producto = a + b
global nombre1 # hace visible nombre1 en el programa principal
nombre1 = "Est... | true |
0b309a7df26faebfd51af64d1871227782a3391e | Hnguyen1997/grepthink | /teamwork/apps/core/helpers.py | UTF-8 | 7,459 | 2.578125 | 3 | [] | no_license | # Required headers for sendgrid: (sendgrid, os)
import sendgrid
import os
from sendgrid.helpers.mail import *
from django.http import JsonResponse
from django.db.models import Q
from django.conf import settings
# Django
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_requi... | true |
d94e5b1004f9f4a2fb07cafaace9845721f44edb | zqwerty/os_course | /v2p/v2p.py | UTF-8 | 2,790 | 2.859375 | 3 | [] | no_license | import argparse
def parse_args():
'''
Parses the node2vec arguments.
'''
parser = argparse.ArgumentParser(description="example: python v2p.py --va 0x1e6f --PDBR 0xd80")
parser.add_argument('--memory', nargs='?', default='mem.txt',
help='filename of memory data')
parser... | true |
3bc0dd7ae121a838342cfde6f0b73956e468c2bf | Aasthaengg/IBMdataset | /Python_codes/p03559/s047335317.py | UTF-8 | 305 | 2.859375 | 3 | [] | no_license | import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
idx_a = bisect.bisect_left(A,b)
idx_c = bisect.bisect_right(C,b)
ans += idx_a * (N - idx_c)
print(ans) | true |
43e556679f52d0c526bf4602ca981b3df0f2584f | SMARTKT/SmartKT | /parsers/dwarfdump_parser.py | UTF-8 | 6,680 | 2.921875 | 3 | [] | no_license | # To use:
# python dwarfdump_parser.py <dwarfdump_output>
'''
There is no clear algorithm here. Just hacks. I wrote this parser as I saw fit.
Can be prone to errors while parsing outputs that I haven't encountered yet.
I will try my best to explain what I have done, but I am no good.
'''
import sys
import os
from xml... | true |
1ae498a2734776113c0b0eb9c179d68001460244 | kaljitism/Regression | /LinearRegressionFromScratch.py | UTF-8 | 1,680 | 3.8125 | 4 | [] | no_license | # Dependencies
import numpy as np
import matplotlib.pyplot as plt
class LinearRegression:
def __init__(self, features, labels):
# Parameters and Hyperparameters
self.x = features
self.y = labels
self.w = 0
self.b = 0
self.learning_rate = 0.01
self.predict... | true |
a2c49a39f2917411b0ae6c00840bb2c07331cf7d | tinku99/ahkzmq | /hwjsonserver.py | UTF-8 | 348 | 2.609375 | 3 | [] | no_license | import zmq
import time
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:5555")
while True:
# Wait for next request from client
message = socket.recv_json()
print "Received request: ", message
socket.send_json({"count": 2, 1: "echo" ,... | true |
17a6ed45f0e13da0ef38a8a7fc4852fc28772435 | MAndersen990/Calc_stuff | /Calc.py | UTF-8 | 3,262 | 5 | 5 | [] | no_license | #A simple program to find the root of a number using either the newton method, bisection method, or fixed-point method in calculus
#Please make sure to edit your function and derivitive values as the program is simple and does not do it for you
#Author: Michael Andersen
#Made Fall 2018
import math
def newton(x):
... | true |
f96447a5079ebd05495d530f957242b993e27cd2 | vladbalmos/mitzasql | /mitzasql/ui/widgets/table.py | UTF-8 | 18,896 | 2.546875 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2021 Vlad Balmos <vladbalmos@yahoo.com>
# Author: Vlad Balmos <vladbalmos@yahoo.com>
# See LICENSE file
import pickle
import hashlib
import urwid
import time
import sys
from .. import utils
from ...logger import logger
class InputProcessor():
'''
Implements support for VIM style keys & basic ... | true |
01f630bac49b2dbef0416e55072e0435a26b24b2 | forkdump/wikitopics | /src/sent/pick_recent_xml.py | UTF-8 | 953 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
"""
Print the sentence with the most recent date
"""
import sys
import re
import bisect
from xml.dom.minidom import parse
import datetime
import serifxml
import serifutils
sys.path.append('/home/hltcoe/bahn/wikitopics/src/wiki')
import utils
if __name__=='__main__':
if len(sys.argv) != 4:
pri... | true |
b88d003e1e55f5f7ea06a0e2cc1d88f8e4b2a4cc | tlc/message-security-workshop | /shared_libs/message/message/scripts/decode.py | UTF-8 | 3,167 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | """This tool signs and encrypts a message, and prints it in base64 to STDOUT."""
import base64
import os
import re
import subprocess
import sys
from argparse import ArgumentParser
from jwcrypto.jws import JWS
from message import Sign
from message import Enc
def main():
identity_name = os.getenv("IDENTITY_NAME")... | true |
440cfc200f3e6058e45f9b60e38d5540bed7da9f | Yvesvc/Django_altijdprijs | /AltijdPrijs/home/ebay_query.py | UTF-8 | 2,120 | 2.609375 | 3 | [] | no_license | import requests
def get_list_ebay(query):
url = 'https://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsAdvanced&SECURITY-APPNAME=YvesVanc-AltijdPr-PRD-260b1f533-cbdffabe&RESPONSE-DATA-FORMAT=JSON&GLOBAL-ID=EBAY-NLBE&entriesPerPage=3&sortOrder=BestMatch&keywords=' + query #get url for a... | true |
f5fab45978b514aba6dce28ae9cad8423900f613 | willemneal/Dominion | /dominion/supply.py | UTF-8 | 3,482 | 2.875 | 3 | [] | no_license | from baseCards import *
from gameObject import GameObject
class BaseSupply(GameObject):
def __init__(self,kingdomCards,numOfPlayers=4):
super(BaseSupply,self).__init__()
numOfVictories =12
if (numOfPlayers == 2):
numOfVictories = 8
self.numberOfPilesGone = 0
self... | true |