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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0cdd3888cbc56a532796220ff82793a6e62e700c | Python | adang1345/Project_Euler | /92 Square Digit Chains.py | UTF-8 | 905 | 4.5 | 4 | [] | no_license | """A number chain is created by continuously adding the square of the digits in a number to form a new number until it
has been seen before.
For example,
44 → 32 → 13 → 10 → 1 → 1
85 → 89 → 145 → 42 → 20 → 4 → 16 → 37 → 58 → 89
Therefore any chain that arrives at 1 or 89 will become stuck in an endless loop. What is... | true |
79a48a1e0c985605a6833060361a364af8f2fb49 | Python | Sergey-Laznenko/Stepik | /Generation Python - A Beginner's Course/11_list/11.5.split_join/6.py | UTF-8 | 321 | 3.515625 | 4 | [] | no_license | """
На вход программе подается строка текста, содержащая целые числа. Напишите программу,
которая по заданным числам строит столбчатую диаграмму.
"""
for i in input().split():
print('+' * int(i))
| true |
9e962c1ce481c714aaa000e91feb6341c2f0c9b1 | Python | renttrent/py-chain | /chain/merkle.py | UTF-8 | 715 | 3.484375 | 3 | [] | no_license | from hashlib import sha256
class MerkleTree:
def __init__(self, data=['1', '2', '3', '4', '5', '6']):
self.data = data
self.length = len(self.data)
self.right = sha256()
self.left = sha256()
def getMerkleRoot(self, index, hashFunc=sha256(), stack=[]):
if index >= self.... | true |
a08f2dcdfbe014a5dd9236ca78b927538a3abc21 | Python | ccr5/BlackJack | /tests/review.py | UTF-8 | 1,417 | 3.328125 | 3 | [
"MIT"
] | permissive | import unittest
import bot
import cards
import dealer
import deck
import players
class TestBlackJack(unittest.TestCase):
# Bot unittests
def bot_play_game(self):
npc = bot.Bot('test', 100)
npc.hand.append(["Aces", [1, 11], "A"], ["Two", 2, "2"])
result = npc.play_game()
self.a... | true |
a8e45680ea24096d0b364bc179f3228c85d2323b | Python | sharmapradyumn/ML-TASK-Adhoc | /matplotbars.py | UTF-8 | 313 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
import matplotlib.pyplot as plt
boys =[1,2,3,4]
gf=[2,3,10,8]
b=[12,34,56,14]
g=[6,20,40,10]
plt.bar(boys,gf,color='green',label='boys vs gf',)
plt.bar(b,g,color='blue',label='boys vs girls',)
plt.xlabel("boii")
plt.ylabel("girll")
plt.grid(True,color='black')
plt.legend()
plt.show()
| true |
83ef377259b8be897b3ba071f7965e1ddb21f83a | Python | simonmonk/prog_pi_ed3 | /11_02_fancy_clock.py | UTF-8 | 1,222 | 3.15625 | 3 | [
"MIT"
] | permissive | # 11_02_fancy_clock.py
import board, time, gpiozero
from adafruit_ht16k33.segments import Seg7x4
from datetime import datetime
switch = gpiozero.Button(23, pull_up=True)
i2c = board.I2C()
display = Seg7x4(i2c)
display.brightness = 0.3
show_colon = True
time_mode, seconds_mode, date_mode = range(3)
disp_mode = time_mo... | true |
2bed2b8fd2125e986a379dfa95962661873dff80 | Python | AlvisonHunterArnuero/EinstiegPythonProgrammierung- | /increaser.py | UTF-8 | 192 | 3.3125 | 3 | [
"MIT"
] | permissive | rng = range(1,9)
sum = 0
increaser = 4
result = 0
for rng_num in rng:
result = result + (rng_num + increaser)
print(f"{rng_num} + {increaser} = {result}")
increaser = increaser +1
| true |
a171adae5495a57f78f084f02dbe746935442998 | Python | afdRinQ/basket_check | /test_items.py | UTF-8 | 335 | 2.546875 | 3 | [] | no_license | import time
link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
def test_button_basket_check(browser):
browser.get(link)
time.sleep(30)
assert len(browser.find_element_by_css_selector('button.btn-add-to-basket').get_attribute(
'value')) != 0, "Add to cart button do... | true |
0532b099b2884f9a8f38bb6b2e42d0c2950580de | Python | Garethgogo/Summary-for-Nowcode-Online-programming | /NetEase_05.py | UTF-8 | 868 | 3.890625 | 4 | [] | no_license | x,f,d,p = map(int,input().split(' '))
day = (f*p+d)//(x+p)
#注意python运算符和java不同
print(min(day,d//x))
'''
题目描述
小易为了向他的父母表现他已经长大独立了,他决定搬出去自己居住一段时间。一个人生活增加了许多花费: 小易每天必须吃一个水果并且需要每天支付x元的房屋租金。当前小易手中已经有f个水果和d元钱,小易也能去商店购买一些水果,商店每个水果售卖p元。小易为了表现他独立生活的能力,希望能独立生活的时间越长越好,小易希望你来帮他计算一下他最多能独立生活多少天。
输入描述:
输入包括一行,四个整数x, f, d, p(1 ≤ x,... | true |
28972dc7326960911607a90caa83093104ed5c0f | Python | guptaadi123/python-chat-server | /udp send.py | UTF-8 | 297 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[11]:
import socket
server=socket.socket( socket.AF_INET,socket.SOCK_DGRAM)
ip="192.168.1.75"
port = 1234
server.connect((ip,port))
#print(server.recv(100))
while(True):
a=input()
b=str.encode(a)
server.send(b)
# In[ ]:
# In[ ]:
| true |
39200fd90a5465888ab711e992811c01565eb452 | Python | BarMih/turbo-barnacle | /main_main.py | UTF-8 | 15,964 | 2.890625 | 3 | [
"Unlicense"
] | permissive | from main import el_length as L, usiliya as arrayUsiliy, uz_num as el, gestkosti as array
# Валидность
def pravilnoLi(name, flt, mns, null, one):
# Убираем пробелы
name = name.strip()
# Пустая строка
if name == '':
name = None
warning = print('Вы ввели пустую строку. Повторите попытку в... | true |
cc20a97b7c600a816ab248cbeec1416fdec125b2 | Python | ValerieMauduit/46-simple-python-exercises | /srcs/ex15.py | UTF-8 | 443 | 4.28125 | 4 | [] | no_license | '''Write a function find_longest_word() that takes a list of words and returns
the length of the longest one.'''
from ex03 import length
def find_longest_word(lst):
'''
This function takes a list of words and returns the length of longest word
Parameters
----------
lst (list of strings)
Returns
----------
T... | true |
ee4cc96a7bbf3dc40d62bc809a98b1e0dff4997e | Python | albininovics/python | /text.py | UTF-8 | 41 | 2.9375 | 3 | [] | no_license | text = "LEARN PYTHON"
print(text.upper()) | true |
a241b2bce1de8a511d7bcf6414edb2a08b3b0a5f | Python | Themimitoof/netwark | /netwark/helpers/domain.py | UTF-8 | 2,188 | 2.953125 | 3 | [
"MIT"
] | permissive | """
Contains a suite of helpers and functions for domain names
"""
import logging
import re
import subprocess
import idna
log = logging.getLogger(__name__)
def is_valid_fqdn(fqdn: str) -> bool:
"""
Check if the FQDN is valid.
"""
# Regex friendly stealed from
# https://github.com/johno/domain-re... | true |
2baa8df2b1444288bb1945c814169b02e4c24248 | Python | Supergecki/smartyard-serversocket | /serversocket_german.py | UTF-8 | 5,792 | 2.953125 | 3 | [] | no_license | # Programm, um die gemessenen Werte vom Sensor Client zu empfangen und sie in die Datenbank zu schreiben.
# Gibt außerdem Anweisungen für Display und Actor Clients.
# Importiert alle benötigten Module.
from socket import socket, AF_INET, SOCK_STREAM, gethostbyname, gethostname # für Socket-Verbindungen
from threading ... | true |
57b1fa4f2dd39079d2636d8a5fe3e42e1ae7e2f7 | Python | divyanshmanocha/hottbox | /hottbox/algorithms/decomposition/tests/test_cpd.py | UTF-8 | 11,098 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
Tests for the cpd module
"""
import pytest
import sys
import io
import numpy as np
import pandas as pd
from functools import reduce
from itertools import product
from ..cpd import *
from ....core.structures import Tensor, TensorCPD
from ....pdtools import pd_to_tensor
class TestBaseCPD:
""" Tests for BaseCPD ... | true |
e7d2437e9a82b8e9c05b73fe94b6103ee4a88eb4 | Python | zhengtongopu/MobileBERT-paddle | /mobilebert_paddle/bottleneck.py | UTF-8 | 2,286 | 2.765625 | 3 | [] | no_license | import paddle
from paddle import nn
from .bottleneck_layer import BottleneckLayer
class Bottleneck(nn.Layer):
def __init__(self, config):
super().__init__()
self.key_query_shared_bottleneck = config.key_query_shared_bottleneck
self.use_bottleneck_attention = config.use_bottleneck_attention... | true |
ee71c6683d1bf58763cd42a71ec468804cf7f941 | Python | liuchaoyangliu/sparkPython | /ml/polynomial_expansion_example.py | UTF-8 | 598 | 2.671875 | 3 | [] | no_license | from pyspark.ml.feature import PolynomialExpansion
from pyspark.ml.linalg import Vectors
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession.builder.appName("polynomial").master("local").getOrCreate()
df = spark.createDataFrame([
(Vectors.dense([2.0, 1.0]),),
... | true |
dd4fa7ddf85c8bfaa212f49d4440919239e18f83 | Python | mtebenev/intprep | /pyprep/count_complete_tree_nodes_test.py | UTF-8 | 2,610 | 3.65625 | 4 | [] | no_license | # https://leetcode.com/problems/count-complete-tree-nodes/
# Tags: medium, tree
from utils.binary_tree_node import TreeNode
import unittest
class Solution:
def countNodes(self, root: TreeNode) -> int:
# Find the tree height
height = 0
node = root
while node and node.left... | true |
b52f5b42e5c2f91a881af672e6afec78fe30bdaf | Python | Mlordx/MAC0499 | /src/alexis/geocomp/ors/segmenttree2d.py | UTF-8 | 12,723 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from primitives import *
from math import *
from functools import *
import copy
class SegmentTreeNode:
def __init__(self,l=None,r=None,lf=False):
inf = float("inf")
self.interval = Segment(Point(-inf,-inf),Point(inf,inf))
self.l = l
se... | true |
93bd693f134369613c07d3bbbe1c7abfae05694e | Python | teogenesmoura/whatsapp-text-analysis2 | /util.py | UTF-8 | 663 | 2.765625 | 3 | [] | no_license | def load_stop_words():
stopwords_set = set()
with open('stopwords.txt', 'r') as stopwords:
for word in stopwords:
stopwords_set.add(word.rstrip("\n"))
return stopwords_set
def load_Iramuteq(columnsOption):
iramuteq_file = open("iramuteq_lexicon.txt", "r")
iramuteq_map = dict()
for line in iramuteq_file.rea... | true |
6e831b88e73d855c04a9d7cb5e52f6d199d98fc3 | Python | rainkr/FeedMyFriends | /model/postgres_db.py | UTF-8 | 4,926 | 2.65625 | 3 | [] | no_license | from sqlalchemy import create_engine, exc, sql
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, Float
import os
import time
DB_CONN = os.environ.get('HEROKU_POSTGRESQL_PURPLE_URL', "postgresql://mwoods@localhost/fmfapp")
PG_ENGINE = create_engine(DB_CONN)
metadata = MetaData()
feeds = Ta... | true |
9f9e92e62be043aa4cd5147736c59c53ae31beaa | Python | cadizm/euler | /euler/problems/p34.py | UTF-8 | 435 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
#
# 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
#
# Find the sum of all numbers which are equal to the sum of the factorial of their digits.
#
# Note: as 1! = 1 and 2! = 2 are not sums they are not included.
#
from euler.math import sum_factorial_digits
def run():
L = [... | true |
e7466eaffa051c3fe5a0fc05b417c579a9d796ee | Python | mhalle/slicer4-download_deprecated | /slicer4-parselogs/access.py | UTF-8 | 2,260 | 2.625 | 3 | [] | no_license | import sys
import re
import gzip
import os
import apache_log_parser
from contextlib import ExitStack
bitstreamRE = re.compile(r'/bitstream/(\d+)')
def create_access_table(db):
"Initialize sqlite table for web access records."
with db as c:
c.execute('''create table if not exists
access... | true |
1853ed1d6c5c0aa531f3c85a9434339a88ab4eb6 | Python | AnkitaBhosle/sdha-ml-tut | /trainingtools.py | UTF-8 | 1,149 | 2.515625 | 3 | [] | no_license | import itertools,json,sys,numpy,math,operator
global dataDir
dataDir = 'data/'
def assemble_vectors(subject_num,tasks,trials, readings):
label=-1 # so hacky.... we have to iterate trial AND start on trial 0......sorry
X = []
y = []
for task in tasks:
label+=1
for trial in trials:
... | true |
22cedbf785e8dd1584098dcf5d42131a491b0829 | Python | KarlLichterVonRandoll/learning_python | /month05/AI/day02/demo06_poly.py | UTF-8 | 1,050 | 3.171875 | 3 | [] | no_license | """
多项式回归模型
"""
import numpy as np
import sklearn.linear_model as lm
import matplotlib.pyplot as mp
import sklearn.preprocessing as sp
import sklearn.metrics as sm
import sklearn.pipeline as pl
# 采集数据
x, y = np.loadtxt(
'../ml_data/single.txt', delimiter=',',
usecols=(0, 1), unpack=True)
# 训练多项式回归模型
x = x.re... | true |
a0159125d9559fc34a3978f5493590e36d8c4b8a | Python | morganstanley/testplan | /tests/unit/testplan/testing/multitest/driver/myapp/repeater.py | UTF-8 | 374 | 3.328125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Simple script that just mirrors stdin back to stdout, until either EOF signal
is received or the string literal "EOF" is input.
"""
import sys
SENTINEL = "EOF"
def main():
for line in sys.stdin:
if line.strip() == SENTINEL:
break
else:
print(line.... | true |
208c2ffcf4e69e1d0db48196c1b4ff4fdfd504cf | Python | alexahs/FYS4460 | /project_3/nsp.py | UTF-8 | 8,286 | 2.5625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage as sp
import os
from skimage import measure
from sp_cluster_density_and_perc_prob import *
from power_law_distributions import *
from tqdm import tqdm
import time
import datetime
plt.style.use('ggplot')
ts = time.time()
ts_formatted = datetime.da... | true |
9f3a902b1107d0658ecb539fb4445916bd8ed579 | Python | ozzi7/DictionaryLookup-NN | /main.py | UTF-8 | 3,869 | 2.8125 | 3 | [] | no_license | # dictionary lookup test input [x1,y1,q1], [x2,y2,q1],.. -> output y where q == x
# outputs 0 if key not found
import numpy as np
import keras.backend as K
from keras.layers import *
from keras.initializers import *
from keras.models import *
from tensorflow.keras.optimizers import *
from keras.utils.generic_utils imp... | true |
76d73cd056afd3b2c426ab0f0c77e56326237c3e | Python | CaoZelin12138/CPBM | /PrepareData/SVMRank.py | UTF-8 | 1,773 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os,sys
import time
import subprocess
# Windows .exe
SVMRANK_TRAIN = r'start ../SVMModel/svm_rank_learn.exe'
SVMRANK_TEST = r'start ../SVMModel/svm_rank_classify.exe'
# Linux
# SVMRANK_TRAIN = '../SVMModel/svm_rank_learn'
# SVMRANK_TEST = '../SVMModel/svm_rank_classify'
def svm... | true |
757023c1046a23387cc986c2fc49f7dcf787fd47 | Python | ru04ru041989/MOOC | /Project_Euler/Q31_solutation.py | UTF-8 | 1,897 | 3.96875 | 4 | [] | no_license | # Coin sums
"""
In England the currency is made up of pound, £, and pence, p, and there are eight
coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using a... | true |
ab230dbcbbfbf2a3adc2cdbadaf8ab0f21eaba58 | Python | HeizerSpider/Personal-Notes-On-Python | /advanced_python/doc_string.py | UTF-8 | 290 | 3.796875 | 4 | [] | no_license | def randomFunction(arg1, arg2=None):
"""
randomFunction(arg1, arg2=None):
Doesnt do much other than to print the arguments given.
First argument to be given, second argument defaults to None.
"""
print(arg1, arg2)
randomFunction(1, 2)
print(randomFunction.__doc__) | true |
5b2acdef1ffcf6cef8aa6f094b7ff7d73adca8fe | Python | Smily-Pirate/100DaysOfCode | /Day35.py | UTF-8 | 339 | 3.9375 | 4 | [] | no_license | def sumVowel(string):
n = len(string)
sum = 0
string = string.lower()
for i in range(0, n):
s = string[i]
if (s == "a" or s == "e" or s == "i" or s == "o" or s == "u"):
sum += ((n - i) * (i + 1))
return sum
if __name__ == '__main__':
string = "ghanshyam"
print... | true |
e44921862a35f73e817db876df3f9ae3a973bb50 | Python | simonfredon/hackinscience | /exercises/040/solution.py | UTF-8 | 164 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 22 14:51:54 2015
@author: simonfredon
"""
a = 0
for i in range(0, 101):
if i % 2 == 0:
a += i
print(a)
| true |
cf787d5af632f8a626f6321c21a1d5d9244af408 | Python | ameeli/algorithms | /leetcode/is_palindrome.py | UTF-8 | 768 | 4.4375 | 4 | [] | no_license | """
Given a string, determine if it is a palindrome, considering only alphanumeric
characters and ignoring cases.
Note: For the purpose of this problem, we define empty string as valid
palindrome.
Example 1:
Input: "A man, a plan, a canal: Panama"
Output: True
Example 2:
Input: "race a car"
Output: False
"""
def ... | true |
a04bcdcc063cd3f429eaa289f729fcc497c125e6 | Python | Axmen/CSCB20 | /personSort.py | UTF-8 | 3,586 | 3.84375 | 4 | [] | no_license | #!/usr/local/bin/python
import os
import sys
### Queue Class
class Queue:
'''A first in, first out (FIFO) queue of items'''
def __init__ (self):
'''(Queue) -> NoneType
Create a new empty queue
'''
self.contents = []
def enqueue (self, new_obj):
'''(Queue, object... | true |
a9b2c7154ccb4594de711b487fe71705a204e68b | Python | aCoffeeYin/pyreco | /repoData/skorokithakis-omnisync/allPythonContent.py | UTF-8 | 80,956 | 2.609375 | 3 | [] | no_license | __FILENAME__ = configuration
"""omnisync configuration module."""
import logging
import re
log = logging.getLogger("omnisync")
class Configuration:
"""Hold various configuration options."""
def __init__(self, options):
"""Retrieve the configuration from the parser options."""
if... | true |
214bc78860ba527aeb58d57e58070aeb860a44d4 | Python | karunvarma/asyncio-python | /intro_to_event_loop.py | UTF-8 | 1,706 | 3.25 | 3 | [] | no_license | from concurrent.futures import Future
import threading
import time
'''
Event loops
-----------
In many asynchronous frame works coordination between different tasks
is managed by the EVENT LOOP
the idea behind an event loop is to continuously monitor the status of
the various resources like network connections,DB... | true |
9e7361dd86366bfba0205565ac978f0e3ed69f9a | Python | chistopher/python-networking | /server.py | UTF-8 | 788 | 2.703125 | 3 | [] | no_license | import socket
import vlc
import sys
#prepare player
instance = vlc.Instance()
player = instance.media_player_new()
#start connection
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.bind(('', 3378))
print "Socket has been bound"
serversocket.listen(1)
while True:
c, addr = serversocke... | true |
b2c61dc724727472e6028507ed85ee5b9fa1a2fd | Python | syugoing/communication | /dialogue_system/language_understanding/attribute_extraction/rule_based_extractor.py | UTF-8 | 2,534 | 3.015625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import re
from dialogue_system.knowledge.reader import read_genres, read_locations, read_subject, read_teacher, read_yes, read_no, read_picture
from dialogue_system.language_understanding.utils.utils import kansuji2arabic
class RuleBasedAttributeExtractor(object):
def __init__(self):
... | true |
a4719299d9fe0b192d66862a6a9840b0a6f553af | Python | youyuge34/LCY_OnlineJudge | /0002/05.py | UTF-8 | 1,079 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018-12-25 11:06
# @Author : YouSheng-MF1832226
'''
冒泡排序
Description
实现冒泡排序。
Input
输入的每一行表示一个元素为正整数的数组,所有值用空格隔开,第一个值为数值长度,其余为数组元素值。
Output
输出的每一行为排序结果,用空格隔开,末尾不要空格。
Sample Input 1
13 24 3 56 34 3 78 12 29 49 84 51 9 100
Sample Output 1
3 3 9 12 24... | true |
a3e9ec85dc4f31575a66e30520a5a4a9356a3a15 | Python | GeekDream-x/LeecodeStory | /JZ/JZ10-2-frogWaysNum.py | UTF-8 | 546 | 3.359375 | 3 | [] | no_license | class Solution:
# 1 动态规划 36/14.8
# def numWays(self, n: int) -> int:
# if n == 0 or n == 1:
# return 1
# ways = [1,1]
# for i in range(2, n+1):
# ways.append(ways[i-1] + ways[i-2])
# return ways[n] % 1000000007
# 2 动态规划优化存储 28/14.7 98/16
... | true |
10f5332834c00ae84f894c789f6830f378b88045 | Python | shaddyx/pyBrowser | /pyBrowser/Browser.py | UTF-8 | 7,489 | 2.90625 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod, abstractproperty
import codecs
import time
def _randStr():
import uuid
return "_" + str(uuid.uuid4()).replace("-","")
class SelectorException(Exception):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class Region(object):
x = 0... | true |
2111f266b99fe3d2215d615aa18dfa43f5a903a6 | Python | ArthurChan0427/Connect-4-Simulation | /Scenes/Game_over.py | UTF-8 | 3,337 | 3.453125 | 3 | [] | no_license | # This file contains the procedures which run the game_over scene when
# the variable "game_state" is set to 'game over'
import pygame
from Objects.Piece import Piece
# global identifiers each representing a RGB colour
black = (0,0,0)
red = (255, 0, 0)
yellow = (255, 255, 0)
white = (255, 255, 255)
'''
run all nece... | true |
d58e4fbda3fdfe5305995773ecfea6568ba4e2c1 | Python | Stevenjin8/MLAPP-Solutions | /src/mlapp_models/abstract.py | UTF-8 | 446 | 2.84375 | 3 | [] | no_license | """Abstract interfaces for models."""
import numpy as np
class AbstractModel:
"""Interface of machine learning model."""
def fit(X: np.ndarray, y: np.ndarray, **kwargs) -> any:
"""Fit model to data."""
raise NotImplementedError("You must implement this method.")
def predict(X: np.ndarray... | true |
954e3e8549559188a5e3baa2c316eea860f9d7c9 | Python | shoumitro-cse/foodshop | /public/tests/main_tests.py | UTF-8 | 1,277 | 2.859375 | 3 | [] | no_license | from django.test import TestCase
# Create your tests here.
#python manage.py test
#https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Testing
from public.models import Product
class PublicTest(TestCase):
@classmethod
def setUpTestData(cls):
print("setUpTestData: Run once to set up no... | true |
273120754ed98e9b07b6e22fd334320a3d9726f7 | Python | boydchristopher7/collatz-tests | /mel2842-TestCollatz.py | UTF-8 | 4,172 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# -------------------------------
# projects/collatz/TestCollatz.py
# Copyright (C) 2016
# Glenn P. Downing
# -------------------------------
# https://docs.python.org/3.4/reference/simple_stmts.html#grammar-token-assert_stmt
# -------
# imports
# -------
from io import StringIO
from unittest... | true |
ee2c74d848ef3c6f97681d403d4b0370359e4764 | Python | AyushSingh26/Dream11_Clone | /match (1).py | UTF-8 | 2,224 | 2.578125 | 3 | [] | no_license | from bs4 import BeautifulSoup as soup
from urllib.request import urlopen, Request
from datetime import date
my_url = 'https://www.espncricinfo.com/live-cricket-match-schedule-fixtures'
req = Request(my_url, headers={'User-Agent': 'Mozilla/5.0'})
webpage = urlopen(req).read()
'''uClient = urlopen(my_url)
... | true |
e5e1cb10e9bf976ff09490d32bfcc8e93cb00bde | Python | AjinkyaVadane/KMeans | /mykde_Q2.py | UTF-8 | 4,683 | 3.5625 | 4 | [] | no_license | # resources used:
# the slides provided by professor
import numpy as np
import matplotlib.pyplot as plot
x_input = []
for i in np.arange(-1, 10, .01):
x_input.append(i)
dim = 0 # This one is for plotting 1D and 2D
h = [.1, 1, 5, 10] #bandwidth
#Algortihm
# by referring to the algorithm in the ppt
def mykde(... | true |
cc53430118c453f721955dddc0597717d1a6734b | Python | aze2201/ISP_Online-Charging-System_DCC | /DBSERVER/src/DBServer.py | UTF-8 | 1,864 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
from socket import *
import thread
import sqlite3
import pickle
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('../config/config.ini')
BUFF = 1024
HOST = parser.get('DBSERVER', 'IP')
PORT = int(parser.get('DBSERVER', 'PORT'))
#DATABASE="file:memdb1?mode=memory&c... | true |
9ae40fe676e9987b15685a53bd646f385f6f2bde | Python | JongSeokJang/capstone_design1 | /web/pycodes/sentiment.py | UTF-8 | 595 | 2.71875 | 3 | [] | no_license | from textblob import TextBlob
from googletrans import Translator
import time
import sys
filename = sys.argv[1]
fp = open(filename, 'r')
content = fp.readlines()
content = ' '.join(content)
fp.close()
translator = Translator()
engString = translator.translate(content,src='ko')
engString = engString.text
analysis = T... | true |
328841fc48c8e86fc8b1ecf5a1fa57cd95de0866 | Python | colinsongf/EffictiveRBM | /rbm/autoencoder/batch_iterator.py | UTF-8 | 1,931 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Author : Jasonwbw@yahoo.com
from abc import ABCMeta, abstractmethod
import numpy as np
class BatchIterator(object):
__metaclass__ = ABCMeta
def __init__(self, batch):
self.batch = batch
self.current_batch = -1
@abstractmethod
def next_batch(self):
pass
... | true |
4abcb27d87c30e3de2afffd7c61693baf41f171b | Python | saltstack/salt | /tests/unit/utils/test_immutabletypes.py | UTF-8 | 1,969 | 3.171875 | 3 | [
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] | permissive | """
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
tests.unit.utils.immutabletypes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test salt.utils.immutabletypes
"""
import salt.utils.immutabletypes as immutabletypes
from tests.support.unit import TestCase
class ImmutableTypesTestCase(TestCase):
def test_im... | true |
6bce86544e2076342c2e848c87485c837c811eb2 | Python | jatinkatyal13/PythonForDataScience | /pattern.py | UTF-8 | 220 | 4.125 | 4 | [] | no_license | n = int(input("Enter an odd number for a beautiful pattern: "))
if n%2 != 0:
for i in range(n):
for j in range(n):
print(n-min(i,j,n-1-i,n-1-j),end="")
print()
else:
print("Not an odd number")
| true |
ff61c6226bb6e02d099aa176b1b4ae1451bdf303 | Python | ashkanRmk/podcast-recommender | /APIResponse.py | UTF-8 | 267 | 2.796875 | 3 | [] | no_license | import json
class ApiResponse:
d = dict()
def __init__(self, status=None, message=None, result=None):
self.d["status"] = status
self.d["msg"] = message
self.d["res"] = result
def to_json(self):
return json.dumps(self.d)
| true |
23f2d01eb411ffed8f2d096a63555553d49e6009 | Python | keerthisreedeep/LuminarPythonNOV | /List_demo/listdemo2.py | UTF-8 | 843 | 3.875 | 4 | [] | no_license | lst=[10,11,12,13,14,15,16,17]
print(lst)
#
# #itreration
#
# for item in lst:
# print(item)
#
# #-------------------------------------
#
# #print sum of this list without using any pre defined function
#
total=0
for item in lst:
total=total+item
print(total)
# #-------------------------------------------... | true |
3a9e2a4de94e04dc430ce13ab9af17110dc58ba8 | Python | adaranutsa/adventofcode-2018 | /day3/main.py | UTF-8 | 6,713 | 3.890625 | 4 | [] | no_license | class Solver:
"""Puzzle: Given the size of the fabric and the input (claims to the fabric),
find how many square inches of fabric has multiple claims to it.
In other words, based on the input, how many of the inputs overlap the same
area in the grid at least twice. Grab that number and return the sq i... | true |
fc588330943d7f8730487c35910def2cb5c40be9 | Python | betagouv/indice_pollution | /indice_pollution/history/models/tncc.py | UTF-8 | 988 | 2.859375 | 3 | [
"MIT"
] | permissive | from sqlalchemy import Column, Integer, String
class TNCC:
tncc = Column(Integer)
nccenr = Column(String)
tncc_codes= {
0: {"article": " ", "charniere": "de "},
1: {"article": " ", "charniere": "d'"},
2: {"article": "le ", "charniere": "du "},
3: {"article": "la ", "... | true |
6e86ca2698d44556736fd68a4edcf6e9009e5adc | Python | jon-chun/text_cleaning | /app_scripts/clean/remove_punctuation_except/__init__.py | UTF-8 | 409 | 3.078125 | 3 | [] | no_license | import string
def remove_punctuation_except(inStr: str, opts: dict):
punct = string.punctuation
chars_to_remove = opts['wordlist'].split(' ')
sc = set(chars_to_remove)
punct = ''.join([c for c in punct if c not in sc])
translator=str.maketrans('','',punct)
return inStr.translate(translator)
#print(remove_punct... | true |
ddaffaa3f1544e6092f1409b2e245686b5f9006e | Python | Python-Geek-Labs/learn-python- | /tut42 - self & __init__() (Constructors) oops3.py | UTF-8 | 1,009 | 4.34375 | 4 | [] | no_license | class Employee():
no_of_leaves = 8 # it is set for all employees
def __init__(self, name, salary, designation):
self.name = name
self.salary = salary
self.designation = designation
def details(self):
return f'Name: {self.name}\nSalary: {self.salary}\nDesignation: {self.des... | true |
e03ce7e06e2a37f2925368d923963c96a5e20d14 | Python | ljhorton32/georgetown-classifier | /gtml/corpus.py | UTF-8 | 1,400 | 3.015625 | 3 | [
"MIT"
] | permissive |
import unicodecsv as csv
from nltk import wordpunct_tokenize
class CorpusReader(object):
"""
Normally would extend nltk.corpus.reader.api.CorpusReader but that
seems like a bit much for now- on other corpora you might do this.
In this case, the job of this class to yield text, label pairs for
the... | true |
c3698811eb8a7ce14d1d6bfcad51f5528c4024fa | Python | Daniil-Budnik/Flask_Server_Elizabeth | /Server_Elizabeth/MyDataBase.py | UTF-8 | 6,133 | 3.046875 | 3 | [] | no_license | # ----------------------------------------------------------------- -----------------------------------------------------------------
import os
import sqlite3 as SQL
# ----------------------------------------------------------------- -----------------------------------------------------------------
# Класс хр... | true |
e7f0f6ebb0f062005e8a4df84f13111e100b25d7 | Python | DavidPits/BookBuster | /DataCollecter/exporter.py | UTF-8 | 830 | 2.9375 | 3 | [] | no_license | import csv
from typing import List
from DataCollecter.models import Book
def export_books_to_csv(books: List[Book], filename: str, is_append_to_csv: bool):
if is_append_to_csv:
file_param = 'a'
else:
file_param = 'w'
with open(filename, file_param) as books_csv:
fieldnames = ['tit... | true |
d05af56d531ce9ea52fe5ba01037f39f8ca426a3 | Python | greisonsantos/Simplex-Pesquisa-Operacional | /liga.py | UTF-8 | 1,015 | 2.78125 | 3 | [] | no_license | from gurobipy import *
# Create a new model
m = Model("liga")
# Create variables
mr1 = m.addVar(vtype=GRB.CONTINUOUS, name="mr1")
mr2 = m.addVar(vtype=GRB.CONTINUOUS, name="mr2")
F = m.addVar(vtype=GRB.CONTINUOUS, name="F")
C = m.addVar(vtype=GRB.CONTINUOUS, name="C")
S = m.addVar(vtype=GRB.CONTINUOUS, name="S")
N =... | true |
086926bfb514cf07c794df4a22854eacb12fed69 | Python | MoMaT/xmas-elves | /pyne_xmas_elves/server/elves/game/serializers.py | UTF-8 | 3,099 | 2.8125 | 3 | [
"MIT"
] | permissive | """Serializers for Sessions and Days.
"""
from rest_framework import serializers
from .models import Day, Session
from .validators import positive_number
class SessionSerializer(serializers.ModelSerializer):
"""A single game session.
Identified using the `uuid` field, POST a new day against this endpoint to... | true |
29d8f444da7df15dfbcdef59e0ae397db4bb2380 | Python | cmulliss/turtles-doing-things | /rewrites2021/two_turtles.py | UTF-8 | 632 | 3.734375 | 4 | [
"CC0-1.0"
] | permissive | # Set up the window and its attributes
import turtle
s = turtle.Screen()
s.bgcolor("pink")
# create tess and set some attributes
t = turtle.Turtle()
t.shape("turtle")
t.color("hotpink")
t.pensize(5)
t.pencolor("blue")
# create alex, who is a second turtle object
t2 = turtle.Turtle()
t2.shape("turtle")
t2.color("gree... | true |
e0eba47611fdece400f08bf7a5425dfdcdc8366d | Python | sungh7/synthetic_dataset_edit | /build/lib/soydata/data/classification/recipe.py | UTF-8 | 4,331 | 3.25 | 3 | [] | no_license | import numpy as np
from ..base import make_rectangular
from ..base import make_triangular
def make_predefined_data(name='decision-tree-1', n_samples=1000):
"""
Arguments
---------
name : str
Dataset name, Valid values are following
names = ['decision-tree-1', 'decision-tree-2']
... | true |
6fbe24f3ba4c937550eb08e4f8e2317c35958c19 | Python | thomas-vl/airbyte | /airbyte-integrations/connectors/destination-langchain/destination_langchain/measure_time.py | UTF-8 | 821 | 3.25 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown",
"Elastic-2.0"
] | permissive | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import time
def measure_time(func):
def wrapper(*args, **kwargs):
wrapper.count += 1
start_time = time.time()
result = func(*args, **kwargs)
end_time = time.time()
execution_time = end_time - start_time
... | true |
e1aa47d9f93d0be5066f711ebbbd68c3b062aced | Python | ece324-2020/ClutterCutter | /pre_processing.py | UTF-8 | 10,513 | 2.875 | 3 | [] | no_license | # Requires nltk and google translate packages
# !pip install googletrans
# !pip install nltk
import os
import random
import string
import re
import csv
from zipfile import ZipFile
from itertools import chain
from glob import glob
from googletrans import Translator
import pandas as pd
from sklearn.model_selection i... | true |
e9505986ca7da837108706560aa1f3acc19cf5b5 | Python | ben/magrecipes | /helpers.py | UTF-8 | 1,915 | 2.671875 | 3 | [] | no_license | from google.appengine.api import users
from google.appengine.ext import db
import datetime
import time
def allmonths():
return ['January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
... | true |
c683bdd42e549e995c16c7c8ddd00dd0c1620f2f | Python | treknuts/NoridianCapstone | /dataVisualization.py | UTF-8 | 1,669 | 2.9375 | 3 | [] | no_license | import sys
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import numpy as np
from PyQt5.QtWidgets import *
class GraphWithQtDemo(QWidget):
def __init__(self, parent = None):
super(GraphWithQtDemo, self).__init__(parent)
self.la... | true |
5372ccda3ec5ab3f72ae8e29604915ab29458dcc | Python | freechenh/licode | /day02/increase_iterable.py | UTF-8 | 606 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @File: increase_iterable.py
# @Author: dell
# @Date: 2020/8/25 14:42
# @Desc:
# @Project: licode
# @Source: PyCharm
class Solution:
@staticmethod
def find_sub_sequences(nums):
result = list()
n = len(nums)
for i in range(n):
... | true |
540e4e7007eb0f3068ac3789a578154c882e3250 | Python | Jeenal4801/Cryptography- | /Text.py | UTF-8 | 3,328 | 4.09375 | 4 | [] | no_license | # Text Encryption and Decryption
'''
@author : Ankit Devani , Jeenal Shah , Meghna Kanade , Sarthak Bharad
'''
import numpy as np #Install and import numpy
import sympy #Install and import sympy
from sympy import Matrix
# Function to encrypt string s using key (Password)
def encrypt(s... | true |
a52ec83f5a19281710584440768e48ed6a3ee3f2 | Python | johnmartinsson/adversarial-representation-learning | /vis/create_attributes_plot.py | UTF-8 | 1,891 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import sys
import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
#plt.rc('font', family='serif', serif='Times')
#plt.rc('text', usetex=True)
#plt.rc('xtick', labelsize=8)
#plt.rc('ytick', labelsize=8)
#plt.rc('title', labelsize=8)
#plt.rc('axes', labelsize=8)
font = {'family' : 'serif',
... | true |
80948b15fa152874e6ac44eddebd67b13d5bbc37 | Python | ZZLLY/LeetCode | /easy/No20.py | UTF-8 | 1,121 | 4.09375 | 4 | [] | no_license | class Solution:
def isValid(self, s: str) -> bool:
# 题意: 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效
# 限制: 有效字符串需满足:
# 1.左括号必须用相同类型的右括号闭合。
# 2.左括号必须以正确的顺序闭合。
# 思路: 用栈的性质, 如果当前与top-1的元素匹配top = top-1, 不匹配return False, 最后查看top是否为原值
# 注意:top初始值为1, 预留一位防止top... | true |
f73a7cbeb75df15bade9d66e3175ca8903991e7d | Python | athirarajan23/luminarpython | /flowcontrols/for loop/pyth3.py | UTF-8 | 257 | 3.421875 | 3 | [] | no_license | low=int(input("enter the limit")) #1
upp=int(input("enter the limit")) #10
sumeven=0
sumodd=0
for i in range(low,upp+1): #1 to 10 checked
if(i%2==0): #
sumeven+=i
else:
sumodd+=i
print(sumeven)
print(sumodd)
| true |
5c4214042c3f2244b4aa84218333323a68847a75 | Python | khlee12/python-leetcode | /medium/279.Perfect_Squares.py | UTF-8 | 1,419 | 3.703125 | 4 | [] | no_license | # 279. Perfect Squares
# https://leetcode.com/problems/perfect-squares/
class Solution:
_dp = [0]
def numSquares(self, n: int) -> int:
# classic dp
# dp[i] = dp[j]+dp[i-j] where 1<=j<=i/2
# dp = [sys.maxsize]*(n+1)
# for i in range(1, n+1):
# sqrt = round(po... | true |
fe2b33c2b7451eb2703c8df604f7ea87bc65410a | Python | pyve/pytweetbot | /do_oauth.py | UTF-8 | 332 | 2.8125 | 3 | [] | no_license | #coding=utf-8
import tweepy
def request_access(key, secret):
auth = tweepy.OAuthHandler(key, secret)
auth_url = auth.get_authorization_url()
print 'Please authorize: ' + auth_url
verifier = raw_input('PIN: ').strip()
auth.get_access_token(verifier)
return (auth.access_token.key, auth.access_tok... | true |
2171eb114f90ae69fe399c9bd513d73ecdaf0bdc | Python | Nikhil-Nair/ThinkPython | /Ch7/ex2.py | UTF-8 | 209 | 3.703125 | 4 | [] | no_license | def square_root(a,b):
while True:
print(b)
y = (b + a / b) / 2
if (y == b):
break
b = y
x = input('number\n')
z = input('approx\n')
square_root(int(x),int(z))
| true |
a0f980033235670b0f26cf9e386dc157c7d0c295 | Python | luyongxi/deep_share | /lib/datasets/IBMattributes.py | UTF-8 | 10,028 | 2.765625 | 3 | [] | no_license | # Written by Yongxi Lu
# import base class
from imdb import Imdb
import numpy as np
import os
import os.path as osp
import cPickle
import yaml
from utils.error import compute_mle
"""Class to manipulate IBMattributes dataset """
class IBMAttributes(Imdb):
""" IBM attribute classification dataset. """
def... | true |
b2c3376c5124ccf713cb82cf01a35567d978fe4d | Python | PingPingE/Algorithm | /알고리즘/CountingSort.py | UTF-8 | 854 | 3.203125 | 3 | [] | no_license | A = list(map(int, input().split())) #크기 n, 범위는 [0,k]
B = [0 for _ in range(len(A)+1)] #n+1만큼
C = [0 for _ in range(max(A)+1)] #k+1만큼
for a in A: #각 원소 count
C[a] += 1
for ind in range(1,len(C)): #누적합 구하기(즉, C[ind]는 ind보다 작거나 같은 값의 개수를 나타냄)
C[ind] = C[ind] + C[ind-1]
for i in range(len(A)-1, -1,-1): #뒤에서 부터 넣... | true |
394bfc689dd3a05e3004bbe98202b160319b503e | Python | HamPUG/meetings | /2015/2015-05-11/matplotlib/wekalist/raw.py | UTF-8 | 2,100 | 2.984375 | 3 | [] | no_license | """
Extracts the raw data from the mbox files and generates a single CSV file.
"""
import sys
import os
import mailbox
import email.utils
import csv
import gzip
import time
def main(args):
"""
Parses the .txt or .txt.gz mbox files in the specific directory.
If not directory specific, cwd is used.
"""... | true |
a8585ff73d1064f9b4ef6213cdca4fa7f383b2ed | Python | RUC-CompThinking18/exploratory-programming-2-michaelpham6897 | /Exploratoty Programming Exercise 2.py | UTF-8 | 426 | 4 | 4 | [] | no_license | def afunct(alist):
#This if statement is to check if the input is a list
if type(alist) != list:
raise TypeError("This is not a list")
#This for loop is to iterate through the list and count up the positive ints
for int in alist:
positive_int = 0
if int > 0:
positive_... | true |
d54072a5fb514d8d16f65070573e3d50aaa61c9a | Python | shruti01052002/day1-TWoC | /task5.py | UTF-8 | 793 | 3.515625 | 4 | [] | no_license | player1=int(input("enter the run scored by player1 on 60 balls : "))
player2=int(input("enter the run scored by player2 on 60 balls : "))
player3=int(input("enter the run scored by player3 on 60 balls : "))
s1=(player1/60)*100
s2=(player2/60)*100
s3=(player3/60)*100
m1=int(player1/6)
m2=int(player2/6)
m3=int(player3/6)... | true |
76b42ef5bcab4108cd7a3701429a91e8c0f5f0c1 | Python | PrasannaWorld/mypy | /hot-incremental-backup.py | UTF-8 | 10,059 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2016 WANdisco,Inc. Pleasanton,CA,USA
# All rights reserved.
#
# Author: Jonathan Paul <support@wandisco.com>
#
# hotincremental-backup.py: perform a "hot" backup of a Subversion
# repository the first time it's called, and subsequently... | true |
e711e7960f8360b7d90bb62968ce357446f04041 | Python | manav1403/stopstalk-deployment | /gcp_cloud_functions/spoj_retrieval_function/function-source/main.py | UTF-8 | 3,699 | 2.828125 | 3 | [
"MIT"
] | permissive | import bs4
import time
import datetime
import json
import requests
def get_problem_wise_submissions(spoj_handle, problem_slug, last_retrieved):
"""
Given the spoj handle and the problem, get the spoj submissions made
after the timestamp represented by last_retrieved
@params spoj_handle (Str... | true |
9a4df6d59da2e9331ec1f174e449f997a02de460 | Python | janeaf/actividad_mvc | /mvc/controllers/alumnos/insert.py | UTF-8 | 953 | 2.578125 | 3 | [] | no_license | import web
import mvc.models.model as alumnos
model_alumnos = alumnos.Alumnos()
render = web.template.render("mvc/views/alumnos/", base="template")
class Insert():
def GET(self):
try:
return render.insert()
except Exception as e:
return "Error " + str(e.args)
def POS... | true |
320c141f38aa79aa6aaf4464ec859bb07f574c00 | Python | Mandar-Sharma/Sockets | /Server.py | UTF-8 | 1,339 | 2.828125 | 3 | [
"MIT"
] | permissive | from socket import *
#AF_INET - IPv4
#SOCK_STREAM - TCP
#Localhost (Within System socket comm)
#host = socket.gethostname()
#192.168.64.1 - WLAN3-Connectify
s_file = socket(AF_INET,SOCK_STREAM)
host = "192.168.64.1"
#host = "localhost"
#port_file = 9010
port_file = 8080
s_file.bind((host,port_file))
#5 is b... | true |
08a11d6f117514b588d21baa40008426ab7670fc | Python | sjhosui/add_numbers | /add_numb.py | UTF-8 | 164 | 2.890625 | 3 | [] | no_license | """ This file was created by John """
from add_three import add_three
def main():
print ("2+3+4 =", add_three(2,3,4))
if __name__ == "__main__":
main()
| true |
d8ded3648e9b2f11bf464e6970e2a868c950f626 | Python | bluewold/test | /db/maoyandb/ActorHelper.py | UTF-8 | 6,813 | 2.53125 | 3 | [] | no_license | # coding:utf-8
import datetime
from sqlalchemy import Column, Integer, String, DateTime, Numeric, create_engine, VARCHAR,BIGINT,TIMESTAMP,BLOB,TEXT
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from db.maoyandb.ISqlHelper import ISqlHelper
import threading
BaseModel ... | true |
ab2a39bea86dece207cfb0ac22a139bd58cd079a | Python | deejkstra/SESClient | /sesClient.py | UTF-8 | 2,069 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import json
import boto3
EMAIL_DATA_FILENAME = 'sample_data.json'
EMAIL_TEMPLATE_FILENAME = 'sample_template.html'
CHARSET = "UTF-8"
# AWS Session
session = boto3.session.Session(profile_name='default')
sesClient = session.client('ses')
def bulkSendEmail(filename=EMAIL_DATA_FILENAME):... | true |
4bbbb4e3bae3a7caf167bd4806f774ae00fe42e6 | Python | rami6/Algorithm | /01_Python/02_LeetCode/0001_TwoSum.py | UTF-8 | 682 | 3.4375 | 3 | [] | no_license | """
Problem description
- https://leetcode.com/problems/two-sum/
Result
- Runtime: 36 ms, faster than 99.75% of Python3 online submissions for Two Sum.
- Memory Usage: 7.9 MB, less than 31.08% of Python3 online submissions for Two Sum.
"""
class Solution:
def twoSum(self, nums, target):
"""
:t... | true |
11d07c3f8816f463ad264fcd5929128bb3281270 | Python | Mahevish/Self-Projects | /Python OOP Practice Projects/Fibonacci_to_n_places.py | UTF-8 | 605 | 4.0625 | 4 | [] | no_license | class Fibonacci():
def __init__(self, num):
self.num = num
self.n1 = 0
self.n2 = 1
self.list1 = []
self.count = 0
def calc(self):
while self.count < self.num:
self.list1.append(str(self.n1))
self.nth = self.n1 + self.n2
#self.... | true |
932a5c681fe5ed600d347e0eb46af65434f4905e | Python | cvdlab-alumni/426816 | /final-project/python/polar.py | UTF-8 | 1,371 | 2.9375 | 3 | [] | no_license | #-----------------------UTILITY FUNCTIONS-------------------------
#function that draw a cylinder with BEZIER CURVES
def CYLINDER(r,h):
dom1 = INTERVALS(1)(40)
dom2 = INTERVALS(2*PI)(40)
rot_domain = PROD([dom1,dom2])
p1 = [[0,0,0],[r,0,0]]
p2 = [[r,0,0],[r,0,h]]
p3 = [[r,0,h],[0,0,h]]
c1 = BEZIER(S1)(p1)
c2 =... | true |
e013f4269a88310e6f1a08cc5394b35bf624d03a | Python | evanthebouncy/embedded_prototype | /sandbox/domains/pong/generate_idx_pickle.py | UTF-8 | 1,711 | 2.78125 | 3 | [] | no_license | import numpy as np
import pickle
import argparse
def generate_random_pickle(tot_size,size,path):
inds = np.arange(tot_size)
np.random.shuffle(inds)
inds = inds[:size]
pickle.dump(inds, open(path, "wb"))
def generate_subset(tot_size,size,path,save_path):
with open(path,'rb') as f:
idx = p... | true |
8b0bfe582635122e09baa478f6b96d61b032ad36 | Python | vbachinsky/ML | /bach12_2.py | UTF-8 | 2,324 | 2.703125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import sklearn.cluster as sk_cluster
import sklearn.preprocessing as sk_preprocessing
import scipy.cluster.hierarchy as sc_clustering_hr
def set_printing_options():
pd.set_option("display.max_columns", None)
pd.set_option("display.width", ... | true |
030eb00fdfc5d10f8b70a2d0316abb856aa3b465 | Python | MoizSM/ARC | /src/solution_9dfd6313.py | UTF-8 | 582 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | import sys
import json
import numpy as np
def solve(): #Logic Funtion
with open(sys.argv[1] , 'r') as f:
data = json.load(f) #Parsing the JSON file
var = ['train' , 'test']
#Running for all the training and testing inputs
for x in var:
for n in range(len(data[x])):
... | true |
4d0124ec38626f0d971dd4215090a6975a35ca40 | Python | JonasHal/P4_code | /Dashboard/Dashboard-Second_Iteration.py | UTF-8 | 6,896 | 2.65625 | 3 | [] | no_license | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import requests
from qwikidata.sparql import return_sparql_query_results
import concurrent.futures
app = dash.Dash(__name__)
SEARCHPAGE = ""
SEARCHENTITY = "Q314"
def retrieve_propert... | true |
b3dc3b0c28386e67757653a0a21bdd3d7cb3baaf | Python | shiyuzh2007/Audio2Vec-2 | /aud2vec.py | UTF-8 | 19,648 | 2.796875 | 3 | [] | no_license | """
Main file Containing the code for all models. We use a seq2seq autoencoder.
The autoencoder has it's own class with functions for the model forward prop and also to train it.
"""
from tensorboard_logger import Logger
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch ... | true |
f9dc0a7dcd9ce7fe6ee75fa557424477ccffde7a | Python | matthewkojetin/IntroToProg-Python-Mod08 | /Assignment08.py | UTF-8 | 6,644 | 3.765625 | 4 | [] | no_license | # ------------------------------------------------------------------------ #
# Title: Assignment 08
# Description: Working with classes
# ChangeLog (Who,When,What):
# RRoot,1.1.2030,Created started script
# RRoot,1.1.2030,Added pseudo-code to start assignment 8
# mkoj,06.08.2020,Added main body of script
# mkoj,06.08.... | true |