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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6f13e4fff998b65900494d717139194249b61bf6 | Python | webclinic017/2020-lfd | /LFD_Project2/src/tuning.py | UTF-8 | 3,304 | 2.828125 | 3 | [] | no_license | import DataGenerator
from hmmlearn.hmm import GaussianHMM
import numpy as np
from sklearn.metrics import mean_absolute_error
import pickle
from DataGenerator import make_features_for_tuning, create_all_features
import matplotlib.pyplot as plt
def validate_model(model, test_x, past_price):
hidden_states = model.pr... | true |
a5e9ffdf42f1672076d4941d391b602ea4ccab9f | Python | uvkrishnasai/algorithms-datastructures-python | /preparation/GraphBFS.py | UTF-8 | 539 | 3.53125 | 4 | [] | no_license | """
input = [
(1, 3), (3, 2), (2, 4), (4, 5), (8, 5), (5, 9),
(3, 6), (10, 6), (6, 4), (4, 7), (7, 9)
]
in_1, in_2 = [], []
for elem in input:
in_1.append(elem[0])
in_2.append(elem[1])
out_1 = set(in_1) - set(in_2)
in_4 = Counter(in_2)
out_2 = []
for k, v in in_4.items():
if v == 1:
out_2... | true |
4d2bcfa1108ffbe667d8ad209607bdb876c56dc6 | Python | shaunharker/2016-12-15-Workshop | /source/pyCHomP/Braids.py | UTF-8 | 4,663 | 3.171875 | 3 | [
"MIT"
] | permissive | ### Braids.py
### MIT LICENSE 2016 Shaun Harker
from CubicalComplex import *
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
class BraidDiagram:
def __init__(self, braid_skeleton):
"""
Inputs:
braid_skeleton : a list of lists such that
braid_skeleton[i]... | true |
53d5667dd0e8522848bd23e9dc128b246dc7667b | Python | varshinireddyt/Python | /Arrays/Sort Array By Increasing Frequency.py | UTF-8 | 775 | 4.15625 | 4 | [] | no_license | """
Leetcode 1636. Sort Array by Increasing Frequency
Given an array of integers nums, sort the array in increasing order based on the frequency of the values.
If multiple values have the same frequency, sort them in decreasing order.
Return the sorted array
Input: nums = [1,1,2,2,2,3]
Output: [3,1,1,2,2,2]
Explanati... | true |
fa94081cb8f8c2e54506fc1231d32439c90bcb21 | Python | Zadigo/my_python_codes | /exercises/google_mapsz/utils.py | UTF-8 | 378 | 2.5625 | 3 | [] | no_license | import os, re
def get_local_files(directory):
LOCAL_FILES = list(os.walk(os.path.dirname(__file__)))[0][-1]
PATTERNS = [
r'(setup\.(json|txt|py))',
]
for LOCAL_FILE in LOCAL_FILES:
var = re.search(PATTERNS[0], LOCAL_FILE)
if var:
setup_path=os.path.join(directory,va... | true |
762e4d2a44d9a607d9a91fffd565185c4e12fb32 | Python | Aasthaengg/IBMdataset | /Python_codes/p02632/s009293034.py | UTF-8 | 1,212 | 3.265625 | 3 | [] | no_license | def f_strivore(MOD=10**9 + 7):
K = int(input())
S = input()
length = len(S)
class Combination(object):
"""素数 mod に対する二項係数の計算"""
__slots__ = ['mod', 'fact', 'factinv']
def __init__(self, max_val_arg: int = 10**6, mod: int = 10**9 + 7):
fac, inv = [1], []
... | true |
7489e7787d918c8609249ecda262b0fc9f01d93d | Python | jhonsonsamueltua/rpi-arduino-tobalobs | /sketchbook/tobalobs/rpi-ws.py | UTF-8 | 3,299 | 2.734375 | 3 | [] | no_license | from flask import Flask, jsonify
import serial
import time
import requests
API_GET_KONDISI_MENYIMPANG = 'http://66.70.190.240:8000/api/penyimpangan-kondisi-tambak'
if __name__ == '__main__':
app = Flask(__name__)
@app.route('/get-monitor')
def monitor():
s = []
ser = serial.Serial('/... | true |
90216233109420cd864e8106f3eba38ab1c1ba57 | Python | Roarpalm/LOL-Teamfight-Tactics | /S3.5.py | UTF-8 | 8,716 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
#-*-coding:utf-8-*-
import itertools
from time import time
from tqdm import tqdm
start = time()
class Hero():
'''英雄属性'''
def __init__(self, cost, name, origin, class_):
# 等级
self.cost = cost
# 名称
self.name = name
# 种族
self.origin = origin
... | true |
d66a738ca87ff422bb43cbad3b6f3d6ce0f142b1 | Python | d80b2t/python | /HackerRank/Algorithms/Sorting/Intro.py | UTF-8 | 389 | 3.53125 | 4 | [] | no_license | '''
Sample Challenge::
This is a simple challenge to get things started. Given a sorted array () and a number (), can you print the index location of in the array?
'''
v = int(eval(input()))
n = int(eval(input()))
for a0 in range(n):
a = list(map(int,input().strip().split(' ')))
for index, item in ... | true |
ddfdb806ad779d84d285fae19fb67739e4927882 | Python | UA-RCL/RANC | /software/tealayers/tealayer1.0/tealayers/additivepooling.py | UTF-8 | 3,202 | 3.15625 | 3 | [
"MIT"
] | permissive | """Contains the code for a tea layer for use in TeaLearning."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from keras import backend as K
from keras.engine.topology import Layer
class AdditivePooling(Layer):
"""A helper lay... | true |
2f42d0214018a7f1bc01d3dfc8be2da6230dbd48 | Python | sankamuk/PythonCheatsheet | /Advance/21/context_manager_02.py | UTF-8 | 445 | 3.953125 | 4 | [] | no_license |
class LoggingContext:
def __enter__(self):
print("Initializing logging context")
return self
def __exit__(self, exc_type, exc_val, exc_tb):
print("Cleaning logging context")
print("Exception details: {}, {}, {}".format(exc_type, exc_val, exc_tb))
return True
def in... | true |
c86f43ce872258bea4b4a86b9815b15bf752927d | Python | The-Anonymous-pro/projects | /week 1 assignment/Assingment.py | UTF-8 | 1,027 | 3.96875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## ASSIGNMENT
#
# **Tomiwa Emmanuel O. Am a python programmer and this script will be solving quadratic equations**. A quadratic equation form is: **(ax² + bx + c = 0)** which is solved using a quadratic formular: **(-b +- √(b²-4ac))/2a** where a, b, c are numbers and **a**... | true |
e7a36b5f4cd241336e83df244cb69d0ae9fc65b4 | Python | hemanta212/blogger-cli | /blogger_cli/commands/cmd_info.py | UTF-8 | 1,872 | 2.703125 | 3 | [
"MIT"
] | permissive | from itertools import zip_longest
import click
from blogger_cli import __version__
from blogger_cli.cli import pass_context
@click.command("info", short_help="Show blog's properties")
@click.argument("blog", required=False)
@click.option("--all", "show_all", is_flag=True)
@click.option(
"-V", "--version", is_fla... | true |
e560cc583d65f1621b3b261396e131a1f3b0314b | Python | kimhyunkwang/algorithm-study-02 | /4주차/정소원/4주차_위험한 동굴.py | UTF-8 | 492 | 3.34375 | 3 | [] | no_license | from itertools import permutations
N = int(input())
# 방법 1: permutations 함수 모듈 이용하기
p = permutations([str(i+1) for i in range(N)], N)
for line in p:
print(' '.join(list(line)))
# 방법 2: dfs로 직접구현
def dfs(n, cur):
if len(cur) == n:
print(' '.join(list(map(lambda x: str(x), cur))))
return
f... | true |
ed8fd7183ea3553e04b8c4716b1f75a86952d69d | Python | minh1061998/D-ng-Quang-Minh-python-c4e27 | /Buoi 4/Bai2.py | UTF-8 | 630 | 3.328125 | 3 | [] | no_license | prices={
'banana':4,
'apple': 2,
'orange': 1.5,
'pear': 3
}
stock={
'banana': 6,
'apple': 0,
'orange': 32,
'pear': 15
}
for i in prices:
print(i)
print('price: ',prices[i])
print('stock: ',stock[i])
for x in stock:
print(x)
print('price: ',prices[x])
print('stock... | true |
e20dcbfce13f0218eb308a590ae0ce07122a49af | Python | zambbo/naver-wordcloud | /coupang/coupang_extract_noun_frequency.py | UTF-8 | 1,500 | 2.8125 | 3 | [] | no_license | import pandas as pd
from konlpy.tag import Okt
import os
from collections import Counter
from datetime import date
def run():
os.chdir('./coupang/')
item_file_name = 'Coupang_보석십자수_2021_7_4.csv'
coupang_df = pd.read_csv(item_file_name)
review_s = coupang_df['review_list']
#전체리뷰 깔끔하게 한 str... | true |
5511b915d556c57e9b4c6d823cd92d220772d1b1 | Python | zixu4728/mypyutil | /testdb.py | UTF-8 | 1,370 | 2.703125 | 3 | [] | no_license | #!/bin/env python
import re
import sys
import json
import MySQLdb
import time
import random
def select_mysql():
try:
conn = MySQLdb.connect(host='127.0.0.1',user='scrapy',passwd='123456',charset='utf8')
conn.select_db('maijiainfo')
cur = conn.cursor()
count = cur.execute('select *... | true |
a2155839cdd136a5f507821cb9ff0d1127227c83 | Python | shnehna/machine_study | /特征抽取/特征过程.py | UTF-8 | 558 | 3.203125 | 3 | [] | no_license | from sklearn.feature_extraction import DictVectorizer
def dictvec():
"""
字典数据抽取
:return: None
"""
# 实例化
dicts = DictVectorizer()
# 调用 fit_transform
city_list = [
{'city': '北京', 'temperature': 30},
{'city': '上海', 'temperature': 60},
{'city': '深圳', 'temperature': ... | true |
4be15d068ae4ad2a690f6180ab61985ae492b59f | Python | Aasthaengg/IBMdataset | /Python_codes/p03050/s947168664.py | UTF-8 | 169 | 2.96875 | 3 | [] | no_license | import math
N, res = int(input()), 0
for i in range(1, int(math.sqrt(N) + 1)):
if N >= i * (i + 1) + i and (N - i) % i == 0:
res += (N - i) // i
print(res)
| true |
3f560a6f0d7c2dd75d64e5c4be80e1fdc4f57256 | Python | Aissen-Li/lintcode | /54.atoi.py | UTF-8 | 761 | 3.5625 | 4 | [] | no_license | class Solution:
"""
@param str: A string
@return: An integer
"""
def atoi(self, str):
if not str:
return 0
str = str.strip()
res = ''
if str[0] == '-' or str[0] == '+':
if str[1] != '-' and str[1] != '+':
res += str[0]
... | true |
a779c1cbf016f1777f8277f5a01bf4ea83f4c13c | Python | hari-bhandari/LinkedList.py | /BST.py | UTF-8 | 3,943 | 4 | 4 | [] | no_license | class BST:
"""Binary Search algorithm is a logarithmic search For more information regarding BSTs, see:
http://en.wikipedia.org/wiki/Binary_search_tree
"""
def __init__(self, value=None):
self.left = None
self.right = None
self.value = value
# def isEmpty(self):
# ... | true |
b129b2be4b08700b5461b804fc687d85c88fd82b | Python | ujiuji1259/disease_normalizer | /src/japanese_disease_normalizer/preprocessor/abbr_preprocessor.py | UTF-8 | 3,632 | 3.015625 | 3 | [] | no_license | """Abbreviation Preprocessor
This module expands abbreviation by using abbreviation dictionary.
"""
import os
import re
import json
from pathlib import Path
from dataclasses import dataclass
import jaconv
from .base_preprocessor import BasePreprocessor
from .. import utils
BASE_URL = "http://aoi.naist.jp/norm/abb_di... | true |
3ae37130fa7e21abeb79e442f87e5902c7a5cbd6 | Python | JasonAHendry/mmp-pipelines | /simulate_fastq-creation.py | UTF-8 | 2,176 | 2.734375 | 3 | [] | no_license | """
MMPP: Mobile Malaria Project Pipelines
--------------------
Simulate
the generation of
.fastq files
from a MinION
--------------------
JHendry, 2019/03/28
"""
import getopt
import sys
import os
import numpy as np
import time
# Parse user inputs
try:
opts, args = getopt.getopt(sys.argv[1:], ":s:t:w:r:", ["sou... | true |
b4251901dc049658d35a772e562a66245d7642f4 | Python | tybens/ProjectEuler | /pe20/pe20.py | UTF-8 | 211 | 3.59375 | 4 | [] | no_license | # PROBLEM 20 - (09/08)
def factorial(num):
res = 1
for i in range(num, 0, -1):
res=res*i
return res
the_num = factorial(100)
res = 0
for i in str(the_num):
res+=int(i)
print(res)
| true |
9479824d6eb3f2a89bfac359804f924afe193ee0 | Python | ubante/poven | /projects/cached_results/something_checker.py | UTF-8 | 2,583 | 3.125 | 3 | [] | no_license | import time
import sys
from somethinglib import Numbre, Whale, Bird
"""
Check something
"""
def main():
print "Here we go."
b = Bird("b")
print b.__str__()
# b.get_flock_travel_distance()
b.compute_travel_distance()
print b.__str__()
# b.get_flock_travel_distance()
# b.compute_travel_... | true |
ea4cd9025065e8bcc2327ad429e2c6f4654c3b3e | Python | rnijhara/question-paper-generator | /app/subset_sum.py | UTF-8 | 1,800 | 3.0625 | 3 | [] | no_license | from typing import List
from app.question import Question
class SubsetSum:
def __init__(self):
self.dp = None
self.subsets = None
def _populate_subsets(self, questions: List[Question], i: int, total: int, subset: List[Question]):
if i == 0 and total != 0 and self.dp[0][total]:
... | true |
456666443ca8a3376c45445d43dcabbb871b207c | Python | mwaghela92/AB_testing | /Code/AB_testing.py | UTF-8 | 3,614 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 9 11:52:32 2019
@author: mayur
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import math
import scipy.stats as st
# importing data into a dataframe
data = pd.read_csv('/Users/mayur/Documents/GitHub/A_B_testing/'
... | true |
cdf7ba68b4d74477c0eb70437019eed5f8fbdc6c | Python | PoolC/algospot | /BOARDCOVER/doodoori2.py | UTF-8 | 2,604 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
#import pdb
rl = lambda: sys.stdin.readline()
#f = open('input.dat', 'r')
#rl = lambda: f.readline()
#pdb.set_trace()
check_tiles = []
check_tiles.append([[0,0], [0,1] , [1, 1]])
check_tiles.append([[0,0], [0,1] , [-1, 1]])
check_tiles.append([[0,0], [1,0] , [0, 1]])
check_tiles.ap... | true |
ad48f57a33a99d757165246536548aec3d4af40d | Python | justinembawomye/python-fun | /numbers.py | UTF-8 | 195 | 3.484375 | 3 | [] | no_license | import sys
numbers = [7,8, 9, 10, 11, 12, 13]
# Prints numbers if they are found or not search algorithm
if 90 in numbers:
print("Found")
sys.exit(0)
print("Not found")
sys.exit(1) | true |
4b4a13a2ce3c18faf3e53919578e055975d7efe4 | Python | phildue/cnn_object_detection | /src/python/utils/fileaccess/XmlParser.py | UTF-8 | 7,159 | 2.828125 | 3 | [] | no_license | import glob
import xml.etree.ElementTree as ET
import numpy as np
from utils.image import Image
from utils.image.imageprocessing import imwrite, imread
from utils.labels.ImgLabel import ImgLabel
from utils.labels.ObjectLabel import ObjectLabel
from utils.labels.Polygon import Polygon
from utils.labels.Pose import Pose... | true |
b07648fde9ce631ffc18bb61a87eba8b1a5dc43b | Python | moduIo/Artificial-Intelligence | /HW2/dfsb.py | UTF-8 | 8,247 | 2.8125 | 3 | [] | no_license | # Tim Zhang
# 110746199
# CSE537 HW 2
#---------------------------------------------------
import sys
import time
import re
#---------------------------------------------------
# Transforms input file into graph representation
#---------------------------------------------------
def generateCSP():
global N, M, K, con... | true |
a5f631ce886b15a3dec2671b8b4efc70361a48c0 | Python | GabrielSPereira/Python-Exercises | /Lista01/Exer15Lista01.py | UTF-8 | 313 | 4.1875 | 4 | [] | no_license | # Questão 15. Elabore um programa que permita a entrada de dois valores ( x, y ),
# troque seus valores entre si e então exiba os novos resultados.
x = int(input("Digite o valor de X\n"))
y = int(input("Digite o valor de Y\n"))
aux = x
x = y
y = aux
print("Valor de X agora é",x, "e o valor de Y agora é",y) | true |
a1389b7289ee0e419648175a6ce31461ffc1c346 | Python | maki-nage/rxsci | /tests/data/test_to_array.py | UTF-8 | 299 | 2.578125 | 3 | [
"MIT"
] | permissive | from array import array
import rx
import rxsci as rs
def test_to_array():
actual_result = []
source = [1, 2, 3, 4]
rx.from_(source).pipe(
rs.data.to_array('d')
).subscribe(
on_next=actual_result.append
)
assert actual_result == [array('d', [1, 2, 3, 4])]
| true |
a173d6300f94d722e2c13c9369374adedc1867ba | Python | PankillerG/Public_Projects | /Programming/PycharmProjects/untitled/Algorithms/Contest_4/E.py | UTF-8 | 2,177 | 2.953125 | 3 | [] | no_license | def length(x, y, dist, xlow, ylow):
if str(x) + ' ' + str(y) not in place:
dist1 = 0
for i in cities:
dist1 = dist1 + abs(
x - int(i[:i.find(' ')])) + abs(
y - int(i[i.find(' ') + 1:]))
if dist == 0 or dist > dist1:
dist = dist1
... | true |
1e9d692520586a9d276c8f45b09dc0ef6c230ba6 | Python | SoapClancy/Python_Project_common_package | /Time_Processing/datetime_utils.py | UTF-8 | 9,773 | 2.640625 | 3 | [] | no_license | import time
from .format_convert_Func import datetime64_ndarray_to_datetime_tuple
from numpy import ndarray
import numpy as np
from typing import Iterable, Union, Callable
import pandas as pd
from pandas import DataFrame
from itertools import product
from datetime import datetime
import copy
from datetime import date
... | true |
a5e1a9a965fea9a9c6221749a5cc7a1d519785bf | Python | MolecularAI/aizynthfinder | /aizynthfinder/context/collection.py | UTF-8 | 4,565 | 3.28125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """ Module containing a class that is the base class for all collection classes (stock, policies, scorers)
"""
from __future__ import annotations
import abc
from typing import TYPE_CHECKING
from aizynthfinder.utils.logging import logger
if TYPE_CHECKING:
from aizynthfinder.utils.type_utils import Any, List, StrD... | true |
b5588ab7a82dcc9f0dcefcdf82a8ad2ce4a9b5eb | Python | jstr045329/public_IB_data_ac | /cmdLineParser.py | UTF-8 | 3,557 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
"""ACTION: Write a bash script that sends 5-10 combinations of command line arguments in
different orders so we can test this."""
import argparse
DEF_ACTION = "store_true" # In most cases we want to store a value either way, with a default of False if an option is not passed in.
OPP_ACTION... | true |
685a3eb7691a798059890b0fe0db1e648fd0f794 | Python | Cr1stalf/Python | /LR4/b.2.py | UTF-8 | 89 | 2.78125 | 3 | [] | no_license | a1, p = map(int, input().split())
A = [a1 + p * (i - 1) for i in range(1, 11)]
print(A) | true |
9bc92a916205e180f290b65587d08fb9dd65c0f8 | Python | vtsartas/ejpython | /ejpy/ejElenaPY/30_hoja-VII-1_metros_cubicos.py | UTF-8 | 1,179 | 4.3125 | 4 | [] | no_license | # Ejercicio 30 - Hoja VII (1) - Indicar el coste del agua de una piscina
# Creamos una función para calcular el importe
def impfinal(p,vol):
return (p*vol)
# Creamos una función para calcular el volumen de la piscina
def volum(anch,larg,prof):
return (anch*larg*prof)
otro="s"
# Pedimos el coste po... | true |
cf8e0af9d6ae5484a0b60c732d1102f96c784187 | Python | vmsgiridhar/DSHackerRank | /Python_Prac/DS/Queue.py | UTF-8 | 406 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 9 11:51:52 2019
@author: C5232886
"""
class Queue:
def __init__(self):
self.data = []
def push(self, data):
self.data.append(data)
print(self.data)
def pop(self):
#FIFO
if len(self.data) != 0:
... | true |
f9241dcdb1ff7a579a161e3f786ec7696bd2c59f | Python | ncfgrill/Advent-of-Code | /2015/d13.py | UTF-8 | 1,378 | 3.265625 | 3 | [] | no_license | '''
AoC 2015 Day 13 Parts 1 and 2
'''
from itertools import permutations
graph = []
def create_graph():
seen = set()
with open('d13') as f:
i, s = -1, len(seen)
for l in f.readlines():
l = l.strip().split(' ')
h = int(l[3]) if l[2] == 'gain' else -(int(l[3]))
... | true |
05c5d1bab87d0cd348f937d79f68b125693dbcfe | Python | bitwalk123/PySide2_sample | /qt_label_image_base64.py | UTF-8 | 1,018 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# reference
# https://stackoverflow.com/questions/53252404/how-to-set-qlabel-using-base64-string-or-byte-array
import sys
from bz2 import decompress
from PySide2.QtCore import QByteArray
from PySide2.QtGui import QPixmap
from PySide2.QtWidgets import (
QApplication,
QLabel... | true |
c54244422d19bcd73d4be42eff0b73e808fcc27a | Python | mitsuk-maksim/tg_mpei_course | /69. Sqrt(x).py | UTF-8 | 595 | 3.515625 | 4 | [] | no_license | #https://leetcode.com/problems/sqrtx/
class Solution:
def mySqrt(self, x: int) -> int:
return int(x**(1/2))
def main():
import sys
import io
def readlines():
for line in io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8'):
yield line.strip('\n')
lines = readlines()
... | true |
6d113abe685d18c9931c0fab52cd66cd8f1bcffe | Python | aczdev/votebot | /tornado.py | UTF-8 | 1,555 | 2.578125 | 3 | [
"MIT"
] | permissive | import psutil
from stem import Signal
from stem.control import Controller
import stem.process
from time import sleep
from urllib3.contrib.socks import SOCKSProxyManager
def kill_tor(tor_path='./tor'):
"""Finds a name of the TOR instance and kills it"""
for proc in psutil.process_iter():
# Get only the... | true |
f57603d71f56eebb237b76a9debcdfa19490de98 | Python | adlev/Learning-Analytics-Fellows-Feedback-Analysis | /sentiment_analysis.py | UTF-8 | 13,052 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
import csv, re, hashlib, numpy
from collections import defaultdict
from ngram import NGram
from math import log, fabs
#input file must be a csv of the form [stringfeedback, studentscore, possiblescore]
input_file = '/Users/adam/Desktop/SI110-Gradeswh.csv'
pos_file = '/Users/adam/Desktop/positiv... | true |
201cd50c6ca7982e929b59a11821c487913ed6ce | Python | bakkurt/python_calismalarim | /email_parser.py | UTF-8 | 635 | 3.1875 | 3 | [] | no_license | #bu program, isim <e-posta>, isim <e-posta> biçimindeki belgeden
#e-posta adreslerini ayıklayıp yeni bir belgeye yapıştırır.
e_posta_giris = input("E-posta adreslerinin bulunduğu dosyanın adını giriniz: ")
dosya_oku = open(e_posta_giris, "r")
dosya_yaz = open("e-posta_yaz.txt","w")
metin = dosya_oku.readline()
eposta =... | true |
0cb58e905976e95169d840a0339eed396d318070 | Python | noobgrow/pointing_game | /compute_score.py | UTF-8 | 3,992 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
def compute_metric(records, metric='pointing', idx=None):
N, C = records.shape
if idx is None:
example_idx, class_idx = np.where(records != 0)
else:
idx = idx[:len(records), :]
example_idx, class_idx = np.where(idx)
if metric == 'pointing':
hits = np... | true |
15d0f0b19dba80da041e5d08aa2170ebd77c7487 | Python | dhockaday/ismir2018 | /scattering_autoencoder/utils/utils_torch.py | UTF-8 | 2,471 | 2.53125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable, Function
def apply_func_at_some_coords(v, func):
m = v.size(1)
if m > 1:
return torch.cat(
(v.narrow(1, 0, 1), func(v.narrow(1, 1, m - 1))), dim=1)
else:
return v
def pad1D... | true |
820550332119c39b63ad67cf21ca7b845821c1b6 | Python | alexandre-mbm/bancadaruralista | /scripts/normaliza-nomes-parlamentares.py | UTF-8 | 721 | 2.9375 | 3 | [] | no_license | from compare import *
# Script que compara os nomes dos candidatos e gera uma lista csv para correções
# Utiliza o compare.py que precisa da difflib e do unidecode
# pip install difflib
# pip install unidecode
# Cria um objeto Matcher - específique o arquivo que vai servir de base para comparações e o campo para comp... | true |
7fb61851327e315401d18de12794d742320a0af2 | Python | jjones203/DecisionTrees | /dec_tree.py | UTF-8 | 16,398 | 3.234375 | 3 | [] | no_license | # Jessica Jones
# CS 429
# Project 1
import csv
import math
import numpy
import node
import mushroom
# info about mushroom dataset
target_attrib = mushroom.target_attrib
positive = mushroom.positive
negative = mushroom.negative
null_class = mushroom.unknown_class
unknown_val = mushroom.unknown_val
fields = mushroom.a... | true |
3e083dba3e59492fb7341d53c62107d86bebcf88 | Python | Somg10/PythonBasic | /M1 Repetitive Printing - Python.py | UTF-8 | 414 | 3.984375 | 4 | [] | no_license | # Function to print given string 'x' times
def print_fun(string, x):
# Your code here
print(string*x)
#{
#Driver Code Starts.
# Driver Code
def main():
testcases = int(input())
# Loop for testcases
while(testcases > 0):
string = input()
x = int(input())
print_fun(stri... | true |
b041d4aa59d32b038af5e130b980c6508ffbbdd4 | Python | shoubhikraj/geodesic-interpolate | /geodesic_interpolate/__main__.py | UTF-8 | 4,585 | 3.203125 | 3 | [] | no_license | """Performing geodesic interpolation or smoothing.
Optimize reaction path using geometric information by minimizing path length with metrics defined by
redundant internal coordinates. Avoids the discontinuity and convergence problems of conventional
interpolation methods by incorporating internal coordinate structure... | true |
e42805b9ffe0e5918191b657c054b0125baed9c5 | Python | RezoApio/WDUTechies | /python/compass.py | UTF-8 | 2,729 | 3.5625 | 4 | [
"MIT"
] | permissive | __DEBUG__ = False
def log(text: str):
if __DEBUG__:
print(text)
class Point:
def __str__(self):
return "Point ({},{})".format(self.x, self.y)
def __init__(self, a, b):
self.x = a
self.y = b
def move(self,dx:int,dy:int):
return Point(self.x + dx, self.y + dy)
... | true |
3919aeb85d43f34c930893777589f4a122d74f2d | Python | BALPRES/BALPRES_BE | /website/models.py | UTF-8 | 2,661 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class OurCompanyContent( models.Model ) :
title = models.CharField( max_length = 500, default = "", null = True )
content = models.CharField( max_length = 1000, default = "", null = True )
img_url_1 = models.CharField( max... | true |
c2c25882cb51fe02d88d73d0a9af6ad51748291a | Python | mkoron/virtual-tea-party | /room.py | UTF-8 | 2,542 | 3.203125 | 3 | [] | no_license | """
Represents normal chat rooms and other states.
"""
import handler
from exceptions import EndSession
class Room(handler.CommandHandler):
"""
A generic environment that may contain one or more users.
It takes care of basic command handling and broadcasting.
"""
def __init__(self, server):
... | true |
583baf3b9d10edd19a5d8ed95da5e0ab91aa0a8d | Python | biznixcn/algorithm_quiz | /3.py | UTF-8 | 559 | 3.9375 | 4 | [] | no_license | #!/usr/bin/python
#-*-coding:utf-8-*-
"""
Given two sorted integer arrays, write an algorithm to get back the intersection.
"""
array1 = [2,5,8,23,56,89,125,169,196]
array2 = [5,8,9,34,78,123,125]
flag1 = 0
flag2 = 0
result = []
while flag1 != len(array1) and flag2 != len(array2):
if array1[flag1] > ar... | true |
e41cd58e0829f047f9850b56f0ecf654407a56a8 | Python | egeorgiev699/exercicis-classroom | /Exercici5.py | UTF-8 | 337 | 3.421875 | 3 | [] | no_license | comida = input ("cuanto te ha costado la comida")
IVA = (float(comida) * 0.21)
propina = (float(comida) * 0.1)
total = (float(comida) + (float(propina)) + (float(IVA)))
print ("precio comida = " + str(float( comida)))
print ("IVA = " + str(float(IVA)))
print ("propina = " + str(float(propina)))
print ("total = " + st... | true |
3c489bcfff2c24a6a893e30aaa10597bbc50c76d | Python | dsiegler2000/Coeus | /src/communication.py | UTF-8 | 27,082 | 2.703125 | 3 | [] | no_license | """
All code to communicate with an interface. Also includes main driver and logging setup currently.
"""
import datetime
import logging
import os
import sys
import threading
import traceback
from typing import List, Optional, Tuple
import chess
import chess.polyglot
import chess.pgn
from engine import CoeusEngine, E... | true |
5a1dfafe93afb2a5d25136e57f6dc672f040ef5d | Python | ventura1981/CursoemVideo-Python | /Desafio_005.py | UTF-8 | 317 | 4.53125 | 5 | [] | no_license | # Faça um programa que leia um número inteiro e mostre na tela o seu sucessor e antecessor.
valor = int(input('Digite um número inteiro:'))
#sucessor = valor + 1
#antecessor = valor -1
#print('{:=20}')
print('Valor digitado: {:>10} \nSucessor: {:>10} \nAntecessor: {:>10}'.format(valor, valor+1, valor-1)) | true |
929f84a5b082410705f00852b91cba557328452a | Python | jiadaizhao/LeetCode | /0601-0700/0664-Strange Printer/0664-Strange Printer.py | UTF-8 | 539 | 3.171875 | 3 | [
"MIT"
] | permissive | class Solution:
def strangePrinter(self, s: str) -> int:
table = [[0] * len(s) for i in range(len(s))]
def dfs(s, l, r):
if l > r:
return 0
if table[l][r]:
return table[l][r]
count = dfs(s, l + 1, r) + 1
for i in range(l... | true |
d6e7798d19eb89b3a125b2c97192a6fb85a68f8b | Python | nnim99/Introduction-to-Programming-Python- | /Lab4/Task 4/Task 3.py | UTF-8 | 466 | 3.28125 | 3 | [] | no_license | def func():
late = int(input("Enter Number of Days a person is late on submitting the book=",))
day = int(input("Enter number of days:"))
if late <=5:
days = day
fine = days*0.5
print ("The fine is:", fine)
elif late > 5 and late <= 10 :
days = day
fine = days*1
print ("The fine is:", fine)
elif la... | true |
2fcc13e76d0c1d842674e696743e42f603003bfa | Python | algo74/predictsim | /simulation/pyss/src/predictors/valopt/algos/sgd.py | UTF-8 | 719 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
# encoding: utf-8
#import numpy as np
class SGD(object):
"""Stochastic Gradient Descent learner with eta/n learning rate"""
def __init__(self, model, loss, eta, verbose=False):
self.model=model
self.loss=loss
self.eta=eta
self.verbose=verbose
self... | true |
0a74bb1a01b4ff31292c79e50b589df8bd76e8ab | Python | hyperskill/hs-test | /src/test/java/projects/python/coffee_machine/stage4/machine/coffee_machine.py | UTF-8 | 1,160 | 3.78125 | 4 | [] | no_license | water = 400
milk = 540
beans = 120
cups = 9
money = 550
def machine_status():
print(f'''The coffee machine has:
{water} of water
{milk} of milk
{beans} of coffee beans
{cups} of disposable cups
{money} of money''')
machine_status()
action = input("Write action (buy, fill, take):\n")
if action == 'buy':
typ ... | true |
3859a700a8353d2fcec1427f80a26777b39734db | Python | Sanjayvaradha/Projects | /Face and Emotion detection.py | UTF-8 | 1,372 | 2.9375 | 3 | [] | no_license |
import cv2
face_detect = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_detect = cv2.CascadeClassifier('haarcascade_eye.xml')
smile_detect = cv2.CascadeClassifier('haarcascade_smile.xml')
def detection(gray,frame):
faces = face_detect.detectMultiScale(gray,1.3,5)
for (x,y,w,h) in faces:
... | true |
32943b4c36adc522d51c567cd971342c82b63248 | Python | jmontara/Purchase-Guidance-from-Quickbooks-report | /functions/getshipments.py | UTF-8 | 8,940 | 2.921875 | 3 | [] | no_license | # filename: getshipments.py
import datetime
import cycletimes
def getshipments(items):
"""
returns dictionary of shipments
Inputs:
items - list of item objects
Outputs:
buyShipmentsByItem
- list of dictionaries
example: {item: [shipment1, shipment2, shipment3]}
"""
print "\n\nentering getsh... | true |
96150b623621ed984ca1c098fb1255d7eb5edc88 | Python | CoinArcade/LISA | /logic_module.py | UTF-8 | 11,160 | 2.796875 | 3 | [] | no_license | #############################################################################################################################################################
# LISA's Backend Functions
##################################################################################################################... | true |
78e781e776593d4c47e5f8e9e99abc8b93d7621c | Python | scoutnolan/School | /GEN/ENG 101/Python/npa0002_prob#1.py | UTF-8 | 1,482 | 2.828125 | 3 | [] | no_license | # Nolan Anderson
# ENG 101 Exam #1
# 4/25/2019
wlist=['promise', 'superb', 'husky', 'torpid', 'field', 'ill', 'macho', 'want',\
'warm', 'high', 'callous', 'star', 'twist', 'high', 'worm', 'grate', 'lame',\
'previous', 'righteous', 'push', 'release', 'pass', 'striped', 'quick',\
'desert', ... | true |
8227eb651fb655641c25e4d12ff801cd8943540a | Python | danieldugas/Vitrified-Code | /Python/Diffusion/sim3.py | UTF-8 | 7,541 | 2.578125 | 3 | [] | no_license | # Diffusion Simulation Through Porous Medium
# Python 2.7
# Daniel Dugas
# Currently
# Implements walls
import sys
import math
import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.patches import Rectangle
np.seterr(all = 'ignore')
plt.ion() # plots don't hang exec... | true |
c0eaaa3592eb4487b859d7606e7005758d0ec20b | Python | LiXiaoRan/Data_handle_practice | /sanitizer_reptile.py | UTF-8 | 1,881 | 2.515625 | 3 | [] | no_license | import requests
import json
import pandas as pd
import numpy as np
my_url = 'http://221.228.242.3:11090/api/FeiFengDataManagement/FFCityManager/GetVehicleData'
my_head = {
'Content-Type': 'application/x-www-form-urlencoded'
}
payload = {'Page': '1000', 'Size': '500', 'dtForm': '2016/7/2 8:00:16', 'dtEnd': '2018/7/... | true |
bd8731fe251c372ebf931ea28d6d3e92a432cd7b | Python | SifeiMexico/ejemplosTimbradoPython | /ejemplo_sellado_cadena_original.py | UTF-8 | 2,249 | 2.734375 | 3 | [] | no_license | import base64
#instalar con > pip install pycryptodome que es mas nuevo y mantiene soporte a diferencia de pycrypto
from Cryptodome.Hash import SHA256
from Cryptodome.Signature import PKCS1_v1_5
from Cryptodome.PublicKey import RSA
from Cryptodome.IO import PEM
from base64 import b64decode
import lxml.etree as ET # ... | true |
8c1a37e9d52630c485ddcbdeb312dd97bbc5cb77 | Python | Niteshkr123/KU-hackfest | /pir.py | UTF-8 | 688 | 2.578125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
import pygame
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN) #PIR
pygame.mixer.init()
try:
time.sleep(2)
while True:
a = GPIO.input(18)
if a:
print("Motion Detected...")
pygame.mixer.music.load("C:/Users/... | true |
2e16ff59a17f925dcee5836ef271905ecdd3fd90 | Python | Msadat97/fairness-vision | /lcifr/code/models/logistic_regression.py | UTF-8 | 555 | 2.90625 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
class LogisticRegression(nn.Module):
def __init__(self, input_dim):
super().__init__()
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
self.linear = nn.Linear(input_dim, 1).to(device)
self.sigmoid = nn.Sigmoid().to(device)
... | true |
51dcf4f630ac39e53d3bb6743f056f1f4c1503f5 | Python | NyarukouSAMA/py_geekbrains | /PythonOOP/FromTeacher/Lesson2/2.3/script.py | UTF-8 | 165 | 2.734375 | 3 | [] | no_license | import re
with open("index.html") as f:
s = f.read()
li = re.findall("<a class=\"home-link home-link_black_yes\" aria-label=\"([^\"]+)\" href=", s)
print(li)
| true |
fa3392c7ce7563d87a7b974210591f5ff1ebc0b8 | Python | nanthu0123/django-blog-app | /blog/views.py | UTF-8 | 4,999 | 3 | 3 | [] | no_license | '''
view is Python function or class that takes a web request and return a web response.
Views are used to do things like fetch objects from the database,
modify those objects if needed, render forms, return HTML, and much more
'''
from datetime import datetime
from django.shortcuts import render
from blog.models impo... | true |
e61480b945808249281130941b50c3119cf1d2a2 | Python | hirekatsu/MyNLTKBOOK | /ch05_02.py | UTF-8 | 5,917 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import nltk, re, pprint
from nltk import word_tokenize
print("""
----------------------------------------------------------------------
2 Tagged Corpora
2.1 Representing Tagged Tokens
-----------------------------... | true |
4edec32061ed558321f26d25b3c683b4f9c04253 | Python | estefaniazuluaga/LabElectro1 | /LabElectro.py | UTF-8 | 2,747 | 3.203125 | 3 | [] | no_license | import math
import numpy as np
Nx = 330; # Número de cuadrículas en el eje x. Cada cuadrícula = 1mm
Ny = 3; # Número de cuadrículas en el eje x. Cada cuadrícula = 1mm
mpx = math.ceil(Nx/2);# % Mid-point of x
mpy = math.ceil(Ny/2); #% Mid point of y
N = 500;
V = np.zeros(Nx,Ny); # Potential (Volta... | true |
003b7ee464be269c03f8efadf16264f284ca3821 | Python | keith-pedersen/iitthesis | /regexRemove.py | UTF-8 | 2,388 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python3
# Copyright (C) 2018 by Keith Pedersen (Keith.David.Pedersen@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the... | true |
6ef8c5eb0adf2fdc9e955d85c2bdb1e7833410c6 | Python | byronduenas/cpen442 | /assignment4/question1.py | UTF-8 | 448 | 3.21875 | 3 | [] | no_license | import hashlib
for x in xrange(0, 9999):
number = str(x).zfill(4)
hash1 = hashlib.sha1(number + "ug").hexdigest()
hash2 = hashlib.sha1("ug" + number).hexdigest()
if hash1 == "7FE36DBE8F148316349EC3435546DB4076FE195F".lower():
print number + "ug" + " is the password"
break
elif hash2... | true |
b28f0bc9de78816ecffc1dc41b321fa1bd0f6e73 | Python | LeilaelRico/semanaTec-herramientasC-arteProgra | /PingPong.py | UTF-8 | 5,656 | 3.328125 | 3 | [] | no_license | import turtle
"""
cambiar la aceleracion de la bola
"""
def pong(name1, score_a, name2, score_b):
# Canvas
win = turtle.Screen()
win.title("Pong")
win.bgcolor("black")
win.setup(width=800, height=600)
win.tracer(0)
rootwindow = win.getcanvas().winfo_toplevel()
rootwindow.call('wm', 'a... | true |
840d966c0eb2cd3cbbfd6f39bc008169a0088c92 | Python | WMQ777/CS420-Final-Project | /MLP.py | UTF-8 | 4,666 | 3 | 3 | [] | no_license | """ Multilayer Perceptron.
"""
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
# Import MNIST data
mnist_train_data = np.fromfile("mnist_train_data",dtype=np.uint8)
mnist_train_label = np.fromfile("mnist_train_label",dtype=np.uint8)
mnist_test_data = np.fromfile("mnist_test_d... | true |
737889734e6cd0b0e620ba492e28ed7400a20d38 | Python | adm6/lessons | /les9/t1.py | UTF-8 | 203 | 3.46875 | 3 | [] | no_license | import random
fib_list = [0, 1]
while (fib_list[-2] + fib_list[-1]) < 5000:
fib_list.append(fib_list[-1] + fib_list[-2])
for i in range(3):
print(fib_list[random.randint(0, len(fib_list)-1)]) | true |
8ea733c60123f00ff1240176acfb2b9d7723d0e9 | Python | minnonong/Codecademy_Python | /06.PygLatin/06_04.py | UTF-8 | 124 | 3.5625 | 4 | [] | no_license | # 06_04 Check Yourself!
original = raw_input("Input: ")
if len(original) > 0:
print original
else:
print "empty"
| true |
7932ee03410cdded508439d3f3a552a3774d8c8f | Python | BIGY2333/hhf | /SEnet.py | UTF-8 | 3,457 | 2.890625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def get_data():
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
return mnist
# 设置权重函数
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev = 0.1)
return tf.Variable(initial)
# 设置阈值函数
d... | true |
94dcd270edc78a4ff5e298595ae33a4a8bd5f9ae | Python | hungrygeek/RNA_clusterin_584 | /final/.svn/pristine/94/94dcd270edc78a4ff5e298595ae33a4a8bd5f9ae.svn-base | UTF-8 | 1,599 | 2.734375 | 3 | [] | no_license | import numpy as np
import random
#assign seqs to clusters based on distance matrix
def assignClusters(medoids, dMatrix):
disMedoids = dMatrix[:,medoids]
clusters = medoids[np.argmin(disMedoids, axis=1)]
clusters[medoids] = medoids
return clusters
#update the medoid based on the current cluster results... | true |
d1a83f25b297c5472ab3d4280f853b3ee8fcfd6c | Python | TechInTech/dataStructure | /set_and_dictory/11.10/linkedbst.py | UTF-8 | 6,080 | 3.4375 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2019/2/24 11:26
# @Author : Despicable Me
# @Email :
# @File : linkedbst.py
# @Software: PyCharm
# @Explain :
from bstnode import BSTNode
from abstractcollection import AbstractCollection
from stack.linkedstack import LinkedStack
from list.linkedlist i... | true |
bf7824ec429d1d393c497c65e12427a9e021e9aa | Python | ken437/TOP500-machine-learning | /train_set_select_strats.py | UTF-8 | 2,067 | 2.875 | 3 | [] | no_license | """
training set size selection strategy that always
returns a size of 1
@param test_pos: position of the test set
@return: recommended train set size (in files)
"""
def one_prev(test_pos):
return 1
"""
training set size selection strategy that always
returns a size of 2, unless the test set is
dataset #2, in which... | true |
db6772a705619e5ca56375bcb9d6409a8a1a0a11 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_136/3261.py | UTF-8 | 307 | 3.453125 | 3 | [] | no_license |
T = int(raw_input())
for i in range(T):
C,F,X = map(float,raw_input().split())
rate = 2
time = 0
while True:
if X/rate < C/rate:
time += X/rate
break
time += C/rate
if X/(rate+F) < (X-C)/rate:
rate+=F
else:
time+=(X-C)/rate
break
print("Case #"+str(i+1)+": "+str(time))
| true |
69f0304d8bd1d85c5528fe6c9d3ddf80b885d8ab | Python | gaaalmeida/trab_benchmark | /bench/benchmark/score.py | UTF-8 | 367 | 3.1875 | 3 | [
"MIT"
] | permissive | def calcScore(t, w):
return (t + (-t/w)) * 100
def getScore(bm_time):
final = []
# Pesos
# Escrever arquivos -> 10
# Processar dados -> 7
# Ler arquivos/RAM -> 3
final.append(calcScore(bm_time[0], 3))
final.append(calcScore(bm_time[1], 7))
final.append(calcScore(bm_time[2], 10))... | true |
493f163e6a518bd68bf91c1e8dddac97ab095574 | Python | smautner/ubergauss | /ubergauss/optimization/blackboxTPE.py | UTF-8 | 3,608 | 2.578125 | 3 | [] | no_license |
import numpy as np
from sklearn.neighbors import KernelDensity
import multiprocessing as mp
from matplotlib.patches import Ellipse
from lmz import *
def mpmap(func, iterable, chunksize=1, poolsize=5):
"""pmap."""
pool = mp.Pool(poolsize)
result = pool.map(func, iterable, chunksize=chunksize)
pool.clo... | true |
e155abeccbdd69686b26b3e7f71cda0748299b41 | Python | maciek16180/masters_thesis | /SQuAD/layers/MaskedSoftmaxLayer.py | UTF-8 | 981 | 2.8125 | 3 | [] | no_license | import theano.tensor as T
from lasagne.layers import MergeLayer
class MaskedSoftmaxLayer(MergeLayer):
'''
This layer performs row-wise softmax operation on a 2D tensor.
Mask parameter specifies which parts of incoming tensor are parts
of input, so that rows can contain sequences of different length.
... | true |
b858787ea196b99bdf4e970883b3d830ed42789b | Python | fireairforce/leetCode-Record | /程序员面试经典/面试题 01.03. URL化.py | UTF-8 | 166 | 3.125 | 3 | [
"MIT"
] | permissive | class Solution:
def replaceSpaces(self, S: str, length: int) -> str:
return S[:length].replace(' ', '%20')
# return '%20'.join(S[:length].split(' ')) | true |
27b835a522ba83537f95aa4cb18a0d167cfa1f5b | Python | Aasthaengg/IBMdataset | /Python_codes/p03242/s807242298.py | UTF-8 | 71 | 3.046875 | 3 | [] | no_license | s = input()
print(s.replace("1","x").replace("9","1").replace("x","9")) | true |
fc7e5de6668fc7a4531574505d77108280f20efe | Python | KobiShashs/Python | /17_OOP/7_my_first_class.py | UTF-8 | 667 | 3.96875 | 4 | [] | no_license | class BankAccount:
def __init__(self):
self.balance = 0
def greet(self, name):
print("Welcome", name)
def deposite(self, amount):
self.balance += amount
def withdraw(self, amount):
self.balance -= amount
def print_blance(self):
print("Current Bala... | true |
c6c6b68dab26b520395869232dde3d7a8d969f72 | Python | iyeranush/100daysOfCoding | /014_reverse_array_inplace.py | UTF-8 | 514 | 3.890625 | 4 | [] | no_license | # Time Complexity: O(n/2) = O(n)
# SPace complexity: Constan. Inplace swaping
def swap(a, b):
temp = a
a = b
b = temp
return a, b
def reverse_inplace(arr):
length = len(arr)
for i in range(int(length/2)):
if length-1-i != i:
arr[i], arr[length-1-i] = swap(arr[i], arr[length... | true |
d92dfed6be7619757425cfc516990fa2fe7e0195 | Python | Wanbli83470/P11_ESTIVAL_THOMAS | /RENDU/test_P11_03_update.py | UTF-8 | 1,316 | 3.28125 | 3 | [] | no_license | import unittest #Test tools
import datetime #For get the date
from P11_01_codesource import update #My project
date_test = datetime.datetime.now()
"""standardize the date for the test"""
if date_test.day < 10 and date_test.month < 10:
date_test = f"{date_test.year}-0{date_test.month}-0{date_test.day}"
print(... | true |
ccc8a9288566421dcd6f3af50f127318cec6196b | Python | mod-1/networking2 | /Alice.py | UTF-8 | 2,066 | 2.71875 | 3 | [] | no_license | from socket import *
import sys
import zlib
import time
class UDPClient:
def start(self, unreliNetPort, start):
servername = 'localhost'
serverport = unreliNetPort
clientsocket = socket(AF_INET, SOCK_DGRAM)
clientsocket.settimeout(0.05)
seq_no = '0'
message = sys.s... | true |
c543e8ae0a14ac7793b845af5007e3b4bfa9dbd9 | Python | cgdilley/AdventOfCode2018 | /day07_1/day07_1.py | UTF-8 | 2,966 | 3.125 | 3 | [] | no_license | import re
REGEX = re.compile(r"Step (.) .* step (.)")
SECONDS = {val: index + 61 for index, val in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ")}
def main():
with open("../input/day7.txt", "r") as f:
lines = [read_instruction(line) for line in f.readlines()]
lines = merge_instructions(lines)
ordered ... | true |
b66f19d654bee9eb71f63ae78ed2d625e1bbda73 | Python | OwnDie/python_ex | /ex15_2.py | UTF-8 | 347 | 2.546875 | 3 | [] | no_license | import re
def parse_sh_ip_int_br(filen_name):
regex = '(\S+) +([\d.]+|unassigned) +\w+ +\w+ +(up|down|administratively down) +(up|down)'
with open(filen_name, 'r') as f:
file = f.read()
result = [match.groups() for match in re.finditer(regex, file)]
return result
if __name__ == '__main__':
print(parse_sh_ip_... | true |
6daf9975c020d14dcf20c449cbc2349cdc6c673d | Python | infcnwangjie/opencv | /宝贵的测试经验/grow_test.py | UTF-8 | 2,907 | 2.875 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
#初始种子选择
def originalSeed(gray, th):
ret, thresh = cv2.threshold(gray, th, 255, cv2.THRESH_BINARY)#二值图,种子区域(不同划分可获得不同种子)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3,3))#3×3结构元
thresh_copy = thresh.copy() #复制thresh_A到thresh_copy
... | true |
e630af364a80ca759cc4ba11b72bd77788261275 | Python | gschen/sctu-ds-2020 | /1906101013-代恒/day0226.py/4.py | UTF-8 | 251 | 2.9375 | 3 | [] | no_license | l1=[1,2,3,4]
l2=[]
for a in l1:
for b in l1:
for c in l1:
if a!=b and b!=c and a!=c:
d=a*100+b*10+c
l2.append(d)
s=len(l2)
print(l2)
print("可以组成%d个无重复三位数"%s) | true |