blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
5c95295a3dacc23571fa742958bfd3dbf93c5759 | madjestic/kappa | /Projects/Python/Junk/class_method.py | UTF-8 | 284 | 3.421875 | 3 | [] | no_license | class Foo(object): # Continue with @classmethods
b = 0
def __init__(self, a=0):
self.b = a
def show(self):
print self.b
@classmethod
def show_foo(cls):
print "foo!"
def main():
foobar = Foo(777)
foobar.show()
foobar.show_foo()
if __name__ == "__main__":
main()
| true |
1f461fb032fb123a3ee1e50b651e0184fcb7edfd | Aluriak/bfia | /test_functions.py | UTF-8 | 1,625 | 2.765625 | 3 | [] | no_license |
import mutator
import scoring
import crossing
import stepping
import creation
import selection
import reproduction
from unit import Unit
from case import Case
def test_mutator_functions():
unit = Unit('+-><--[-<')
for func in mutator.default_functions():
assert func(unit) is None
def test_scoring... | true |
76750b27a4216f0e145bd192574ca9a6ad042776 | khentatiana/Selenium-with-Python | /12_alerts_popups.py | UTF-8 | 438 | 2.71875 | 3 | [] | no_license | from selenium import webdriver
import time
link = "http://testautomationpractice.blogspot.com/"
browser = webdriver.Chrome()
browser.get(link)
browser.implicitly_wait(5)
alert_button = browser.find_element_by_xpath("//button[contains(text(),'Click Me')]").click()
#To click OK on alert message
browser.switch_to_alert(... | true |
d7e996b417fda8c57418a258d5a5fe6d8d171aee | ChinaGISboyYang/Python_point | /python_point1.py | UTF-8 | 2,735 | 4.25 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 09:30:43 2018
@author: hasee_yang
"""
'''
PYTHON KNOWLEDGE POINTS
python基础
1.可变与不可变类型;
2.浅拷贝与深拷贝的实现方式、区别;deepcopy如果你来设计,如何实现;
3.__new__() 与 __init__()的区别;
4.你知道几种设计模式;
5.编码和解码你了解过么;
6.列表推导list comprehension和... | true |
72616bac10cd7379c6f338b157fe97c3aff4505a | Azimdjan/Data-Structure-and-Algorithms-Python- | /Forth_lesson_recursion_stack/stack.py | UTF-8 | 715 | 3.78125 | 4 | [] | no_license | class Stack :
def __init__(self) -> None:
self.stack = []
def push(self,data):
self.stack.append(data)
def pop(self):
return self.stack.pop()
def isEmpty(self):
if len(self.stack)==0:
return True
else:
return False
def peek(self):
... | true |
4cac7f7a62ba3eb37c5e1cce7726ec2303475ef9 | andrewhutchison1/sourcetools | /sourcetools/diagnostics.py | UTF-8 | 2,378 | 3.25 | 3 | [] | no_license | from enum import Enum, auto
from typing import Optional, Iterator
from .source import Range
class AnnotationKind(Enum):
NOTE = auto()
HINT = auto()
WARN = auto()
ERROR = auto()
FATAL = auto()
class Annotation:
"""Models an atomic piece of information of interest that is optionally attached
... | true |
4b54833cb4c1a4d07f96ccc77042b84aed5531b1 | ajitjha393/PYTHON-PT1 | /q4.py | UTF-8 | 1,076 | 4.125 | 4 | [] | no_license | import array as arr
def getInput():
dataType = input('Enter the data type of array : ')
# i -> int
# f -> float
# d -> double
# l -> long
if dataType == 'int':
d = 'i'
fun = int
elif dataType == 'float':
d = 'f'
fun = float
myArray = arr.array(d, [])
... | true |
4e352de3ff4d215d2364400e2e822644e00b3cd4 | VakinduPhilliam/Python_Interface_Engine | /Python_Interface_Tk_Lookup.py | WINDOWS-1252 | 643 | 3.453125 | 3 | [] | no_license | # tkinter Python interface to Tcl/Tk
# The tkinter package (Tk interface) is the standard Python interface to the
# Tk GUI toolkit.
# Tk itself is not part of Python; it is maintained at ActiveState.
# lookup(style, option, state=None, default=None).
# Returns the value specified for option in style.
# If sta... | true |
8efdfd9e4a069e929c785211ff5ffeb294acc6f4 | raffivar/NextPy | /unit_2/big_thing.py | UTF-8 | 582 | 4.03125 | 4 | [] | no_license | class BigThing:
def __init__(self, name="Really Big Thing"):
self._name = name
def size(self):
return len(self._name)
class BigCat(BigThing):
def __init__(self, name, size):
BigThing.__init__(self, name)
self._size = size
def size(self):
if self._size > 20:
... | true |
4bb9be671c1747dfb92f37b832c2625beca72e54 | ihilburn/PmagPy | /magic_select.py | UTF-8 | 2,478 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
import pmag,sys
def main():
"""
NAME
magic_select.py
DESCRIPTION
picks out records and dictitem options saves to magic_special file
SYNTAX
magic_select.py [command line optins]
OPTIONS
-h prints help message and quits
-f FILE: specify... | true |
e3c394501a4109f17912aa15f935a36948cb0688 | ming024/ML2017FALL | /hw4/hw4_ensemble.py | UTF-8 | 1,013 | 2.71875 | 3 | [] | no_license | import csv
import sys
import numpy as np
print('reading file : ', end = '', flush = True)
i = 1
print(str(i), end = '', flush = True)
infile = open('prob(' + str(i) + ').csv', 'r')
prob = np.asarray([line.strip('\n') for line in infile]).astype(float)
infile.close()
print('\b' * len(str(i)), end = '', flush = True)
#... | true |
2c3bc0dcd134f931141c290640d0cfd2e14e2d1a | athletejuan/TIL | /Python/SS4th/StartCamp/FileRename/change_filenames.py | UTF-8 | 659 | 3.046875 | 3 | [] | no_license | import os # python으로 운영체제(operating system)에 접근하기 위한 모듈
os.chdir('/Users/Juan/GIT/TIL/Python/FileRename/dummy') # 작업 경로 변경
filenames = os.listdir('.') # 현재 경로('.')안에 있는 파일들을 리스트에 담기
for filename in filenames:
os.rename(filename, f'SAMSUNG_{filename}') # 모든 파일명 앞에 'SAMSUNG_' 추가
# os.rename(filename,... | true |
2edb24616daa8304012d081d202051ea56fdfeca | ERChetanSharma/pythonbasics | /Day 3 content/str.py | UTF-8 | 423 | 3.6875 | 4 | [] | no_license | # immutable vs mutable
# ways to declare string
str='this is string'
str1="this is string 2"
string3="""this is
mutiline"""
# using index
# +ve index
print(str[0])
# -ve index
print(str[-1])
# substring using slice operator
print(str[0:3])
# len of string
print(len(str))
# slice varitaions
print(str[0:])
print(str[... | true |
67544be94a326a5a9e7c893fbd0746ef9b28da5a | chiragnayak/python | /PyTraining/tech_rnd/Day_1_22March2021/statements.py | UTF-8 | 2,291 | 4.25 | 4 | [] | no_license | print('-' * 75)
# Simple IF ... ELSE
num = 12
if num % 5 == 0:
print('S1')
print('S2')
print('S3')
else:
print('S4')
print('S5')
print('-' * 75)
# Multilevel IF ... ELSE (Alternative to Switch Case Statements)
num = 1
if num % 5 == 0:
print('Div By 5')
elif num % 3 == 0:
print('Div By 3... | true |
f3d2da66a92ff1dcbf402561bb4e1cdb8f89e4a4 | TiltMagic/ExcelMetrics | /report.py | UTF-8 | 1,526 | 2.796875 | 3 | [] | no_license | import columnmanager
import format_file
import error_logger
class Report:
def __init__(self, column_manager, column_titles):
self.column_manager = column_manager
self.column_titles = column_titles
self.job_type = self.get_job_type()
# self.final_report = self.get_final_report()
... | true |
79b9ad9472b255931586a6a77cf9125a3d3ff95f | beatrizAdalab/Nemory | /app/ext/api_avatar.py | UTF-8 | 483 | 3.015625 | 3 | [] | no_license | import requests
import random
colors = ['amber', 'blue', 'blueGrey', 'brown', 'cyan', 'deepOrange', 'deepPurple', 'green', 'grey', 'indigo', 'lime', 'orange', 'pink', 'purple', 'red', 'teal']
def create_avatar(name, lastname):
color_random = random.choice(colors)
response = requests.get(f"https://avatars.dic... | true |
94bb5568a24a71fd7bd54aea18d5c9744e347913 | vvilq27/Python_port_OV7675 | /port/port.py | UTF-8 | 1,512 | 2.546875 | 3 | [] | no_license | import time
import serial
import os
# while True:
# file = open("data.txt", "wb")
s = serial.Serial('COM6', 512000)
PIXSPERROW = 250
t = list()
badRowsCnt = 0
missedRowIndexes = [i for i in range(11,163)]
while True:
l = s.readline().hex()
if len(l) == PIXSPERROW*2 and l != "53544f500a":
# pixelCnt = int(... | true |
40d99924a4e59b8a377c32a7f830331da939e5ab | bbengfort/geonet | /geonet/commands/destroy.py | UTF-8 | 3,963 | 2.640625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# geonet.commands.destroy
# Destroy all instances under management
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Tue Jan 23 18:10:54 2018 -0500
#
# ID: destroy.py [] benjamin@bengfort.com $
"""
Destroy all instances under management
"""
#####################################... | true |
fb51634d2783ce3b39d1591df1ce9cbba2dd4130 | eognianov/PythonProjects | /PythonFundamentals/1.Functions, Debugging and Troubleshooting Code/07. Greater of Two Values.py | UTF-8 | 112 | 3.21875 | 3 | [] | no_license | def get_max(type=int,a,b):
c=max(a,b)
return c
type=input()
a=input()
b=input()
print(get_max(type,a,b)) | true |
4508f2cc736c1ff1d697b5aff833a54ca688f126 | Leslie-Wong-H/leetcode-solutions-python | /33.search-in-rotated-sorted-array.py | UTF-8 | 1,101 | 3.21875 | 3 | [] | no_license | #
# @lc app=leetcode id=33 lang=python3
#
# [33] Search in Rotated Sorted Array
#
class Solution:
def search(self, nums: List[int], target: int) -> int:
# deal with array with only one element
if len(nums) == 1:
if nums[0] == target:
return 0
else:
... | true |
b71def27088217790b8f6b95a18f3c485cafac22 | Gerardouz/ejercicios-python | /lista.py | UTF-8 | 1,336 | 3.703125 | 4 | [] | no_license | class Nodo:
def __init__(self,v):
self.valor = v
self.sig = None
class lista:
def __init__(self):
self.__primero = None
self.__ultimo = None
def vacio(self):
if(self.__primero == None):
return True
def insertar(self,v):
nodo = Nod... | true |
fb168553992c815baec2a47c6ac08f3d1800c8f5 | AlexLoner/2020-1-Atom-Deep-Python-A-Lukianov | /hw2/max_heap.py | UTF-8 | 2,829 | 3.78125 | 4 | [] | no_license | from typing import List
class MaxHeap:
# ---------------------------------------------------------------------------------------------
def __init__(self) -> None:
self.heap_len = 0
self.heap = []
# ------------------------------------------------------------------------------------------... | true |
73e64d2a986b3e94da89986ddeab25c852f7335a | alfredsimkin/AMTA | /script_folder/multiple_vs_single_mutations.py | UTF-8 | 1,288 | 2.671875 | 3 | [] | no_license | import cPickle
ancestor_dict={'human':'3', 'chimp':'3', '3':'2', 'gorilla':'2', '2':'1', 'orangutan':'1', 'gibbon':'1'}
descendant_dict={'1':['gibbon', 'orangutan', '2'], '2':['3', 'gorilla'], '3':['chimp', 'human']}
gene_dict=cPickle.load(open('final_utr_dictionary_nogaps'))
species_list=['3', '2', '1']
good_list=['A'... | true |
fa68443a897e86a1cc366fafa34f33049513f366 | adurm/MonsterUniversity | /class_example.py | UTF-8 | 2,189 | 3.734375 | 4 | [] | no_license | from monster_workshop import MonsterWorkshop
from student import Student
from teacher import Teacher
# As a Receptionist of the University, I should be able to create a Student with only first and last name
# Create empty list called students
list_of_students = []
# create a student_id_counter
student_id = 0
# With ... | true |
bf0370b006a58270b6c25b6989cf4a293f70ded9 | domzhaomathematics/Hashing-1 | /problem1.py | UTF-8 | 1,652 | 4.09375 | 4 | [] | no_license | #Problem 1
#time complexity: O(n)
#space complexity: O(n)
'''
Approach:
Have a hashmap with frozen sets (hashsets) of the letters as key
and an dynamic array of the actual words as value
'''
def group_anagram(words):
if not words:
return None
h={}
for word in words:
wordset=frozenset(list(w... | true |
a228bf705e3860867653f58aed54d6452249b2cf | HTCssy/Flask | /apps/upload/views.py | UTF-8 | 1,635 | 2.59375 | 3 | [] | no_license | from flask import Blueprint, Flask, request, render_template, jsonify
from apps.ext import images
from apps.utils.image_utils import get_new_image_name
upload_blue = Blueprint('upload', __name__, template_folder='templates', static_folder='static')
def init_upload_img(app:Flask):
app.register_blueprint(upload_bl... | true |
4a9cd14f75073e6c479f7732c313ce5121811c74 | pellegre/zephod | /examples/finite-automata/regular-expression.py | UTF-8 | 424 | 2.609375 | 3 | [] | no_license | from zephod.finite import *
from utils.plotter import *
from utils.language.grammar import *
def regex_example():
expr = (~Z("aaa") | ~Z("bb") | (~Z("cd") + Z("ab"))).minimal()
g = Grammar.build_from_finite_automata(expr)
strings = g.enumerate(length=8)
for each in strings:
assert expr.read... | true |
e3c7768921187d4291b38e9d7a4c7f3c7d8cf3bd | schovancova/adventOfCode2020 | /4/solution_part_1.py | UTF-8 | 613 | 2.71875 | 3 | [] | no_license | REQ = ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]
def main():
with open('input.txt') as f:
lines = f.read().splitlines()
valid = 0
missing = len(REQ)
for line in lines:
if not line:
valid += 1 if not missing else 0
missing = len(REQ... | true |
61a4600f233942f19ffb0ada3cda4520b76b9b22 | manuelgomezsuarez/AII-Eclipse-Ejercicios | /AII-Ejercicios/Ejercicios03-10-2017/ejercicio6.py | UTF-8 | 2,019 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 3 oct. 2017
@author: Admin
'''
class Corcho(object):
def __init__(self,bodega=""):
if bodega:
self.bodega=bodega
else:
raise AttributeError("Nombre de bodega incorrecto, no lo deje vacio")
def __str__(self):
... | true |
678529e979ce0f1d783595bc7f9454f9a5b6f5ba | nunojesus/cats_vs_dogs | /src/architecture.py | UTF-8 | 4,008 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | """Provides interface for the definition of the model's architecture."""
import tensorflow as tf
def model(input_, name=None):
"""
Builds the model's architecture on the graph.
# Parameters
input_ (tf.placeholder):
- Placeholder for the input data.
name (str):
- T... | true |
df53f25ede26ce4b9918ab9beb556f792971b286 | tjlane/electrolysis | /electrolysis/align.py | UTF-8 | 7,236 | 3.078125 | 3 | [
"MIT"
] | permissive |
"""
align.py
"""
import numpy as np
from scipy import ndimage
from matplotlib import pyplot as plt
_WARN = False
def blob_align(images, init_peak_loc=None):
"""
Align a series of images on the strongest peak.
Pad your image beforehand if you want to retain information at the
very edges of the im... | true |
880ec79a4dd6358693d47d21951b65fb518f6fae | HarshCasper/Rotten-Scripts | /Python/Github_Bomb_Issues/bomb-issues.py | UTF-8 | 649 | 2.828125 | 3 | [
"MIT"
] | permissive | from github import Github
import os
import getpass
username = input("Enter your username: ")
password = getpass.getpass("Enter your Github password: ")
g = Github(username, password)
repository = input(
"Give the GitHub repository name that you want to bomb issues on (Example: rohankumawat/Github_automation): "
)... | true |
bc14f225b26e0bb277a274a306304fae912e5398 | tsu-nera/AOJ-ICPC | /2000/2000.py | UTF-8 | 641 | 3.53125 | 4 | [] | no_license |
moves = {"N": (0, 1),
"S": (0, -1),
"E": (1, 0),
"W": ( -1, 0)}
while True:
n = int(raw_input())
if n == 0:
break
houseki = set()
pos = (10, 10)
for i in range(n):
x, y = map(int, raw_input().split())
houseki.add((x, y))
m = int(raw_input(... | true |
6ebc247f160638a9c5aabf6420bef5a03e518896 | ihor-nahuliak/real_estate_study | /geospatial_data_visualization/rental_apt.py | UTF-8 | 2,657 | 2.921875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import folium
from folium.plugins import MarkerCluster, HeatMap
from shapely.geometry import Point
import geopandas as gpd
import webbrowser
df = pd.read_csv('rent.csv', encoding = 'gbk')
print(df.head())
# MarkerCluster
m1 = folium.Map(location = [31.2304, 121.4737], zoom_sta... | true |
586a836a643f67dcaa1efd52411d3e0730720adb | amitdev81296/SimplePythonPrograms | /fibonacci.py | UTF-8 | 329 | 3.84375 | 4 | [] | no_license | n = int(input("Enter the number of terms : "))
fibonacci_sequence = []
first = 0
second = 1
next_term = 0
for i in range(0, n):
if i <= 1:
next_term = i
else:
next_term = first + second
first = second
second = next_term
fibonacci_sequence.append(next_term)
print(fibonacci_s... | true |
f2febcd8bd3e2637c02ea7e459a086e3c331d37f | dyefymenko/gun-mayhem | /main.py | UTF-8 | 4,196 | 3.375 | 3 | [] | no_license | # Program Name: Gun Mayhem
# Authors: Jacky Zhang, Dasha Yefymenko, Michael Tandazo
# Date: 13 June 2021
# Description: A 2-player arcade shooter made using Pygame
import tkinter as tk
from tkinter.ttk import *
import game
class Launcher(tk.Tk):
def __init__(self):
"""Initializes the Launcher object."""
... | true |
3808a045db239acf3f9c8d11e3355ec80f1b164c | DeshanHarshana/Python-Files | /pythonfile/New folder/pythonAssesment/LearnPy/Random Notes on Python Features/String.py | UTF-8 | 178 | 3.1875 | 3 | [] | no_license | import string
print(dir(string))
uc=string.ascii_uppercase
print(uc)
print(string.hexdigits)
print(string.printable)
print(string.whitespace)
print(string.punctuation)
dir(str )
| true |
f171dc3da0de9129a01e908dde3abed48f62cfe2 | webclinic017/email_api | /email_api/message.py | UTF-8 | 8,610 | 3.09375 | 3 | [] | no_license | """This module contains the main data structures related to an email
and its components. As well as utils functions to build and validate
them.
The web framework and the third party providers should be aware of this
core data structure, but not the other way around (to avoid coupling)
TODO:
- Implement `Attachment`... | true |
a3b5b195db0d6cbab3cd1e337191683eb80ecebc | NerdyGuy109/Learn-Python | /Lesson_Lists.py | UTF-8 | 1,993 | 4.5 | 4 | [] | no_license |
# Lists
foodsThatStartWith_Q = ["quince", "quiche", "quahog"]
upTo10 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# String --> List using .split()
letterList = "a b c d e f g h i j k l m n o p q r s t u v w x y z".split()
wordList = "world, earth, water, life, art, periodic table of elements".split(",")
# List Compre... | true |
7d56195388c446acad758886bba812650532abf2 | Aldunate5/Diego_Aldunate | /Educative/ML - Data manipulation.py | UTF-8 | 2,307 | 3.140625 | 3 | [] | no_license | import numpy as np
a = np.array([0, 1])
b = np.array([9, 8])
c = a
print('Array a: {}'.format(repr(a)))
c[0] = 5
print('Array a: {}'.format(repr(a))) #changes in a
d = b.copy()
d[0] = 6
print('Array b: {}'.format(repr(b)))
arr = np.array([np.nan, 1, 2]) #fill with not available
print(repr(arr))
arr = np.arange(-1.5, ... | true |
c353caa38ab6021b987657320054050a65a7e365 | Nobodylesszb/python_module | /Algorithms/itertools/itertools_accumulate.py | UTF-8 | 427 | 3.875 | 4 | [
"MIT"
] | permissive | #该accumulate()函数处理输入iterable,
# 将第n和第n + 1项传递给函数并生成返回值而不是任何一个输入。
# 用于组合这两个值的默认函数会将它们相加,
# 因此accumulate()可用于生成一系列数字输入的累积和
from itertools import *
print(list(accumulate(range(5))))
print(list(accumulate('abcde')))
"""
output:
[0, 1, 3, 6, 10]
['a', 'ab', 'abc', 'abcd', 'abcde']
""" | true |
2b284462bc6094ff8751aba970a11787e364a6a7 | eligantRU/ood | /samples/factory/py_version/include/Canvas.py | UTF-8 | 1,170 | 3.140625 | 3 | [] | no_license | from arcade import draw_line, draw_ellipse_outline
from include.CanvasInterface import ICanvas
from . import *
def color2arcade(color: Color) -> Tuple[int, int, int]:
if color is Color.BLACK:
return 192, 192, 192
elif color is Color.BLUE:
return 0, 0, 255
elif color is Color.GREEN:
... | true |
b3d1d26c00343737866ecaed12bacf418ea3577f | shovalsolo/PythonWebDriver | /PythonWebDriver/MicrosoftBasic/020_call_api.py | UTF-8 | 1,176 | 3.375 | 3 | [] | no_license | # This is an example of an api call with python
import requests
import json
import pprint
base_url = 'https://reqres.in'
users_reqsuest = '/api/users?page=2'
url_reqsuest = base_url + users_reqsuest
r = requests.get(url_reqsuest)
print()
print('--------------All the call--------------')
print(r.json()) ... | true |
07061e47fecaa9e4ac21ab3f2348ed6b530278fd | asgaines/BioinformaticsAlgorithms | /commands/fastq_nt_gt_len.py | UTF-8 | 2,228 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
import fnmatch
import argparse
NT_DEFAULT_LENGTH = 30
task = '''
FASTQ Percent Nucleotides Greater than Length.
Recursively find all FASTQ files starting from `base_dir` and
report each file name and the percent of sequences in that file
that are greater than `length` nu... | true |
37cb955e4637be04b30869be0cfa249c73f8c414 | srihariprasad-r/workable-code | /500_Practise Problems/subarray_equal_0_1.py | UTF-8 | 634 | 3.65625 | 4 | [] | no_license | """
Input : {1, 0, 1, 1, 1, 0, 0}
Output : 1 to 6
Input : {0, 0, 1, 1, 0}
Output: 0 to 3 or 1 to 4
"""
def equalSubArray(array, n):
maxlen = -1
startindex = 0
for i in range(0, n-1):
if array[i] == 0:
sum = -1
else:
sum = 1
for j in range(i+1, n):
... | true |
3149ad33e97603e905cab838f9230f7727468a81 | TaRudik/project | /unit_4/script_task_1.py | UTF-8 | 75 | 2.96875 | 3 | [] | no_license | def salary(rate, hours, bonus):
sum = rate*hours+bonus
return sum
| true |
27b0c9bc4592b241127c5bc1cb108f3ff0fce30a | jerrywu2013/computer_science_with_python | /Chapter14 拷貝/area2.py | UTF-8 | 618 | 4.34375 | 4 | [] | no_license | # L-14 MCS 260 : area2
"""
A rectangle is given by length and width,
for a square we only need one argument
to compute the area.
"""
def area(length, **width):
"returns area of rectangle"
if len(width) == 0: # square
return length**2
else: # rectangle
result = le... | true |
ef60050f90fcdf63883c1b3f475255f8116b7b55 | YuTaNCCU/201808_Peer_Based_Deep_Learning | /Potential_Question2_YisItems/1030_model.py | UTF-8 | 65,441 | 2.90625 | 3 | [] | no_license | # coding: utf-8
# In[]:Import packages
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from sklearn.linear_model import LinearRegression
from sklearn.metrics import accuracy_score,confusion_matrix
import tensorflow as tf
import numpy as np
from keras import metrics, optimi... | true |
a825542253ba3c3313473a43194b05c49cbf434c | W-H-Mitchell/Figure_code | /Fig_WidthDepthAsectratio.py | UTF-8 | 2,279 | 3.03125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
channel_data = pd.read_csv('ChannelDimensions.csv')
channel_data.head()
# downstream distance (x axis)
dist = channel_data.Distance_km
# element scale
elem_width = channel_data.Width
elem_height = channel_data.Height
elem_asp = channel_data.Aspect... | true |
fd9fa42f7435f185f0b3694881640ec1ac401805 | johntelforduk/advent-of-code-2020 | /23-crab-cups/solution23_2.py | UTF-8 | 8,861 | 4.28125 | 4 | [
"MIT"
] | permissive | # Solution to part 2 (and also part 1, again) of day 23 of AOC 2020, Crab Cups.
# https://adventofcode.com/2020/day/23
class Game:
def __init__(self):
# k = cup label.
# v = (a, c). Where a and c are the labels of the cups anticlockwise and clockwise of this cup respectively.
# This makes ... | true |
54ff230237871978c970dd1d767e239783296aea | mercurium/proj_euler | /prob179.py | UTF-8 | 450 | 2.5625 | 3 | [] | no_license | import time
START = time.time()
lst = [0] * (10**7)
for i in xrange(2,len(lst)):
for j in xrange(i, len(lst), i):
lst[j] += 1
count = 0
for i in xrange(2,len(lst)-1):
if lst[i] == lst[i+1]:
count += 1
print count
print "Time taken:", time.time() - START
"""
~/Desktop/python_projects/proj_euler $python p... | true |
4da240587108a65dfa252e1184bf35b10eeaabea | qalf/Pendu | /Pendu Console/pendu_console.py | UTF-8 | 1,889 | 3.328125 | 3 | [] | no_license | """
Jeu pendu version console
03/12/2020
Lucas Fleury
https://github.com/qalf/Pendu
"""
from random import choice
def OpenFichier ():
fichier = open("mot_pendu.txt","r")
for mots in fichier:
mots = mots.split(",")
fichier.close()
mot = choice(mots)
affiche = mot[0]
for i in ran... | true |
5dfe53ae6d77d4466b41a230cf41d4aafa5160a8 | samvram/skylarkDataTransfer | /PowerBI_Pipedrive/SingleRow.py | UTF-8 | 2,570 | 2.5625 | 3 | [] | no_license | import requests
import json
import datetime
from dateutil.parser import parse
def is_date(x):
try:
parse(x)
return True
except:
return False
json_deal = requests.get('https://skylarkdrones.pipedrive.com/v1/deals?api_token=d4d19d807af6c5e9861b0fa81d1cf403ea88e402')
intermediate = json_... | true |
b3bc2512c3702d05179949c6d1c95d55bc9ba141 | ronj1901/ICS_32 | /Professor Notes/scrible.py | UTF-8 | 1,773 | 3.546875 | 4 | [] | no_license | # scribble applicatio
import tkinter
_BACKGROUND_COLOR = 'orange'
_LINE_COLOR = '#008000'
class ScribbleApplication:
def __init__(self):
'''
Initializes a new scribble applucation byt creating a winfow
and placing a Canvas widget inside of it. However the
application does not... | true |
e1c6a12422b12da62a319e30e23bb6c54e6c3bff | SamJ2018/LeetCode | /python/python语法/pyexercise/Exercise10_19.py | UTF-8 | 1,184 | 3.953125 | 4 | [] | no_license | import random
def main():
numberOfBalls = eval(input("Enter the number of balls to drop: "))
numberOfSlots = eval(input("Enter the number of slots: "))
slots = numberOfSlots * [0]
for i in range(numberOfBalls):
slots[onePath(numberOfSlots)] += 1
printHistogram(slots)
# Return ... | true |
3cd4e774acad826d63bf87b3d86d8d3a0d50b181 | CaCOsses/CodeWars | /Build a pile of Cubes/main.py | UTF-8 | 153 | 2.734375 | 3 | [] | no_license | def find_nb(m):
m1=0
n=0
while m1<m:
m1=m1+n**3
n+=1
if m1==m:
return (n-1)
if m1!=m:
return (-1)
| true |
c6974dd7e0961c624624fb6d1e8adf3f9d205f25 | yuzuohong/Test_Codes | /pymongo_001.py | UTF-8 | 237 | 2.578125 | 3 | [] | no_license | import pymongo
import time
index = 1
client = pymongo.MongoClient("localhost",27017)
db = client.imdb
for item in db.title.basics.find({"startYear":2020}):
print(index)
print(item)
time.sleep(1)
index+=1
| true |
7efcdc1025a2c699b2a6941f344704fcc6132cf3 | saikumar-aks/Codeforces-Level-800to900 | /George_and_Accommodation.py | UTF-8 | 131 | 3.1875 | 3 | [] | no_license | n= int(input())
c=0
while n!=0:
p , q = map(int , input().strip().split())
if abs(p-q) >=2:
c+=1
n-=1
print(c)
| true |
f86db5468cedf7d58aa853348a61b55dd1263ef5 | vidhigupta9/api | /back-end/app.py | UTF-8 | 3,340 | 2.9375 | 3 | [] | no_license | # Main API file
from flask import Flask, request, jsonify
from flask_cors import CORS, cross_origin
# random required for generating the OTP
import random
import json
# importing important classes
import Email
import Users
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
# resp_j... | true |
561577a59b0d85170f697cbfc0b22cc19038c8a9 | manuck/myAlgo | /개념/02 List2/실습문제/[4837]부분집합합_재귀.py | UTF-8 | 513 | 2.84375 | 3 | [] | no_license | import sys
sys.stdin = open("input.txt", "r")
ans = N = K = 0
def subset(k, n, hap, cnt):
global ans, N, K # 전역변수
if hap == K and cnt == N:
ans += 1
return
if hap > K or cnt > N:
return
if k == n:
return
subset(k + 1, n, hap, cnt)
subset(k + 1, n, h... | true |
1f9d1594ddd91faebfd99f8e24c01e515b06253c | KaryZenk/Python_IT_academy | /clock.py | UTF-8 | 1,984 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | import colorama
from colorama import Fore, Back, Style
import datetime
import time
import random
from numbers import digits, semicolon, blank, blank_digit # My dict + symbols
BLOCK = 2*'\u2588'
BLINK_FLAG = True
def get_current_time(): # Create our laptop time
return datetime.datetime.now()
def merge_digits... | true |
f8a84749b8eda7c40536d07feb085e76b2e8a0e2 | Aasthaengg/IBMdataset | /Python_codes/p03393/s702057114.py | UTF-8 | 652 | 3.09375 | 3 | [] | no_license | import collections
S = input()
if(S == "zyxwvutsrqponmlkjihgfedcba"):
print(-1)
exit()
alp = "abcdefghijklmnopqrstuvwxyz"
r = S[::-1]
c = collections.Counter(S)
c_s = sorted(c.items(), key=lambda x:x[0])
tmp = ""
for i in range(len(c_s)):
tmp += c_s[i][0]
if(len(S) < 26):
for i in range(len(alp... | true |
468329f6abd9596c649d7343a3f8e49f2f2d7861 | YanYii/Sublime-MirrorCommand | /mirror_right_delete.py | UTF-8 | 377 | 2.59375 | 3 | [] | no_license | import sublime
import sublime_plugin
class MirrorRightDeleteCommand(sublime_plugin.TextCommand):
def run(self, edit):
sels = self.view.sel()
for sel in reversed(sels):
if sel.begin() == sel.end():
begin = sel.begin()
end = sel.end()+1 if sel.end()+1 <= self.view.size() else self.view.size()
sel = ... | true |
c50836f4185907a5e20fac4a76323d9a5232cf97 | igorpsf/Stanford-cs57 | /Homework5.py | UTF-8 | 874 | 4.6875 | 5 | [] | no_license | # 1) Using recursion, calculate n! for any integer >=0.
def factorial(n):
if n == 1:
return n
else:
return n * factorial(n - 1)
print(factorial(5)) # 120
# 2) Using recursion, calculate x^y for any integers x,y >=0.
def power(x,y):
if y==0:
return 1
elif y >= 1:
r... | true |
2824b87b444df9312c0eb69f00137d6b4e9c2664 | omarhurani/Bazar | /bzr-front-end/routes.py | UTF-8 | 1,553 | 2.703125 | 3 | [] | no_license | from flask_app import app, CATALOG_ADDRESS, ORDER_ADDRESS
import requests
# Search endpoint
@app.route('/search/<book_topic>', methods=['GET'])
def search(book_topic):
# Get book from the catalog server
response = requests.get(f'{CATALOG_ADDRESS}/query/topic/{book_topic}')
# Return the catalog server res... | true |
f38f3355470c603b63cbad74f7d58bd9a8886f67 | psy777/Python-Scripts | /dec_to_hex.py | UTF-8 | 1,168 | 3.640625 | 4 | [] | no_license | input_number = int(input('Number: '))
numlist = []
new_numlist = []
al = []
def create_list(number):
while number>1:
number = number/16
numlist.append(number)
numlist.pop()
def smooth_list():
for num in numlist:
num = find_and_delete_decimals(num)
new_numlist.append(int(num... | true |
e3204cda1cdafbd5c6f555e31d918d7018c67b7c | chase-qi/tools | /squad/unknown_issues.py | UTF-8 | 859 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import os
def compare(f, k):
with open(f, 'r') as fp:
# readlines() returns a list of lines with '\n' included.
failures = fp.readlines()
with open(k, 'r') as fp:
known_issues = fp.readlines()
filename = '{}-unknown-issues'.format(os.path.b... | true |
acccdd0cde5dcd30b44fbbf4205a44dee64c039f | VictorGavo/Worklog | /classes.py | UTF-8 | 8,868 | 3.421875 | 3 | [] | no_license | import collections
import csv
import datetime
import sys
class Menu:
def __init__(self):
self.query = [0, 0, 0, 0, 0]
self.low_range = 0
self.hi_range = 0
self.selected_entries = {}
self.previous_menu = 0
self.prompts = {
"Home": {"[1]": "Add entry",
... | true |
ef1e29f1ed57c59790178882632feb2448918aa8 | Bhumbra/Nnet | /nnet/supvlayers.py | UTF-8 | 3,021 | 2.703125 | 3 | [] | no_license | """
A module with classes for supervised learning.
"""
# Gary Bhumbra.
from nnet.baselayers import *
import nnet.cost_func as cost_func
class CostLayer (FeedLayer):
"""
This is a FeedLayer with a cost function support for cost-based learning
rules for supervised learning. It is therefore suitable for as an out... | true |
2c9b1dd5b0ce4f1a69f1c997b8506442ee7bf4ba | MsFalilat/Collatz-Sequence | /collatzSequence.py | UTF-8 | 1,213 | 4.90625 | 5 | [] | no_license | #This program is an implementation of the Collatz Sequence
def collatz(number):
if (number % 2 == 0): #if value is even
number = int(number // 2) #divide value by two and set value to output
else: #if value is odd
number = int(3 * number + 1) #multiply value by three and add one and set... | true |
4fe19e687dfd15ea1d283dcb315c07c5501cae4b | JohnMason1999/Co-evolution-Problems | /PopulationTools.py | UTF-8 | 3,225 | 3.171875 | 3 | [] | no_license | import random as rnd
import statistics
import math
def obj_score(individual):
#a is an array of scalars represented by binary strings
count = 0
for scalar in individual:
for bit in scalar:
if bit=='1':
count = count + 1
return count
def obj_score_pop(po... | true |
5c39eead9c2bf854d1dc26da3f4a1b992b98b7a6 | conradylx/Python_Course | /21.04.2021/exc5/exc5.py | UTF-8 | 1,309 | 4.125 | 4 | [] | no_license | # Utwórz klasę sklep. Sklep posiada różne produkty. W sklepie można produkt zobaczyc, przymierzyc, kupic, zwrocic.
class Shop:
shop_items = ['Sweater', 'Hoodie', 'Shorts', 'T-shirt', 'Kardigan', 'Shirt', 'Hat']
shop_sold_items = []
def check_assortment(self):
formatted_items = ", ".join(self.shop_... | true |
2843bad7ab62092dddb4472935dcc2cc905c6fcc | words16/rephrase | /basic_filter.py | UTF-8 | 452 | 3.203125 | 3 | [] | no_license |
def filter_paraphrases(partials, n_results):
paraphrases = []
for i in range(0, n_results):
paraphrase = ''
if len(partials) > 0:
for j in range(0, len(partials)):
if i >= len(partials[j]):
paraphrase = ''
break
... | true |
032d5142b3d851f596bc540436d34673e0a528f4 | wwwwodddd/Zukunft | /leetcode/complex-number-multiplication.py | UTF-8 | 229 | 2.765625 | 3 | [] | no_license | class Solution:
def complexNumberMultiply(self, num1: str, num2: str) -> str:
a,b=map(int,num1.replace('i','').split('+'))
c,d=map(int,num2.replace('i','').split('+'))
return '%d+%di'%(a*c-b*d,a*d+b*c) | true |
b1a2b044b2301dc648039709bf0bcfc918665e51 | bernard-murunga/stackoverflow-lite-Api | /api/manage_db.py | UTF-8 | 1,404 | 3 | 3 | [] | no_license | from api.db_connect import conn, cur
import psycopg2
def create_tables():
"""
create tables in the database
"""
create_users = """ CREATE TABLE IF NOT EXISTS users (
id SERIAL NOT NULL PRIMARY KEY,
username varchar(255) UNIQUE NOT NULL,
email varchar(255) UNIQUE NOT NULL... | true |
a725fcaebe963449f52cc9d2b86c6a820f3e2c0a | shubhankar-31/Misc_Projects | /Caesar_Cipher.py | UTF-8 | 957 | 3.21875 | 3 | [
"MIT"
] | permissive | class Caesar:
@staticmethod
def encrypt (text,shift)-> str :
if not text.isalpha():
return None
result=""
for i in range(len(text)):
#for upper-case letters
if(text[i].isupper()):
result+=chr((ord(text[i]) + shift - 65)% 26... | true |
13adcc80c2c4ba96e63cdae0fd9cfba9f9cfae29 | francescadamico/cracking_the_code_interview | /Chapter16_moderate/LangtonsAnt.py | UTF-8 | 1,907 | 4.46875 | 4 | [] | no_license |
'''
An ant is sitting on an infinite grid of white and black squares. Initially, the grid is all white and the ant faces right. At each step, it does the following:
(1) at a white square, flip the color of the square, turn 90 degrees rigth (clockwise), and move forward one unit.
(2) at a black square, flip the color o... | true |
0f3cec893d1a8491f2bb412a25078c2384715a2f | YiqunPeng/leetcode_pro | /solutions/538_convert_bst_to_greater_tree.py | UTF-8 | 381 | 3 | 3 | [
"MIT"
] | permissive | class Solution:
def __init__(self):
self.s = 0
def convertBST(self, root: TreeNode) -> TreeNode:
self._convert(root)
return root
def _convert(self, root):
if not root:
return
self._convert(root.right)
v = root.val
root.val +=... | true |
442ed44c25bab62fdd28b2eb31e53bd85620082a | Akramz/msds692 | /notes/code/youtube/search.py | UTF-8 | 1,277 | 2.5625 | 3 | [
"MIT"
] | permissive | # get API keys: https://support.google.com/cloud/answer/6158862
# getting started: https://developers.google.com/api-client-library/python/start/get_started
# I then enabled "YouTube Data API v3"
# API doc: https://developers.google.com/youtube/v3/
# Install library: pip install --upgrade google-api-python-client
impo... | true |
767a18a77cc3e981200cf4e2e2e009e0075631e3 | anmol/algorithm_python | /random_problems/prim_mst.py | UTF-8 | 1,639 | 3.125 | 3 | [] | no_license | """
Prims
"""
from collections import defaultdict
import heapq
def initialize(graph, start):
d = {} # distance dict
p = {} # parent dict
pq = [] # 'mutable' priority queue [priority, node, isValid]
for v in graph:
p[v] = None
if v != start:
d[v] = float('Inf')
else:... | true |
e7b43be3f45a581be03a55a411960ca91cb55c6b | howeixiong/CS5250_Assignment4 | /test.py | UTF-8 | 2,839 | 3 | 3 | [] | no_license | from simulator import *
def multiple_runs():
min_time = 999999999
for i in range(100):
SRTF_schedule, SRTF_avg_waiting_time = SRTF_scheduling(process_list)
if (SRTF_avg_waiting_time < min_time):
min_time = SRTF_avg_waiting_time
print "SRTF: average_waiting_time is %.2f" % min_t... | true |
f9833b18028dabb1b990789546677958f93f1a82 | bullet1337/codewars | /katas/Python/6 kyu/Linux history and command Series2 The n command 5814bf3f3db1ffc0180000d3.py | UTF-8 | 221 | 2.6875 | 3 | [] | no_license | # https://www.codewars.com/kata/5814bf3f3db1ffc0180000d3
import re
def bang_n(n, history):
m = re.search(r'\s+{}\s+(.*)'.format(n), history)
return '!{}: event not found'.format(n) if m is None else m.group(1)
| true |
051da0cb1bc0c10d82557396d434a19d6fad4e58 | jmosbacher/instrosetta-python | /instrosetta/utils/devices.py | UTF-8 | 362 | 2.96875 | 3 | [
"MIT"
] | permissive | import enum
class TestableEnum(enum.Enum):
@classmethod
def has_value(cls, value):
return any(value == item.value for item in cls)
def test_connection(f):
def wrapped(self, *args, **kwargs):
if not self.connected:
raise ConnectionError("Device not connected.")
return f(... | true |
474af1c5075991ea54cf415a92bcda3814e764de | anushka-DS/Machine-Learning | /applied-machine-learning-master/Algorithms-From-Scratch/algorithm-test-harness.py | UTF-8 | 4,702 | 4.15625 | 4 | [] | no_license | # A test harness provides a consistent way to evaluate machine learning algorithms on a dataset.
# It involves 3 elements:
# 1 - The resampling method to split-up the dataset.
# 2 - The machine learning algorithm to evaluate.
# 3 - The performance measure by which to evaluate predictions.
# The loading and preparatio... | true |
55279e830e3ebfd8ed15d4f274b446afb7cd0c70 | leglars/ThinkingofYou | /AM-flask/app/timezone_handler.py | UTF-8 | 2,517 | 2.84375 | 3 | [
"MIT"
] | permissive | from datetime import datetime, timedelta, tzinfo
class UTC10(tzinfo):
def utcoffset(self, dt):
return timedelta(hours=10) + self.dst(dt)
def dst(self, dt):
"""
this function is for daylight saving time, Brisbane don't have a dst, so we can directly return 0.
"""
return... | true |
c6327d19a3f6a60ea138d14e85ee727dca7a4288 | SiddhartaSc/social_networks | /instagram_stories/dbDictUpload.py | UTF-8 | 6,862 | 2.609375 | 3 | [] | no_license | from google.cloud import datastore
import elasticsearch
import codecs
from elasticsearch import Elasticsearch, RequestsHttpConnection
import certifi
from decorators import exponential_backoff_retry
import hashlib
from datetime import datetime
import elasticsearch
from elasticsearch import Elasticsearch, RequestsHttpCon... | true |
9967e64b2c8aa64c6af3a01a0571340fa30c72d7 | jinjiaacademy/Intro-to-Computation-and-Programming | /code/chapter 08/chapter8.py | UTF-8 | 2,876 | 4.21875 | 4 | [
"CC0-1.0"
] | permissive | # -*- coding: utf-8 -*-
# # Code from page 148
def is_smaller(x, y):
"""Assumes x and y are ints
Returns True if x is less than y and False otherwise."""
# # Code from page 150
def sqrt(x, epsilon):
"""Assumes x, epsilon floats
x >= 0
epsilon > 0
Returns result su... | true |
7655182c1471d03154395e00c7fb71f3a3b494b1 | rbracci/project4 | /robbiefinal.py | UTF-8 | 5,921 | 2.65625 | 3 | [] | no_license | from pygame import *
from pygame.sprite import *
import pygame
import random, time
import os, sys
from pygame.locals import *
Width = 800
Height = 600
DELAY = 1000;
#creating initial colors
white = (255,255,255)
black = (0,0,0)
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
pink = (255, 153, 204)
tokenspe... | true |
8e12d99c84d9788452a08e33ea04479af0309bf3 | RenZichang/internet_course_design | /wx/feature.py | UTF-8 | 1,582 | 2.71875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
from scipy import signal
import sys
#指定算法参数和备选参数值
params = {}
params['window'] = 100
params['path'] = './test.csv'
params['opath'] ='./feature_test.csv'
argvs = sys.argv
try:
#用sys.argv读取命令行中传递过来的参数
for i in range(len(argvs)):
if i < 1:
cont... | true |
d17d3f7f61e9ed4ecf6bc1b24ea86b4fc9169e14 | wcks13589/DrBC | /Create_Graph.py | UTF-8 | 1,483 | 2.53125 | 3 | [] | no_license | import os
import pickle
import argparse
import networkx as nx
from tqdm import trange
from torch_geometric.utils import from_networkx
from networkx.generators.random_graphs import powerlaw_cluster_graph
parser = argparse.ArgumentParser()
parser.add_argument('-n_graph', '--n_synthetic_graph', type=int, default=30)
par... | true |
57da21b219100c155b634b2db1fd9773c89544ea | nova26/NeuralEmulator | /VoltageSources/SinSignal.py | UTF-8 | 1,145 | 3.046875 | 3 | [] | no_license | import numpy as np
from NeuralEmulator.Interfaces.VoltageSourceBase import VoltageSourceBase
class SinSignal(VoltageSourceBase):
def __init__(self, simulationTime, stepTime, frequency=1):
inc = int(simulationTime // stepTime)
vals = [0]
for x in range(1, inc):
va... | true |
0ab59d3d33cc420a7d455b597a89fb93c2a79bb4 | zephyr2403/pymailer | /handler.py | UTF-8 | 3,930 | 2.890625 | 3 | [] | no_license | import time
import threading
from string import letters
from random import choice
ftext="Enter Username And Password"
fclr="#454545"
'''
ENCRYPT THE USERNAME, PASSWORD AND CODE BEFORE INSERTING IN DATABASE
'''
def encrypt(string):
random_ = letters + '0123456789'
string = bytearray(string)
for i in range... | true |
c119b74dc2a1b18976df50be2bc722870d593264 | Chong1455/Advent-of-Code-2020 | /day2.py | UTF-8 | 1,083 | 3.75 | 4 | [] | no_license | import re
with open("day2.txt") as file:
input_lines = file.read().splitlines()
# Part One
def check_password(password_line):
password_list = re.split('[- :]', password_line)
min_num = int(password_list[0])
max_num = int(password_list[1])
char = password_list[2][0]
word = password_list[4]
... | true |
d2c1daa92d945714ec620905f2063728581d35ba | alessioBelli/HTTP3_QUIC | /Valutazione_prestazioni/analisi.py | UTF-8 | 1,627 | 2.609375 | 3 | [] | no_license | import json
f = open("/vagrant/Valutazione_prestazioni/Results/Prova3/http2.txt", "r")
dati = json.loads(f.read())
f.close()
time_total = []
time_namelookup = []
time_connTCP = []
time_handshakeSSL = []
time_starttransfer = []
time_contenttransfer = []
for x in dati:
time_total.append(x["time_total"])
time_... | true |
39c1756a16774f886882e50dc2b5a4cc189d9027 | jskinn/robot-vision-experiment-framework | /benchmarks/rpe/relative_pose_error_comparison.py | UTF-8 | 8,471 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | # Copyright (c) 2017, John Skinner
import numpy as np
import pickle
import bson
import util.associate as ass
import core.benchmark_comparison
class RPEBenchmarkComparison(core.benchmark_comparison.BenchmarkComparison):
"""
Comparison of two Relative Pose Error benchmark results.
Basically just the differe... | true |
7ab60767a50de7eeb59c2c9ccaece4f87b74e896 | roberth84/NLP-Domain-Adaptation | /scripts/domain_adaptation/augment_vocab.py | UTF-8 | 23,415 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
"""BERT vocabulary update functionality."""
import logging
import argparse
from pathlib import Path
from typing import List, Union, Optional
import os
import shutil
import glob
import nltk
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
import ... | true |
013e5f56f2ac4ed4b012c61b0ddd5570d5227ac0 | SmileShmily/LaunchCode-summerofcode-Unit1 | /ClassExercise & studio/chapter 14/Arithmetic Methods.py | UTF-8 | 1,552 | 4.28125 | 4 | [] | no_license | '''Our add method will take a Fraction as a parameter. It will return a new Fraction representing the sum.
We will use the equation shown above to compute the new numerator and the new denominator.
Since this equation will not give us lowest terms, we will utilize a similar technique as was used in the simplify method ... | true |
e29515929fc9b7cb06647394766dd07d499965bc | KikeM/degiro-wrapper | /src/degiro_wrapper/core/model.py | UTF-8 | 599 | 3.15625 | 3 | [] | no_license | def compute_weights(amounts, isin_cash=None, regex=None):
"""
Compute positions weights.
Parameters
----------
amounts: pd.DataFrame
isin_cash: str
regex: str
Returns
-------
pd.DataFrame
"""
_amount_df = amounts.copy()
# Apply filters
if isin_cash is not Non... | true |
fb1083aee7bd67868e20d8d5dcfa0103ad6bc098 | eMZet777/python | /88. defaultdict - domyślne wartości dla kluczy w słowniku - praktyczny przyklad lekcja 88.py | UTF-8 | 2,478 | 3.296875 | 3 | [] | no_license | import requests
import json
r = requests.get("https://jsonplaceholder.typicode.com/todos")
from collections import defaultdict
def count_task_frequency(tasks):
completedTaskFrequencyByUser = defaultdict(int)
for entry in tasks:
if(entry["completed"] == True):
completedTaskFrequencyByUser[... | true |
73d652691d9bcc57ef85d7a460544fdcdd2b062c | lantian316/Stone_Study_Box | /PyThon学习笔记+代码/PyStudy/syntax-err.py | UTF-8 | 624 | 3.6875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
#Example of syntax errors
# while 1:
# print("hello world")
#Examples ofexceptions
# print(8/0)
#print(hello * 4)
# num=6
# print("hello world" + num)
#handling exceptions
# while 1:
# try:
# x = int(input("please enter a number: "))
# break
# ... | true |