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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fbd8ac47fb911a8f6cfd2708bcd327cb9fee9f44 | Python | 13683643950/recommend | /recommend/algorithm/video/v1.py | UTF-8 | 7,948 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
youtube 视频第一版推荐算法
召回环节通过比较标签相似度以及热门视频
排序环境通过视频播放量进行排序
"""
import random
from math import log10
from recommend.models import (
es_client,
redis_client,
video_model,
cache_region,
)
from recommend.const import (
video_index,
video_type,
hot_video_key,
Operation... | true |
b5705461f08a695b00dda296407941126d0ce745 | Python | jpkarlsberg/readux | /readux/books/management/commands/import_volume.py | UTF-8 | 16,488 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive |
'''
Manage command to import a single volume.
Currently assumes single volume only, and one that is not already in
the reposistory (onus on user to check for now).
Takes a path to bag with book/volume contents, a collection id
that the book should be added to, and an optional flag to use
fast bagit validation.
Basi... | true |
32118538dccd062b723d24532f7872e40108c668 | Python | ramiBoss/DynamicProgramming | /python/cut_rod_V2.py | UTF-8 | 548 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python
# Rod Cutting Problem using Dynamic Programming's Bottom-Up Approach
def cut_rod(p, n):
dp = [-1000]*(n+1)
return cut_rod_aux(p, dp, n)
def cut_rod_aux(p, dp, n):
dp[0] = 0
for i in range(1, n+1):
q = p[i]
for j in range(1, i+1):
q = max(q, p[j]+dp[i-j])
... | true |
2b84a1c9822b5e2e4fd855def9ffa6530bd0e48d | Python | tosobolewski/comp_prog_zut | /2. programowanie obiektowe/oop lista 3/3. Komentarze.py | UTF-8 | 2,452 | 3.75 | 4 | [] | no_license | # lista 3 zad 3
class CKomentarz:
def __init__(self, komentarz, użytkownik):
self.komentarz = komentarz
self.użytkownik = użytkownik
pass
def pokaż(self):
print(self.użytkownik.imię, self.użytkownik.nazwisko,\
'<' + self.użytkownik.status + '>')
print(self... | true |
ecafff9d69705d7703d9a5ad4ad0beacef62b4c3 | Python | getState/Programmers-Algorithm | /Level1/29.하샤드수/29.하샤드수.py | UTF-8 | 215 | 3.203125 | 3 | [] | no_license | def solution(x):
answer = True
temp = x
count = 0
while x>0:
count += x%10
x = int(x/10)
if temp%count==0:
answer = True
else:
answer = False
return answer | true |
daf215d9f36635449889bb59d9f767a8c9cb316a | Python | arifgursel/Python-MVC-BoilerPlate | /app/models/User.py | UTF-8 | 4,289 | 2.953125 | 3 | [] | no_license | """
Sample Model File
A Model should be in charge of communicating with the Database.
Define specific model method that query the database for information.
Then call upon these model method in your controller.
Create a model using this template.
"""
from system.core.model import Model
import re
... | true |
84dd13a562657cf30b1b2a498e1bfdca266c6192 | Python | raghavgr/firecode.io | /flip_2d_matrix.py | UTF-8 | 676 | 3.96875 | 4 | [] | no_license | """
You are given an m x n 2D image matrix (List of Lists)
where each integer represents a pixel.
Flip it in-place along its horizontal axis.
Example:
Input image :
1 1
0 0
Modified to :
0 0
1 1
"""
def flip_horizontal_axis(matrix):
"""
Flip 2D matrix ho... | true |
8569d88ddf5945ff21e27d036b189840cedc6a5f | Python | molchiro/AtCoder | /old/ABC162/B.py | UTF-8 | 261 | 3.109375 | 3 | [] | no_license | N = int(input())
total = N*(N+1)//2
fizz_n = N//3
fizz_total = 3*fizz_n*(fizz_n+1)//2
buzz_n = N//5
buzz_total = 5*buzz_n*(buzz_n+1)//2
fizzbuzz_n = N//15
fizzbuzz_total = 15*fizzbuzz_n*(fizzbuzz_n+1)//2
print(total - fizz_total - buzz_total + fizzbuzz_total) | true |
5f57249ff69bc6ca1e23b3700dff390e0a7ec548 | Python | davidHards/Twitch_Project | /sortTest.py | UTF-8 | 1,394 | 2.796875 | 3 | [] | no_license | '''
id set
Date: 01/03/2019
Author: David Hards
'''
import glob
import os
import csv
def getFileNames():
# the folders to be scanned
#os.chdir("D://UG_Project_Data")
os.chdir("E://UG_Project_Data")
# obtains stream data file names
#for file in glob.glob("*streamD*"):
#s... | true |
fa9ad8976fd13f1874addc0c5d3ab58128b5de4f | Python | ShurfLL/infa_2020_kuruts | /mygame/shooter неудачная попытка/game_controller.py | UTF-8 | 1,315 | 2.640625 | 3 | [] | no_license | import pygame
import math
import sys
from pygame.constants import WINDOWHITTEST
from pygame.draw import *
from random import randint
import game_model as model
import game_draw as draw
pygame.init()
FPS = 60
Xbound=800
Ybound=800
screen = pygame.display.set_mode((Xbound, Ybound))
dt=1
def conv_to_screen(x,y,alpha... | true |
73c9a4e245723e938fa3620c06962b2f086c1894 | Python | mscully4/TheQuantitative | /BondYields/plot.py | UTF-8 | 4,737 | 3.109375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import datetime as dt
from matplotlib.ticker import FuncFormatter
import matplotlib.dates as mdates
import os
os.chdir('/home/daily_reports/BondYields/')
def year_ago(df):
#Gathering the data from a year... | true |
844bda399a8b6363b4a5b21a2523b4dab3145baf | Python | yashgugale/Python-Programming-Data-Structures-and-Algorithms | /NPTEL Course/Concept Practices/scope_bk2.py | UTF-8 | 990 | 3.9375 | 4 | [] | no_license | x = 200
print("The value of x from global scope is: ", x)
print("Global scope of global: ", globals())
def f1():
global x
x = 2000
print("\nWe have now changed x to 2000 by using - global x. Value of x is: ",x)
print("Global scope of f1: ", globals())
print("Local scope of f1: ", locals())
f1()
pri... | true |
e687e59dcff048da7bbe623804909219b38a3dfa | Python | CupOfEarlGrey/univer_library | /library_main/models.py | UTF-8 | 588 | 2.609375 | 3 | [] | no_license | from os import path
from uuid import uuid4
from django.db import models
# Create your models here.
def get_file_name(filename):
ext = filename.strip().split('.')[-1]
filename = f"{uuid4()}.{ext}"
return path.join("images", filename)
class Book(models.Model):
name = models.CharField(max_length=50)
... | true |
689abcae6021e066b1a36ba90a3fc410fdc70c04 | Python | manuelsoldini/Deep-Learning-For-EMG | /JANETandLSTMimplementation/model_file.py | UTF-8 | 7,133 | 2.75 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from aux_code.rnn_cells import CustomLSTMCell
from aux_code.tf_ops import linear
def rnn(x, h_dim, y_dim, keep_prob, sequence_lengths,
training, output_format, cell_type='janet',
t_max=None):
'''
Inputs:
x - The input data.
Tensor shape (batch_size, max_sequ... | true |
f85b7d0d3365693df878ccfc45e87dfa5b52e6f1 | Python | Basdanso/ReimbursementApi | /expenseReimbursementProject1/entities/reimbursement_chart_info.py | UTF-8 | 357 | 2.640625 | 3 | [
"MIT"
] | permissive | class ReimbursementChartInfo:
def __init__(self, status: str, amount: int):
self.amount = amount
self.status = status
def __str__(self):
return f"id= amount= {self.amount}, status= {self.status} "
def as_json_dict(self):
return {
"amount": self.amount,
... | true |
a695829320e04075c39bb5614bb26e3e53138fd1 | Python | wheekey/compare-images | /image_resizer.py | UTF-8 | 712 | 3.046875 | 3 | [] | no_license | import cv2
def resize(img_path, width):
img = cv2.imread(img_path, cv2.IMREAD_UNCHANGED)
# 1- width, 0 - height
scale_percent = width / img.shape[1] * 100 # percent of original size
width = int(img.shape[1] * scale_percent / 100)
height = int(img.shape[0] * scale_percent / 100)
dim = (width,... | true |
33a9631bfd9eef93f1a8b4a6f2492b5d03bfba20 | Python | apocalyptech/borderlands2 | /borderlands/datautil/huffman.py | UTF-8 | 3,445 | 3.3125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | from bisect import insort
from borderlands.datautil.bitstreams import ReadBitstream, WriteBitstream
class HuffmanNode:
"""
This is a bit of a hack because I don't feel like rewriting `make_huffman_tree`
entirely. Basically the current implementation relies on Python 2 behavior
where lists and ints c... | true |
ed10c709a80fdbcac34617f590207ad42427b636 | Python | dataAlgorithms/data | /python/strText_tokenText.py | UTF-8 | 3,959 | 2.796875 | 3 | [] | no_license | text = 'foo = 23 + 42 * 18'
tokens = [('NAME', 'foo'), ('EQ','='), ('NUM', '23'), ('PLUS','+'),
('NUM', '42'), ('TIMES', '*'), ('NUM', '10')]
import re
NAME = r'(?P<NAME>[a-zA-Z_][a-zA-Z_0-9]*)'
NUM = r'(?P<NUM>\d+)'
PLUS = r'(?P<PLUS>\+)'
TIMES = r'(?P<TIMES>\*)'
EQ = r'(?P<EQ>=)'
WS = r'(?P<WS>\s+)'
master_p... | true |
12404b768b91557303e66169aff3f85a4c558c2c | Python | MengYunSong/poseidon_master | /poseidon/core/datetime.py | UTF-8 | 723 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: kangliang
date: 2019-12-25
"""
import time
def get_timestamp(type=None):
_localtime = time.localtime(time.time())
if type is None or type == 1:
_year = "{}".format(_localtime.tm_year)[2:]
_month = "{:0>2d}".format(_... | true |
0af27ce7ed115ca5758810bb1de3cc28b694caef | Python | Farnaz08/MLforCOVID | /mlForCovid.py | UTF-8 | 714 | 2.546875 | 3 | [] | no_license | import sklearn.datasets as datasets
import pandas as pd
from sklearn.metrics import accuracy_score
dataset = pd.read_csv('Downloads/covid.csv')
X =dataset.iloc[:, 0:7].values
y = dataset.iloc[:, 8].values
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y,tes... | true |
211e1af9caec2b4d81e5af1c8dfd6a436bd4191b | Python | teodorwisniewski/traning_python_morsels | /Exercice9_deep_suppress/ex9_deep_suppress_17_12_2019.py | UTF-8 | 1,113 | 3.125 | 3 | [] | no_license | from contextlib import contextmanager
@contextmanager
def suppress(*errors):
exception, traceback = (None, None)
try:
yield
except errors as e:
exception = e
traceback = "costam"
return exception, traceback
# class suppress(object):
# def __init__(self,*errors):
# ... | true |
2560a1f650d208820cb6b153e731331d071994ae | Python | Alex-from-belgorod/Homework | /задание 3.py | UTF-8 | 196 | 3.625 | 4 | [] | no_license | run = int(input('введите любое целое, положительное число '))
r = 1
while run > 10:
d = run % 10
run //= 10
if d > r:
r = d
print(r) | true |
469aaae7e4e362c8b2706abb7ce0a1fe0c61207a | Python | wallace123/adventofcode | /2021/day13.py | UTF-8 | 2,326 | 3.34375 | 3 | [] | no_license | #!/usr/bin/python3
class Paper:
def __init__(self):
self.dots = []
self.folds = []
def _parse_input(self):
with open('data/day13.txt', 'r') as infile:
content = infile.read().split('\n\n')
temp = [line.rstrip() for line in content[0].split('\n')... | true |
c5ce7f50879d76fb8995869afe6993c34115330b | Python | mak705/Python_interview | /python_prgrams/testpython/tup9.py | UTF-8 | 454 | 2.84375 | 3 | [] | no_license | fhand = open('romeo.txt')
counts = dict()
for line in fhand:
words = line.split()
# print words
for word in words:
wrd = word.lower()
counts[wrd] = counts.get(wrd,0) + 1
print counts
print counts.items()
flipped = list()
for key,val in counts.items():
# print key,val
newtup = (val, key)
# print newtup
flipped... | true |
8071d9ad3cddf39be41b6330296fb4ed8bf46cdd | Python | George-Leonard/Machine-Learning | /Iris/Code/classification.py | UTF-8 | 5,604 | 3.53125 | 4 | [] | no_license | from sklearn.datasets import load_iris
from sklearn.neighbors import KNeighborsClassifier
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn import svm
import numpy as np
import pandas as pd
iris = load_iris()
#4.5,3,2,0.5
clfKNN = KNeighborsClassifier(n_neighbors=1) # using the ... | true |
bad44e2f995b4ee51f1365772289e016e9be30eb | Python | bepstein111/Code-Class | /22-Audio/Code/Ball0_ABall/Ball0_ABall.pyde | UTF-8 | 433 | 3.5625 | 4 | [] | no_license | #from the Ball.py file, import the Ball class
from Ball import Ball
numBalls = 200
def setup():
global ball #make ball available elsewhere
background(0)
size(640,480)
ball = Ball(random(10),random(10),random(10),
random(10),random(100), random(255),
random(255), ran... | true |
da93e2790f293e65d8f322a1c872c38236f1ee61 | Python | aybjax/bioSanDiego | /wk2/05/FrequentWordsWithMismatches.py | UTF-8 | 2,664 | 3.296875 | 3 | [] | no_license | # Write your FrequentWordsWithMismatches() function here, along with any subroutines you need.
# Your function should return a list.
def FrequentWordsWithMismatches(Text, k, d):
#print(f'genome is\n\t{Text}')
#print(f"mismatch nbr is {d}")
frqPtn = set()
neighborhood = []
for i in range( len(Text) -... | true |
f72601ea72a1bda1c0247c6d77c232866921d839 | Python | Amreshhub/Script_Python | /f1.py | UTF-8 | 145 | 2.78125 | 3 | [] | no_license | def add(m,n):
return m +n
if __name__ == '__main__':
print("f1", __name__, repr(__name__)
print(add(10,20))
| true |
7536326bf3bbb038c7ab4d515bf2d573a2ca26e1 | Python | JukeboxPipeline/jukeboxmaya | /src/jukeboxmaya/mayapylauncher.py | UTF-8 | 2,987 | 2.828125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
"""This module provides a way to launch a new mayapy process.
:func:`mayapy_launcher` is supposed to call the regular jukeboxmaya launcher
but with tha maya python intepreter. It will setup the necessary environment and
transver all arguments to the launcher who handles argparsing etc.
You can a... | true |
d67bf326588f1f589288937180da2d8048bbf8b7 | Python | legendary-acp/Basic_programs | /Python Programs/triangle.py | UTF-8 | 236 | 4.40625 | 4 | [
"MIT"
] | permissive | #Program to find if given three sides can make a triangle or not.
(a,b,c)=[int(i) for i in input().split()]
if(a+b>c and a+c>b and b+c>a):
print("Yes! It's a triangle :)")
else:
print("No! these sides can't make a triangle :(")
| true |
fa965c51ee558914592e3f0cf4d5969c83c2ceb5 | Python | andrew128/MNISTModels | /DiffNumModelCombinations/two_model_threshold_experiment.py | UTF-8 | 4,992 | 2.828125 | 3 | [] | no_license | import tensorflow as tf
import time
import numpy as np
import helpers.helper_funcs as helpers
import helpers.models as models
def run_combinations(simple_model, complex_model, x_data, y_data):
'''
Attempt all confidence values in 0:0.1:1
Store accuracy and time for each confidence value
'''
conf_v... | true |
24811e462a1287ece2cc98a4225e3c377ff0dbb2 | Python | JackoChi/Coursera-Learn-to-Program-The-Fundamentals | /Week 4/Assignment 2: DNA Processing.py | UTF-8 | 3,300 | 4.375 | 4 | [] | no_license | def get_length(dna):
""" (str) -> int
Return the length of the DNA sequence dna.
>>> get_length('ATCGAT')
6
>>> get_length('ATCG')
4
"""
return len(dna)
def is_longer(dna1, dna2):
""" (str, str) -> bool
Return True if and only if DNA sequence dna1 is longer than DNA sequence... | true |
74ce99fbeb37fee2733db78645cf3305f060dcf8 | Python | cullea37/Tabulator | /src/tabulator/server/src/scripts/Fret_crop_calculations.py | UTF-8 | 361 | 2.515625 | 3 | [] | no_license | def fretCrop():
from contourTrial import NeckLength
neckLeftX ,neckRightX, BoundingBoxCoordinates = NeckLength()
cropX = []
for i in range(len(BoundingBoxCoordinates)):
bottomLeft,topLeft,bottomRight,topRight = BoundingBoxCoordinates[i]
leftX = bottomLeft[0]
if leftX < 0:
leftX = 0
cropX.append(leftX)
... | true |
bdda42665acfefccad45a2b49f5436a186140579 | Python | andrewjr897/Finance-Program | /People.py | UTF-8 | 2,068 | 2.828125 | 3 | [] | no_license | class people:
def __init__(self, name):
self.name = name
self.purchase_descrip = []
self.purchase_price_descrip = []
self.purchases = []
self.total_spent = 0
self.debt = 0
self.debt_temp = 0
self.pay = []
self.pay_out = []
self.pay_who... | true |
874eaa6e7a6bf57f87b6f1c3bc015839f08f47e3 | Python | yusufcankann/Introduction-To-Algorithms | /HW3/question4.py | UTF-8 | 1,479 | 3.921875 | 4 | [] | no_license | import random
#stores swap count for quicksort
swap_quicksort=0
#stores swap count for insertion sort
swap_insertion=0
def quick_sort(arr, low, high):
if low<high:
p=rearrange(arr, low, high)
quick_sort(arr, low, p-1)
quick_sort(arr, p + 1, high)
def rearrange(a,low,high):
global sw... | true |
573ab183a3e70ab5adb5b5034ad8b84e6148eeae | Python | xgao0412/UIUC-MCS | /AML/hw9/mnist/q2.py | UTF-8 | 6,654 | 2.515625 | 3 | [] | no_license | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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 applica... | true |
8376e66b594b975f8de4878c7dfcc5635074eb7f | Python | LisaThomas9/AIChatBot | /LF2.py | UTF-8 | 2,525 | 2.640625 | 3 | [] | no_license | import json
import boto3
import logging
from urllib.request import urlopen
# Initialize logger and set log level
logger = logging.getLogger()
logger.setLevel(logging.INFO)
sqs = boto3.resource('sqs', region_name='us-east-1')
queue = sqs.get_queue_by_name(QueueName='dining_orders')
dynamodb = boto3.resource('dynamod... | true |
46a46cc9426887ef81b332ecaee707134d7cb516 | Python | OtuokereTobechukwu/salaries | /salary_analysis.py | UTF-8 | 2,218 | 3.515625 | 4 | [] | no_license | import pandas as pd
import numpy as np
# Importing the data
salary_data = pd.read_csv('San Francisco Salaries.csv')
# ---------- Creating a calculated field for Total pay -------------- #
salary_data['Total Pay'] = salary_data['Base Pay'] + salary_data['Overtime Pay'] + salary_data['Other Pay']
# print(salary_data.he... | true |
53e70259bfedccd948c4e4444913b53008361246 | Python | EphTron/dry-sand | /World.py | UTF-8 | 464 | 2.515625 | 3 | [] | no_license | import pygame
import sys
from pygame.locals import *
import Collision
class World:
def __init__(self, ID, SIZE, line_width):
#setup player
self.ID = ID
self.SIZE = SIZE
self.line_width = line_width
self.left_world = None
self.right_world = None
self.background = pygame.Color(225,22... | true |
9ec215051c35385963393e518e00acd8ce8f7c4c | Python | arjunaugustine/fss16ASE | /code/2/3_5.py | UTF-8 | 769 | 3.59375 | 4 | [] | no_license | def draw_plus_minus():
"""
draws:
+ - - - -
"""
print '+' + ' -' * 4,
def draw_pipe_space():
"""
draws:
|
"""
print '|' + ' ' * 4,
def draw_plus_minus_plus_row(count):
"""
draws draw_plus_minus() count times
and append the result with '+'
"""
for i in ran... | true |
d9b768de5767ae2c5c3ec7e0df2e24d798db4039 | Python | slizb/swag-bag | /python/swagbag/precompute_colors.py | UTF-8 | 2,390 | 3 | 3 | [
"MIT"
] | permissive | import json
import pandas as pd
import numpy as np
# todo: scrape ncaa teams from here http://dynasties.operationsports.com/team-colors.php?sport=ncaa
# todo: hook in colormath
def hex_to_rgb(value):
lv = len(value)
rgb_list = [int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3)]
rgb_str = ' '.j... | true |
702ed84b6140c515099ce4f0fc275850461b999a | Python | bonald/vim_cfg | /osp_sai_2.1.8/system/apps/web/webapi/webapi.py | UTF-8 | 4,230 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
#-*- coding: utf-8 -*-
'''
Created on Aug 20, 2016
@author: wangqj
'''
import types
import base
from flask import jsonify, request, session
from api_error import ApiError
from parse import Parser
class WebApi(object):
def __init__(self, auth=True):
'''
@param auth:
... | true |
3a526ff9f6830e96a38326f6f541fe409493ba6b | Python | LiuAllan/send_mail | /send_mail.py | UTF-8 | 1,875 | 3.09375 | 3 | [] | no_license | import smtplib
#import email_replace
import re
import fileinput
#letter template to be sent
letter = """
=LOCATION=
Attention: =TITLE=
Having consulted with my colleagues and based on the
information gathered from the Nigerian Chambers of Commerce
and industry, I have the privilege t... | true |
816a3eee4c96f51721074c030a8cde961df5bfa6 | Python | MrMalina/Source.Python | /addons/source-python/packages/source-python/memory/manager.py | UTF-8 | 19,217 | 2.9375 | 3 | [] | no_license | # =============================================================================
# >> IMPORTS
# =============================================================================
# Python
from configobj import ConfigObj
# Source.Python
from memory_c import *
from memory.helpers import *
# =================================... | true |
0b465e5aaae802e66a48db89a3422ac3e984dc87 | Python | ThomasMullen/Contour-Analysis | /Code/AllPatients.py | UTF-8 | 3,218 | 2.984375 | 3 | [] | no_license | import pandas as pd
from collections import namedtuple
def separate_by_recurrence(all_patients):
"""
:param all_patients: The global data of all patients
:return: group of DSC cuts global set with patients that have had DSC cuts
recurrence in prostate cancer and DSC cuts global set with no recurrence
... | true |
5099008624eecf000019a9220506ae82f8694ef0 | Python | liusong1220/ClipboardSync | /ClipboardSync.py | UTF-8 | 843 | 2.96875 | 3 | [] | no_license | import sys
import TCPSocketClient
import TCPSocketServer
def main():
print "Hello Clipboard Sync!"
# Read the command line arg to determine whether this be server or client...
if len(sys.argv) < 4:
print "Usage : ClipboardSync server/client ip port"
sys.exit(1)
if sys.argv... | true |
735106c0fb7e4283631214487ea6f5fc9536a55a | Python | RuihanWei/ObjectVersionControl | /Repository/DataAccess.py | UTF-8 | 5,535 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
import mysql.connector
import Tools.Converters.DateTimeConverters as dateTimeConverters
import datetime
# potential ORM
# mysql+mysqlconnector://<user>:<password>@<host>[:<port>]/<dbname>
# Base = declarative_base()
# app = Flask(__name__)
# app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://root:rien... | true |
169e9fca689a5534e80d1894fa3d748597f6751a | Python | darcyfzh/algorithm | /剑指offer代码/37_firstCommonNode.py | UTF-8 | 1,635 | 3.734375 | 4 | [] | no_license | '''
@Author: Darcy
@Date: May, 19, 2017
@Topic: First common node of two linkedList
'''
class Node(object):
def __init__(self, a):
self.value = a
self.next = None
class linkedList:
def __init__(self):
self.head = None
self.size = 0
def length(self):
return self.size
def isEmpty(self):
return self.siz... | true |
3ef56d6f11f9ecd6711ec875aecf15b49fea96ce | Python | MrJaba/MachineLearning | /eval.py | UTF-8 | 888 | 2.890625 | 3 | [] | no_license | from sklearn import cross_validation
import sklearn.neighbors as neighbours
import numpy as np
def evaluation(actual, predicted):
actual == predicted
def main():
knn = neighbours.KNeighborsClassifier(algorithm:"kd_tree", weights:"distance")
dataset = np.genfromtxt(open('Data/train.csv','r'), delimiter=','... | true |
8e9dfc63ee05fd6e8bfe29468ce7a0c65c720628 | Python | yashhR/competitive | /Code Forces/#650-Div3/D-TaskOnTheBoard.py | UTF-8 | 82 | 2.625 | 3 | [] | no_license | q = int(input())
while q:
s = list(input())
m = int(input())
q -= 1
| true |
10fbc568ea3ce13fa7cec232eb304595bf6d38a5 | Python | fgokdata/PythonCodes | /assignment-14.py | UTF-8 | 351 | 3.8125 | 4 | [] | no_license | #Print the prime numbers which are between 1 to entered limit number (n).
n = int(input("please enter the a number which you want\
to find prime number between 1 to\n"))
number = []
for i in range(1,n+1):
count = 0
for j in range(2,i):
if i % j ==0:
count +=1
if count == 0:
n... | true |
3a8aefb40a1d9f550ad3520b2f0063f20dc13bf3 | Python | huyquangtranaus/Toto | /toto/inputs/mat.py | UTF-8 | 2,212 | 3.390625 | 3 | [] | no_license | """Read MATLAB file
This import mat file. This class returns a Panda Dataframe with some extra attributes such as Latitude,Longitude,Units.
Parameters
~~~~~~~~~~
filename : (files,) str or list_like
A list of filename to process.
Notes
-----
The file MUST contain a variable c... | true |
10b692dec5e99f17aa69dc77275f183e4c46e7d9 | Python | aftaberski/tic-tac-toe | /game.py | UTF-8 | 3,558 | 4 | 4 | [] | no_license | class Board(object):
game_board = [["", "", ""],
["" , "" , "" ],
["" , "" , "" ]]
def print_board(self):
for i in self.game_board:
print i
class Player(object):
def __init__(self, name, mark):
self.name = name
self.mark = mark
class Gam... | true |
eff65df288bf19fe91e228cc026ce39201766c5d | Python | LuyandaGitHub/intro_python | /Week_3/Triangle/triangle.py | UTF-8 | 621 | 4.25 | 4 | [] | no_license | import math
side_1 = float(input('Enter the length of the first side'))
side_2 = float(input('Enter the length of the second side'))
side_3 = float(input('Enter the length of the third side'))
def calculate_area(side1, side2, side3) :
# FIRST, WE CALCULATE THE semi_perimeter (WHICH IS HALF THE PERIMETER)
... | true |
a8106dd9d83598a77be66ca3a879c2907f3120fb | Python | kiminh/seeking-micro-influencers-for-brand-promotion | /code/metrics_all.py | UTF-8 | 7,551 | 2.875 | 3 | [] | no_license | import xlrd
import xlsxwriter
class Metrics:
def mrr(l_brand, l_in, l_ist, l_score): # MRR
all_positive = 797
brand_num = 74
max_len = all_positive * brand_num
index = 0
index_1 = 0
top_rank = []
for j in range(0, brand_num)... | true |
2c8a7bb5cdd1db9d77e3f6d89be1e6d408143080 | Python | Zetinator/just_code | /python/leetcode/huffman_decoding.py | UTF-8 | 1,381 | 3.984375 | 4 | [
"MIT"
] | permissive | """https://www.hackerrank.com/challenges/tree-huffman-decoding/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=trees&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen
Huffman coding assigns variable length codewords to fixed length input characte... | true |
5aef40f3eb9314038126f4d49a347afd9ccba014 | Python | Greek-and-Roman-God/Athena | /codingtest/week15/not_square_number.py | UTF-8 | 449 | 3.21875 | 3 | [] | no_license | # 제곱 ㄴㄴ수
import math
results = []
min_num, max_num = map(int, input().split())
validation = [1 for _ in range(min_num, max_num+1)]
search_target = int(math.sqrt(max_num))
squares = [v**2 for v in range(2, search_target+1)]
for square in squares:
cur_idx = (math.ceil(min_num / square) * square) - min_num
while c... | true |
dc3d81b46f170900022fb2d82eb2157d5cb094d1 | Python | jeremyzhangsq/WeiboForecasting | /read.py | UTF-8 | 1,032 | 2.875 | 3 | [] | no_license | import pandas as pd
import random
path = "weibo_train_data.txt"
def df_gen(path):
with open(path, 'rb') as f:
content = f.read()
content = content.decode('utf-8')
lines = content.split('\n')
info = {"uid":[],"mid":[],"time":[],"forward_count":[],"comment_count":[],"like_count":[],"content":[],... | true |
ff9e281ad53bec54d24c23584bf2a5683bdd319d | Python | joswha/interviewpreparation | /cracking-coding-interview/Algorithms/RecursionDP/4.py | UTF-8 | 531 | 4.5625 | 5 | [] | no_license | # Powerset: Write a method to return all subsets of a set.
def powerset(x):
res = []
if not x: # set is empty
res.append(x)
else: # set is not empty, continue the algorithm
a = x[0] # current starting character
b = x[1:] # rest of the total elements
for elem in powerset(... | true |
b3d1b9e8fdda3f35b711960232f1e9e73bf5b109 | Python | veromejia/holberton-system_engineering-devops | /0x16-api_advanced/1-top_ten.py | UTF-8 | 709 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
"""module to request the top 10 for a subscribers"""
import json
import requests
def top_ten(subreddit):
"""Return the top 10 hot post for a subreddit"""
req = requests.get("https://www.reddit.com/r/{}/hot/.json?limit=10"
.format(subreddit),
hea... | true |
de3a9bc06a93d1a04de49257fdb094d31c188be1 | Python | AkiraKaneshiro/MIT_OCW_DATASCIENCE | /inst/mapreduce.py | UTF-8 | 1,860 | 2.578125 | 3 | [] | no_license | """
#
# Runs a dummy job.
# see inst/s3.py for a script to interact with s3 buckets
#
# make sure mrjob has been installed
export AWS_ACCESS_KEY_ID=''
export AWS_SECRET_ACCESS_KEY=''
# It is possible to chain multiple mapreduces together on the commandline because each one blocks until it completes :)
python mapredu... | true |
8a6f17cc6e17d6e5f60b9fa834f78e05b2a9a996 | Python | Mekire/Plants-VS-Zombies | /data/states/story.py | UTF-8 | 1,794 | 2.75 | 3 | [] | no_license | import pygame as pg
from .. import setup,tools
from ..components import sun, sun_objects
class Story(tools._State):
"""This State is updated while our game shows the Story screen."""
def __init__(self):
tools._State.__init__(self)
self.sun_obj = sun_objects.SunObjects()
self.title = se... | true |
e64d3215df1062796fbd01c4db5b2d6453c17a96 | Python | gordiig/Un_RSOI_Microservices | /Gateway/GatewayApp/Queue/Queue.py | UTF-8 | 3,038 | 2.71875 | 3 | [] | no_license | from typing import Union
class Queue:
AUDIO, IMAGE = 'audio', 'image'
_audio_status, _image_status = 1, 1
queue = []
@staticmethod
def _add_task_to_queue(request, data, uuid, ttype):
Queue.queue.append({
'request': request,
'data': data,
'uuid': uuid,
... | true |
1da4f76f7e2c989e09195c4f073fd75a1ad0c5c4 | Python | emunozh/ConstructionYearTechRep | /scripts/_getNeighbours.py | UTF-8 | 1,586 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
import pandas as pd
def _getNeighbours(uuid, Buildings, ID):
cols = ["baw", "gfk", "bja", "sqm", "shell_wall",
"geometry", "distance", "rank"]
mask = ([(a in uuid and b > 0) for a, b in zip(
Buildings.index.tolist(), Buildings.bja.tolist())])
if... | true |
5b6c556d35fe6f062c6e32c13b889a6b6b7b1058 | Python | isabellabvo/Design-de-Software | /Lista com pares ou ímpares.py | UTF-8 | 846 | 4.15625 | 4 | [] | no_license |
#---------ENUNCIADO---------#
'''
Faça uma função que recebe uma lista de números e retorna a string 'ímpar', 'par' ou 'misturado' se ela tiver, respectivamente, só números ímpares, só números pares, ou números dos dois tipos. Se a lista for vazia ela deve retornar misturado.
O nome da sua função deve ser verifica... | true |
bdff992b84a6b099ae83838dd573fa8cce3e9b8a | Python | JamesCraster/URSS-Subcubic-APSP | /MatrixAlgorithms.py | UTF-8 | 2,597 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | import math
import numpy as np
import copy
inf = 10000
def naive(A, B):
d = len(A[0])
C = np.zeros((len(A), len(B[0])))
for i in range(0, len(A)):
for j in range(0, len(B[0])):
C[i][j] = np.dot(A[i, :], B[:, j])
return C
def padMatrix(Y):
X = [i for i in Y]
initWidth = le... | true |
4e9f7332073372a1aa9ebb917ce89297c7645612 | Python | koteswari2/Centos7 | /python/python.py | UTF-8 | 439 | 3.40625 | 3 | [] | no_license | #!/bin/python
mynumber=86
myfloatnumber=3.3
myname="john"
print mynumber
print myfloatnumber
print myname
name= raw_input()
print "Name is %s" %(name)
number= raw_input()
print "Number is %r" %(number)
print 'krishna'
print "hari hara"
print '''Good Morning
How do you do
what do you do
kyaaaa'''
list1 = ['rose', 'li... | true |
c72de78f77dbe10bedf756ee415dd60c26ebe635 | Python | Damon-ZengPeng/Python_Demo | /server.py | UTF-8 | 1,884 | 3.046875 | 3 | [] | no_license | import socket
import threading
import time
import queue
client_queue = queue.Queue(99)
def recv_all(client_socket):
msg = b''
while True:
temp = client_socket.recv(1024)
if temp == b'':
break
msg += temp
return msg
s = socket.socket(socket.AF_INET, socket.SOCK_... | true |
cac5d1c0030aeaebcb1cc66cd11427e7690d5b41 | Python | GudniNathan/SC-T-201-GSKI | /doubly_linked_lists/node.py | UTF-8 | 155 | 3.125 | 3 | [
"MIT"
] | permissive | class Node():
def __init__(self, element=None, prev=None, next=None):
self.element = element
self.prev = prev
self.next = next
| true |
28f04316520943901189bca413fb36018cd387b1 | Python | tetianaNY/python-selenium-automation | /Homework_week_7/pages/base_page.py | UTF-8 | 1,090 | 3.125 | 3 | [] | no_license | from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class Page:
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(self.driver, 15)
def open_page(self, url: str):
self.driver.get(url)
... | true |
b17cf45eeb8439c0c1617cad2128900002a47b47 | Python | msalehi64/Keratoconus | /utils/loss.py | UTF-8 | 1,367 | 2.546875 | 3 | [] | no_license | import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.autograd import Variable
from torch.nn import CrossEntropyLoss
class FocalLoss(nn.Module):
def __init__(self):
super(FocalLoss, self).__init__()
def forward(self, score, target):
target = target.data.cpu()
... | true |
2f9987517fc077799d0935c6dcfba6838fb16f2e | Python | Akshathakmurthy/soloLearn | /Python/Core/PhoneNumberValidator.py | UTF-8 | 136 | 3.09375 | 3 | [] | no_license | import re
#your code goes here
n = str(input())
p = '\A(1|8|9)\d{7}$'
if re.match(p, n):
print('Valid')
else:
print('Invalid') | true |
f1cee242fe7f6a91bfa9770088e5c9b454f10966 | Python | prashanth41/DAA-assignments | /Assignment 1/mul.py | UTF-8 | 1,641 | 3.34375 | 3 | [] | no_license | import time, sys
from random import randint
# Use the below command to run this program
# python -m memory_profiler mul.py
# Functions
@profile
def random_n_digit(digits): # Generation of random numbers
neg = randint(0,1)
if neg==0:
neg = -1
else:
neg = 1
number_1 = 10**(digits-1)
number_2 = (10**digits)-1
... | true |
d67490825dfddaf660d8822c587b3a2d1149bf8e | Python | carlb15/Python | /oopconcepts.py | UTF-8 | 881 | 4.34375 | 4 | [
"MIT"
] | permissive | """Learning to Program PT2 OOP Concepts."""
class Classroom:
"""Class room class."""
def __init__(self):
"""Initialization."""
self._people = []
def add_person(self, person):
"""Add a person."""
self._people.append(person)
def remove_person(self, person):
"""... | true |
650efbafdd3f0f97dcfaecae8d4047a6efc7b374 | Python | VINCENT101132/vincent1 | /20210706/homework/1.py | UTF-8 | 186 | 3.5625 | 4 | [] | no_license | """
Topic:華氏溫度轉攝氏溫度
Show:Please input Celsius Temperature:
Input:60
Output:
60.0F = 15.6C
"""
t=int(input('請輸入溫度(F)'))
T=str((t-32)/9*5)
print(T+'C') | true |
fafbd671bf12a19a8c15cf4b152cc92f35ecc467 | Python | tianmeng-wxk/web_PO_shopxo | /common/common.py | UTF-8 | 4,773 | 2.609375 | 3 | [] | no_license | import yaml,xlrd,openpyxl
import smtplib
from email.mime.text import MIMEText
#from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.header import Header
from log.log import Logger
from selenium import webdriver
from options.chrome_options import Options
def read_... | true |
1cc1d52140736206114200a4249ae2a18be48858 | Python | shanminlin/Cracking_the_Coding_Interview | /chapter-1/5_one_away.py | UTF-8 | 3,657 | 4.65625 | 5 | [] | no_license | """
Chapter 1 - Problem 1.5 - One Away
Problem:
There are three types of edits that can be performed on strings:
insert a character, remove a character, or replace a character.
Given two strings, write a function to check if they are one edit (or zero edit) away.
Solution:
1. Clarify the question:
Rephrase the questio... | true |
785c52185004dfeddfd2f61b3fc0b00e95573498 | Python | qhuydtvt/tk-vids | /models/utils.py | UTF-8 | 348 | 2.703125 | 3 | [] | no_license | from urllib.request import urlopen
import json
def load_web_json(path):
with urlopen(path) as response:
return json.loads(response.read().decode('utf-8'))
if __name__ == "__main__":
topsong = load_web_json("https://itunes.apple.com/us/rss/topsongs/limit=50/genre=29/explicit=true/json")
print(jso... | true |
a937830dfab8bb80d1a42edcd6898bf6b841eee4 | Python | IvanaH/PyTest | /Test/logAndDecorator.py | UTF-8 | 1,161 | 3.015625 | 3 | [] | no_license | #! usr/bin/env python
# -*- coding: utf-8 -*-
'''
create 2019/10/30
@author Ivana
'''
import logging
import functools
def sampleLogger(filepath = None):
#Create a logger
logger = logging.getLogger('errorAndWarning')
#Create handlers and set the level
e_handler = logging.StreamHandler()
e_hand... | true |
345a510e4c704273f0b6d678a499f5a4760425b6 | Python | nskadam02/python-programs | /countDigits.py | UTF-8 | 220 | 3.71875 | 4 | [] | no_license | def Sumation():
num=int(input("Enter number:"));
sumation=0;
temp=num;
while num>0:
num=int(num/10);
sumation=sumation+1;
print("count of digits in",temp,"is:",sumation);
Sumation();
| true |
96a26ee8e5c714d1f3133b9f3679dbb9f32af164 | Python | jmwalls/iverplot | /iverpy/iver_utils/misc/median_filter.py | UTF-8 | 1,304 | 3.578125 | 4 | [] | no_license | import numpy as np
class Median_filter (object):
"""
generic median filter object for scalar values
Parameters
-----------
win_size : size of window to compute threshold
median_threshold : threshold for median test
vals : list of raw values
is_good : vector of whether a measurement was... | true |
46e56be6d48b1b2f02b1ca13388d4fb77d670526 | Python | szkbkbqiang/ScrapyCrawler | /ScrapyTrainingExercises/unit2/unit2/spiders/quote-authors.py | UTF-8 | 1,353 | 2.625 | 3 | [] | no_license | import scrapy
class QuoteAuthor(scrapy.Spider):
name = 'quote-authors'
start_urls = ['http://quotes.toscrape.com/']
def parse(self, response):
for quote in response.xpath('//div[@class="quote"]'):
item = {'text': quote.xpath('span[@class="text"]/text()').extract()[0],
... | true |
a63eb9a4e24984bc3ef404e7552122fb57809204 | Python | sgscomputerclub/tutorials-python | /Week 6/Tutorial Walkthrough/5 - Moar.py | UTF-8 | 1,884 | 4.34375 | 4 | [] | no_license | '''
Some further functioning that allows you to add someone new to a house
'''
class Boy: # define a class with class just as you use def with functions.
def __init__(self, house, tutor, form, fname, initial, lname):
self.house = house # Note: We don't have to setup the variable first, we can just go sel... | true |
98a5298a19f2db9c998780dffc0de9697d6f1031 | Python | franziskamarb/snake | /snake.py | UTF-8 | 1,584 | 3.15625 | 3 | [] | no_license | import pygame
import random
from typing import Optional, List, Tuple
TILE_SIZE = 20
# TODO: Spielklassen
def main():
width = 20
height = 15
speed = 7
pygame.init()
screen = pygame.display.set_mode((
TILE_SIZE * width,
TILE_SIZE * height
))
clock = pygame.time.Clock()
... | true |
ad1913f490b929365d7a7dd4827a75510ac36a1f | Python | Magnusalt/AoC2018 | /7b.py | UTF-8 | 3,144 | 3.09375 | 3 | [] | no_license | import re
import string
class Worker:
def __init__(self, offsetStart, workItem):
self.finishTime = offsetStart + self.letterToSeconds(workItem)
self.workItem = workItem
def letterToSeconds(self, l):
return string.ascii_uppercase.index(l) + 60
class WorkerPool:
def __init__(self,... | true |
29ac981a73df465308a69d7824bf73f417206fd5 | Python | panchupichu/CodecademyPractice_Python | /ShippingCostCalculator.py | UTF-8 | 1,799 | 4.21875 | 4 | [] | no_license | """ Shipping Cost Calculator
Exercise: List/Dictionary/Control Flow
"""
#Create a dictionary for price list
prices = {
"ground" : [20.00, 1.50, 3.00, 4.00, 4.75],
"drone" : [0.00, 4.50, 9.00, 12.00, 14.25],
"premium" : 125.00
}
#Calculate cost for Ground Shipping
def cost_ground(weight):
flat =... | true |
856bc5a4ba75f38de0b1a94c0b0ac1918268b917 | Python | CYanLong/learn-python3 | /chapter9-example/feild.py | UTF-8 | 278 | 3.734375 | 4 | [] | no_license | class Counter:
count = 0 #类属性定义在外面.
def __init__(self): #实例属性定义在__init__方法中
self.__class__.count += 1
if __name__ == '__main__':
print(Counter.count) #0
c1 = Counter()
print(Counter.count) #1
c2 = Counter()
print(Counter.count) #2 | true |
f9ce1a6f5f56f6ac12a4cdccca4a01fb2799c9d0 | Python | tsperr/Python-Financial-and-Election-Analysis | /PyBank.py | UTF-8 | 3,049 | 3.375 | 3 | [] | no_license |
# This is for PyBank!
# First, we import os and csv modules to create file paths and read csv files
import os
import csv
# import the path to view on all operating systems
PyBankcsvpath=os.path.join('Resources','PyBank.csv')
#set variables to zero
count_of_months=0
total_profit=0
initial_profit=0
total_change=0
m... | true |
c882a3165c93da84ff27c21b4aed9b022263e9dd | Python | LordAzazzello/Work2020 | /OOPLAB/2_semestr/Pyt3/Pyt3.2.py | UTF-8 | 2,730 | 3.6875 | 4 | [] | no_license |
# Напишите классы «Книга» (с обязательными полями: название, автор,
# код), «Библиотека» (с обязательными полями: адрес, номер) и
# корректно свяжите их. Код книги должен назначаться автоматически
# при добавлении книги в библиотеку (используйте для этого
# статический член класса). Если в конструкторе книги указыва... | true |
913fcf2e7a8ff1fbe5d9641ed310c371ec7dd090 | Python | monarchmoney/finicity-python | /finicityapi/models/statement_report_data.py | UTF-8 | 2,012 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
class StatementReportData(object):
"""Implementation of the 'Statement Report Data' model.
TODO: type model description here.
Attributes:
account_id (long|int): Specify the account to retrieve the statement
for and display in the report.
i... | true |
43df3d9d54a7295b2c9327396cddbb73d4b88ad3 | Python | ViniciusTxr/Implementacoes-Face-Recognition | /reconhece_imagem.py | UTF-8 | 3,200 | 3.015625 | 3 | [] | no_license | import face_recognition
import cv2
import os
import re
from PIL import Image
#-----------------------------------------------------------------------
#função para encontrar todas as faces em uma pasta
def scan_known_people(known_people_folder):
known_names = []
known_face_encodings = []
for file in im... | true |
dd68e4f3e122a7cd3e0dff2a6fea920cfde8a11d | Python | jasmineespindola/P2_ECE464 | /project_2_fault_cvg.py | UTF-8 | 32,143 | 2.734375 | 3 | [] | no_license | from __future__ import print_function
import csv
import math
import os
unnamedSA = []
gl_a_f_list = []
gl_b_f_list = []
gl_c_f_list = []
gl_d_f_list = []
gl_e_f_list = []
global_fault_list = [gl_a_f_list, gl_b_f_list, gl_c_f_list, gl_d_f_list, gl_e_f_list]
# Function List:
# 1. netRead: read the benchmark... | true |
5e2c88633bc382e9ed88c56cebb30a864d7e49e1 | Python | lucasfeitosapr/pyms | /reader.py | UTF-8 | 3,429 | 2.859375 | 3 | [] | no_license | import re
import itertools
from primer import Primer
from barcode import Barcode
def reader(file_name):
for line in f:
if "[barcodes]" in line or reading_barcodes:
class Config:
def __init__(self, file_name):
self._primer_config = {}
self._barcode_config = {}
self.libraries = file_name
def __str__(sel... | true |
eb0b3d8aea485b4335699dec20be207427dfbd11 | Python | shenbagabalan/pythonpgms | /largerof3nos.py | UTF-8 | 212 | 3.46875 | 3 | [] | no_license | value1,value2,value3=input().split()
value1=int(value1)
value2=int(value2)
value3=int(value3)
if(value1>value2 and value1>value3):
print(value1)
elif(value2>value3):
print(value2)
else:
print(value3)
| true |
e63a3af0acd730aa3bb754c327bfb2c0f899e57b | Python | runarandreassen/Progmod-x-18-19 | /integrasjon/integrasjon.py | UTF-8 | 975 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 26 15:01:44 2019
@author: anru0906
"""
#Et program som definerer metoder for integrasjon
def rektangel(f, a, b, n):
h = (b - a)/n
sum = 0
for k in range(0, n):
sum += f(a + k*h)
return sum*h
def trapes(f, a, b, n):
h = (b - a)/n... | true |
6e293ada0ccef4e2e1e05daddd6ee9b48e1a564f | Python | nmoorenz/automateboring | /6-bulletPointAdder.py | UTF-8 | 483 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 30 14:14:36 2019
@author: MooreN
"""
# add bullet points to a copied list from the clipboard
# and put it back on the clipboard
import pyperclip
myList = pyperclip.paste()
print(myList)
splitList = myList.split('\r\n')
print('')
print(splitList)
for i in range(len... | true |
de54b6395100104e29f2d8828965b6ca68fcc423 | Python | JinghuiChan/SVM | /test.py | UTF-8 | 237 | 2.5625 | 3 | [] | no_license | from SVM import *
from data import *
#如果为gauss核的话 ['Gauss',标准差]
svm=SVM(data,'Line',1000,0.02,0.001)
svm.train()
print("*******************************")
print(svm.predict([4,0]))
print(svm.a)
print(svm.w)
print(svm.b) | true |
b8e455a169f32c2eeb84a4ffaabe152949e4e3fd | Python | accus84/python_bootcamp_28032020 | /moje_skrypty/nauka/03_programowanie_obiektowe/zad_08.py | UTF-8 | 2,416 | 4.375 | 4 | [] | no_license | #wyjątki
#przy definiowaniu swoich wyjątków trzeba utworzyć klasę ze swoim wyjątkiem
class ExceptionFull(Exception): #(Exception) trzeba dodać żeby było wiadomo że to wyjątek
pass
class Pojemnik:
def __init__(self, capacity):
self.elements = []
self.capacity = c... | true |
28601afe14c5abce4f23bc18a9e17b055947c5af | Python | ricardo64/Over-100-Exercises-Python-and-Algorithms | /src/examples_in_my_book/general_problems/modules/grep_word_from_files.py | UTF-8 | 630 | 3.125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
import sys
def grep_word_from_files():
''' using iterator enumerate to create a grep command '''
word = sys.argv[1]
for filename in sys.argv[2:]:
with open(filename) as file:
for lino, line in enumerate(file, start=1)... | true |
4613e8452896edd680c826d7ac23915af9134c13 | Python | suman25/ContentTrackManagement | /slot.py | UTF-8 | 194 | 2.984375 | 3 | [] | no_license | class Slot(object):
def __init__(self, slot_time , slot_name, slot_duration):
self.slot_time = slot_time
self.slot_name = slot_name
self.slot_duration = slot_duration | true |