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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8dfd44cbc1bb20c4513d24bc7e9fc7b240857bb9 | Python | AdnanAKhan/category-aware-PHD | /preprocessing_scripts/step_segment_processing.py | UTF-8 | 3,436 | 2.59375 | 3 | [] | no_license | import pandas as pd
import os
import pickle
class VideoSegmentation:
def __init__(self, train=True):
self.DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'Data')
self.SAVE_DIR = os.path.join(self.DATA_DIR, 'segment_info')
if train:
self.df ... | true |
b942ace696013c688c9e27c3f4e4f3116269735b | Python | hsl89/AlectioSDK | /test/test_torch_utils.py | UTF-8 | 3,301 | 2.5625 | 3 | [] | no_license | '''
test torch_utils functions
'''
from alectio_sdk.torch_utils.loss import HardNegativeMultiBoxesLoss
from alectio_sdk.torch_utils.metrics import mAP
from alectio_sdk.torch_utils.utils import Anchors
from alectio_sdk.torch_utils.utils import cxcy_to_xy
from numpy.testing import assert_almost_equal
import numpy as np... | true |
aa0f9e87080775732854f73cda4c0ba424cdfceb | Python | fp-computer-programming/cycle-3-labs-p22cpetrelli | /lab_4-1.py | UTF-8 | 348 | 3.640625 | 4 | [] | no_license | # author CJP 9/29/ 2021
magic_strength = int(input("What is your magic strength level? "))
shield_charged = int(input("What is your shield charged to? "))
if not ((magic_strength >= 90) and (shield_charged >= 75)):
print("The dragon burns you to a crisp.")
else:
print("You defeated the dragon! But the princ... | true |
11c915cba85bc765ff19308687a63622c0d22698 | Python | nwthomas/code-challenges | /src/leetcode/medium/endcode-and-decode-strings/test_encode_and_decode_strings.py | UTF-8 | 740 | 3.15625 | 3 | [
"MIT"
] | permissive | from encode_and_decode_strings import decode, encode, ENCODING_SPACER
import unittest
class TestEncodeDecode(unittest.TestCase):
def test_encodes_string_correctly(self):
"""Correctly encodes a string"""
strings = ["this", "is", "a", 'test']
result = encode(strings)
self.assertEqual(... | true |
1e920dd8ef33c8f27727c92ee103e621ef58f5f8 | Python | dzejeu/roguelike | /roguelike/model/world/tile.py | UTF-8 | 1,319 | 3.484375 | 3 | [] | no_license | class Tile:
breakable = False
collidable = False
passable = True
occupied_by = None
type = "V" #types of tiles V - void, R - room, C - corridor, W - wall, O - obstacle, easily expandable
mark_as_attacked = 0
mark_as_attacked_by_enemy = 0
mark_as_poisoned = 0
gold_dropped = None #... | true |
041feccd51ccc94b63e3dc0634ef486b15a128ef | Python | nobe0716/problem_solving | /codeforces/contests/1077/C. Good Array.py | UTF-8 | 477 | 2.921875 | 3 | [] | no_license | from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(list)
for i in range(n):
d[a[i]].append(i)
sum_of_a = sum(a)
r = []
for i in range(n):
rest_sum_of_a = sum_of_a - a[i]
if rest_sum_of_a % 2 == 1 or (rest_sum_of_a // 2) not in d:
continue
... | true |
706451f338d787c3370271500da78566e1d4a3a2 | Python | bkzech/test-proj1 | /app.py | UTF-8 | 87 | 3.953125 | 4 | [] | no_license | x = input('Type number:')
x = int(x)
y = x + 2
print('Your number is two less than',y)
| true |
232621037e5f661b8683f4d7a19c2ce0f0949467 | Python | atlisg/VeganBot | /vegan_bot.py | UTF-8 | 7,029 | 2.5625 | 3 | [] | no_license | import re
import os
import csv
from pprint import pprint
from flask import Flask, render_template, request
from collections import Counter
#from stemming.porter2 import stem
import argparse
from PyDictionary import PyDictionary
import datetime
parser = argparse.ArgumentParser(description="VeganBot : A chatty robot tha... | true |
ed4d6bc07888ab90c8de32197ba1544fed725a01 | Python | WSMStudio/crawler | /smash_text_content_downloader.py | UTF-8 | 2,997 | 2.6875 | 3 | [] | no_license | import requests, time
from database_class import *
from parsel import Selector
import re
import copy
def download_from_bid():
with open(f"./smash_data/content/not_crawled.txt", "r", encoding="utf-8") as f1:
not_crawled_ = f1.read().split('\t')[:-1]
not_crawled = [int(i) for i in not_crawled_]
crawl... | true |
5d3acb02e7f0ce61869834fa3bfa7b7cec686cef | Python | Yackpott/public | /Yackpott-repo/Actividades/AC14/Release/test.py | UTF-8 | 1,389 | 2.78125 | 3 | [] | no_license | from main import Alumno, Base, Ramo
class TestSistema:
def setup_method(self, method):
self.base = Base()
self.alumno = Alumno(self.base, 0, "Rodolfo")
self.ramo = Ramo("MAT9999", "0", "10")
self.base.db.append(self.ramo)
# con y sin vacantes
def test_tomar_si(self):
... | true |
2e5366d5e218457bb65762438f30a6848c67f7e0 | Python | SwordreamLj/leetcode | /python3/1两个数之和.py | UTF-8 | 302 | 2.984375 | 3 | [] | no_license | class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
mp = dict()
for i, num in enumerate(nums):
sub_num = target - num
if mp.get(sub_num, None) != None:
return [mp[sub_num], i]
mp[num] = i
return [] | true |
cb6921af01c1fd6d24fa357aec06059dea76b307 | Python | SinisterSoda/Audverter | /GUI.py | UTF-8 | 4,291 | 2.875 | 3 | [] | no_license | import tkinter as tk
from tkinter.filedialog import askdirectory
from Converter import *
class ApplicationGUI(tk.Frame):
master=None
directory=""
converter=None
def __init__(self, c):
master=tk.Tk()
tk.Frame.__init__(self, master)
self.converter = c
self.grid(row=0, col... | true |
500df3b7971c67903bd7a458e95eab5d7939ebb9 | Python | nalinraut/high-level-Motion-Planning | /Archived/Research/MotionPrimitives/MetricLearning/training.py | UTF-8 | 17,532 | 3.140625 | 3 | [] | no_license | from primitivelibrary import Primitive,PrimitiveLibrary
import random
import scipy as sp
import scipy.linalg as LA
import time
from collections import defaultdict
class TrainingData:
"""
Raw training data.
Members:
- problems: a list of training problems
- costs: a dict from (primitiveIndex,pr... | true |
2d42cd3c096cfb0dd9d39c9715910b601d3d0ecd | Python | emanuelgustavo/pythonscripts | /loteria.py | UTF-8 | 360 | 3.3125 | 3 | [] | no_license | import random
def sorteio():
pass
def aposta():
aposta = []
while len(aposta) < 6:
numero = int(input('Digite um numero de 1 a 60'))
while numero < 1 or numero > 60:
numero = int(input('Digite novamente!'))
else:
aposta.append(numero)
return aposta
def... | true |
7054dae26d9546a06bc0e5941fdc6fb19adfb227 | Python | tgieseking/alpha-tsuro | /alphaTsuro/Player.py | UTF-8 | 789 | 3.34375 | 3 | [] | no_license | from .Piece import Piece
from .Board import Board
class Player:
def __init__(self, index, board, deck, piece_row, piece_col, piece_position):
self.board = board
self.piece = Piece(board, piece_row, piece_col, piece_position)
self.hand_size = 3
self.hand = [deck.draw() for i in range... | true |
a0b988308e6dfb606ed319de28a2aba1208d5690 | Python | jasonblog/note | /python/src/pyprogbook/第二版(博碩)課本範例程式/ch6/RC_6_6.py | UTF-8 | 266 | 3.640625 | 4 | [] | no_license | #RC_6_6 功能: 現值
def pvfix(fv, i, n):
#fvfix: 計算現值公式
result=fv/((1+i)**(n))
return(result)
fv=float(input('輸入終值 = '))
i=0.03
n=int(input('輸入n年前 = '))
print('%d年前的現值 = %6.2f' %(n, pvfix(fv, i, n)))
| true |
78334b4b45e5778fc37bd4f2a3446d7d6f63adc7 | Python | jiejie168/array_leetCodes | /4Sum.py | UTF-8 | 1,893 | 3.859375 | 4 | [] | no_license | __author__ = 'Jie'
"""
18. 4Sum
Given an array nums of n integers and an integer target,
are there elements a, b, c, and d in nums such that a + b + c + d = target?
Find all unique quadruplets in the array which gives the sum of target.
Note:
The solution set must not contain duplicate quadruplets.
Example:
Given ar... | true |
7fe457867690c7ea58b9d93528355f716ccafaa9 | Python | yunpengb/Py_Dev_Suite | /1.PythonBasic_Train/2.14/Exercise.py | UTF-8 | 99 | 3.109375 | 3 | [] | no_license | for i in range(21):
if i == 4 or i == 6:
continue
elif i % 2 == 0:
print i, | true |
658854d5ef56728410a6039310de0326073a96a8 | Python | kidusasfaw/addiscoder_2016 | /labs/server_files_without_solutions/lab9/fibonacci2/fibonacciSol.py | UTF-8 | 369 | 3.703125 | 4 | [] | no_license | import sys
# This function should take as input an integer n and output the nth Fibonacci number
def fibonacci(n):
# student should implement this function
###########################################
# INPUT OUTPUT CODE. DO NOT EDIT CODE BELOW.
n = int(sys.stdin.readline())
ans = fibonacci(n)
sys.stdou... | true |
445cdac1ff454a9494ee503b1f6409f46f8e5229 | Python | kmoon601/teste | /SNS datalab/mapdata.py | UTF-8 | 338 | 2.875 | 3 | [] | no_license | # folium
import folium
tip='확인'
map_data= folium.Map(location = [37.1515,127.51515], zoom_start=20) # 위도 경도 입력
map_data= folium.Marker([37.1515,127.51515],popup='check', tooltip=tip).add_to(map_data) # 지도에 갖다대면 툴팁에 'chech'라고 뜬다
map_data.save(r'C:\LAB\map1.html') # html 문서로저장 | true |
5f05b80e52f647c280f2972e4b9433a11ecac168 | Python | debu999/djangofundamentals | /djangorestproject/languages/models.py | UTF-8 | 1,324 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | from django.db import models
# Create your models here.
class Popularity(models.Model):
previousrank = models.IntegerField(verbose_name="PreviousWeekRank", name="previousrank",
blank=True, null=True, db_index=True)
rank = models.IntegerField(verbose_name="Rank", name="ra... | true |
90aa82390d6888b19b1075b1e6d0ffe3d29cf7fc | Python | sairin1202/Leetcode | /80.py | UTF-8 | 821 | 2.640625 | 3 | [] | no_license | from collections import Counter
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums) == 0:
return 0
if len(nums) <= 2:
return len(nums)
idx = 1
count = 1
curre... | true |
ad998c5fca89c8ba48be341f29bd5e89186ee4e4 | Python | surya-lights/Python_Cracks | /iterator.py | UTF-8 | 1,213 | 4.75 | 5 | [] | no_license | # return an iterator from a tuple and print each value
mytuple = ("apple", "banana", "cherry")
myit = iter(mytuple)
print(next(myit))
print(next(myit))
print(next(myit))
# String as an iterator
mystr = "Red"
myit = iter(mystr)
print(next(myit))
print(next(myit))
print(next(myit))
# Looping through an iterator
mytup... | true |
00910b7b8efd0ab88e7f8a0342b0a83b82dac970 | Python | lsilvamiguel/usercode | /Python/QCDRate.py | UTF-8 | 5,859 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python
import string
from math import sqrt
# Define the tuple containing the cross sections
# Including high luminosity factor
crossSections = [ 163000000.*0.01,
21600000.*0.01,
3080000.*0.01,
494000.*0.01,
101000.*0.01,
... | true |
36a2b854bfeedd149eafe7d1e255b28a874592dd | Python | Nesar13/Python | /Labs/lab_7.py | UTF-8 | 936 | 3.671875 | 4 | [] | no_license | # If the integer is odd, the right-most bit would be 1. If the integer is even, the right-most bit would be 0
# from 1010 to 1011, the value of the number is changing in that the last recursive call to the number is not divisible by 2.
s = '00000000'
def isOdd(n):
if n == 0:
return False
elif n % 2 == ... | true |
eb6cf58e35e2f4510086b00fe1b361ceeda5b21a | Python | triint/projektt | /dataret.py | UTF-8 | 1,860 | 2.546875 | 3 | [] | no_license | import sqlite3
#loo andmebaas
def firststart():
db = sqlite3.connect('test.db')
#kustutab eelmised tabelid
db.execute('drop table if exists kliendid')
db.execute('drop table if exists tooted')
db.execute('create table kliendid (t1 text, i1 int, t2 text)')
db.execute('create table tooted (... | true |
2a5b6555be974755434512c1db0d7e5e6eae72db | Python | nitinKumarInfy12/Python_material | /MyPyhton/Detailed_Study/Regex_isPhoneNumber/isPhoneNumber.py | UTF-8 | 6,843 | 4.1875 | 4 | [] | no_license | # regular expression or regex. use it from re module
# \d\d\d-\d\d\d-\d\d\d\d is analogus to 123-345-2345 where \d represents digit character
# \d{3}-\d{3}-\d{4} also is analogus to 123-345-2345
import re
message = 'my phone number is 123-345-4567'
phoneNumRegex = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d') # create a reg... | true |
551810888e2c10fd20df21a0d812e4cc9958e464 | Python | RicardoJPedro82/Wind_Blown_App | /b_get_data.py | UTF-8 | 13,332 | 2.53125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
""" Main lib for wmillfailprev Project
"""
import os
import pandas as pd
import numpy as np
import datetime
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import StandardScaler
from sklearn import metrics, model_selection
from sklearn.linear_model import LogisticRegr... | true |
652c9450fa12f56baf2b9469231c1c1088c88e81 | Python | OreNot/PythonRep | /src/part_2/2.py | UTF-8 | 97 | 3.484375 | 3 | [] | no_license | n = int(input())
sumd = 0
while n > 0:
i = input()
sumd += int(i)
n -= 1
print(sumd) | true |
34d5827b9fb52893fdc503162c1ae2089e59ae1c | Python | Yxav/URI-python | /1012.py | UTF-8 | 1,314 | 4.625 | 5 | [] | no_license | # Escreva um programa que leia três valores com ponto flutuante de dupla precisão: A, B e C. Em seguida, calcule e mostre:
# a) a área do triângulo retângulo que tem A por base e C por altura.
# b) a área do círculo de raio C. (pi = 3.14159)
# c) a área do trapézio que tem A e B por bases e C por altura.
# d) a área do... | true |
1d88420f1263f23aecc84b117d3bbe6f9061ba84 | Python | tlxxzj/leetcode | /23. Merge k Sorted Lists.py | UTF-8 | 1,051 | 3.328125 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
if len(lists) == 0:
return None
def merge(a, b):
... | true |
a6c22774e2c4b8ac2dca183fbdebf3023071db40 | Python | xysecurity/securitydevtool | /Jenkins-CVE-2018-1000861.py | UTF-8 | 1,823 | 2.515625 | 3 | [] | no_license | import requests
import sys
import queue
import threading
import binascii
import base64
class test():
def __init__(self,attackip,attackport):
self.attackport=attackport
self.attackip=attackip
def post(self,ip):
# with open(self.file,mode='rb') as f:
# file=f.read()
attackip=self.attackip
port=self.atta... | true |
e954d8a49ad4ef33c1e2597da436f7372ace8974 | Python | leon1peng/algorithm016 | /Week_07/单词接龙.py | UTF-8 | 1,304 | 3.515625 | 4 | [] | no_license | """
单词接龙
"""
from collections import deque, defaultdict
# 1
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
# 先验判断
if endWord not in wordList:
return 0
# 提前构建邻接表 -> 用generic state做key
in_words = defaultdict(list)
... | true |
ec29b54be02ffb0bf676d72b2c465e4d8ac5ede0 | Python | PhilipTrauner/spotify-graveyard | /spotify_graveyard/term_input.py | UTF-8 | 3,189 | 2.8125 | 3 | [
"MIT"
] | permissive | from sys import stdout
from shutil import get_terminal_size
from getch import getch, pause
from colorama import init as colorama_init
from colorama import Fore, Back, Style
colorama_init()
ENTER_ORD = 13
BACKSPACE_ORD = 127
ESC_ORD = 27
def get_terminal_width():
return get_terminal_size().columns
def startswith(... | true |
4228d5f95843010fb775720b90d62a4bf8c121c4 | Python | tomislacker/jira-graph | /jira_graph/util.py | UTF-8 | 4,297 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | """
util
====
Contains utility classes/methods
"""
import logging
import networkx as nx
from jira.exceptions import JIRAError
ISSUE_STATUS_COLORS = {
'in progress': '#bcebff',
'new': '#bcffd0',
'closed': '#ffd0bc',
'_DEFAULT_': '#ffbceb',
}
"""Define fill colors for issues based on status"""
log = l... | true |
730490323fa7999e9585abfcd00162bac5418d23 | Python | sinadadashi21/Wave-1 | /area-of-a-field.py | UTF-8 | 219 | 4.125 | 4 | [] | no_license | length = float(input("What is the length of your field? (in ft) "))
width = float(input("What is the width of your field? (in ft) "))
area = length*width / 43560
print("The area of the farm is " + str(area) + " acres") | true |
6582aa523befcead6d4781226efc49f66ca90dd5 | Python | hamin2065/PnP-Algorithm | /Week 7/L)11582.py | UTF-8 | 926 | 3.125 | 3 | [] | no_license | # 치킨 TOP N
# https://www.acmicpc.net/problem/11582
def merge_sort(A,C):
if len(A)<= 1:return A
mid = len(A)//2
left = merge_sort(A[:mid],C)
right = merge_sort(A[mid:],C)
return merge(left, right,C)
def merge(left,right,C):
i=j=0
sorted_list = []
while i < len(left) and j < len(right):... | true |
39b5a80cca4544159566cded9fdc431c50f16bac | Python | RichardPinecone/BigFish-U1-Python-SDK | /examples/pin.py | UTF-8 | 500 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | import pyb
# create instance for GPIO0
a=pyb.PIN(0)
# set GPIO to output mode
a.mode(a.OUT)
# set GPIO0 output high
a.value(1)
# set GPIO0 output low
a.value(1)
# create instancee for GPIO1 with input mode
b=pyb.PIN(1,pyb.PIN.IN)
# get GPIO1 state
print(b.value())
# GPIO rising interrupt callback
def func(pin):
... | true |
bc1b19cb5350bd4c7eeda8ba67785eb94d31e950 | Python | billm79/COOP2018 | /Chapter03/U03_Ex17_SquareRoot.py | UTF-8 | 1,891 | 4.90625 | 5 | [] | no_license | # U03_Ex17_SquareRoot.py
#
# Author: Bill Montana
# Course: Coding for OOP
# Section: A3
# Date: 25 Oct 2018
# IDE: PyCharm
#
# Assignment Info
# Exercise: 17
# Source: Python Programming
# Chapter: 3
#
# Program Description
# This program computes the square root of a user-specified number using Ne... | true |
6615274eef189c78c159e4cec6c3e3366f7f0822 | Python | chenxu0602/LeetCode | /1606.find-servers-that-handled-most-number-of-requests.py | UTF-8 | 4,461 | 3.4375 | 3 | [] | no_license | #
# @lc app=leetcode id=1606 lang=python3
#
# [1606] Find Servers That Handled Most Number of Requests
#
# https://leetcode.com/problems/find-servers-that-handled-most-number-of-requests/description/
#
# algorithms
# Hard (36.03%)
# Likes: 171
# Dislikes: 4
# Total Accepted: 3.2K
# Total Submissions: 8.9K
# Testc... | true |
9a6ec9b16ac72a0a3ba055c0004efde091ec76a7 | Python | domestos/inventory_rest_app | /proj/apps/inventory/models.py | UTF-8 | 1,460 | 2.5625 | 3 | [] | no_license | from django.db import models
from rest_framework import filters
#=================__PERSON__===========================
class Person(models.Model):
fname = models.CharField(max_length=30)
sname = models.CharField(max_length=30)
class Meta:
verbose_name = 'User'
verbose_name_plural = 'Users... | true |
064c55ff5f0f1c38d74e20f86510f4fabedde15c | Python | sven-h/dbkwik | /d_analyse/b_count_mapping.py | UTF-8 | 1,114 | 2.515625 | 3 | [] | no_license | from __future__ import division
import logging
from nparser import parse
from collections import defaultdict
def get_mappings_count_and_unique(dump_path, name):
subjects = set()
count = 0
with open(dump_path + name, 'rb') as f:
for s, p, o in parse(f):
subjects.add(s.value)
... | true |
5985ffa008f59c1e34c9d6e2806cfd3b8635d5fd | Python | SeenBetterDes/python_quiz3 | /quiz3.py | UTF-8 | 710 | 2.953125 | 3 | [] | no_license | import requests
import json
import sqlite3
conn = sqlite3.connect("Anime.sqllite3")
cursor = conn.cursor()
url = "https://animechan.vercel.app/api/quotes/anime?"
print(requests.get(url).headers)
title = input("Enter the name of your anime:")
info = {'title': title,'character':'character','quote':'quote'}
r= ... | true |
43311f6c01c59013b93052601ac018fd6fad0ecd | Python | Vlados-Doroshenko/Practice | /День 1/завдВ8.py | UTF-8 | 509 | 3.859375 | 4 | [] | no_license | import datetime
def printTimeStamp(name):
print('Автор програми: ' + name)
print('Час компіляції: ' + str(datetime.datetime.now()))
a = input("Введіть місяць народження: ")
b = int(input("Введіть число народження: "))
if a == ("December") and b >= 22:
print("Capricorn")
elif b <= 21:
print(... | true |
772f850bc52736b1bd24f8e5c0f321580e1777d6 | Python | dexapier/crawling-projects | /Myntra_complnt_reg.py | UTF-8 | 1,941 | 2.859375 | 3 | [] | no_license | from selenium import webdriver
import time
def com_reg():
msg = "My order was marked for return on July 1, and was picked from my residence on July 2. Since that day I have made numerous calls and emails to myntra.com to know more about the return request but was only told to wait a few more days. My registered compl... | true |
7722cfd8c849ab24f1c53c5ce6f259d440e8b004 | Python | davidkoh316/gyration_games | /files/.svn/text-base/CParticle.py.svn-base | UTF-8 | 2,065 | 3.078125 | 3 | [] | no_license | import Component
import pygame
## Style flags
# 0 - nothing
FLY_UPWARDS = 1 # - fly upwards
FLY_DOWNWARDS = 1 << 1
SIDE_SIDE = 1 << 2 # - side-to-side floaty movement
SPIN_CLOCKWISE = 1 << 3 # rotation of particle
SPIN_CCLOCKWISE = 1 << 4
EXPLODE = 1 << 5
def pdraw(entity, screen):
screen.blit(
ent... | true |
adc15516724a6762d2319dda8dd88ee1e761fa33 | Python | marc45/dcos-commons | /tools/ci/checks/get_applicable_changes.py | UTF-8 | 3,382 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import argparse
import itertools
import os.path
import subprocess
from typing import List
BUILD_FOLDERS = ["cli/", "clivendor/", "govendor/", "sdk/", "testing/", "tools/"]
BUILD_FILES = ["conftest.py", "test_requirements.txt", "frozen_requirements.txt", "Dockerfile"]
def get_changed_files(g... | true |
b9bdb2912a302025da4a4017ffe77435428914a4 | Python | horvatha/varEC | /varEC/setup_en.py | UTF-8 | 2,988 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
BASE SETTINGS
Ha változtatni akarsz, keresd meg a
## VÁLTOZTATHATÓAK
sort. Az után szerepelnek a legfontosabb beállítások.
For Hungarian Users
Default values. Change it, if you want.
"""
GROUP = 'physics' # I will use bin/physics.py
code_interval = (1, 10000)
import time
... | true |
e101e34d0bad7187baa7d8fd79898ce8ff3b6c0a | Python | Suryamadhan/9thGradeProgramming | /CPLab_21/GuessingGame.py | UTF-8 | 1,177 | 4.21875 | 4 | [] | no_license | """
Lab 21.2 Guessing Game
--------
Object class for the Guessing Game lab.
"""
from random import randint
class GuessingGame:
def __init__(self, stop):
self.number = stop
self.num = randint(1, self.number)
self.guess = 0
self.guessCount = 0
def playGame(self):
... | true |
8431cb8b047cf716798fb7cf26b561a5283925b9 | Python | jah128/ardebug | /testDataSource.py | UTF-8 | 1,718 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import json
import time
import random
class Robot:
def __init__(self, id):
self.id = id
self.state = "IDLE"
self.ir = [random.randint(0, 4095) for _ in range(8)]
self.battery_voltage = random.uniform(4.0, 4.2)
self.last_state_change = time.time() + random... | true |
cbe2c214272375cafcbc246a62757fc35cd4ce7f | Python | HuSniTo/Camp-Stuff-July-2019- | /madlibs.py | UTF-8 | 306 | 4.21875 | 4 | [] | no_license | def main():
verb = input("Type a verb: ")
verb2 = input("Type another verb: ")
place = input("Type a place (example: Japan) ")
name = input("Enter a name: ")
print ("{} was {} for his friend to {} in {}".format(name, verb, verb2, place))
if __name__ == "__main__":
main() | true |
bf7898dbf217823f9c98b4a2a5361814d6d1333a | Python | Dharaneeshwar/Leetcode | /1640. Check Array Formation Through Concatenation.py | UTF-8 | 314 | 3.078125 | 3 | [
"MIT"
] | permissive | class Solution:
def canFormArray(self, arr: List[int], pieces: List[List[int]]) -> bool:
# store start values of pieces
dairy = {}
for i in pieces:
dairy[i[0]] = i
output = []
for i in arr:
output += dairy.get(i,[])
return output == arr | true |
56f61179114b81ff16d6413401d103bab7526b73 | Python | VSVDEv/python_starter | /variables/arithmetic.py | UTF-8 | 475 | 3.828125 | 4 | [] | no_license | # Math
import math
a = 4
b = 2
print(a + b)
print(a - b)
print(a * b)
print(a / b)
# without residue return int
print(a // b)
# residue
print(a % b)
print(-a)
print(+a)
print(abs(a))
print(int(a))
print(float(a))
comp = complex(a, b)
print(comp)
print(comp.conjugate())
print(a**b)
print(pow(a, b))
c = 2.534534... | true |
755f4ca73d5982ce20a5ae18c914a21023d89e50 | Python | mdszamal/webexp1 | /app.py | UTF-8 | 475 | 2.953125 | 3 | [
"MIT"
] | permissive | from flask import Flask, request, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
@app.route("/predict", methods=["POST"])
def predict():
int_features= [float(x) for x in request.form.values()]
final_features= [np.array(int_features)]
prediction= ... | true |
a1b7a532cebcc8e96beb9153e7a4b1767db1583a | Python | justiniansiah/10.009-Digital-Word | /00 Finals/2017/2017_Q7.py | UTF-8 | 1,641 | 3.34375 | 3 | [] | no_license |
class MyTask(object):
def __init__(self, deadline, duration):
self.deadline = deadline
self.duration = duration
def __str__(self):
return 'T(%d,%d)' %(self.deadline, self.duration)
def procrastination(assignments):
totalTime=0
firstDead=assignments[0].deadline
last... | true |
c029f5544a8ea9cf0918e4f0b29ef9f3a64f022b | Python | amaguri0408/AtCoder-python | /panasonic3-14/b.py | UTF-8 | 235 | 2.84375 | 3 | [] | no_license | h, w = map(int, input().split())
ans = 0
ans += (h // 2) * (w // 2) * 2
if h % 2 != 0:
ans += w // 2
if w % 2 != 0:
ans += h // 2
if h % 2 != 0 and w % 2 != 0:
ans += 1
if h == 1 or w == 1:
ans = 1
print(ans) | true |
823410ba82329f61657526974a8cce78acd8b00b | Python | cairey88/ArubaGetVLAN | /GetVLAN.py | UTF-8 | 3,129 | 2.796875 | 3 | [] | no_license | #import modules
import netmiko
import sys
import re
import time
from netmiko import ConnectHandler
from getpass import getpass
#Prompt user for device input
ipaddress = input("Enter switch IP: ")
username = input("Enter switch username: ")
password = getpass()
#Start Timer
count = 0
start = time.time()
#Connect to e... | true |
bac03ed5096762af81abdd6547cb1458868b662d | Python | AikKh/Chat | /client.py | UTF-8 | 1,563 | 3.140625 | 3 | [] | no_license | import socket, threading
from Command import Command
def handle_messages(connection: socket.socket):
while True:
try:
msg = connection.recv(1024)
if msg:
print(msg.decode())
else:
connection.close()
break
e... | true |
a4472f8c10944e3f72735be77f688402de547c20 | Python | sushtend/100-days-of-ml-code | /code/Advanced Python 1/4 inheritance.py | UTF-8 | 1,902 | 3.984375 | 4 | [] | no_license | # https://www.youtube.com/watch?v=RSl87lqOXDE
class Employee:
raise_amount = 1.04
num_of_emps = 0 # Counting employees. This is constant for all instances
def __init__(self, first, last, pay): # Instance is passed always
self.first = first
self.last = last
self.pay = pay
... | true |
4b837c76b9cf54377d8840bc74a345fa24e26f5d | Python | ayqourlove/ayq-codes | /python_work/_sort.py | UTF-8 | 138 | 2.9375 | 3 | [] | no_license | cars = ['bwm','audi','toyota','subaru']
print(cars)
print(sorted(cars,reverse=True))
cars.sort(reverse=True)
print(cars)
print(len(cars))
| true |
4c11517fd467ba243951d505ea52b0cf2a1bca1e | Python | yurireeis/ml | /plots/plots_dispersion_chart.py | UTF-8 | 1,561 | 3.71875 | 4 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import seaborn
import pydataset
df_air_passengers = pydataset.data('AirPassengers')
# AirPassengers dataset head
print('AirPassengers: ', df_air_passengers.head())
plt.figure(0)
'''
If you wanna use a dispersion chart, you must invoke the scatter method instead of... | true |
b9b721217b87302598c2665416782604f8de974e | Python | linminhtoo/algorithms | /ArraysStrings/easy/canplaceFlowers.py | UTF-8 | 1,445 | 3.53125 | 4 | [
"MIT"
] | permissive | from typing import List
# https://leetcode.com/problems/can-place-flowers/
class Solution_optimized:
def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool:
s = len(flowerbed)
bed = [0] + flowerbed + [0] # trick is to add [0] at both front and back
for i in range(1, s+1):
... | true |
f40e601f9796661fec87416d943e13ad2a00396c | Python | mrparkonline/ics4u_solutions | /10-09-2020/countingSort.py | UTF-8 | 1,167 | 4.21875 | 4 | [
"MIT"
] | permissive | # Counting Sort
'''
Counting Sort Algorithm:
let A be a given list of integers (unsorted);
let D be a dictionary;
let R be a resulting list, set to []
1. Create keys for D from min(A) to max(A) inclusively
2. for each value in A:
if D[value] is null:
D[value] = 1
else:
D[value] +=... | true |
a5a288106a13b2fb4aa453f3dfe89cf366df8fba | Python | fjavidcr/RaspiAlert | /Presencia/otros/25_ultrasonic_ranging.py | UTF-8 | 751 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import RPi.GPIO as GPIO
import time
TRIG = 11
ECHO = 12
def setup():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
def distance():
GPIO.output(TRIG, 0)
time.sleep(0.000002)
GPIO.output(TRIG, 1)
time.sleep(0.00001)
GPIO.output(TRIG, 0)
while GPIO.inp... | true |
91623aaf5a92e8a7490c7b8cab34976999f898cf | Python | felipefadul/aprendizado-de-maquinas-UFRJ | /10_Regressor_Polinomial_Regularizado_Conjunto_Boston/10_Regressor_Polinomial_Regularizado_Conjunto_Boston.py | UTF-8 | 8,630 | 3.484375 | 3 | [
"MIT"
] | permissive | #=============================================================================
# EXPERIMENTO 10 - REGRESSOR LINEAR vs KNN vs POLINOMIAL
# vs REGULARIZAÇÃO - CONJUNTO BOSTON
#=============================================================================
import pandas as pd
import math
from sklearn.model_selection impor... | true |
23302fa6ee5af36eeb9108276d168d495251ec37 | Python | pybel/pybel | /tests/test_parse/test_parse_utils.py | UTF-8 | 2,439 | 2.9375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Tests for parsing utilities."""
import unittest
import networkx as nx
from pybel.utils import subdict_matches
from tests.constants import any_subdict_matches
class TestSubdictMatching(unittest.TestCase):
"""Tests for matching sub-dictionaries."""
def test_dict_matches_1(self):
... | true |
8b86615d34f06e818ff4ef2f694a5ec344adfbdd | Python | scotteverhart/myGitHubRepo | /PythonProjects/src/stringFormatter.py | UTF-8 | 289 | 2.75 | 3 | [] | no_license | """
Created on Feb 22, 2017
@author: cs_everhart
"""
def addTwoHyphensBeforeAndAfter(someText):
return "--"+someText+"--"
def addTwoAsterisksBeforeAndAfter(someText):
return "**"+someText+"**"
def addTwoCaretsBeforeAndAfter(someText):
return "^^"+someText+"^^" | true |
20eab4d0546b645f532af7e64b6ab3d94f978a88 | Python | astrochialinko/StanCode | /SC101/Class_Demo/SC101_week2/robot_starter.py | UTF-8 | 806 | 2.84375 | 3 | [] | no_license | from robot import Robot, Robot2, Robot3
from campy.graphics.gwindow import GWindow
def main():
w = GWindow()
# r1 = Robot(183, 70, color='magenta')
# ball1 = r1.give_me_a_ball(100)
# w.add(ball1, 200, 100)
# r1.self_intro()
# r1.bmi()
# r1.say_hi()
#
# r2 = Robot(160, 45, color='... | true |
8f77a717e7302fa9aae2e3322e89a6ec1529960e | Python | Akshitamvvs/steganographytool | /code/slsb3.py | UTF-8 | 3,679 | 2.90625 | 3 | [] | no_license | from sys import argv
from PIL import Image
import time
import psutil
import os
from cryptography.hazmat.backends import default_backend
from sys import argv
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serializatio... | true |
31f811cccd3fba9b106f169042ebfb7ee86761f6 | Python | quintonweenink/omniglot-classification-and-data-generation | /SiameseNetwork/CNNMain.py | UTF-8 | 5,864 | 2.671875 | 3 | [] | no_license | import time
import CNN
# import Siamese
import torch
import CNNDataPreparation as dp
import torch.nn.functional as F
def train_cnn(cnet, d, epochs, learn_rate):
num_batches = len(d.train_loader)
print("NUM_BATCHES:", num_batches)
loss, optimiser = cnet.module.loss_and_optimiser(learn_rate)
... | true |
f51ae5df6451e849c856ae53ac42f365c492bd51 | Python | Francois-Aubet/UCL_MSc_ML_code | /algorithms/FA.py | UTF-8 | 3,086 | 2.765625 | 3 | [] | no_license | """
This is just a random thing to try and use Factor Analysis (FA) to extract neural paths.
"""
from algorithms.Algorithm import Algorithm
import numpy as np
import sklearn.decomposition
class FA(Algorithm):
""" FA """
algName = "FA"
def __init__(self, dataset, meta_data, bin_times, numb_latents)... | true |
a27cd03d4fe7a51d511977ea9bd8295fa520afcf | Python | prabal01pathak/django_auth | /view/newyear/views.py | UTF-8 | 424 | 2.796875 | 3 | [] | no_license | from django.shortcuts import render
from datetime import datetime
def find_year():
date = datetime.now()
if date.month==1 and date.day==1:
return 'Happy New Year'
else:
return 'Today isn\'t new year'
def isnewyear(request):
year = find_year()
context = {
"year":datetime.... | true |
29070bfbb5dcaaec4cf0e419d6b664b71688371d | Python | hepeng1986/Roc | /Library/Python/cluster.py | UTF-8 | 659 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#主成分分析
#参数为文件名
import sys
import numpy as np
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
file = sys.argv[1]
centers = int(sys.argv[2])
data = np.loadtxt(file, delimiter=",")
#聚类算法
km = KMeans(n_clusters=centers, init='random', random_state=28)
k... | true |
64c81a7f57bcbc923c546b1680e04feca2db20f4 | Python | brenorb/celluloid | /examples/sines.py | UTF-8 | 585 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Sinusoid animation."""
import numpy as np
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
from celluloid import Camera
fig, axes = plt.subplots(2)
camera = Camera(fig)
t = np.linspace(0, 2 * np.pi, 128, endpoint=False)
for i in t:
axes[0].plot(t, np.sin(t + i)... | true |
c665895b269b28265ea49f4cefeb3727097bd7ee | Python | winsonluk/CSE110Project-scraping | /scrapingScripts/auditScraper/scrape_audit.py | UTF-8 | 1,701 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
import re
import sys
from bs4 import BeautifulSoup
def prepend(courses):
prepended = []
department = ''
for course in courses:
number = course.strip()
if course[0:1].isupper() or course[0:1].islower():
index = re.search('\d', course)
if index:... | true |
d4890396e1e2ee337b1b852b79f975d02d6b4235 | Python | edwardtanguay/python4 | /py_strings2.py | UTF-8 | 285 | 3.4375 | 3 | [] | no_license | age = 34
next = 35
fruits = ['apple', 'orange']
message = "James is {} this year and next year will be {}."
print(message.format(age, next))
print(message.upper())
print(message.replace("i", "a"))
print(message.endswith("nnn"))
if 'applex' in fruits:
print('yes')
print(len(fruits)) | true |
8ee21d320c10c4abc80c4368b04595309db7d047 | Python | floatinghotpot/chinafund | /chinafund/utils/datetime.py | UTF-8 | 2,238 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8; py-indent-offset:4 -*-
import os
import datetime as dt
def str_now():
return dt.datetime.now().strftime('%Y:%m:%d %H:%M:%S')
def datetime_today():
now = dt.datetime.now()
return dt.datetime(now.year, now.month, now.day)
def get_file_modify_time(fname):
ts = os.stat(fname).st_mti... | true |
c3845edaa33f4e24b0b35cfb486b6181d35fdf7b | Python | EugeneVC/web_monitor | /configure.py | UTF-8 | 3,163 | 3.15625 | 3 | [] | no_license | import configparser
class Configure:
""" Класс, отвечающий за конфигурационные параметры системы """
def __init__(self, configure_filename):
"""
Инициализация класса
:param configure_filename - путь к конфигурационному файлу
"""
self._config = configparser.Confi... | true |
d761d04bd8bd16f76bcdb3570945de400ce198a9 | Python | mcrivaro/crivbot | /plugins/weather.py | UTF-8 | 1,302 | 2.90625 | 3 | [] | no_license | import requests
import os
import json
WEATHER_ICONS = {
'clear': u'☀️',
'clouds': u'☁️',
'rain': u'🌧️',
'thunderstorm': u'⛈️',
'snow': u'🌨️',
'mist': u'🌫️',
}
class WeatherPlugin():
def __init__(self):
try:
api_key = os.getenv("WEATHER_API_KEY")
except:
... | true |
efa02011c73d89cec0ea0bbbf9999c5999844334 | Python | im-ant/sr-return | /linear/algos/sf_q_learning.py | UTF-8 | 8,115 | 2.53125 | 3 | [] | no_license | # =============================================================================
# Linear successor lambda return agent
#
# Author: Anthony G. Chen
# =============================================================================
import copy
from collections import namedtuple
from typing import List, Tuple
from gym impo... | true |
57e98eac32a1bc7b1f07ebce11556e0405b94c0b | Python | Makova/illuminOS | /util/toolkit.py | UTF-8 | 3,269 | 2.90625 | 3 | [
"CC-BY-3.0",
"MIT"
] | permissive | import time, gc
def log(msg):
# TODO: Heavy to use ticks and concatenate each time. Need to find a better way
print(str(time.ticks_ms()) + " [INFO] " + str(msg))
def scan_wifi():
import network
n = network.WLAN(network.STA_IF)
n.active(True)
return n.scan()
def determine_preferred_wifi(c... | true |
bb0c44ddfedd6439b3858157b9a11722418b1e5c | Python | Sivagnanam99/Python-Assessments- | /2.Arithmetic Error With Except Block.py | UTF-8 | 128 | 3.1875 | 3 | [] | no_license | try:
a=10/0
print(a)
except ArithmeticError:
print("Arithmetic Exception occurs")
else:
print("Success")
| true |
172911a49199ffef3f839206f06c4431daf0b191 | Python | andreagaietto/Learning-Projects | /Python/Small exercises/functions/single_letter_count.py | UTF-8 | 173 | 3.390625 | 3 | [] | no_license | def single_letter_count(word, letter):
letter_count = word.lower().count(letter.lower())
if letter_count == 0:
return 0
else:
return letter_count | true |
79e9423d22d3f07b3e9a0496c606b5d98829baa3 | Python | abouchan01/Music-Player | /pythonMusicPlayer.py | UTF-8 | 3,155 | 3.03125 | 3 | [] | no_license | #BouCo- Bouchan Ramirez Abraham
#Reproductor de música básico con python.
import os
#Va a preguntar en que folder se encuentra la musica que queremos reproducir, por lo tanto
#usamos os, ya que nos permit navegar con el control de usuario y sus datos en la pc.
from tkinter.filedialog import askdirectory
#Preguntar d... | true |
d6040f5f11af4164a5759e78d85e70ceb3ddb818 | Python | scianna2/opengamedata-core | /extractors/LegacyFeature.py | UTF-8 | 1,824 | 2.78125 | 3 | [
"MIT"
] | permissive | ## import standard libraries
import abc
import typing
from typing import Any, Dict, List, Union
# Local imports
from extractors.Feature import Feature
from schemas.Event import Event
## @class Model
# Abstract base class for session-level Wave features.
# Models only have one public function, called Eval.
# The Eva... | true |
92985dcfb91cf39dbd485261069339b9d486b5de | Python | aanara/GWC_Python | /hello.py | UTF-8 | 332 | 4.40625 | 4 | [] | no_license | # My GWC Hello World Program
# Setting up variables
name = ""
age = 0
count = 0
# get input
name = input("What is your name? ")
age = input("How old are you? ")
# display output
print("Hello " + name)
print("You are " + str(age) + " years old")
#count from 1 to 5
for count in range(5):
print(co... | true |
f167521252450e2162ef7d9702ac201d7e560296 | Python | afzalraza92/program | /pro44.py | UTF-8 | 449 | 4 | 4 | [] | no_license | """Sum of 2 elements of array whose sum is equal to a given value x.
If there exist 2 pair such that their sum is equal to the value x print yes else print no."""
x = [5,3,1,9,2,6,10,18,4,3]
y = 10
sum=0
low = 0
high = len(x)-1
x.sort()
print(x)
for i in range(len(x)):
sum = x[low] + x[high]
if(sum == y):
... | true |
092e717115769b6a8b2f9e5bb711ac50e6ece4ac | Python | dylngg/weekly-programs | /week07/backupZip.py | UTF-8 | 1,139 | 3.375 | 3 | [] | no_license | import zipfile
import os
def backupZipDir():
directory = str(input('What directory do you want to look for folders to zip up?'))
zipFilename = str(input('What do you want to name the zip file?'))
if '.zip' not in zipFilename:
zipFilename = zipFilename + '.zip'
zipDestination = str(input('Where do you want th... | true |
3037c16e99b013601e9be9ca2474902fa413b5d1 | Python | YohannesGetachew/Competitive-Programming | /climbing_the_leaderboard.py | UTF-8 | 349 | 3.171875 | 3 | [] | no_license | def climbingLeaderboard(ranked, player):
ranked = list(dict.fromkeys(ranked))
ranked.sort(reverse=True)
results = []
for score in player:
while len(ranked) != 0 and score >= ranked[-1]:
ranked.pop()
results.append(len(ranked)+1)
return results
print(climbingLeaderboard(... | true |
5c5f068fab2eb9e0cc8a1d9a15a092dff761f04c | Python | rogema/tsg_toolbox | /bin/compute_tracer_gradients.py | UTF-8 | 3,709 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# Useful python module
import os
import glob
import sys
import xarray as xr
from mpi4py import MPI
import tsg
# Define the parser for input parameters
import argparse
description = ("Compute horizontal gradients of temperature, salinity "
"and buoyancy on different in situ dataset... | true |
9680ee6dbfb31ff982d67e3514a634e0f24643a5 | Python | achillesheel02/image-processing-techniques | /imutils.py | UTF-8 | 335 | 2.78125 | 3 | [] | no_license | import numpy as np
import cv2
def translate(image,x,y):
M=np.float32([[1,0,x],[0,1,y]])
shifted=cv2.warpAffine(image,M,(image.shape[1],image.shape[0]))
return shifted
def rotate(image, anchor,degree,scale,w,h):
M=cv2.getRotationMatrix2D(anchor,degree,scale)
rotated=cv2.warpAffine(image,M,(w,h))
... | true |
92da82c97c28ffe09e4b8db7df511c383c8844bf | Python | hovell722/engineering-54-python-basics | /109_if_function.py | UTF-8 | 583 | 4.1875 | 4 | [] | no_license | # If Functions
# Syntax
# if <condition>:
# block of code that runs if condition return True
# elif <condition>:
# block of code that runs if condition return True
# else:
# block of code that runs when ALL other conditions are False
# Notes:
# if functions will exit once a condition becomes true
# buil... | true |
e4fb0f99303a7899e09f00fce91cd63c7156447b | Python | pazz/egsolver | /egsolver/generators.py | UTF-8 | 1,759 | 3.234375 | 3 | [] | no_license | # Copyright (C) 2017 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
import random
import networkx as nx
from .games import EnergyGame
def random_energy_game(n, d, o, maxeffect, mineffect=None, nosinks=False):
"""
generates a random energy g... | true |
97272b9271068c990b95132daae7da4197fdac95 | Python | JoshyJosh/django_bootstrap3_datetimepicker | /calendar_events/models.py | UTF-8 | 988 | 2.765625 | 3 | [] | no_license | # ruthlessly modified from http://stackoverflow.com/questions/27697939/create-unique-slug-django
from django.db import models
from django.utils.text import slugify
import re
# Create your models here.
class Event(models.Model):
content = models.TextField(max_length=400, blank=True)
title = models.CharField(max_len... | true |
fcc8e7cea46456ab167cef90603c154990401d7e | Python | lachgil/Barcode-Stock-Tracker | /app.py | UTF-8 | 1,070 | 2.875 | 3 | [] | no_license | import csv
import datetime
from collections import OrderedDict
import os
from smtp import send
def write(input):
w = open('transactions.csv', 'ab')
w = csv.DictWriter(w, fieldnames=input.keys(),delimiter=',')
w.writerow(input)
send(input)
return "Transaction Complete"
while True:
try:
input = OrderedDict()... | true |
4f578e7b4a61930d5d380f27d8bc2bf9b0d355fa | Python | Oliver-sn/BP | /BP_NN.py | UTF-8 | 1,582 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
"""
@Project Name : BP
@File : BP_NN.py
@Contact : s1142233286@163.com
@License : (C)Copyright 2018-2019
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2019/6/25 10:01 sunan 1.0 ... | true |
d11c9224ec132bce51bc24be3876b991cb18a300 | Python | thibaultbl/feature_engine | /feature_engine/imputation/base_imputer.py | UTF-8 | 2,448 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted
from feature_engine.dataframe_checks import (
_check_input_matches_training_df,
_is_dataframe,
)
from feature_engine.validation import _return_tags
class BaseImputer(BaseEstimator... | true |
3491273438124c27d747aa8bf01fc12e96fc0467 | Python | simonzheng/simonlucas-tweet-weather-classifier | /multinomialNBclassify.py | UTF-8 | 4,072 | 2.53125 | 3 | [] | no_license | import os
import sys
from feature_extraction import dataloader
#load the raw train csv file into the loader
loader = dataloader.DataLoader('data/train.csv')
import evaluation
def load_raw_tweets_from_file(filename):
tweetsToBeTagged = []
f = open(filename)
tweetsToBeTagged = f.readlines()
f.close()
return tweets... | true |
4790aa7c24d2b5320204d3dc7f7c4a0b8432eb13 | Python | HBinhCT/Q-project | /hackerearth/Basic Programming/Implementation/Basics of Implementation/Odd divisors/test.py | UTF-8 | 709 | 2.578125 | 3 | [
"MIT"
] | permissive | import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'5',
'1 100',
'110 30',
'12345 100000007',
'10 28383',
'100 5',
])
def test_case_0(self, i... | true |
8894c98842448614e33c69c75cdb54c0b4b4a2e6 | Python | github/codeql | /python/ql/test/library-tests/ControlFlow/except/test.py | UTF-8 | 1,251 | 3 | 3 | [
"MIT",
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-other-copyleft",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Python-2.0"
] | permissive | #Ensure there is an exceptional edge from the following case
def f2():
b, d = Base, Derived
try:
class MyNewClass(b, d):
pass
except:
e2
def f3():
sequence_of_four = a_global
try:
a, b, c = sequence_of_four
except:
e3
#Always treat locals as no... | true |