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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cb20338b6e2ff2edf81a24aa8b29673858d02669 | Python | vivekvijayanIOT/python_string_reverse | /init.py | UTF-8 | 40 | 2.890625 | 3 | [] | no_license | a=raw_input()
b=str(a[::-1])
print b
| true |
ce51e6380bbeddfc56b2777f688b826419571175 | Python | dugb/curly-carnival | /curly_carn.py | UTF-8 | 587 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import scapy.all as scapy
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--interface', dest='interface', help='The interface to sniff packets from.')
options = parser.parse_args()
if not options.interface:
parser.error('[-] Please spe... | true |
b2683e77e14ef0426663382d549ba532a8dbc589 | Python | kionoluv/learning_code | /Python/intro_practice.py | UTF-8 | 120 | 2.59375 | 3 | [] | no_license | #end of intro to python practice to summarize what I've learned
monty = True
python = 1.234
monty_python = python ** 2
| true |
a15fb96d0b783819b0bc48f32e5aa646a0accc76 | Python | Aasthaengg/IBMdataset | /Python_codes/p02975/s636131884.py | UTF-8 | 742 | 3.015625 | 3 | [] | no_license | # coding: utf-8
N = int(input())
A = list(map(int, input().split()))
# A.sort()
d = {}
for i in range(N):
a = A[i]
if a not in d.keys():
d[a] = 1
else:
d[a] += 1
flag = True
if len(d.keys()) == 1:
if list(d.keys())[0] == 0:
flag = True
else:
flag = False
elif len(d.ke... | true |
afc05f4a1f31adb4a5b7b688f1d8b7f40d7584e0 | Python | MarkCBell/bigger | /bigger/triangulation.py | UTF-8 | 18,032 | 3.25 | 3 | [
"MIT"
] | permissive | """ A module for representing a triangulation of a punctured surface. """
from __future__ import annotations
from collections import Counter
from collections.abc import Container, Collection
from dataclasses import dataclass
from functools import partial
from itertools import chain
from typing import Any, Callable, G... | true |
db55236881d8efec2e01352a3dabd18f8c6d0a87 | Python | cgreer/ResearchScripts | /smallRNAProcessing/fastQTypes.py | UTF-8 | 2,344 | 3 | 3 | [] | no_license |
def getFastQType(fName, quick = False):
'''The quick option is for determing if it is +33 or +64 quickly'''
fastFile = open(fName, 'r')
sangerFlag = False #Is there a character below 58?
notSangerFlag = False #Is there a character above 73?
solexaFlag = False #is notSanger true and a character below 64
illumin... | true |
746f429c867adab8d252adacbc1c7e46cd817955 | Python | wonjongah/multicampus_IoT | /python/chapter8/ex01.py | UTF-8 | 1,185 | 4.03125 | 4 | [] | no_license | def swap(x, y):
temp = y
y = x # 스택 프레임 안에 있음
x = temp
print("x", x)
print("y", y) # 스와프 안에 프린트 함수 호출, 스와프 스택 프레임 위에 프린트 스택프레임 생성
a = 10 # 데이터 파트 중 전역 영역에 있음, 함수 영향 안 받음
b = 20
swap(a, b) # 위로 갔다가 돌아왔을 때, 위의 a=10, b=20은 그대로 있어야 한다, 데이터
# 데이터 유지해야 한다
print("a", a... | true |
a5080bc9e8fcda0c686fee0a104a5cb143682534 | Python | FarzanaEva/Data-Structure-and-Algorithm-Practice | /Algorithm Implementation/merge_sort.py | UTF-8 | 952 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 3 22:22:46 2021
@author: Farzana Eva
"""
def merge(arr, start, mid, end):
temp = [0] * (end - start+ 1)
i, j, k = start, mid+1, 0
while i <= mid and j <= end:
if arr[i] <= arr[j]:
temp[k] = arr[i]
k +=1
... | true |
408431b30aa822e6572d166bbe466e2729f468c1 | Python | AlexMooney/pairsTournament | /strategies/chrisStrategies.py | UTF-8 | 10,894 | 3.1875 | 3 | [
"MIT"
] | permissive | from __future__ import division
from copy import copy
from math import log
class FoldLowWithHigh:
def __init__(self, fold, hand):
''' Strategy that folds when 'fold' is available if 'hand' or higher is in hand'''
self.fold = fold
self.hand = hand
def play(self, info):
# get bes... | true |
77dbd92b69f892e5cbafc9bf06bf5421e88fac20 | Python | sotondriver/miniondriver | /python_code/preprocess/traffic_process.py | UTF-8 | 1,496 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on 16/6/3 00:22 2016
@author: harry sun
"""
from extend_function import *
import numpy as np
import operator
def load_traffic_data(district_dict, path):
traffic_list = []
temp_path1 = listdir_no_hidden(path)
for p in temp_path1:
temp_path2 = path+'/'+p
... | true |
09b1d856f0526574ce19db6f0f743a0575b4b57a | Python | TayExp/pythonDemo | /05DataStructure/表示数值的字符串.py | UTF-8 | 989 | 3.375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
class Solution:
# s字符串
def isNumeric(self, s):
# write code here
p = 0
pend = len(s)
if s[p] == "+" or s[p] == "-":
p += 1
if p == pend:
return False
flag = True
while p<pend and s[p] >= "0" and s[p] <= "9"... | true |
aca01e4aa11b23c6cb7fd7e24a7014206f620370 | Python | krisburke/automatetheboringstuff | /theCollatzSequence.py | UTF-8 | 364 | 4.25 | 4 | [] | no_license | def collatz(number):
if (number % 2 == 0):
num = number//2
print(num)
return num
elif (number % 2 == 1):
num = 3 * number + 1
print(num)
return num
def enter():
print('Choose a number: ')
number = int(input())
value = number
while True:
value = collatz(value)
if (value == 1)... | true |
97f89c3afef0e35961b1e45663d4efb8e23aec7e | Python | Aasthaengg/IBMdataset | /Python_codes/p03229/s288923943.py | UTF-8 | 526 | 2.640625 | 3 | [] | no_license | n = int(input())
a = []
for i in range(n):
a.append(int(input()))
a.sort()
b = []
d = []
for i in range(n):
c = i // 2
if i%2 == 0:
b.append(a[c])
else:
b.append(a[n-1-c])
for i in range(n):
c = i // 2
if i%2 == 1:
d.append(a[c])
else:
d.append(a[n-1-... | true |
c555e7432dbf22f0b6147674ef37d9cf3421fb6e | Python | toshiks/TikFake | /tikfake/nodes/rendering_node.py | UTF-8 | 1,237 | 2.546875 | 3 | [
"MIT"
] | permissive | from typing import Dict, Optional
import cv2
import numpy as np
from mediapipe.python.solutions.pose import POSE_CONNECTIONS
from tikfake.nodes.sprite_node import SpriteNode
class RenderingNode:
def __init__(self):
pass
def reset_state(self):
"""Reset state of node."""
def _render_skele... | true |
7281584bd170e8e0cf2aa43cd90187f25fcd44d3 | Python | quocnguyen5/BaiTapLuyencode.net | /VL16.py | UTF-8 | 521 | 3.015625 | 3 | [] | no_license | a, b = [int(x) for x in input().split()]
x, y = a, b
a = abs(a)
b = abs(b)
UocSoA = []
UocSoB = []
UocChung = []
for i in range(1, a+1):
if a % i == 0:
UocSoA.append(i)
for i in range(1, b+1):
if b % i == 0:
UocSoB.append(i)
if UocSoB == [] or UocSoA == []:
UocChung = UocSoA ... | true |
9a7d8d8e3bb2f1c85606f53cff687127a486de84 | Python | 14E47/Hackerrank | /30DaysOfCode/day10_binary_numbers.py | UTF-8 | 567 | 3.40625 | 3 | [] | no_license | # n = 5
#
# print(bin(n).split('b')[1])
#
# x = 101
# print()
#!/bin/python3
import math
import os
import random
import re
import sys
def max_consecutive_ones(n):
b = bin(n).split('b')[1]
consecutive_ones = 0
count = 0
for i in b:
if i == '0':
count = 0
else:
c... | true |
899249000f86520637a3d27670ec140bbc436584 | Python | khezam/algos_ds | /review/BST/BST.py | UTF-8 | 9,740 | 3.65625 | 4 | [] | no_license | class Node:
def __init__(self, element):
self.element = element
self.left = None
self.right = None
class BinarySearchTree:
def __init__(self):
self.root = None
def _add(self, node, new_node):
if node.element < new_node.element:
if node.ri... | true |
2ea3570b6225fa575004ab148c055510bce9f9a5 | Python | RITESH-Kapse/ImportantNotes | /IteratingOverCell_MaxmDataInSheet/IterRows_IterColumns.py | UTF-8 | 975 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python3
"""
Iterating over cells with iter_rows and iter_cols
"""
from openpyxl import Workbook
def create_sheets(wb, sheet_name_list):
# Adds the sheets in the sheet_name_list to the workbook
for sheet_name in sheet_name_list:
wb.create_sheet(sheet_name)
if __name__ == "__main__":
... | true |
2c86020b5202adc622b4bd949d09d06d3fec21fc | Python | Ryan-UTD/ACM-Research-Coding-Challenge-F21 | /main.py | UTF-8 | 6,496 | 3.5625 | 4 | [] | no_license | # Import libraries and download necessary resources for text processing
import pandas as pd
from textblob import TextBlob
import nltk
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
from nltk.sentiment.vader import SentimentIntensityAnalyzer
# nltk.download() # Only needs to be downloaded o... | true |
cbc16904b2ea5f0077487a44ee5372c3edcf7484 | Python | hankerkuo/HogwartsHouses | /alex_simplify.py | UTF-8 | 9,769 | 2.640625 | 3 | [] | no_license | '''
BSD 3-Clause License
Copyright (c) 2017, Frederik Kratzert
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of co... | true |
15695aa4b93dc6123ae0391eeff04b98ecc3ae43 | Python | jieunyu0623/3522_A00998343 | /Labs/Lab2/controller.py | UTF-8 | 2,740 | 3.609375 | 4 | [] | no_license | import math
import random
import time
from datetime import datetime
from Labs.Lab2.asteroid import Asteroid
from Labs.Lab2.vector import Vector
class Controller:
"""
Controller class used to simulate Asteroid random movements.
"""
asteroid_list = []
def __init__(self):
"""
create... | true |
cb63b3e9ebd1b9abb53cca9da5baf29e3148e727 | Python | belajarqywok/HacktoberFest2021-3 | /Checkforidentical.py | UTF-8 | 1,855 | 4.125 | 4 | [] | no_license | # Python program to check if two given trees are identical or not. You are provided with
# the root of both node.
import sys
class node:
def __init__(self, info):
self.info = info
self.left = None
self.right = None
def insert(ptr,key):
if(ptr is None):
pt... | true |
3e4144fc64e29019080d4c0a4ec1198409e0e937 | Python | SKPalu/image-super-resolution | /ISR/models/imagemodel.py | UTF-8 | 4,751 | 2.703125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
from ISR.utils.image_processing import (
process_array,
process_output,
split_image_into_overlapping_patches,
stich_together,
)
from multiprocessing import Process, Manager
import multiprocessing as mp
from time import sleep
def toCollectPatches(listOfTuples: list):
lenT = len(... | true |
c134f39912d0161ff847978f05d5a3adab1e2e64 | Python | jasjkoi/recs-scripts | /scripts/utils/file_reader.py | UTF-8 | 273 | 2.640625 | 3 | [] | no_license | from pathlib import Path
PROJECT_PATH = Path(__file__).parents[2]
def get_list_from_resources(filename):
file = PROJECT_PATH / "resources/{}".format(filename)
with open(file, 'r') as f:
data = f.readlines()
return [line.strip('\n') for line in data]
| true |
4c5eb3e6a4d7747fb90c4e1c560e60e842d9d164 | Python | ynkwon/cs224n-acceptability | /acceptability/models/bert_classifier.py | UTF-8 | 1,676 | 2.5625 | 3 | [
"MIT"
] | permissive | from transformers import BertModel, BertTokenizer
import torch
import torch.nn as nn
import numpy as np
from acceptability.models import LinearClassifier
class BertEncoder():
def __init__(self):
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
self.tokenizer = BertTokenize... | true |
659dfc4954b25153dcc682a7ad27c2852657efa8 | Python | Lel0uch-H/hanab-stats | /difficulty.py | UTF-8 | 2,448 | 2.5625 | 3 | [] | no_license | from sys import argv
from util import flatten,convertStr
l=open(argv[1]).read().split('\n')
l=l[:-2]
l=[i[:(i.find('#')-2)] for i in l]
def calcDeckCards(name, numsuits):
count = numsuits*10
dark_names = [
'Black',
'Gray',
'Dark',
'Cocoa',
'Mix',
]
... | true |
acbe0559cd028bad35084a560171154a459b5836 | Python | r50206v/Leetcode-Practice | /2022/Easy-350-IntersectionOfTwoArraysII.py | UTF-8 | 427 | 3.140625 | 3 | [] | no_license | '''
hashmap
time: O(max(N, M))
space: O(max(N, M))
'''
class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
from collections import Counter
counter1 = Counter(nums1)
counter2 = Counter(nums2)
ans = []
for k in counter1.keys():
... | true |
af0407ab17e7349fc374ff60116fed8aedaa3da9 | Python | AR123456/python-deep-dive | /work-from-100-days/Beginner days 1-14/Day -9/day-9-2-append-dictionary-in-a-list/main.py | UTF-8 | 1,018 | 3.734375 | 4 | [] | no_license | travel_log = [
{
"country": "France",
"visits": 12,
# this is a list nested inside of a dictionary
"cities": ["Paris", "Lille", "Dijon"]
},
{
"country": "Germany",
"visits": 5,
# this is a list nested inside of a dictionary
"cities": ["Berlin", "Hamburg", "Stuttgart"]
},
]
#🚨 Do NOT change the code... | true |
9adac4d2688cd18db5e843459a415b088c244a04 | Python | LuannaLeonel/PrayerRoulette | /Main.py3 | UTF-8 | 2,099 | 3.625 | 4 | [] | no_license | import cmd
import os
data_file = open('data.txt', "a")
with open('data.txt', 'r') as file:
name_list = file.readlines()
def addlista():
print("Adicione multiplos nomes à lista, depois de cada nome pressione enter e quando concluir digite '.' ")
ans = True
while ans:
nome = input()
if... | true |
e9fcfec80d1f27ba6d313d7df0a07fcac36169c5 | Python | luancheng12/checkinpanel | /ck_hostloc.py | UTF-8 | 8,236 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
cron: 48 0-23/12 * * *
new Env('HOSTLOC');
"""
import random
import re
import textwrap
import time
import requests
from pyaes import AESModeOfOperationCBC
from requests import Session as req_Session
from notify_mtr import send
from utils import get_data
desp = "" # 空值
def log(info: st... | true |
517da0a09eda4b1ebd1655092a5598d35a7904c4 | Python | VittorLF/progr1ads | /Lista 5/Lista 5 Ex7.py | UTF-8 | 269 | 4.59375 | 5 | [] | no_license | '''7 - Faça um programa que leia 5 números e informe o maior número.'''
cont = 1
maior = -999999
while cont < 6:
valor1 = float(input('Digite o valor: '))
if valor1 > maior:
maior = valor1
cont += 1
print('\nValor maior é: {}'.format(maior))
| true |
16aa5abbc16b6dc74ace21af3acce76d1ad9b412 | Python | shashikantilager/gpu-ddvfs | /src/prediction_models/xgboost_regression.py | UTF-8 | 4,116 | 2.609375 | 3 | [] | no_license | import time
import numpy as np
import pandas as pd
import xgboost as xgb
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from src.utils import utility
## TODO - Get que from the configuration
model_name = "xgboost"
data_directory = "/home/ubuntu/phd_data/data/GPUE... | true |
ee7d0e2e5b3e086e85e4f802069f62d4f9395e58 | Python | ccastroa/Wheel-of-python | /wheel_of_fortune.py | UTF-8 | 9,677 | 3.5 | 4 | [] | no_license | #Carol Castro
#88710391
import json
import wof_computer
import random
import time
NUM_HUMAN = 1
NUM_PLAYERS = 3
VOWEL_COST = 250
VOWELS = ['A', 'E', 'I', 'O', 'U']
# Load the wheel
wheelFile = open('wheel.json', 'r')
wheel = json.loads(wheelFile.read())
wheelFile.close()
# Load the phrase set
phraseFile = open('... | true |
1c3835bad90d733ae4586af4d13a2a8200aaa539 | Python | dlr-wf/crackpy | /crackpy/crack_detection/deep_learning/docu.py | UTF-8 | 5,854 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import os
from datetime import datetime
def count_parameters(model):
"""Returns the number of trainable parameters of 'model'."""
return sum(p.numel() for p in model.parameters() if p.requires_grad)
class Documentation:
"""Wrapper class for documentation of neural network training.
Methods:
... | true |
d6e34ecb539648b7693c477dadfe11448a46f829 | Python | rohansharmaa/Secure-File-Transfer-using-AES-128 | /attachmentDownload.py | UTF-8 | 3,349 | 2.90625 | 3 | [] | no_license | import imaplib, email, os
'''
Function to authorise a user gievn the username and password
Returns an IMAP4 object
'''
def auth(username,password,imap_url):
#create an IMAP4 object at the required mail server
con=imaplib.IMAP4_SSL(imap_url)
#login to your account
con.login(username,password... | true |
d5edfcd05a16ef375c5e44682c940795e22d8ddf | Python | liguoliguoli/dataset_spider | /img_precess/test_featureExtractor.py | UTF-8 | 4,262 | 2.609375 | 3 | [] | no_license | from unittest import TestCase
from img_precess.featureExtracter import FeatureExtractor
import os
from imutils import paths
import numpy as np
from matplotlib import pyplot as plt
class TestFeatureExtractor(TestCase):
def setUp(self):
self.extractor = FeatureExtractor()
self.all_dir = "..\\img\\a... | true |
b18afed716580b61c4284a3615f0d71ba629d1a3 | Python | Stock-Portfolio-Risk-Analyzer/spr | /portfolio_utils/Investor.py | UTF-8 | 358 | 2.75 | 3 | [] | no_license | class Investor(object):
def __init__(self, username):
self.portfolio_list = []
self.username = username
def get_username(self):
return self.username
def get_latest_portfolio(self):
return self.portfolio_list[-1]
def get_oldest_portfolio(self):
... | true |
9a380820294f6eec0c0660cc93a39abc6c13b657 | Python | cnspica/TextClassify2 | /TextFeature.py | UTF-8 | 1,217 | 2.96875 | 3 | [] | no_license | #coding: utf-8
from __future__ import division
__author__ = 'LiNing'
def TextBool(words_feature, text):
bool_features = []
words = sorted(list(set(text)))
for word_feature in words_feature: # 根据words_feature生成每个text的feature
if word_feature in words:
bool_features.append(1)
else... | true |
24b3223fcfed9a8e777ce30b65ee893c4ae95a92 | Python | JavaProgrammerLB/pythonchallenge | /18.py | UTF-8 | 1,325 | 3.046875 | 3 | [] | no_license | import difflib
def main():
left, right = first_step()
diff = second_step(left, right)
third_step(diff)
def first_step():
deltas = open("swan/deltas", 'r')
left = ""
right = ""
while True:
line = deltas.readline()
if line:
left += line[:53]
left += ... | true |
dd7babc5a572349ee6462655836736bdc7a3a014 | Python | serendia95/JCDS07_Final_Project | /app.py | UTF-8 | 3,373 | 2.5625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from flask import Flask, render_template, request, redirect, send_from_directory
import pickle as pkl
import warnings
wa... | true |
baae2da4dd627fcf21fbdb084c7d2066dea276c1 | Python | ryndovaira/leveluppythonlevel1_300321 | /topic_06_files/examples/2_io_file_pickle.py | UTF-8 | 1,427 | 2.9375 | 3 | [] | no_license | import pickle
print('\n--------------------------------------- Write file (dict) binary --------------------------------------------')
my_dict = {'Python': '.py', 'C++': '.cpp', 'Java': '.java'}
with open("dict.pkl", "wb") as f:
pickle.dump(my_dict, f)
print('\n--------------------------------------- Write file (... | true |
111ace56472558a573875509e8716db693c658a7 | Python | utolee90/Python3_Jupyter | /workspace2/10-collection/exam4_.py | UTF-8 | 327 | 4.09375 | 4 | [] | no_license | a = [1, 2, 3]
print(a)
print('-' * 30)
# 인덱싱 : 데이터 1개
a[2] = 300
print(a)
print('-' * 30)
a[1] = ['a', 'b', 'c']
print(a)
print('-' * 30)
print(a[1][1])
print('-' * 30)
# 슬라이싱 : 데이터 여러개
a[1:2] = ['x', 'y', 'z']
print(a)
print('-' * 30)
a[1:3] = [10, 20]
print(a)
print('-' * 30)
| true |
678dde9293b26a9aba1044bea7543f586e5975a7 | Python | amureki/lunch-with-channels | /core/exceptions.py | UTF-8 | 444 | 2.765625 | 3 | [
"MIT"
] | permissive | import json
class ClientError(Exception):
"""
Custom exception class that is caught by the websocket receive()
handler and translated into a send back to the client.
"""
def __init__(self, code):
super(ClientError, self).__init__(code)
self.code = code
def send_to(self, chann... | true |
e9e2596beebd62e1e3259650a46a16bf62fa7904 | Python | Jesonchang12/DDZShuffle | /ThreeGame.py | UTF-8 | 762 | 3.125 | 3 | [] | no_license | from PukeGameBase import PukeGameBase
from Peasant import Peasant
from Landlord import Landlord
import random
class ThreeGame(PukeGameBase):
def __init__(self):
"""This is 3 person Game"""
PukeGameBase.__init__(self)
p1 = Landlord(3, "landlord")
p2 = Peasant(3, "peasant1")
... | true |
7a1386091981f841b711d4c5ef23498d17336962 | Python | l33tdaima/l33tdaima | /p303e/num_array.py | UTF-8 | 772 | 3.71875 | 4 | [
"MIT"
] | permissive | from typing import List
from itertools import accumulate
class NumArray:
def __init__(self, nums: List[int]):
self.psums = [0] + list(accumulate(nums))
def sumRange(self, left: int, right: int) -> int:
return self.psums[right + 1] - self.psums[left]
# Your NumArray object will be instantiat... | true |
84f4920ea917dae47f1b1b5324fdf59d4bb777c1 | Python | twiffy/eabooc | /coursebuilder/modules/csv/plag.py | UTF-8 | 3,142 | 3 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Plagiarism detection!
This is a pretty well-explored area of computer science, I just googled around
until I found a reasonable way to do it
(http://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm - published in
1987). Luckily, that way worked fine for a course of our size. Basically, it... | true |
ca25da51b5bab1218fb5b2ac3823a6e975fdafcc | Python | quocbao0603/My-Code | /SPOJ/quocbao/accepted_code/UCV2013H.py | UTF-8 | 1,086 | 3.0625 | 3 | [] | no_license | dr = [0, 0, 1, -1]
dc = [1, -1, 0, 0]
MAX = 251
table = [None] * MAX
slick = [0] * (MAX * MAX)
q = [None] * (MAX * MAX)
def BFS(sr, sc):
left = right = 0
q[0] = (sr, sc)
table[sr][sc] = '0'
count = 1
while left <= right:
ur, uc = q[left]
left += 1
for i in range(4):
... | true |
6a0eaaa006e4840c7d2b842c713769ea59c3f16f | Python | lj015625/CodeSnippet | /src/main/python/array/firstDuplicateValue.py | UTF-8 | 1,079 | 4.0625 | 4 | [] | no_license | """
Given an array of numbers can only be 1 to n, inclusive, find the first duplicate value in
"""
# O(n) time O(n) space
def firstDuplicateValue(array):
found = set()
for n in array:
if n in found:
return n
else:
found.add(n)
return -1
# O(n) time O(1) space
def ... | true |
c1d88f2e845cbb1468c0a42ca9422ca797ad446f | Python | yage99/TCGAMaxim | /TCGAMaxim/clinical.py | UTF-8 | 5,451 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
class clinical:
import re
_matcher = re.compile("(\{.*\})(.*)")
def __init__(self, file):
import xml.etree.ElementTree
self.file = file
self.root = xml.etree.ElementTree.parse(file).getroot()
self.dict_clinical = self.__clinical_parse_to_dict(self... | true |
5e7f9dd72a27a359635a53febf11fe8c27d8e1eb | Python | alexnel24/AlexNelson | /PersonalProjects/BasketballReferenceAutoEmails/plus.py | UTF-8 | 6,742 | 2.625 | 3 | [] | no_license | import urllib.request
from bs4 import BeautifulSoup
import pandas as pd
from datetime import date, datetime, timedelta
import os, ssl
if (not os.environ.get('PYTHONHTTPSVERIFY', '') and
getattr(ssl, '_create_unverified_context', None)):
ssl._create_default_https_context = ssl._create_unverified_context
# function... | true |
726c243897e9e61fe3e7499f3016e9c3ebbb4b05 | Python | ENNAJIHYassin/Proba-V | /SrganModel.py | UTF-8 | 4,824 | 2.671875 | 3 | [] | no_license | from keras.layers import Dense
from keras.layers.core import Activation
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutional import UpSampling2D
from keras.layers.core import Flatten
from keras.layers import Input
from keras.layers.convolutional import Conv2D
from keras.model... | true |
960228d1e9b26f15a6c245d3065ea9b273abb032 | Python | C0der1iu/SomeTools | /creeper.py | UTF-8 | 2,016 | 2.765625 | 3 | [] | no_license | #encoding = utf-8
"""
@扫描模块
@Author: c0d3r1iu
@Email: admin@recorday.cn
@File: creeper.py
@Time: 2019/2/15 14:02
"""
import re
import requests
class Creeper:
target_url = ''
target_list = []
headers = {'User-Agent': 'Mozilla/4.0(compatible;MSIE7.0;WindowsNT5.1;360SE)'}
def __init__(s... | true |
ee5a4bc5601b89c5bd4593978af8390eec6a429a | Python | tjol/how-does-async-work | /python/asyncdemo_no_asyncio.py | UTF-8 | 706 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python
class return_number_async(object):
def __init__(self, n):
self.n = n
def __next__(self):
print('in return_number_async')
e = StopIteration()
e.value = self.n
raise e
def __iter__(self):
return self
next = __next__
def sil... | true |
67c76db1d0c7e60dda195e542a8a8ccad78cedb8 | Python | KimDongGon/Algorithm | /10000/10000/10800/10819.py | UTF-8 | 255 | 2.921875 | 3 | [] | no_license | from itertools import permutations as p
n = int(input())
arr = map(int, input().split())
answer = 0
for a in p(arr, n):
temp = 0
for i in range(1, n):
temp += abs(a[i] - a[i - 1])
if answer < temp:
answer = temp
print(answer) | true |
dfbb18a159755e282494307c35abe74ae82573e8 | Python | Kazuya-KT/FavPicker | /FavPicker/myapp/favpicker/get_fav_list.py | UTF-8 | 3,815 | 2.546875 | 3 | [] | no_license | #get_image.pyからFavoritesとDLリストの取得処理を分割する
import json
import ssl
from requests_oauthlib import OAuth1Session # OAuthのライブラリの読み込み
from . import api_settings # 認証情報
CK = api_settings.CON_KEY
CS = api_settings.CON_SECRET
max_id_value = None
twitter = None
ssl._create_default_https_context = ssl._create_unverified_conte... | true |
5e9475db8059d6f19d1ed7c6b0cf457e91c2725a | Python | disposedtrolley/udacity-fsnd | /Intro to Backend/Forms and Inputs/user-signup/user_signup.py | UTF-8 | 3,805 | 2.703125 | 3 | [] | no_license | import os
import re
import jinja2
import webapp2
template_dir = os.path.dirname(__file__)
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir),
autoescape = True)
USER_RE = re.compile(r"^[a-zA-Z0-9_-]{3,20}$")
PASS_RE = re.compile(r"^.{3,20}$")
EMAIL_RE = re.co... | true |
7aeee98e539cd2c848403ba47a2815c31303088f | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/117/usersdata/197/26962/submittedfiles/al2.py | UTF-8 | 181 | 3.59375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
a=float(input('digite o número'))
inteiro=int(a)
real=(a-inteiro)
print('a parte inteira do número é' inteiro)
print('a parte decimal do número é' real) | true |
be8bec20e05cbf5aa26e1cb824b5be2ffe259628 | Python | qdouasbin/postproc_explo_airbus | /join_cases.py | UTF-8 | 1,360 | 2.671875 | 3 | [] | no_license | import os
import glob
import numpy as np
import pandas as pd
def join_subdirectory_csv_files(prefix, extension):
"""
1. Seek for csv files according to prefix.extension rule
2. concatenate all files
3. drop duplicates
4. re-index
5. dump clean concatenated file
"""
# Find all csv file... | true |
76292c008ea3b720f28c9c7cc338e0cd99033795 | Python | wsgan001/PyFPattern | /Data Set/bug-fixing-5/50377242a7479ff85fbbd1c5bf24acb46036c9c4-<test_parallel_threads>-fix.py | UTF-8 | 709 | 2.578125 | 3 | [] | no_license | def test_parallel_threads():
lock = ReentrancyLock('failure')
failflag = [False]
exceptions_raised = []
def worker(k):
try:
with lock:
assert_((not failflag[0]))
failflag[0] = True
time.sleep((0.1 * k))
assert_(failflag... | true |
e8782ae6b0844724485401180d452a261c075305 | Python | tapiaw38/agrapi | /producer/models/production.py | UTF-8 | 1,777 | 2.953125 | 3 | [] | no_license | """ Model Production """
from django.db import models
class Production(models.Model):
'''
Type of Production that the producer develops,
stores the producer's residence,
road conditions and coordinates.
'''
producer = models.ForeignKey(
"producer.Producer",
related_name='prod... | true |
c7b151f3e8ea33fb69a29f970075b7c927516317 | Python | Perlence/rpp | /rpp/scanner.py | UTF-8 | 2,204 | 3.359375 | 3 | [
"BSD-3-Clause"
] | permissive | import attr
def tokenize(string):
lex = Lexer()
lex.input(string)
return iter(lex)
def lexer():
return Lexer()
class Lexer:
_input = None
_iter = None
def input(self, s):
self._input = s
self._iter = iter(self)
def token(self):
return next(self._iter, None... | true |
312d30d404b6f6c3435b262f081fa596abaa870e | Python | StanfordASL/safe_traffic_weaving | /scripts/viz_vehicle.py | UTF-8 | 1,346 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from __future__ import division
import rospy
from visualization_msgs.msg import Marker
from utils.math_utils import int_or_float
from utils.markers import car_marker
VTD_CAR_X = 4.22100019455 # parameters corresponding to VTD simulated car
VTD_CAR_Y = 1.76199996471
VTD_CAR_dX = 1.3654999733
c... | true |
0c11220cca60b06424e07cebb6abc4cad79da04c | Python | Barchid/Indoor_Segmentation | /losses/focal_tversky_loss.py | UTF-8 | 1,724 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow.keras.backend as K
def class_tversky(y_true, y_pred):
smooth = 1
y_true = K.permute_dimensions(y_true, (3, 1, 2, 0))
y_pred = K.permute_dimensions(y_pred, (3, 1, 2, 0))
y_true_pos = K.batch_flatten(y_true)
y_pred_pos = K.batch_flatten(y_pred)
true_pos = K.sum(y_true_pos * y... | true |
9943f7c431e67dc4c0392dbda315faf20231b432 | Python | why1679158278/python-stu | /python资料/day8.3/day03/exercise08.py | UTF-8 | 528 | 4.03125 | 4 | [
"MIT"
] | permissive | """
2.
在终端中录入一个年份,
如果是闰年为变量day赋值29,
否则赋值28。
闰年:年份能被4整除但是不能被100整除
年份能被400整除
"""
year = int(input("请输入年份:"))
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
# 下面代码太绕了,不建议
# if not year % 4 and year % 100 or not year % 400:
day = 29
else:
day = 28
... | true |
9e31f65e219fcb2bae2e9ef51fac7f1adfb9efab | Python | jonmagnus/INF1900 | /KAP6/poly_repr.py | UTF-8 | 363 | 3.421875 | 3 | [] | no_license |
def eval_poly_dict(poly,x):
return sum([poly[p]*x**p for p in poly])
def eval_poly_list(poly,x):
sum_ = 0
for p in range(len(poly)):
if poly[p]: sum_ += poly[p]*x**p
return sum_
pd = {0: -.5, 100: 2}
pl = [0]*101
pl[0] = -.5; pl[100] = 2
x = [0,1,2,3]
y1 = [eval_poly_dict(pd,x_) for x_ in x]
y2 = [eval_poly_l... | true |
cb1ce31327897fc826ddaf40189d67d3aac52a1f | Python | ctesta01/oire-excel-restructure | /python_macro-runner.py | UTF-8 | 2,023 | 2.671875 | 3 | [] | no_license | from __future__ import print_function
import unittest
import os.path
import win32com.client
"""
ExcelMacro
August 19th, 2015
ExcelMacro works by running a macro defined in Macros.xlsm.
The macro is projectsRestructure.
projectsRestructure runs on OIREProjects.csv.
This macro outputs a file called OIREPr... | true |
5fd896f3b130da8304ae68299d8cb96281abe4fc | Python | rohit-ganapathy/ToxicCommentClassification-TF-Estimator | /create_tf_records.py | UTF-8 | 4,115 | 2.703125 | 3 | [] | no_license | import tensorflow as tf
from collections import Counter, OrderedDict
import pandas as pd
import nltk
import os
flags = tf.flags
FLAGS = flags.FLAGS
flags.DEFINE_string("input_file", None,
"path to csv containing data")
flags.DEFINE_integer("vocab_size", 30000,
"size of vocab... | true |
6f575765b58a5c598371a02b50aaaa043e16c95c | Python | bengovernali/string_exercises | /capitalize_a_string.py | UTF-8 | 291 | 4.28125 | 4 | [] | no_license | def uppercase_a_string(given_string):
new_string = ""
index = 0
for letter in given_string:
if index == 0:
new_string += letter.upper()
else:
new_string += letter
index += 1
return new_string
print(uppercase_a_string("bobby")) | true |
0438c036003e1cf957d43e6f2f6c6ca637a5983f | Python | bobbyrward/dota2_stats | /dota2_stats/keyvalues.py | UTF-8 | 807 | 3.03125 | 3 | [] | no_license | import pyparsing as pp
def parse_keyvalues_file(file_like):
"""An extremely lenient key values file parser
See: https://developer.valvesoftware.com/wiki/KeyValues
"""
# a quoted string
quoted = pp.dblQuotedString.setParseAction(pp.removeQuotes)
# a data value
keyval = pp.Dict(pp.Group(qu... | true |
0836b5eaa13477fae185eafc0deb8af601c0f7c6 | Python | pickleCucumber/xml_parser | /parser.py | UTF-8 | 1,030 | 3.1875 | 3 | [] | no_license | import xml.etree.ElementTree as ET
import pandas as pd
import re
a=[]
n=[]
tree = ET.parse('file_name.xml')
root = tree.getroot()
#регулярное выражение рекомпилим для дальнейшего использования
regex= re.compile(r'^1.[0-9]{1,2}$')
#проходя нужный уровень, выбираем значения по регулярке, помещая в массив для дальнейш... | true |
b68a7ce0369336d9d492433bd45042b962077c06 | Python | kawazrepos/Kawaz3rd | /src/kawaz/apps/stars/perms.py | UTF-8 | 5,638 | 2.84375 | 3 | [] | no_license | from permission.logics import PermissionLogic
from kawaz.core.utils.permission import check_object_permission
class StarPermissionLogic(PermissionLogic):
def _check_object_permissions(self, user_obj, codenames, obj):
"""
指定されたユーザーが指定された省略形パーミッションのどれか一つでも
対象オブジェクトに対して持つか調べる
Args:
... | true |
b2fde2c25bdc8dd56d144e959ede0fc2d0b27191 | Python | sivasankari1996/codekata | /removevowel.py | UTF-8 | 189 | 2.984375 | 3 | [] | no_license | x=raw_input()
z=list(x)
g=[]
z=z[::-1]
l=['a','e','i','o','u','A','E','I','O','U']
for i in range(len(z)):
if z[i] in l:
pass
else:
g.append(z[i])
print(''.join(z))
print(''.join(g))
| true |
286fb38181940337848c606b8394eb879806ffa7 | Python | dashaevsina/MEMEX_SANDBOX | /_misc/1_build_structure_annotated.py | UTF-8 | 7,338 | 3.296875 | 3 | [] | no_license | import os, shutil, re
import yaml
###########################################################
# VARIABLES ###############################################
###########################################################
settingsFile = "./settings.yml" # Main settings are stored in a yaml file, which is
# better... | true |
7b9583a0635ae6ea6132a45344feb60d6b2d8a69 | Python | laurenwheat/ICS3U-Assignment3B-Python | /3B.py | UTF-8 | 601 | 4.21875 | 4 | [] | no_license | #!/usr/bin/env python3
# Created by: Lauren Wheatley
# Created on: May 2021
# This program plays the number guessing game, but better
def main():
# this function plays the number guessing game, but better
guess = int(input("Enter a number: "))
guessx = int(input("Enter another number: "))
if guess ... | true |
d803463b5168648608a5c1508e4832d41c4b9e4f | Python | RomiSugianto/python_projects | /perulangan_segitiga2.py | UTF-8 | 155 | 3.390625 | 3 | [] | no_license | # for kolom in range(7):
# for baris in range(kolom):
# print(kolom,end="")
# print()
i = 7
while i <= 7 and i >=0:
print(i)
i -=1 | true |
9b89cbf126702b6ae845ad42d3320eeeb08c6898 | Python | jeffreyzpan/directory-scraper | /search_directory.py | UTF-8 | 3,260 | 2.78125 | 3 | [
"MIT"
] | permissive | import pytesseract
import os
from PIL import Image
import json
import re
import argparse
parser = argparse.ArgumentParser(description='Converts PDF of Directory to a list of students.')
parser.add_argument('--path', type=str, nargs='?',
help='path to image folder')
args = parser.parse_args()
path ... | true |
907a7141c57b4331cfa2d833f09174c0deb20026 | Python | awneesh6894/ds_algo | /Arrays/trapping_rain_water.py | UTF-8 | 177 | 2.75 | 3 | [] | no_license | #x=int(input())
lm=0
rm=0
#arr=list(map(int,input().split()))
arr1=[6,9, 9]
x=len(arr1)
for i in range(int(x/2)):
lm=max(lm,arr1[i])
rm=max(rm,arr1[x-i-1])
print(lm,rm) | true |
6bea271c70725f4ed65c02348873a5ef7224bc7c | Python | tommeagher/pycar14 | /project1/project_1.py | UTF-8 | 7,263 | 4.0625 | 4 | [
"MIT"
] | permissive | # import modules
import csv
FILE_NAME = 'fdic_failed_bank_list.csv'
# write a function to open a csv file
def open_csv_file(file_name):
# open the csv
csv_file = open(file_name, 'rb')
# create the object that represents the data in the csv file
csv_data = csv.reader(csv_file)
# output that obje... | true |
aeddf76e0a3b6924fb9f7a5637db36541b9bd39e | Python | shouryaAr/Games | /pingpong.py | UTF-8 | 3,980 | 3.25 | 3 | [] | no_license | # Ping Pong
import pygame, sys, random, time
# Play Surface
X = 1280
Y = 800
playSurface = pygame.display.set_mode((X, Y))
pygame.display.set_caption('Ping Pong Game')
pygame.init()
time.sleep(3)
# Colors
red = pygame.Color(255, 0, 0)
green = pygame.Color(0, 255, 0)
black = pygame.Color(0, 0, 0)
whit... | true |
8d0771c9b4495bf102610739c66223a70cd9bb6d | Python | kterra/EDA-2015 | /Trabalho Final/Exercicios_Otto/codigo_rademaker_2.py | UTF-8 | 2,617 | 3.8125 | 4 | [] | no_license |
#Vamos utilizar o exercicio 3 do capitulo 5 de divisao e conquista do livro Algorithm Design de John Kleinberg e de Eva Tardos
#como inspiracao para resolucao de um problema real com uma base de dados do setor de matematica.
#O problema consiste na comparacao de strings a fim de descobrir qual a proporcao de professor... | true |
66242030e8d4dd7eec99be141364e82ace6e95b9 | Python | SamirKhadka890/Lets-Upgrade | /Day 2 Assignment.py | UTF-8 | 1,416 | 4 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#Strings
# In[2]:
ram = "this is string"
print(ram.title())
# In[3]:
print(ram.upper())
# In[4]:
print(ram.lower())
# In[6]:
first_name = "Samir"
last_name = "Khadka"
print(first_name+" "+last_name)
# In[7]:
print(first_name+" "+last_name.lstrip())
... | true |
4d8b62acc5152a66248689a86452948601265b5c | Python | dpstart/genbci | /genbci/generate/progressive.py | UTF-8 | 5,091 | 3.015625 | 3 | [] | no_license | # coding=utf-8
from torch import nn
import torch
"""
Karras, T., Aila, T., Laine, S., & Lehtinen, J. (2017).
Progressive Growing of GANs for Improved Quality, Stability, and Variation.
Retrieved from http://arxiv.org/abs/1710.10196
"""
class ProgressiveDiscriminator(nn.Module):
"""
Discriminator module for im... | true |
a52b1c8722b5d9e5b7d35997eac2280bfb219089 | Python | podema/pandas | /analyze_hits.py | UTF-8 | 763 | 2.75 | 3 | [] | no_license | import os
import pandas as pd
import numpy
#inicialitzar data_frame de sortida
df_out=pd.DataFrame()
df_out['Machines']=ex=pd.ExcelFile(os.listdir('.')[0])
for file in os.listdir('.')[:-1]:
print file
ex=pd.ExcelFile(file)
out=[]
for sheet in ex.sheet_names[2:]:
df=ex.pars... | true |
fe1fabaffccb413ddedd6d3da9fc32945707411f | Python | JasonK93/Deechat | /web_crwal/qiushibaike.py | UTF-8 | 2,879 | 3 | 3 | [] | no_license | # coding:utf-8
import requests
import re
from bs4 import BeautifulSoup
import time
import numpy as np
# get HTML Text
def getHTMLText(url):
try:
r = requests.get(url, timeout = 60) # 向服务器发送请求
r.raise_for_status() ... | true |
f24cfb8ed1075e262724618729608f023909fa87 | Python | Tommimon/advent-of-code-2020 | /marcomole00/09/9.py | UTF-8 | 908 | 2.765625 | 3 | [
"MIT"
] | permissive | with open('marcomole00/9/input.txt')as file:
lines = list(map(int,file.read().split('\n')))
for i in range(len(lines)-25):
check = False
k = i+25
for j in range(25):
for l in range(25):
if (k == l): break
if lines[k] == lines[k-j-1] +lines[k-l-... | true |
a03b6950a22f577a8c1d66ce52e78d3a8966b4ef | Python | aguiejean1992/churn-engineering | /src/python/src/utils/utils.py | UTF-8 | 390 | 2.890625 | 3 | [] | no_license | import pandas as pd
import pickle
def read_dataset(path: str):
"""
Read dataset
:param path: Path of the dataset
:return: Dataframe
"""
df = pd.read_csv(path)
return df
def load_model(path: str):
"""
Load serialized model
:param path: Model path
:return: Model instance
... | true |
885d5a037f5887f8bd9dea07bc9193c4d00b801c | Python | bmclaugh/hello-world | /ha 4.59.23 PM.py | UTF-8 | 1,301 | 3.1875 | 3 | [] | no_license | a_list = [1,2,3, 'BEV', [5,6,7], 'WORD']
print a_list
print a_list[0]
#print a_list[len(a_list)]
print a_list[len(a_list)-1]
print a_list[:2]
print a_list[:-1]
print a_list[-1]
print a_list[-1][0]
a_string = 'RASHAD'
print a_string[-1]
print a_list.index('BEV')
a_list.reverse
print a_list
my_list = [ 1, 2.5 ,'BEV', [2,... | true |
5d25ffc5de8a78aa6765c3d3f58f118e6e58304d | Python | kobeding/python | /2015/ding_triangles.py | UTF-8 | 220 | 3.265625 | 3 | [] | no_license | #!/usr/bin/python3.4
# Filename: ding_triangles.py
#def triangles():
L = [1,]
x = 0
while x < 10:
i = len(L) - 1
while(i):
L[i] = L[i] + L[i-1]
i -= 1
L.append(1)
print(L)
x += 1
#y = triangles()
#print(y)
| true |
e0f7d22b96d505231543ff3a97fa5377df8e8c5d | Python | MartyPang/machine_learning_course_proj | /Project3_SVM/svm20newsgroup.py | UTF-8 | 1,133 | 2.5625 | 3 | [] | no_license | from sklearn.datasets import load_files
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.model_selection import cross_val_score
from sklearn.svm import LinearSVC
import os
derectory = "../data/20_newsgroups"
# delete incompatible files
count_vector = CountVectorizer()
files =... | true |
085b5cf0b254a87a6bbc36a33a68965992446d15 | Python | babraham1995/PracticeLanguages | /practicePython/RockPaperScissors.py | UTF-8 | 2,611 | 4.125 | 4 | [] | no_license | # Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game)
# Remember the rules:
# Rock beats scissors
# Scissors beats paper
# Paper beats rock
input1 = int(input("rock... | true |
bde5debb2188abffff2baeb035905df0408a0787 | Python | AlvaroMartinezQ/python-starter | /module_2-files/pass_to_dict.py | UTF-8 | 425 | 3.09375 | 3 | [] | no_license | # Return name and user ID from /etc/passwd file
# name -> field[0]
# UID -> field[2]
PATH = "../statics/etc_passwd.txt"
fil = open(PATH)
users = dict()
line = fil.readline()
while(line):
words = line.split(":")
if "#" in words[0]:
# Section is a comment
pass
else:
name = words[0]... | true |
95ed104a7d7b6427520103eb2dda9e61413b8e9a | Python | lp1dev/Downloader | /dl.py | UTF-8 | 759 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
import re
import requests
from sys import argv
URL_REGEXP=re.compile('((http|https)(://.*?"))')
def usage():
print("""
dl.py will download all the link contents of a given file
usage: %s [file]
""")
return 0
def main():
if len(argv) < 2:
return usage()
with open(argv[1]) a... | true |
6ef20b5706c1ff7905344d96f299d219e453bf51 | Python | rafaelfeliciano4/CampusStudy | /Campus_Test.py | UTF-8 | 2,317 | 2.640625 | 3 | [] | no_license | from CampusFlask import app
import os
import json
import unittest
import tempfile
class FlaskTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, app.config['DATABASE'] = tempfile.mkstemp()
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
os.... | true |
987c4e89cbaffa3d84e76d1cc7e0b4c0ac3bc2c9 | Python | vernikagupta/Opencv-code | /crop_flip.py | UTF-8 | 920 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 13:08:19 2020
@author: vernika
"""
from __future__ import print_function
import cv2
import argparse
def show_img(img):
cv2.imshow("canvas",img)
cv2.waitKey(0)
return
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", requi... | true |
3d9ac2a8d17859a2517bbf14a46d51b0da4b116b | Python | TheRealJenius/TheForge | /TK.py | UTF-8 | 5,009 | 3.453125 | 3 | [] | no_license | # And so it begins
"""
Things to do:
- Define Functions required
- Enter input
- Display input as output
- Delete input
- Copy input
- Paste input
- Create a GUI
- TKinter seems to be the default a good place to start
- Create Menus
- File
- Edit
- About
- Time and date package
... | true |
5cd8161f493ae40d666f14a60803dff3036b6da2 | Python | ruan65/python_algorithms_and_problem_solving | /hacker_rank/python_practice/classes/three_d_angle.py | UTF-8 | 613 | 3.34375 | 3 | [] | no_license | class Points(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __iter__(self):
return iter([self.x, self.y, self.z])
def __sub__(self, other):
return Points(*(a - b for a, b in zip(self, other)))
def dot(self, other):
return sum... | true |
8439fdfe28b6273c4bc90be2e86f5600a8638797 | Python | andrewhingah/storemanager | /app/tests/v1/test_sales.py | UTF-8 | 2,792 | 2.671875 | 3 | [
"MIT"
] | permissive | """
Sales testing module
"""
import json
from .base_test import BaseTestCase
class TestSales(BaseTestCase):
"""
class for testing sales endpoints
"""
def test_get_all_sales(self):
"""Test user can get all sales
"""
self.register_user()
result = self.login_user()
access_token = json.loads(result.data.dec... | true |
a0ba65df6f35f1014872c80a8c013c82a3f31f54 | Python | wangkua1/apd_public | /model/fc.py | UTF-8 | 2,542 | 2.578125 | 3 | [] | no_license |
import pdb
import torch
import torch.nn as nn
from torch.autograd import Variable
class fc_pytorch_base(nn.Module):
"""
for a unified API with cnn.py
"""
def __init__(self):
super(fc_pytorch_base, self).__init__()
self.posterior_samples = []
self.posterior_weights = []
d... | true |
01963644225da095c733d1459317543505b46d1f | Python | Ashton-Sidhu/Daily-Coding-Problems | /Solutions/Problem 9.py | UTF-8 | 1,575 | 4.4375 | 4 | [] | no_license | #QUESTION
# Given a list of integers, write a function that returns the largest sum of non-adjacent numbers.
# Numbers can be 0 or negative.
# For example, [2, 4, 6, 2, 5] should return 13, since we pick 2, 6, and 5. [5, 1, 1, 5] should return 10,
# since we pick 5 and 5.
# Follow-up: Can you do this in O(N) time and c... | true |
303f2e18c682a532588a5231182e31dded4f6cfe | Python | leo0842/algorithmic | /backtracking/operator-insert.py | UTF-8 | 2,428 | 3.34375 | 3 | [] | no_license | """
6
1 2 3 4 5 6
2 1 1 1
"""
n = int(input())
numbers = list(map(int, input().split()))
operators = list(map(int,input().split()))
operators_dict = dict()
operators_dict[0] = "+"
operators_dict[1] = "-"
operators_dict[2] = "*"
operators_dict[3] = "//"
max_num = float('-inf')
min_num = float('inf')
def operatio... | true |