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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
219937ccca517f4b2cff9b90ae9ca28c9d82359c | Python | vikrantuk/Code-Signal | /Arcade/Intro/32_absoluteValuesSumMinimization.py | UTF-8 | 1,328 | 4.34375 | 4 | [] | no_license | '''
Given a sorted array of integers a, your task is to determine which element of a is closest to all other values of a. In other words, find the element x in a, which minimizes the following sum:
abs(a[0] - x) + abs(a[1] - x) + ... + abs(a[a.length - 1] - x)
(where abs denotes the absolute value)
If there are sever... | true |
3f77ccab7ba01aedb98101951dfe4f0230e6fa54 | Python | suchareq3/covid-vaccination-map | /main.py | UTF-8 | 11,670 | 3.078125 | 3 | [] | no_license | """
Generates a world map with worldwide vaccination data in the form of a .svg file.
Vaccination data is based on the user-given date and other preferences specified by the user.
"""
import csv
import json
import os.path
import sys
from datetime import datetime
import pygal
import requests
from pygal.styl... | true |
f9ab4ec040b7323863a2183b49fc4eb70b7a8d60 | Python | zhengnengjin/python_Learning | /Day26/编码拾遗.py | UTF-8 | 620 | 3.578125 | 4 | [] | no_license | #__author: ZhengNengjin
#__date: 2018/10/16
# Py3:str bytes
# str: unicode
# bytes: 十六进制
a = 'hello郑能锦'
print(type(a)) # <class 'str'>
'''str>>>>>bytes : 编码'''
b = bytes(a,'utf8') #utf8规则下的bytes类型
print(b) #b'hello\xe9\x83\x91\xe8\x83\xbd\xe9\x94\xa6'
b2 = a.encode('utf8')
print(b2)#b'hello\xe9\x83\x91\xe8\x83... | true |
d82518095beab44de9451a184c034c043126aeca | Python | fgpiaui/vacinaDados | /cidade.py | UTF-8 | 7,624 | 2.8125 | 3 | [] | no_license | from colunas import *
class Cidade:
def __init__(self, df, municipios):
self.df = df
self.municipios = municipios
self.municipios['doses'] = self.municipios['populacao']*2
self.dicionario_cidade = dict.fromkeys(list(self.df['estabelecimento_municipio_nome']
... | true |
c0017f11d6e18e811f6ed696e9982ffb534bacbc | Python | uberscientist/activetick_http | /activetick_http/__init__.py | UTF-8 | 14,662 | 2.859375 | 3 | [
"MIT"
] | permissive | from . quote_fields import quote_definitions, quote_dtypes
from io import StringIO
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
from requests import Session
# TODO look into read_csv use_cols option for speedups
# TODO Fix doc comment formatting on methods
class ActiveTick:
def ... | true |
f022cd49fa1078d7a7b717dc610679c440fc282d | Python | eduardo-duran/automizer-crontab-parser | /tests/test_period_day.py | UTF-8 | 4,708 | 3.09375 | 3 | [] | no_license | import unittest
from application.services.period_day import PeriodDay
from domain.schedule import Schedule
class TestPeriodDay(unittest.TestCase):
def test_getHours_with_startHour_8(self):
startHour = '8'
dummy = ''
period = createPeriod( dummy, startHour, dumm... | true |
d1d32d0ac8d882d65f52f030e725f5394414ad9c | Python | ksu-is/Commute-Traffic-Twitter-Bot | /Practice/twitter_practice2.py | UTF-8 | 1,927 | 2.734375 | 3 | [] | no_license | import sys
import tweepy
import keys
import datetime, time
import tkinter as tk
auth = tweepy.OAuthHandler(keys.TWITTER_APP_KEY, keys.TWITTER_APP_SECRET)
auth.set_access_token(keys.TWITTER_KEY, keys.TWITTER_SECRET)
api = tweepy.API(auth)
def get_tweets(api,username):
display_message = ""
try:
stuff =... | true |
19f9ec38883bc4f3baddfe9e386cbb255f2fd59c | Python | dmtrbrlkv/CrackWatcherBot | /app/main.py | UTF-8 | 2,179 | 2.609375 | 3 | [] | no_license | import crack_watch
import bot
import time
import logging
from threading import Thread
class Watcher(Thread):
def __init__(self, every, subscribe, cursor):
super().__init__()
self.every = every
self.subscribe = subscribe
self.cursor = cursor
@staticmethod
def send_info_to_... | true |
98d13c7c41687a9e137c84b67b577a3107c4d35e | Python | krprithvi/vacationplanner | /app/legs.py | UTF-8 | 860 | 3.234375 | 3 | [] | no_license | import re
class Leg:
segments = None
travelDuration = None
travelDurationHours = None
travelDurationMinutes = None
maxAirline = None
def __init__(self, segments, travelDuration, maxAirline):
self.segments = segments
self.travelDuration = travelDuration
self.maxAirline ... | true |
381cf2cec343761e65edcf4c88456420a7bb23f9 | Python | chitn/Algorithms-illustrated-by-Python | /example/prim.py | UTF-8 | 1,522 | 3.25 | 3 | [] | no_license | # MST
# https://www.spoj.com/problems/MST/
# AC
from heapq import heappush, heappop
INF = 10**9
def prims(sta):
visit = []
dist[sta] = 0
heappush(visit, (0, sta))
while (len(visit) > 0):
vh_data = heappop(visit)
vh = vh_data[1]
visited[vh] = True
... | true |
252a87d8a7dbe9766c4a0267abc893cd6dbbd480 | Python | moon729/PythonAlgorithm | /5. 재귀 알고리즘/gcd.py | UTF-8 | 268 | 4 | 4 | [] | no_license | #euclidean algorithm
def gcd(x:int, y:int) -> int:
if x < y:
x, y = y, x
if y == 0: return x
else:
return gcd(y, x%y)
if __name__ == '__main__':
x = int(input('x : '))
y = int(input('y : '))
print(f'gcd(x,y) = {gcd(x,y)}')
| true |
63d949bb0778cc84f862cf0c74e7e8ac92b1f38a | Python | dylanpmorgan/cwdm_ML | /cwdmModel.py | UTF-8 | 5,683 | 2.640625 | 3 | [] | no_license | import os, time, sys, pdb
import numpy as np
try:
import cPickle as pickle
except:
import pickle
import itertools
import sklearn.base
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearchCV
from matplotlib.colors i... | true |
0d15222ae33375ca909f14cc43e47829955247fd | Python | rlawjdghek/2021-LG-AI-Competition | /src/augmentations.py | UTF-8 | 8,376 | 2.609375 | 3 | [] | no_license | import cv2
import numpy as np
import torch
import albumentations as A
from albumentations.core.transforms_interface import DualTransform
import os
# 출처: https://www.kaggle.com/shivyshiv/efficientnet-gridmask-training-pytorch
class GridMask_(DualTransform):
"""GridMask augmentation for image classification and obje... | true |
faf2360b7c3759ef0f49ba2bef17675f71f6bb27 | Python | PPodhorodecki/Prework | /03_Biblioteka_standardowa_w_języku_python/Zadanie_2-Łączenie_listy/task.py | UTF-8 | 83 | 3.046875 | 3 | [] | no_license | lista=list(["a", "b", "c", "d", "e"])
separator = " "
print(separator.join(lista))
| true |
be11da17cd3b82ab32c3818d558a45ba3e3d2e89 | Python | sogoodnow/python-study | /week9/week9/spiders/dangdang.py | UTF-8 | 3,005 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from ..items import DangItem
from scrapy.loader import ItemLoader
from scrapy.http import Request
class DangdangSpider(scrapy.Spider):
name = 'dangdang'
allowed_domains = ['search.dangdang.com']
start_urls = ['http://search.dangdang.com/?key=python&act=input']
pag... | true |
e0eb57defc9fe468e5e18471d3d2af683a18f0a2 | Python | deternan/Light-tools-Python- | /Value_check.py | UTF-8 | 272 | 2.875 | 3 | [] | no_license | # coding=utf8
'''
NaN_check
version: December 03, 2019 02:02 PM
Last revision: December 03, 2019 02:12 PM
Author : Chao-Hsuan Ke
'''
import numpy as np
aa = 18
divided = 3
if(divided!=0):
print(aa/divided)
else:
print('divided: 0')
#print(np.isnan(divided/aa))
| true |
11888fae7fc65fc486b8f4e8814d87bfa04ee383 | Python | decretist/Sg | /post/freq.py | UTF-8 | 530 | 2.765625 | 3 | [] | no_license | #!/usr/local/bin/python3
#
# Paul Evans (pevans@sandiego.edu)
#
import re
import helper
def main():
"""freq.py | sort -n -r | head -300 | awk '{print $2}' | sort > freq.out"""
string = open('../hand/Gratian3.txt', 'r').read()
words = re.split(r'\W', string)
sg_freqs = helper.dictify(words)
keys = sg... | true |
666acecdc0d8441ae7191d700497fff0b6cb69f7 | Python | xieziwei99/jqxxsx | /var/cityclass.py | UTF-8 | 1,697 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
#用来存储一二三线城市名单
class CityClass:
TierOneCities = ('北京', '上海', '广州', '深圳')
NewTierOneCites = ('成都', '重庆', '杭州', '武汉', '西安', '天津', '苏州', '南京', '郑州', '长沙', '东莞', '沈阳', '青岛', '合肥', '佛山')
TierTwoCities = ('无锡', '宁波', '昆明', '大连', '福州', '厦门', '哈尔滨', '济南', '温州', '南宁', '长春', ... | true |
7d5f447eb752a213029d9ccfd025b9030582aa70 | Python | DiFve/Datastructure-Lab | /Lab04/63010789_Lab04_2.py | UTF-8 | 1,413 | 3.3125 | 3 | [] | no_license | class Queue:
queue=[]
maxq=0
def __init__(self,max):
self.queue=[]
self.maxq=max
def pop(self):
if(len(self.queue)>0):
self.queue.pop(0)
def top(self):
if(len(self.queue)>0):
return self.queue[0]
else:
return "err"
de... | true |
6425a3e1de47807306368060294b81d55899dd53 | Python | ShirleyKirk/black_history_Python | /Python_Practice/Unit_1/shelve_practice/second_version/dump_db_classes.py | UTF-8 | 213 | 2.734375 | 3 | [] | no_license | import shelve
data_box=shelve.open('classes-shelve')
for key in data_box:
print(key,"=>\n",data_box[key].name,':',data_box[key].pay)
#print(data_box['tom'].lastName())
#bob=data_box['bob']
#print(bob.lastName()) | true |
e85275bc4fd21a5b1587c548ceba0f8055497ed4 | Python | JaanaKaaree/data-extraction | /get_facebook.py | UTF-8 | 697 | 2.84375 | 3 | [] | no_license | import facebook
import configparser
config = configparser.RawConfigParser()
config.read('config.ini')
accesstoken = config.get('Facebook', 'access_token')
print (accesstoken)
graph = facebook.GraphAPI(access_token=accesstoken, version="2.12")
# Search for places near 1 Hacker Way in Menlo Park, California.
places ... | true |
914feaabb89dda242e14d1fe5813cf6f3c158192 | Python | gmoretti1/Scientific_Python_Assignments_POLIMI_EETBS | /Assignment 6-Pandas A-Deadline Oct 31 2017/Assignment6_Moretti/Assignment6_Moretti.py | UTF-8 | 1,973 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
EETBS 2017/2018 - Assignment 6 - Redoing assignment 2 using pandas module
Giorgio Moretti (10433550)
"""
import pandas as pd
# The lists are made using this order: [type, length, k, h, area, R value]
resistances_names = ["indoor","outdoor","foam","side plaster","center plaster","brick"]... | true |
369bff85a7de932c6ff5aa368084e8fbe1c74b7b | Python | gobber/sklearn-export | /sklearn_export/estimator/regressor/MLPRegressor/__init__.py | UTF-8 | 2,936 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from sklearn_export.estimator.regressor.Regressor import Regressor
class MLPRegressor(Regressor):
"""
See also
--------
sklearn.neural_network.MLPRegressor
http://scikit-learn.org/stable/modules/generated/
sklearn.neural_network.MLPRegressor.html
"""
# @forma... | true |
72729ef0bf75210f57ebb91d684d689eed4453e6 | Python | poojithumeshrao/poojith | /programs/kdtree.py | UTF-8 | 1,611 | 2.921875 | 3 | [] | no_license | k = 3
count = 0
root = None
import numpy as np
import pdb
import graphviz as gv
class node:
def __init__(self,k,d):
self.points = d
self.order = k
self.left = None
self.right = None
def search(nod,point):
nn = nod
#pdb.set_trace()
while (True):
if nn == None:
... | true |
7f98bcb0b68a6b3450afb5fdc7396f0dfd83fc4a | Python | justinharringa/aprendendo-python | /2020-09-12/gabi/ex78.py | UTF-8 | 507 | 3.65625 | 4 | [
"MIT"
] | permissive | lista_de_num = [int(input('digite um numero: '))
int(input('digite outro: '))
int(input('digite outro: '))
int(input('digite mais um: '))
int(input('o ultimo: '))
print(f'o maior valor foi: {max(lista_de_num)}')
for i, v in enumerate(lista_de_nu... | true |
f51e0df00b9a0f1fa6227e8ee2623e6ab441e891 | Python | LichenZeng/AlphaZero_Gomoku | /policy_value_net_pytorch.py | UTF-8 | 10,135 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
An implementation of the policyValueNet in PyTorch
Tested in PyTorch 0.2.0 and 0.3.0
@author: Junxiao Song
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
def set_learning_rate(optim... | true |
a9666f4c82ff918effdd627e5fe29c691d7c48e1 | Python | rtjxodnd/stockToKakao | /stockToKakao/p11_get_filltered_big_stock_info/bizLogic/screen.py | UTF-8 | 5,613 | 3 | 3 | [] | no_license | from stockToKakao.p11_get_filltered_big_stock_info.crawler.crawlStockDetailInfo import getStockDetailInfo
from stockToKakao.p11_get_filltered_big_stock_info.crawler.crawlDailyStockInfo import main_process as maxVolumeCrawler
from stockToKakao.p11_get_filltered_big_stock_info.crawler.crawlImpairedRatio import find_impai... | true |
283243e5fd940e3d0001c4e166a875b17053e206 | Python | ImpalerWrG/opensmac | /widget.py | UTF-8 | 11,795 | 3 | 3 | [] | no_license | import pygame, render
import txt
import math
def add((x1, y1), (x2, y2)):
return x1 + x2, y1 + y2
def sub((x1, y1), (x2, y2)):
return x1 - x2, y1 - y2
#widget size is internal for drawing, should be set by parent
class Widget(object):
expand = 0, 0
shrink = 0, 0
#size = 0, 0
def __init__(self, **kwargs... | true |
b7e2f3cec92beead03406ff1c75d15c341b6b4be | Python | noeljn/projectPy | /MineSweeper - old/TileGrid.py | UTF-8 | 3,992 | 3.34375 | 3 | [] | no_license | import Tile
import random
class TileGrid():
def __init__(self, size_x, size_y, mines):
self.size = [size_x, size_y]
self.allTiles = []
self.mines = mines
def ClickTile(self, cord):
tile = self.GetTile(cord)
if tile.open == False and tile.flaged == False:
sel... | true |
1b2383c9b657e3d57d20d75db3dcc81dc043c63f | Python | shihaamabr/dhiraaguddns | /ipupdate.py | UTF-8 | 1,611 | 2.609375 | 3 | [] | no_license | import requests
import re
LOGIN_URL = "https://portal.dhivehinet.net.mv/adsls/login_api"
HOME_URL = "https://portal.dhivehinet.net.mv/home"
#The creds
DHIRAAGU_USERNAME=""
DHIRAAGU_PASSWORD=""
NOIP_USERNAME=""
NOIP_PASSWORD=""
NOIP_DOMAIN=""
def login(username= DHIRAAGU_USERNAME, password=DHIRAAGU_PASSW... | true |
94f467320af0a054779611335db320995ed9a3cb | Python | AntonCharnichenka/Python-GitHub-repositories | /python_repositories.py | UTF-8 | 1,718 | 3.5 | 4 | [] | no_license | """This module represents an application collecting information of the most starred GitHub python projects
and saving it in the form of diagram"""
# import
import requests
import pygal
# create api request and save response
url = 'https://api.github.com/search/repositories?q=language:python&sort=stars'
r =... | true |
13e8ded59dc860805a03b2631f14dda3ba849a31 | Python | saikumarkorada20/Fairness-Aware-Ranking | /utils.py | UTF-8 | 97 | 2.609375 | 3 | [] | no_license | def swap(dict, pos1, pos2):
dict[pos1], dict[pos2] = dict[pos2], dict[pos1]
return dict | true |
8f0a29f67229e4f4f2c5e397984b536c0b7d8854 | Python | wldp/quantitative | /quantitative/performance.py | UTF-8 | 1,501 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from scipy import stats
APPROX_BDAYS_PER_MONTH = 21
APPROX_BDAYS_PER_YEAR = 252
MONTHS_PER_YEAR = 12
WEEKS_PER_YEAR = 52
TOTAL_SECONDS_IN_A_DAY = 24 * 60 * 60.
TOTAL_SECONDS_IN_A_YEAR = TOTAL_SECONDS_IN_A_DAY * 365.24
ANNUALIZATION_... | true |
6c06f9429da3de42ba6675cd6d57a0a76d57850f | Python | 981377660LMT/algorithm-study | /11_动态规划/dp分类/概率dp/掷色子/1223. 掷骰子模拟.py | UTF-8 | 1,277 | 3.640625 | 4 | [] | no_license | from functools import lru_cache
from typing import List
# 投掷骰子时,连续 掷出数字 i 的次数不能超过 rollMax[i]
# 计算掷 n 次骰子可得到的不同点数序列的数量。
# 1 <= n <= 5000
# rollMax.length == 6
# 1 <= rollMax[i] <= 15
MOD = int(1e9 + 7)
class Solution:
def dieSimulator(self, n: int, rollMax: List[int]) -> int:
@lru_cache(Non... | true |
5f9d96db203a140a435feb1547aa9426165d96bf | Python | ZeyadYasser/Stanford-CS231n-Projects | /pytorch-testing/momentum/momentum.py | UTF-8 | 2,451 | 2.8125 | 3 | [] | no_license | import torch
import numpy as np
import matplotlib.pyplot as plt
device = torch.device('cpu')
N, D_in, H, D_out = 64, 1000, 100, 10
x = torch.randn(N, D_in, device=device)
y = torch.randn(N, D_out, device=device)
start_w1 = np.random.randn(D_in, H)
start_w2 = np.random.randn(H, D_out)
start_w1 = np.random.randn(D_in,... | true |
e0c3f271b83a5ae70cfbd0850f8d041f125aa045 | Python | Saalu/Google_Automation | /python_list/slice.py | UTF-8 | 270 | 3.53125 | 4 | [] | no_license | words =['Hello', 'world', '!']
print(words, type(words))
print(words[1])
m = [[1,2,3], [4,5,6]]
print(m[1][2])
squares = [0,1,4,9,16,25,36, 49, 64]
print(squares[2:6])
print(squares[6:])
print(squares[:6])
print(squares[::2])
print(squares[2:6:3])
print(squares[::-1]) | true |
2fe7d57017c570ae2fc1d6f666ceb74df5069717 | Python | fannifulmer/exam-trial-basics | /box/box.py | UTF-8 | 694 | 4.78125 | 5 | [] | no_license | # Create a class that represents a cuboid:
# It should take its three dimensions as constructor parameters (numbers)
# It should have a method called `get_surface` that returns the cuboid's surface
# It should have a method called `get_volume` that returns the cuboid's volume
class Cuboid(object):
def __init__(sel... | true |
f2ee0620b99869ac1a6891b00e99ce623a0a390b | Python | jian01/tp-elixir-tdl | /python_client/blocking_socket_transferer.py | UTF-8 | 2,959 | 2.90625 | 3 | [] | no_license | import os
import socket
import select
from typing import Optional
DEFAULT_SOCKET_BUFFER_SIZE = 4096
OK_MESSAGE = "OK"
OK_MESSAGE_LEN = len(OK_MESSAGE.encode('utf-8'))
SIZE_NUMBER_SIZE = 20
class SocketClosed(Exception):
pass
class BlockingSocketTransferer:
def __init__(self, socket: socket)... | true |
23a9f7ba8fec1049a274d62190f2fa46d1e3c253 | Python | 0x0400/LeetCode | /p1448.py | UTF-8 | 867 | 3.234375 | 3 | [] | no_license | # https://leetcode.com/problems/count-good-nodes-in-binary-tree/
from common.tree import TreeNode
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def goo... | true |
6d7d6020fe7fa988ccf7c7711c7e5a207680e266 | Python | JosePabloOnVP/IntroTestingAutomatizado | /Python/page_object/06_page_base/home_page.py | UTF-8 | 369 | 2.671875 | 3 | [] | no_license | from search_page import SearchPage
from page_base import BasePage
class HomePage(BasePage):
def navigate_to(self):
self._driver.get(self._url)
def search_for(self, keyword):
search_field = self._driver.find_element_by_id("search")
search_field.send_keys(keyword)
search_field.s... | true |
adc949d60eaff162819e973593ba0f9e9990b05f | Python | ascle/repo-python | /placa/temp.py | UTF-8 | 1,404 | 3.078125 | 3 | [] | no_license | import cv2
import numpy as np
def draw_lines(hough, image, nlines):
n_x, n_y=image.shape
#convert to color image so that you can see the lines
draw_im = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)
for (rho, theta) in hough[0][:nlines]:
try:
x0 = np.cos(theta)*rho
y0 = np.sin(theta)*rho
pt1 = ( int(x0 + ... | true |
9af7724e7432957553e05edb512b0de00743f6b6 | Python | Nymphet/sensors-plotter | /esp8266_probe_request/analyzer/time_series_histogram.py | UTF-8 | 1,790 | 3.078125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import esp8266_aux
def calc_nbins(df, time_window_length):
# calculate how many bins do we need
start_time = df['time'].min()
end_time = df['time'].max()
nbins = (end_time - start_time) / pd.to_timedelta(time_window_length)
nbi... | true |
486b2045cee1c4e8e54b3cd6dabb1ab3380c5293 | Python | giggzy/go-api-exercise | /scripts/gen_sample_json.py | UTF-8 | 2,194 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
import json
from string import ascii_letters
# generate sample json file for testing
json_file = 'sample.json'
def gen_services():
records_count = 15
services = { "services" : []}
#service_list = services["services"]
for i in range(records_count):
"""
" {
... | true |
1be3c13565fff4836bfa5ac062d038c14d24cb1e | Python | Cooler-ykt/my_education | /try_labs/Turtle/tur13.py | UTF-8 | 1,814 | 3.4375 | 3 | [] | no_license | import math
import turtle
def draw_circle(Radius,pos_angle,rotation):
n=36
storona=2*Radius*math.sin(math.pi/n)
angle=360/n
if rotation=='Left':
nach_povorot=pos_angle+180/n
turtle.seth(nach_povorot)
for i in range(n):
turtle.forward(storona)
turtle.l... | true |
96a443d78d0d764fac88294f248fcdfca978e251 | Python | vrai-group/sequenceLearning | /neural-network.py | UTF-8 | 6,214 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import datetime
import re
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.layers.embeddings import Embedding
from keras.preprocessing import sequence
from sklearn.utils import compute_class_weig... | true |
f74519b5c5656780baed141fc8da2aaab3e91651 | Python | antiface/OpenCLNoise | /openclnoise/genericfilter.py | UTF-8 | 612 | 2.59375 | 3 | [
"MIT"
] | permissive | class GenericFilter(object):
def __init__(self,filename,invocation,defines={}):
self.__defines = defines
self.__FILENAME = filename
self.invocation = invocation
def __loadCode(self):
code = ''
for k,v in self.__defines.iteritems():
code += '#define {0} {1}\n'.format(k,v)
with open(self.__FILENAME,... | true |
46ceb4dc55ba23bcca3f793a30955925f7bc8d76 | Python | luiscabus/ufal-linux-package-manager | /src/Graph.py | UTF-8 | 1,934 | 3.875 | 4 | [] | no_license | from collections import defaultdict
class Graph:
def __init__(self, connections, directed=False):
self.graph = defaultdict(set)
self.directed = directed
self.addConnections(connections)
# Generate the graph dictionary based on the array of touples that
# represent every edge in the graph.
# Example: [(1, ... | true |
66abacbb5d1057a912c17a333823b1037f3e7750 | Python | omou-org/mainframe | /account/management/commands/migrate_summit_accounts.py | UTF-8 | 6,055 | 2.640625 | 3 | [] | no_license | from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
import pandas as pd
import uuid
import math
from account.models import Student
from account.models import Parent
from account.models import Note
from django.contrib.auth.models import User
from rest_framework.authtoken... | true |
a28715538a30eb9c3377d5ae97edfb413d550e7a | Python | Itchy83/PythonStudie | /Lektion 5/Diverse notater Kap8.py | UTF-8 | 1,296 | 3.96875 | 4 | [] | no_license | def HelloWorld(): # simpel defination
""" Her er det en god ide at beskrive hvad funktionen gør"""
print('Hello World')
HelloWorld() #Køres ved bare at skrive navnet på den.
print('----------------------------------------------------------------------------------')
def hej... | true |
a49f62f2d4b50078a54296a4630e5e8d5e87b821 | Python | ClickHouse/ClickHouse | /tests/ci/git_test.py | UTF-8 | 2,797 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
from unittest.mock import patch
import os.path as p
import unittest
from git_helper import Git, Runner, CWD
class TestRunner(unittest.TestCase):
def test_init(self):
runner = Runner()
self.assertEqual(runner.cwd, p.realpath(p.dirname(__file__)))
runner = Runner("/")... | true |
65022c75224ede628132264342756e49fd35e4de | Python | CINick72/project_euler | /pe152/pe152_2.py | UTF-8 | 3,731 | 2.90625 | 3 | [] | no_license | import time
from decimal import *
start = time.clock( )
getcontext().prec = 16
def is_prime(n):
if n == 2 or n == 3: return True
if n < 2 or n%2 == 0: return False
if n < 9: return True
if n%3 == 0: return False
r = int(n**0.5)
f = 5
while f <= r:
# print '\t',f
if n%f == ... | true |
0837c9c2c80f4e1bf9bdbefc47ee806a8ae5b909 | Python | ningshengit/small_spider | /PythonExample/PythonExample/菜鸟编程网站基础实例/Python 十进制转二进制、八进制、十六进制.py | UTF-8 | 360 | 3.265625 | 3 | [] | no_license |
实例(Python 3.0+)
# -*- coding: UTF-8 -*-
# Filename : test.py
# author by : www.runoob.com
# 获取用户输入十进制数
dec = int(input("输入数字:"))
print("十进制数为:", dec)
print("转换为二进制为:", bin(dec))
print("转换为八进制为:", oct(dec))
print("转换为十六进制为:", hex(dec))
| true |
07be75b9620010aec525ba04ac8248e834c370c3 | Python | lisasil/insight_journal | /insight_journal/stats.py | UTF-8 | 4,834 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import nltk
import re
import os
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from collections import Counter
class Stats:
def __init__(self, entry):
self.entry = entry
#save text to file
f = open('entry.txt', 'w')
f.write(self.entry... | true |
f972bd423ce4ce537899156b690f734ab57ea11b | Python | ejziel/Trabalho-Pratico-1 | /client.py | UTF-8 | 2,135 | 2.875 | 3 | [] | no_license | import socket
import sys
import pickle
import time
import os
import tqdm
# arguments
host = sys.argv[1]
port = int(sys.argv[2])
filename = sys.argv[3]
SEPARATOR = "<SEPARATOR>"
BUFFER_SIZE = 1024
def request_file(filename, host, port, direc):
# create the client socket
s = socket.socket()
print(f"[+] Co... | true |
3fcedfd7954755a92d0e74690a27d6993170b567 | Python | Sunshine-Queen/Test | /day03/morra.py | UTF-8 | 402 | 3.796875 | 4 | [] | no_license | import random
player=int(input("请输入:剪刀(0),石头(1),布(2):"))
computer=random.randint(0,2)
if((player == 0)and(computer == 2))or ((player == 1)and(computer == 0))or((player==2)and(computer==1)):
print("获胜,哈哈哈,你太厉害了")
elif computer==player:
print("平局,要不要在玩一次")
else:
print("输了,不要灰心呐,再来一次") | true |
d6771c041edfa61e1a70f17cd8292fb4380124be | Python | danbikle/tsds | /public/class08/class08a.py | UTF-8 | 359 | 2.59375 | 3 | [] | no_license | """
class08a.py
This script should help me do the lab of class08.
Ref:
http://www.tsds4.us/cclasses/class08#lab
Demo:
rm -f allpredictions.csv
wget http://www.spy611.com/csv/allpredictions.csv
python class08a.py
"""
import pandas as pd
allpredictions_df = pd.read_csv('allpredictions.csv')
... | true |
b16687b32d5640a2f8ccd8521c8cbd5c0a281116 | Python | pattiestarfish/root | /machine learning/logistic regression/feature_importance.py | UTF-8 | 1,423 | 3.5 | 4 | [] | no_license | #determines how much weight each feature carries
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from exam import exam_features_scaled, passed_exam_2
# Train a sklearn logistic regression model on the normalized exam data
model_2 = LogisticRegression()
model_2.fit... | true |
f246fa706e779f700d25e62bacc8995fa88aff15 | Python | KashishGambhir/python-programs | /data structure.py | UTF-8 | 516 | 3.75 | 4 | [] | no_license | #append(obj) list.append(obj)
alis=[11,'abc','xyz','python','abc']
alis.append(2009)
print alis
#count list.count(obj)
print alis.count(123)
print alis.count('abc')
#extend()
alis=['abc','ab','xyz','qrst']
blis=[1,2,3,4,5]
alis.extend(blis)
print alis
#index() list.index(obj)
alis=['abc','ab','xyz','qrst']
alis.inde... | true |
abfa1ce25a32b7062d2cbc9f363437fe4066f0b3 | Python | LIGHT1213/PythonStudy | /6/a&a+.py | UTF-8 | 200 | 3.546875 | 4 | [] | no_license | f = open('1.txt', 'a+') #打开文件,返回一个文件对象
content = input("请输入写入的内容:")
f.write (content)
str=f.read()
f.close() #关闭文件
print(str)
| true |
74d76dd31155fcd10ab2c1d648c2565d9a641f9a | Python | Jane-QinJ/Python | /workspace/diaryProject.py | UTF-8 | 3,043 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from Tkinter import *
import os
#写日记
def write():
textVar.set("") #清空entry
text.delete("0.0","end") #清空text
label.config(text="写日记模式")
listBox.pack_forget() #隐藏listBox
entry.pack() #显示entry
text.pack() #显示pack
#保存
def save():
title = textVar.get() + ".txt" ... | true |
c8b80e5eacb9c5789c60afceeb87c815d6e0fb03 | Python | jtmorgan/ds4ux | /notifications/bgt-traffic-solutions/challenge3.py | UTF-8 | 1,249 | 3.5625 | 4 | [
"MIT"
] | permissive | """
How much southbound traffic does the Burke-Gilman get, on average, during Morning commute hours?
How much does it get during evening commute hours?
"""
import bgt_traffic
morning_commute_hours = ['07:00:00 AM', '08:00:00 AM', '09:00:00 AM']
evening_commute_hours = ['04:00:00 PM', '05:00:00 PM', '06:00:00 PM']
a... | true |
f697a67deb5c7c880a3419da250de0f3c1f96d3d | Python | ShamHolder/ML-Algorithms | /project/msh_machinelearning/bayes.py | UTF-8 | 2,368 | 3.3125 | 3 | [] | no_license | import numpy as np
from math import sqrt
from math import pi
from math import exp
class NaiveBayes():
def __init__(self, train, test):
summary = summarizeByClass(train)
predictions = list()
for row in test:
predicitons.append(predict(summary, row))
return predictions
... | true |
228649fef4457654c075ceee16598076dc2d0b32 | Python | oyatziry/KnightsTourGame | /knightsTour.py | UTF-8 | 2,053 | 4 | 4 | [] | no_license | import Tkinter as Tk
class KnightGame:
def __init__(self):
self.canvas_width = 500
self.canvas_height = 500
self.tiles = {}
self.canvas = Tk.Canvas(root, width = self.canvas_width, height = self.canvas_height)
self.canvas.pack()
self.currentRow = 0
self.curr... | true |
fc54ea774641fbe8872a63257f36b0dee0b8ef12 | Python | profcarlos/MSG | /6sv1/Py6S_tutorial_test.py | UTF-8 | 5,423 | 2.65625 | 3 | [] | no_license | from Py6S import *
import os
#s = SixS('C:\\Users\\carlos.silveira\\Dropbox\\newPython\\brdf\\sixsV1_1_dell.exe')
s = SixS('C:\\Users\\carlos.silveira\\Dropbox\\newPython\\6SV1\\sixsV1_1_lab.exe')
s.produce_debug_report()
#classmethod UserWaterAndOzone(water, ozone)
#Set 6S to use an atmosphere defined by an ... | true |
761006cd69862812867b58f3db875be2b5998265 | Python | blank77/store | /zd_day06/main.py | UTF-8 | 1,026 | 3.078125 | 3 | [] | no_license | from HTMLTestRunner import HTMLTestRunner
import unittest
import os
tests = unittest.defaultTestLoader.discover(os.getcwd(),pattern="test_ss.py")
'''
'''
runner = HTMLTestRunner.HTMLTestRunner(
title="这是一份抖音的测试报告", #标题
description="这是一份详细的抖音的测试报告", #备注
verbosity=1,
stream= open(file="抖音测试报告.html"... | true |
b0358407b77cff1df30b1955877c3a81517490ca | Python | AdityaRavipati/algo-ds | /anagram.py | UTF-8 | 762 | 3.015625 | 3 | [] | no_license | # code
from collections import defaultdict
import sys
def anagram(str_test):
string = str_test.split()
import pdb; pdb.set_trace()
i = 0
str1 = string[0]
str2 = string[1]
l1 = len(str1)
l2 = len(str2)
if l1 != l2:
print("NO")
sys.exit("NO")
d = defaultdict(lambda: ... | true |
c7f618c9c71bdd9db3a0a3f810f0266ac643fa1c | Python | victor3r/search-algorithms | /Stack.py | UTF-8 | 715 | 4.03125 | 4 | [
"MIT"
] | permissive | class Stack:
def __init__(self, size):
self.size = size
self.cities = [None] * self.size
self.top = -1
def push(self, city):
if not Stack.fullStack(self):
self.top += 1
self.cities[self.top] = city
else:
print("A pilha já está cheia")
... | true |
c2c0c360feed62177ba14473c17020cbb9ec37f9 | Python | RethikNirmal/Optical-Character-Recognition | /data_extract.py | UTF-8 | 3,482 | 2.546875 | 3 | [] | no_license | from scipy import misc
import numpy as np
import cv2
image_size = (54,128)
import h5py
def createImageData(datapoint, output_size, path):
rawimg = cv2.imread(path+datapoint['filename'])
img = np.array(cv2.resize(rawimg, output_size))
return img, rawimg.shape
def generateData(data, n=1000):
... | true |
5f8981a5988e3cfc44f26ce28c2fe2bfd8259b78 | Python | lucaskf1996/robotica2020 | /aula02/atividade2.py | UTF-8 | 7,803 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
import time
from math import pi
import matplotlib.cm as cm
# Parameters to use when opening the webcam.
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)... | true |
fa66831213d32da5d67dcfbdbb07d492e91fdd73 | Python | VikaOlegova/QuickSpec-to-XCTest-converter | /main.py | UTF-8 | 19,719 | 2.53125 | 3 | [] | no_license | import re
import os
from subprocess import Popen, PIPE
from pathlib import Path
import shutil
import string
import sys
def write_file(filename, text):
dir = os.path.dirname(filename)
if dir != '':
os.makedirs(dir, exist_ok=True)
with open(filename, 'w', encoding='utf-8') as f:
f.write(tex... | true |
0360dc0e5367d946d0712bbef90a9eb6bf30b910 | Python | wangyum/Anaconda | /lib/python2.7/site-packages/gensim/models/wrappers/dtmmodel.py | UTF-8 | 13,934 | 2.609375 | 3 | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Artyom Topchyan <artyom.topchyan@live.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
# Based on Copyright (C) 2014 Radim Rehurek <radimrehurek@seznam.cz>
"""
Python wrapper for Dynamic Topic Models (DTM) and the Docu... | true |
501d8db8dd050050164c3b70bcbf609381a52015 | Python | waltont8/AutoCSVAPI | /AutoCSVAPI.py | UTF-8 | 1,666 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
import getopt
import sys
import csv
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
import socketserver
import re
from urllib.parse import parse_qs, urlparse
IP = "127.0.0.1"
PORT = 8888
argv = sys.argv[1:]
opts, args = getopt.getopt(argv, 'x:y:')
if len(args) != 1:
... | true |
8488af40db5ae6030d66773aee3491fce0eaa5f6 | Python | Thomas84/pyChilizer | /Architype.tab/PHPP.panel/Mass thermal bridge.pushbutton/script.py | UTF-8 | 8,030 | 2.515625 | 3 | [] | no_license | __title__ = "Mass Thermal\n Bridge PHPP"
__doc__ = "Populate the PHPP Thermal Bridge Value parameters for all Windows \nv1.1"
from pyrevit import revit, DB
from pyrevit.framework import List
from pyrevit.forms import ProgressBar
# http://www.revitapidocs.com/2018.1/5da8e3c5-9b49-f942-02fc-7e7783fe8f00.htm
class Fami... | true |
8db5531b7537b5b88e7b8f5bc7e8b2b64d39f5f8 | Python | seoul-ssafy-class-2-studyclub/GaYoung_SSAFY | /programmers/1004_기능개발.py | UTF-8 | 907 | 3.40625 | 3 | [] | no_license | progresses = [95, 90, 99, 99, 80, 99]
speeds = [1, 1, 1, 1, 1, 1]
def solution(progresses, speeds):
# 끝나는 요일 계산하기
check = []
for i in range(len(progresses)):
x, y = divmod((100 - progresses[i]), speeds[i])
if y == 0:
check.append(x)
elif y != 0:
check.append... | true |
87688ef38d3d7e3f5a19d46dcd536b45402d6845 | Python | zsquareplusc/lttp-backup | /link_to_the_past/hashes.py | UTF-8 | 1,705 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# encoding: utf-8
#
# (C) 2012-2016 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
"""\
Link To The Past - a backup tool
Hash functions and commands.
"""
import hashlib
import zlib
class CRC32(object):
"""\
CRC32 API compatible to the hashlib functions (... | true |
0f81ae6c2204049471d13bddeaf9c5643c634493 | Python | Mahendrarrao/Python-sample-programs | /week511.py | UTF-8 | 547 | 3.203125 | 3 | [] | no_license | fname = input("Enter file name: ")
fhandle = open(fname)
list = []
counts = dict()
for line in fhandle:
sline = line.rstrip()
temp = sline.split()
i = 0
for word in temp:
i = i + 1
if 'From' in word:
if 'From:' not in word:
list.append(temp[i])
for word in lis... | true |
9c0149c90030ffb0cc8f199a8ba25df25579a67d | Python | ritwickdey/Python-Week-Day-3 | /demo/demo_7.py | UTF-8 | 109 | 3.4375 | 3 | [] | no_license | # Demo of math module
from math import *
print(sqrt(81)) #output: 9.0
print(pi) #output: 3.141592653589793
| true |
e477cfc5fbd5c1ea1e8b08e7d27b5dbfc2c30b94 | Python | jerryfeng007/pythonCodes | /练习题/00032头尾元素对调.py | UTF-8 | 164 | 3.546875 | 4 | [] | no_license | # 定义一个列表,并将列表中的头尾两个元素对调。
def duidiao(l):
l[0], l[-1] = l[-1], l[0]
return l
print(duidiao([1, 2, 3, 4, 5]))
| true |
06b10872199dfc031e3ed18c3e09cddff59c0d3f | Python | drpuig/Leetcode-1 | /minimum-number-of-arrows-to-burst-balloons/minimum-number-of-arrows-to-burst-balloons.py | UTF-8 | 483 | 2.984375 | 3 | [] | no_license | class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
if not points: return 0
points.sort()
print(points)
count = 1
_, cur_e = points[0]
for s, e in points[1:]:
if s > cur_e:
count += 1
cur_e = e
... | true |
f6ebabc6fdfe911c3ed3955fcd5ebc7d8f8fc80b | Python | mais2086/Facoders | /python/exr1.py | UTF-8 | 125 | 3.078125 | 3 | [] | no_license | def list(list_name):
b=[list_name[0],list_name[-1]]
return b
a = [1, 5, 6, 2, 58, 5, 109, 1000, 22]
print (list(a))
| true |
03fc2fa7e1240beef47907473166862ee874b3c6 | Python | JordanStone/Project2 | /p1/test.py | UTF-8 | 1,051 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
#test.py
#
import pointerqueue
def testPass(name,passed):
if (passed):
print "The method", name, "has passed."
else:
print "The method", name, "has failed."
def main():
rqueue = pointerqueue.pointerQueue()
equeue = []
print "Testing ENQUEUE method."
for n in range(1,11):
rqueue.... | true |
a6690499a1c580c24227b80f6630f57b5b10d69c | Python | erik1066/covid-web-scraper | /src/sc_scraper.py | UTF-8 | 2,990 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import requests, json, io, datetime, pathlib, sys, time, os, csv
from io import StringIO
import county_report, state_report
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverW... | true |
8c0dd593606048a14baa6a06dc683c15abed0e58 | Python | epaillas/contrast_old | /python_tools/meanfrommocks.py | UTF-8 | 1,161 | 2.75 | 3 | [] | no_license | import numpy as np
import glob
import click
import sys
@click.command()
@click.option('--handle_in', type=str, required=True)
@click.option('--handle_out', type=str, required=True)
def mean_from_mocks(handle_in,
handle_out):
print('\nAveraging mean from mocks for the following arguments:')
... | true |
9fa75964065e7bb4e696c3e4da1121b30e7feb81 | Python | KennSmithDS/machine-learning | /stock_projects/prnews_crawler/prnews/pipelines.py | UTF-8 | 1,279 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import sqlite3
class PrnewsPipeline:
def __init__(self):
self.db_connection()
# def __del__(self):
# ... | true |
49370e411b2e8c9b9ec5fce158d70bf3283733da | Python | BigBrou/Laboratory | /PythonK/FirstPython/Library/LibraryUse.py | UTF-8 | 932 | 2.875 | 3 | [] | no_license | #Import Library
##Import datetime of datetime only
from datetime import date, timedelta
VsDate = date.today()
print(VsDate.strftime('%y/%m/%d'))
VtOneweek = timedelta(days= 7)
VsDate = VsDate + VtOneweek
print(VsDate.strftime('%y/%m/%d'))
####################################
import zipfile
VsCompressFileName = zipfi... | true |
9687f9e4757611a65bcbbb7f64095180ecfab1c0 | Python | ArlenZhang1988/PythonLearning | /Lesson 71 pratice two content checker.py | UTF-8 | 528 | 3.28125 | 3 | [] | no_license | from tkinter import*
import hashlib
# learning checker
root = Tk()
text = Text(root,width = 30,height = 5)
text.pack()
text.insert(INSERT,"I low her")
contents = text.get("1.0",END)
def GetSig(contents):
m = hashlib.md5(contents.encode())
return m.digest()
sig = GetSig(contents)
def Check():
contents... | true |
cdcac7fc207ec5cc4e3a9593c46f45976ab16f5e | Python | pinakm9/filters | /python/experiments/BPF Evolution/bpf5_evol.py | UTF-8 | 1,487 | 2.609375 | 3 | [] | no_license | """
Plots evolution of ensembles
"""
# Takes size (or length of Markov chain or final time) of models as the command line argument
# add modules folder to Python's search path
import sys
from pathlib import Path
from os.path import dirname, realpath
script_dir = Path(dirname(realpath(__file__)))
module_dir = str(script... | true |
0488deb041523a29a84cd746a8a9726972fa4fe7 | Python | qmul21-CC-Group17/REST-API | /app/main/service/user.py | UTF-8 | 2,494 | 2.5625 | 3 | [] | no_license | from app.main.model.user import User
from app.main import db
def save_new_user(data):
user_exist = User.query.filter_by(username=data['username']).first(
) or User.query.filter_by(email=data['email']).first()
if user_exist:
return {
'status': 'fail',
'message': "User alread... | true |
1955053c004056dffd9d10481caf945f1621097b | Python | tongue01/hybrid-cosim | /SemanticAdaptationForFMI/FMIAbstraction/src/case_study/scenarios/ControlledScenario_EventController.py | UTF-8 | 9,805 | 2.796875 | 3 | [] | no_license | """
In this scenario, the controller is a statchart that receives events at his input.
The main semantic adaptation is getting the continuous armature signal coming from the power system,
and converting it into an event.
"""
import logging
from bokeh.plotting import figure, output_file, show
from case_study.units.ad... | true |
1684915267f58c55264c56f4b7ea2b08ac43defd | Python | ivSaav/Programming-Fundamentals | /RE07/triplet.py | UTF-8 | 598 | 3.8125 | 4 | [] | no_license | #Given a tuple of n integers, with n > 3, write a Python function triplet(atuple) that finds a
#triplet (a, b, c) such that their sum is zero (i.e., a + b + c = 0)
def triplet(atuple):
result = ()
indx_1 = 0
for item1 in atuple:
indx_1 += 1
indx_2 = indx_1
for item2 in atup... | true |
4fa13ad720f3e5ef2655d1c030f0ef34ad504ac1 | Python | webclinic017/SeleAio | /main.py | UTF-8 | 1,674 | 2.546875 | 3 | [] | no_license |
from email import encoders
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
smtp_server = "smtp.gmail.com"
port = 587 # For starttls
sender_email = "poingshop@gmail.com"
body = "This is an email with attachment sent from P... | true |
f271bbb8cb7868a53db12170be134b5d92d85fed | Python | afcarl/chatbot--EricSchles | /server/app/models.py | UTF-8 | 530 | 2.75 | 3 | [] | no_license | from app import db
class Greeting(db.Model):
__tablename__ = 'greeting'
id = db.Column(db.Integer, primary_key=True)
greeting = db.Column(db.String)
def __init__(self, greeting):
self.greeting = greeting
def __str__(self):
return repr(self.greeting)
class Log(db.Model):
__tab... | true |
731b1372c087218dd6f8efa69210988600945f26 | Python | Aravinthr20/Beg-Set5 | /range.py | UTF-8 | 93 | 3.28125 | 3 | [] | no_license | x=int(input())
if(x>10) or (x==0) or (x<0):
print("NO")
elif(x<=10):
print("yes") | true |
95d2aef0b079198520f5f7572e931875b8894d48 | Python | h0108j/MyPythone | /Ch05/sam05.py | UTF-8 | 481 | 3.859375 | 4 | [] | no_license | scoreKor = int(input("국어 점수를 입력하세요."))
scoreMath = int(input("수학 점수를 입력하세요."))
scoreEng = int(input("영어 점수를 입력하세요."))
avg = (scoreKor + scoreMath + scoreEng)/3
print("평균:", avg)
if avg >= 90:
print("A학점 입니다.")
elif avg >= 80:
print("B학점 입니다.")
elif avg >= 70:
print("C학점 입니다.")
elif avg >= 60:
... | true |
1b299bc4054869e3514cf0b9e1400bfd6741e4d0 | Python | IamWilliamWang/Leetcode-practice | /2020.4/Permute.py | UTF-8 | 447 | 3.171875 | 3 | [] | no_license | class Solution:
def permute(self, nums: list) -> list:
if len(nums) == 0:
return [[]]
result = []
for firstNum in nums:
nextNums = nums.copy()
nextNums.remove(firstNum)
matrix = self.permute(nextNums)
for i in range(len(matrix)):
... | true |
69c2d640e36c7b4b793c1f55dff32493385e0a54 | Python | lijx10/opengm | /src/interfaces/python/examples/add_multiple_unaries.py | UTF-8 | 945 | 2.8125 | 3 | [
"MIT"
] | permissive | import opengm
import numpy
#------------------------------------------------------------------------------------
# This example shows how multiple unaries functions and functions / factors add once
#------------------------------------------------------------------------------------
# add unaries from a for a 2d grid... | true |
a92d19877f72cf0bfa435883d6aed26778871c11 | Python | Thirumurugan-12/Python-programs-11th | /2n2n+1.py | UTF-8 | 183 | 3.671875 | 4 | [] | no_license | #sum of N natural numbers
n=int(input("Enter the number "))
os,es=0,0
for i in range(1,n+1,2):
os+=i
print(i,os)
for i in range(2,n+1,2):
es+=i
print(i,es)
| true |
cbe938073c14ba7bd0bad9fa136dfcd30525cbc7 | Python | giurgiumatei/Fundamentals-of-Programming | /Pandemic Simulation (Prophecy of Corona)/Services.py | UTF-8 | 1,624 | 2.71875 | 3 | [] | no_license |
class service:
def __init__(self,p_repo):
self.p_repo=p_repo
def get_persons(self):
return self.p_repo.get_persons()
def infect(self):#look specifications
persons=self.p_repo.get_persons()
counter=0 #check if there are ill persons
for p in person... | true |
0c0a568b320982f1f54bb9b530d6453b75a54b99 | Python | stevenlrj/Deep-Learning | /vgg.py | UTF-8 | 3,624 | 3.3125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import scipy.io
def _conv_layer(input, weights, bias):
"""
used to calculate the output of con2d layer, Wx+b
"""
conv = tf.nn.conv2d(input, tf.constant(weights), strides=(1, 1, 1, 1),
padding='SAME')
return tf.nn.bias_add(conv, bias)
def cn... | true |
7d92d1191c205b193d003fdaea3776d8531cf6b4 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_123/47.py | UTF-8 | 1,415 | 2.546875 | 3 | [] | no_license | import fileinput,sys
import math
print_indicator = 0
def myprint(*arg):
if print_indicator != 0:
print print_indicator
print arg
lines = []
for line in fileinput.input():
lines.append(line)
n= int(lines[0])
case = 0
line_no =1
myprint("n",n)
for j in xrange(1,n+1):
case +=1
... | true |