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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9adc031e20bf1a9be7b40195f08129f248aa5742 | Python | daniellowtw/MentalMaths | /Game.py | UTF-8 | 4,672 | 3.5 | 4 | [
"MIT"
] | permissive | __author__ = 'Daniel'
from random import randint, randrange
from question import *
from time import clock
from UserData import *
class UnknownCommandException(Exception):
def __init__(self, msg):
self._msg = msg
class NoQuestionException(Exception):
pass
class Game:
"""
Represents a game ... | true |
8b8ae57a034259d2a251b1002fb0c7021b77a58a | Python | MatheusRocha0/Web-Scraper | /scraper.py | UTF-8 | 1,582 | 3.0625 | 3 | [] | no_license | from time import sleep
from bs4 import BeautifulSoup as bs
import requests
import pandas as pd
import sqlite3
conn = sqlite3.connect("books.db")
# Creating books table if not exists
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS books(
title TEXT,
price INTEGER,
rating INTEGER
)""")
conn.commi... | true |
222cfb4f4ee0ecbbda310983aa089646e601133a | Python | niolabs/nio | /nio/modules/scheduler/job.py | UTF-8 | 960 | 2.90625 | 3 | [] | no_license | from nio.modules.proxy import ModuleProxy
class Job(ModuleProxy):
"""A scheduled job in the scheduler module """
def __init__(self, target, delta, repeatable, *args, **kwargs):
""" Create a new job instance.
Args:
target (callable): The task to be scheduled.
delta (t... | true |
06e4686672af5bdb4ec7cb38f7a7d80d5dec8c61 | Python | laurelmachak/pythonProjects | /clockFace.py | UTF-8 | 418 | 3.921875 | 4 | [] | no_license | #determine angle by which the minute hand turned since the start of the current hour
# 360/60 = 6
#input is degrees hour hand turned since midnight
hourHandDegrees = int(input("degrees hour hand turned since midnight: "))
hours = hourHandDegrees//30
print("hour", hours)
minutes = (hourHandDegrees%30)*2
print("minu... | true |
5a8bca72ec0018cbcc31460aa20f048fd4975c68 | Python | Hum4n01d/qt-todos | /TodosListModel.py | UTF-8 | 5,286 | 2.890625 | 3 | [] | no_license | from PySide2 import QtCore
from TodosViewModel import TodosViewModel
class TodosListModel(QtCore.QAbstractListModel):
NAME_ROLE = QtCore.Qt.UserRole # UserRole means custom role which means custom object key in JS
IS_CHECKED_ROLE = QtCore.Qt.UserRole + 1 # Add one because it needs a unique enum value
def __ini... | true |
9083433b3a69044491f6bda4bfb0780bcaf5f953 | Python | ice-stuff/ice | /ice/registry/server/validation.py | UTF-8 | 1,282 | 2.59375 | 3 | [
"MIT"
] | permissive | import re
from cerberus.errors import ERROR_BAD_TYPE
from eve.io import mongo
class MyValidator(mongo.Validator):
def __init__(self, *args, **kwargs):
super(MyValidator, self).__init__(*args, **kwargs)
# RegExs
self._ip_re = None
def _validate_type_ip(self, field, value):
""... | true |
b0ac4a04686f2d8a49b00a64f7ef4d5728ee22ac | Python | jadenpadua/Foundation | /arrays/median-of-two-sorted-arrays.py | UTF-8 | 1,259 | 3.3125 | 3 | [] | no_license | class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
if len(nums1) > len(nums2):
return self.findMedianSortedArrays(nums2, nums1)
x = len(nums1)
y = len(nums2)
low = 0
high = x
while low ... | true |
2de020abbcff78b4245caa56f652706bda884575 | Python | Niewenqiang/sword_to_offer | /deleteDuplication.py | UTF-8 | 2,287 | 4.375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# 删除链表中重复的结点
# 在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 例如,链表1->2->3->3->4->4->5 处理后为 1->2->5。
# 1、思路
#
# 删除重复结点,只需要记录当前结点前的最晚访问过的不重复结点pPre、当前结点pCur、指向当前结点后面的结点pNext的三个指针即可。
# 如果当前节点和它后面的几个结点数值相同,那么这些结点都要被剔除,然后更新pPre和pCur;如果不相同,则直接更新pPre和pCur。
#
# 需要考虑的是,如果第一个结点是重复结点我们该怎么办?这里我们分别处理一下就好... | true |
cb2c5b5fa316dea415ce91637eaba0be841dce05 | Python | xyt556/urban_growth_framework | /code/autotuning/classification_example_python.py | UTF-8 | 5,014 | 3.234375 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Description: This is a script that shows how to use the library machine_learning_library.py
and apply it to the input data stored in a .csv file.
Author: Dr. Jairo Alejandro Gómez Escobar and Mr. Santiago Passos.
Last updated on: 4th June 2019... | true |
9c181540f30d3cbe13ef776fa2e7b2124b61d6c4 | Python | iecheverria/random_scripts | /remove_loops.py | UTF-8 | 3,393 | 2.65625 | 3 | [] | no_license | # Eliminate only loops longer than X
from Bio import PDB
from Bio.PDB.DSSP import *
from sys import exit
import numpy as np
import argparse
# DSSP codes
# H = alpha-helix
# B = residue in isolated beta-bridge
# E = extended strand, participates in beta ladder
# G = 3-helix (310 helix)
# I = 5 helix (pi-helix)
# T = h... | true |
51eacd15ad36fe522f25feb9665f114e61358b93 | Python | alonkol/MusicTrends | /DBPopulation/population.py | UTF-8 | 5,177 | 2.609375 | 3 | [] | no_license | import json
from DataAPIs.LastFM.retreive_data_from_last_fm import SONGS_FILE, ARTISTS_FILE
from DataAPIs.MusixMatch.lyrics_collector import LYRICS_FILE
from DataAPIs.Youtube.DataEnrichment import populate_videos
from DBPopulation.insert_queries import insert_into_lyrics_table, insert_into_words_per_song_table, \
... | true |
e3bde69d9a5a2b5a1ec11916efceb25e7b792d1c | Python | Swaroo/TWO | /download-images.py | UTF-8 | 150 | 2.8125 | 3 | [] | no_license | import urllib.request
for x in range(100):
print(str(x))
urllib.request.urlretrieve("https://picsum.photos/100", "random" + str(x) + ".jpg")
| true |
a76152de761b6d60eda789d44c23a5ddfa8544be | Python | Eric-Wonbin-Sang/CS110Manager | /check_dir/kamalaaron/Cs110 final project copy-1.py | UTF-8 | 4,069 | 3.3125 | 3 | [] | no_license | # Aaron Kamal
# I pledge my honor that I have abided by the stevens honor system
# This code will indicate the best buy and sell times of a stock based on a MACD, technical levels, and moving averages
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import mplfinance as mpf
import matplotlib.dates... | true |
078d27169d96c08bccca32471bfc87c948d33987 | Python | hoon4233/Algo-study | /2021_spring/2021_05_20/11497_JJ.py | UTF-8 | 493 | 2.9375 | 3 | [] | no_license | import sys
from collections import deque
input = sys.stdin.readline
T = int(input())
for _ in range(T):
n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
dq = deque([])
flag = True
for i in range(n):
if flag:
dq.append(l[i])
else :
dq.a... | true |
13e5f5265a8da275619ca616bdab7588a865bd38 | Python | geoffder/learning | /LP_deep_learning_2/theano2.py | UTF-8 | 2,493 | 2.734375 | 3 | [] | no_license | import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
from LP_util import get_normalized_data, y2indicator
def error_rate(p, t):
return np.mean(p != t)
def main():
Xtrain, Xtest, Ttrain, Ttest = get_normalized_data()
Ttrain, Ttest = y2indicator(Ttrain), y2indicator(T... | true |
b363a027050d69b1b36e5abff63b88b7425b48d6 | Python | Metropass/URLAutomationMachine | /urlClass.py | UTF-8 | 1,599 | 3.4375 | 3 | [
"MIT"
] | permissive | import urllib3
import re
from colorama import Fore
# Class urlAutomationMachine
# Defines a urlAutomationMachine object which initiates the request in order to determine the status
# code of the url. If a file is passed, a regex will be processed on all lines in the file in order
# to pull out the urls and for each ur... | true |
60072ed24116b19d863df94d87b6215fb390d876 | Python | andreas-bauer/advent-of-code-2020 | /day_6/main.py | UTF-8 | 709 | 3.25 | 3 | [
"MIT"
] | permissive | groups = []
for line in open('input.txt', 'r').read().split('\n\n'):
answers = line.split('\n')
groups.append(answers)
# Part 1
yes_in_group = []
for group in groups:
yes_answ = set()
for answers in group:
for a in answers:
yes_answ.add(a)
yes_in_group.append(len(yes_answ))
pri... | true |
8351d7b0d2d8978846ef976040ba779edb78cf90 | Python | guozhenjiang/Python | /PyQt5_LiNing/src/controls/p027_IconForm.py | UTF-8 | 1,262 | 3 | 3 | [] | no_license | import sys # 获取系统参数
from PyQt5.QtWidgets import QMainWindow, QApplication # GUI 程序必须的
from PyQt5.QtGui import QIcon # 添加图标需要
'''
窗口的 setWindowIcon 方法用于设置窗口的图标,只在 Windows 中可用
QApplication 中的 setWindowIcon 方法用于设置主窗口的图标和应用程序图标,但调用了窗口的 setWindowIcon ... | true |
a11b91f2be5e37ee92f66cafbaf5422fea2f5c9a | Python | ZJ-CuteBear007/Data-Engine-2021 | /L4/L4_task_transaction.py | UTF-8 | 2,060 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 7 20:57:52 2021
@author: ZhangJian
"""
import pandas as pd
def main():
raw_data = pd.read_csv('./Market_Basket_Optimisation.csv', header = None)
transactions=CleanData(raw_data)
#Correlation_Analysis1(transactions)#Correlation_Analysis1:利用effici... | true |
690482656790e53a34fe7010644c2aef25fffbff | Python | sleepingfox/zym2018 | /day9/test.py | UTF-8 | 872 | 2.640625 | 3 | [] | no_license | __author__ = 'Administrator'
# -*- coding: utf-8 -*-
# from socket import *
#
# server = socket(AF_INET,SOCK_DGRAM)
# server.bind(("127.0.0.1",8081))
#
# while True:
# data,client_addr = server.recvfrom(1024)
# print(data,client_addr)
# server.sendto(data.upper(),client_addr)
# dic1 = {
#
# }
#
#
#
# di... | true |
bc80c369626f68d837590f1dd5273e8cee9a15cc | Python | rawsumi/senko-disc-bot | /senko/converters/primitives.py | UTF-8 | 5,773 | 3.015625 | 3 | [] | no_license | from babel.core import UnknownLocaleError
from babel.numbers import NumberFormatError, parse_decimal, parse_number
from discord.ext import commands
from .utils import clean
__all__ = ("Int", "Float", "Bool")
class Int(commands.Converter):
"""
Converts to :class:`int`.
Parameters
----------
min... | true |
aa6762546b3fef27979b3ccce9d42e16f508c771 | Python | becrevex/AICScripts | /console.py | UTF-8 | 904 | 3 | 3 | [] | no_license | #Programmer: Brent Chambers
#Date: 11/13/2018
#filename: console.py
#Description: Interactive console that allows C&P data entry to perform operations on
# hosts or IP's that have been entered into the system.
import string, os
from sets import Set
import sys
def remove_dupes(jaja):
uniqueList = Set(jaja)
re... | true |
6b14be0c6bd4e8e11d99ab3a82f4aae470ad83c7 | Python | peacount/AutomatetheBoringStuff | /42. Reading Excel Spreadsheets.py | UTF-8 | 562 | 3.515625 | 4 | [] | no_license | import openpyxl
workbook = openpyxl.load_workbook('example.xlsx')
print(type(workbook))
# sheet = workbook.get_sheet_by_name('Sheet1') ... decipricated function
sheet = workbook['Sheet1']
print(type(sheet))
# sheet = workbook.get_sheet_names() # decipricated function
# print(sheet)
cell = sheet['A1']
print(cell.va... | true |
7bf564c56098bc607af70bca0c918c430d90e8e2 | Python | orpembery/thesis | /petsc-tolerances.py | UTF-8 | 606 | 2.65625 | 3 | [] | no_license | # I found out how to use the petsc4py commands by taking some of this from https://github.com/firedrakeproject/petsc4py/blob/16675da20ac64ed690db3633850f2573f54d0d8a/test/test_ksp.py
from petsc4py import PETSc
ksp = PETSc.KSP()
ksp.create(PETSc.COMM_SELF)
# I know what the labels are from https://www.mcs.anl.gov/petsc... | true |
4179dad335005c89d97f9adcc438bd4d8170d9f3 | Python | avl-harshitha/HackerRankSolutions | /staircase/staircase.py | UTF-8 | 708 | 3.03125 | 3 | [] | no_license |
#!/bin/python3
import math
import os
import random
import re
import sys
def no_of_steps(i, memo):
if i < 0:
return 0
if i <= 2:
return i
if i == 3:
return 4
if memo[i - 1] == 0:
memo[i - 1] = no_of_steps(i - 3, memo) + no_of_steps(i - 2, memo) + no_of_steps(i - 1, memo... | true |
8a158622f2f20f7ad0bc308839190945a7efafa5 | Python | YuMurata/trainer-notebook | /window/compare/compare_frame.py | UTF-8 | 5,440 | 2.8125 | 3 | [] | no_license | from exception import IllegalInitializeException
from typing import Callable, List, NamedTuple
import tkinter as tk
from tkinter import ttk
from logger import CustomLogger
from window.image import ImageStruct, ImageStructDict
logger = CustomLogger(__name__)
class StatusFunc(NamedTuple):
change: Callable[[ImageSt... | true |
cd20b391e1578c0caf50047873499589157e4933 | Python | aryabartar/learning | /interview/array/StringCompression.py | UTF-8 | 713 | 3.640625 | 4 | [] | no_license | from nose.tools import assert_equal
def compress(string):
new_str = ""
last_char = None
last_char_count = 0
for c in string:
if c != last_char:
if last_char is not None:
new_str = new_str + last_char
new_str = new_str + str(last_char_count)
... | true |
53b52e32c34a90a79b756b00ff3c6a08103bff98 | Python | daveoncode/python-string-utils | /tests/test_uuid.py | UTF-8 | 412 | 2.765625 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from string_utils import is_uuid
from string_utils.generation import uuid
class UUIDTestCase(TestCase):
def test_generates_uuid_string(self):
uid = uuid()
self.assertIsInstance(uid, str)
self.assertTrue(is_uuid(uid))
def test_as_hex(self):
uid =... | true |
14aa5e941cd3aedfb807822ba2cbea9ee3989711 | Python | LarisaSam/python_lesson2 | /homework2.py | UTF-8 | 524 | 3.828125 | 4 | [] | no_license | my_list = []
n = int(input("Введите количество элементов списка"))
for i in range(0, n):
elements = int(input("Введите элемент списка, после ввода каждого элемента - enter"))
my_list.append(elements)
print(my_list)
j = 0
for i in range(int(len(my_list)/2)):
my_list[j], my_list[j + 1] = my_list[j + 1],... | true |
adaed9a7c939125f2e4c5db2f42047bf47f32611 | Python | benabernathy/fitds | /fitds/smoothing.py | UTF-8 | 337 | 2.78125 | 3 | [] | no_license | def smooth(data, column, window_span=25):
ma = data[column].rolling(window=window_span, min_periods=window_span).mean()[:window_span]
rest = data[column][window_span:]
smoothed_df = pd.concat([sma, rest]).ewm(span=window_span, adjust=False).mean()
smoothed_df = smoothed_df.fillna(value=0.0)
return s... | true |
6d5aed5b4a644b0532df41ed58b59f72bb23597b | Python | gmagno/nano3d | /example/example1/main.py | UTF-8 | 4,272 | 2.625 | 3 | [] | no_license |
import gc
import time
import nanogui as ng
import numpy as np
from example.example1.gui import MainScreen
from nano3d.camera import CameraOrtho, CameraPerspective
from nano3d.mesh import Axes, CubeWired, Grid
from nano3d.renderer import RendererManager
from nano3d.scene import CameraFPSNode, CameraNode, Node, Scene,... | true |
20cd319d7cb94d5604532b9f544a9d9b4bd2e2f7 | Python | standag/kiwi_python_weekend | /03_debugging_and_testing/format.py | UTF-8 | 588 | 3.234375 | 3 | [] | no_license | from __future__ import print_function
import sys, os, time
greetings = 'Hello'
name="Standa"
print("{greetings} {name}!".format( greetings=greetings,name = name ))
class Example:
def __init__(self):
self.variable='kiwi'
self.something_really_long_name_for_variables = "something"
def test(self):... | true |
0f4bacca12ef61f64c4f33ff43ea0fb8a1754484 | Python | ramonhuber/TinyIPFIX-for-ESP32 | /subscriber_print.py | UTF-8 | 590 | 2.6875 | 3 | [] | no_license | import zmq
class Subscriber_Print:
def __init__(self, topicfilters):
self.port = "5556"
self.context = zmq.Context()
self.socket = self.context.socket(zmq.SUB)
for topic in topicfilters:
self.socket.setsockopt(zmq.SUBSCRIBE, bytes([topic]))
self.so... | true |
0106cc762dfa15dce0a3143d1cdee9c1d1b93659 | Python | zhangyq-98/mapmatching | /mapmatching.py | UTF-8 | 17,126 | 3.0625 | 3 | [
"MIT"
] | permissive | import math
import gc
import time
import numpy as np
from scipy.sparse import csr_matrix, csc_matrix
import networkx as nx
from geopy.point import Point
from geopy.distance import great_circle as distance
def mapmatch(points, times, graph):
"""Matches a series of gps points to defined trail segments.
Args:
... | true |
1cbadaf2d7b9885b0046f989f918ac05b67b0506 | Python | kylelong/weeklyProblems | /isFactorial.py | UTF-8 | 476 | 3.921875 | 4 | [] | no_license | '''
Cassido's interview question of the week - 1/20/2020
Given a number, return true if the input is a factorial of any natural number.
'''
import math
def isFactorial(n):
result = 1
for i in range(1, int(math.ceil(math.sqrt(n))) + 1):
result = i * result
if result == n:
return True
return False
print(isFacto... | true |
4f876cd837a57a0f1faad0c9c1c60b1d435ad3a0 | Python | aleksei-stsigartsov/Old-Beginnings-In-Programming | /two_dimensional_js/python/task3.py | UTF-8 | 436 | 3 | 3 | [] | no_license | import os
import readFrom
arr= readFrom.fromfileToArr('input.txt')
summa= 0
proiz= 1
file= open('task3.txt', 'w', encoding='utf-8')
i= 0
while i<len(arr):
j= 0
while j<len(arr[i]):
if arr[i][j] % 3==0 or arr[i][j] % 5==0:
summa+= arr[i][j]
proiz*= arr[i][j]
j+= 1
i+= ... | true |
955693a797461659512533e18f569a5bc0a54158 | Python | EasternJournalist/pi-GAN | /nerf.py | UTF-8 | 5,989 | 2.53125 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn.functional as F
def sample_cam_poses(std_yaw, std_pitch, num:int) -> torch.Tensor:
'return list of 4x4 matrices'
cam2world = []
for i in range(num):
yaw = torch.randn(1) * std_yaw
pitch = torch.randn(1) * std_pitch
r = 1.
cam2world.append(torch.t... | true |
bd2aedec00ce6425e260bfeb9757849cb9d775a8 | Python | kfinn/elizabeth-pipeline | /models/z_sliced_image.py | UTF-8 | 647 | 2.53125 | 3 | [] | no_license | import numpy
import skimage.io
from models.image_filename import ImageFilename
class ZSlicedImage:
def __init__(self, path, source):
self.path = path
self.source_dir = source
@property
def image(self):
if not hasattr(self, "_image"):
raw_image = skimage.io.imread(self.path)
if len(raw_... | true |
435f0bf6fff797cdc706c3cff7d0492728948798 | Python | wilsonwong2014/MyDL | /Tensorflow/labs/keras-yolo3-master/yolo_comput_mAP.py | UTF-8 | 15,470 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
import pdb
pdb.set_trace()
import xml.etree.E... | true |
3af81cffaebe8e8a92c977c8cef11bf4f229e595 | Python | aot9/bashdb-gui | /Debug.py | UTF-8 | 3,308 | 2.703125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
import pexpect
import re
class BashDb():
def __init__(self, args):
self.appOut = None
self.curCodeLine = None
self.prevCmd = None
self.breakList = {}
self.watchList = {}
self.curSourceFile = args[0]
self.child ... | true |
794dd113b71ce92cb01f244463b48418b508f4f4 | Python | negativedsd/Negative-Densest-Subgraph-Discovery | /risk_averse/peel_risk_averse.py | UTF-8 | 14,054 | 2.890625 | 3 | [] | no_license | from lib.fibheap import FibonacciHeap
from lib.SimpleNode import SimpleNode
import json, sys, os
def peeling(node_dict, total_C_degree, total_positive_degree, fib_heap, q, B, C, lambda1, lambda2,
max_subgraph_output_size=1000):
n = node_dict.__len__()
C_average_degree = float(total_C_degree) / n
... | true |
80a78ba020bf3c065c7c2badc806bdf0791aabef | Python | kchodorow/blook | /filters/siat.py | UTF-8 | 3,892 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from filters.base import BaseEntry, BaseListing, NotFoundError
import re
PREVIOUS_RE = re.compile('Previous ')
OLDER_RE = re.compile('Older ')
CONTINUE_RE = re.compile('continue reading')
NEXT_RE = re.compile('Next ')
class SiatEntry(BaseEntry):
def applies(self, soup):
return soup.find(class_='post')
def e... | true |
a1a15c8698a4e426e6d63fbf4ad510983d65eca9 | Python | ankurjain8448/leetcode | /assign_cookies.py | UTF-8 | 433 | 3 | 3 | [] | no_license | class Solution(object):
def findContentChildren(self, g, s):
"""
:type g: List[int]
:type s: List[int]
:rtype: int
"""
g = sorted(g)
s = sorted(s)
g_max = len(g)
g_index = 0
for i in xrange(len(s)):
if s[i] >= g[g_index]:
... | true |
48b5797f781f507a26391c55a383e16060c652f5 | Python | I-sudo-svg/learning-flask-wc-tph | /app.py | UTF-8 | 2,178 | 2.765625 | 3 | [] | no_license | from flask import Flask, render_template, request, session, redirect
import sqlite3
from sqlite3 import Error
DB_NAME = "smile.db"
app = Flask(__name__)
def create_connection(db_file):
"""create a connection to the sqlite db"""
try:
connection = sqlite3.connect(db_file)
# initialise_tables(c... | true |
b348a49c96eb808740013f767e8cdcbcc2c29eda | Python | DeSerg/regional | /scripts/json_to_csv.py | UTF-8 | 1,206 | 2.84375 | 3 | [] | no_license | # -*- coding: utf8 -*-
import sys
import json
import pandas as pd
header = ["Регион", "Тексты", "Авторы", "Слова", "Длинные тексты", "Авторы длинных текстов",
"Слова в длинных текстах", "Первые тексты", "Авторы первых текстов",
"Слова в первых текстах"]
keys = ["texts", "authors", "words", "long_te... | true |
2d7c7a182da252c7ace81b792290ddc36b3b6447 | Python | HuXuzhe/algorithm008-class02 | /Week_03/236.二叉树的最近公共祖先.py | UTF-8 | 985 | 2.90625 | 3 | [] | no_license | '''
@Descripttion:
@version: 3.X
@Author: hu_xz
@Date: 2020-05-06 14:27:39
@LastEditors: hu_xz
@LastEditTime: 2020-05-08 11:52:57
'''
#
# @lc app=leetcode.cn id=236 lang=python
#
# [236] 二叉树的最近公共祖先
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# ... | true |
01eed7ce6a95c98558e4676b5ccb6acf4b8dfba9 | Python | Sayakhatova/TSIS-1- | /TSIS_10/b.py | UTF-8 | 393 | 2.53125 | 3 | [] | no_license | #create a table
import psycopg2
conn=psycopg2.connect(
database='mydb',
user='postgres',
password='1535',
host='localhost',
port='5432'
)
cur=conn.cursor()
cur.execute(
"""
CREATE TABLE COMPANY(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS... | true |
181974ecf83ef150fc95787b16e4675450aa18e6 | Python | patell11/DataStructuresAndAlgorithms_SanDiego | /Practice/gradient_descent.py | UTF-8 | 892 | 3.21875 | 3 | [] | no_license | import numpy as np
def gradeintDescent(x,y):
m_curr = b_curr = 0
iterations = 1000
n = len(x)
learning_rate = 0.01
for i in range(iterations):
y_predicted = m_curr * x + b_curr
#print("y_predicted {}".format(y_predicted))
cost = (1.0/n) * sum([val**2 for val in (y-y_predict... | true |
ba6638c4f3e3aaf85815e413a2e7774caea1f74c | Python | veronicarose27/set5 | /natural.py | UTF-8 | 71 | 3.125 | 3 | [] | no_license | nt=int(input())
sum=0
for j in range(1,nt+1):
sum=sum+j
print(sum)
| true |
53ad470365af4da0d3f174c2a33d20f4e2add83f | Python | tk1223108078/bookdoubanspider | /mydouban/dbaccbook.py | UTF-8 | 2,231 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import dbacc
import MySQLdb
import logging
DB_NAME = 'spider'
TABLE_NAME = 'book'
# 创建数据库连接
db = dbacc.DbAcc('127.0.0.1', 'root', 'kaige.19930730', None, 3306)
db.dbconnect()
def dbaccbook_initdb():
result = False
# 数据库不存在就创建
sql = 'create database if not exists %s' % DB_NAME
... | true |
f71040200a545af631de99093f4f9ccf3428107c | Python | milestonesvn/parameter_prediction | /parameter_prediction/dictionaries/explicit.py | UTF-8 | 1,191 | 3.4375 | 3 | [
"MIT"
] | permissive |
"""
Dictionaries are (either implicitly or explicitly) a matrix where the rows are
dictionary atoms.
All dictionaries must implement the following interface:
@property input_dim:
the dimension of each atom
@property size:
the number of atoms in the dictionary
get_subdictionary(indices):
indices is a seq... | true |
e5b6d03b5873d26e8f237334298cd92a618c44d7 | Python | DanielNagy97/szakdolgozat | /program/arpt/symbol.py | UTF-8 | 3,725 | 2.9375 | 3 | [] | no_license | import cv2
import pickle
import numpy as np
from datetime import datetime
import os
from arpt.canvas import Canvas
class Symbol(object):
"""
Symbol Recognition class
"""
def __init__(self, shape):
"""
Initalize the Symbol function
"""
self.shape = tuple([shape[1], shape... | true |
f08a34fafc7891336d4bc114d5f84dac16d85130 | Python | gakhromov/Python-Testing | /utils.py | UTF-8 | 254 | 3.796875 | 4 | [] | no_license | def round_point_array(point_array, ndigits=2):
new_point_array = []
for point in point_array:
el0 = round(point[0], ndigits)
el1 = round(point[1], ndigits)
new_point_array.append((el0, el1))
return new_point_array | true |
7c6e645ade32981d60b11357d5bb04dd9c5550d1 | Python | ssummun54/wofford_cosc_projects | /350 Projects/Project 3/cosc350.py | UTF-8 | 990 | 4.3125 | 4 | [] | no_license | class Queue:
"""
A queue is a container that organizes data
using a first-in, first-out discipline
"""
def __init__(self):
"""
Initialize a new queue to be empty
"""
self.items = []
def is_empty(self):
"""
Determine whether this queue is empty
... | true |
f42efcff09ceb811a2dc8ad7042285cd10bb6715 | Python | daxingyou/mjclient | /tools/pythoncode/xlrd-1.0.0.tar/xlrd-1.0.0/tests/test_xlsx_comments.py | UTF-8 | 1,965 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | from unittest import TestCase
import os
from xlrd import open_workbook
from .base import from_this_dir
class TestXlsxComments(TestCase):
def test_excel_comments(self):
book = open_workbook(from_this_dir('test_comments_excel.xlsx'))
sheet = book.sheet_by_index(0)
note_map ... | true |
e068ce1e6a91a6e8ccfed3fe8e79117de0c671ac | Python | Toxic5698/projekty-Python | /projekt3.py | UTF-8 | 5,605 | 3.453125 | 3 | [] | no_license | # Projekt 3 - election scraper
import requests
import sys
from bs4 import BeautifulSoup as bs
import csv
# hlavni funkce
def hlavni() -> None:
# ziskani odkazu
odpoved = vytvor_pozadavek(url)
print("ziskavam data...")
parsered = zpracuj_pozadavek(odpoved.text)
odkazy = vypis_odkazu(parsered)
... | true |
dcfd107cc547735a41f2815f6e7c58680055ef5f | Python | ruby2015/MyPython | /unit 16/tsTserv.py | UTF-8 | 516 | 2.671875 | 3 | [] | no_license | from socket import *
from time import ctime
HOST = ''
PORT = 21567
BUFSIZE = 1024
ADDR = (HOST,PORT)
tcpSerSocket = socket(AF_INET,SOCK_STREAM)
tcpSerSocket.bind(ADDR)
tcpSerSocket.listen(5)
while True:
print 'waiting for connection...'
tcpCliSock,addr = tcpSerSocket.accept()
print '...connected from:',a... | true |
e41778341363652732f6a6d964cd049c474f6c96 | Python | jackdewinter/pymarkdown | /test/paragraph_series/test_markdown_paragraph_series_m_tb.py | UTF-8 | 19,738 | 2.90625 | 3 | [
"MIT"
] | permissive | """
https://github.github.com/gfm/#paragraph
"""
from test.utils import act_and_assert
import pytest
@pytest.mark.gfm
def test_paragraph_series_m_tb_ol_nl_tb():
"""
Test case: Ordered list newline thematic break
was: test_list_blocks_256fx
"""
# Arrange
source_markdown = """1.
---
""... | true |
ce4fd55af5a0bb2cdbe57f2a18deade9df9525c5 | Python | mfandre/VectorSpaceModel | /GPlus.py | UTF-8 | 934 | 2.921875 | 3 | [] | no_license | __author__ = 'aferraz'
import json, requests, re
class GPlus:
url = "https://www.googleapis.com/plus/v1/activities"
key = "AIzaSyCAAzF35cGixGPpcoc6xwIttI9HaFff07M"
def __init__(self, key):
self.key = key
def __init__(self):
pass
def getActivities(self, query):
#https://w... | true |
0afb32c39fde65c63f945763ff351bb37831933e | Python | text007/python | /A1/ex20.py | UTF-8 | 1,187 | 4.25 | 4 | [] | no_license | # 函数与文件
# 导入 sys 的 argv 模块
from sys import argv
# 获取文件名
script, input_file = argv
# 创建函数传入读取的文件内容作为参数,并打印出来
def print_all(f):
print(f.read())
# 创建函数,传入文件作为参数,把读/写的位置移到文件最开头
# seek(0) :把读/写的位置移到文件最开头。
def rewind(f):
f.seek(0)
# 创建函数,传入两个参数
def print_a_line(line_count, f):
# 打印一个参数和文件内容的一行
print(line... | true |
c5fa7312f51d696a26e1c00afb0048dd0fd035d4 | Python | ricerkare/crypto | /ch2.py | UTF-8 | 485 | 3.140625 | 3 | [] | no_license | # Nota bene: This will not work on Python 2.7 (most likely because zip behaves differently)
import binascii
from homebrewed_functions import *
string0 = binascii.unhexlify("1c0111001f010100061a024b53535009181c")
string1 = binascii.unhexlify("686974207468652062756c6c277320657965")
def xor(S, T): # assumes S, T are by... | true |
468526b68ca5c4532d53aab8a75fe1e61b8e2ade | Python | jayfry1077/serverless_discord_diceroll_bot | /src/bot_funcs/bot.py | UTF-8 | 737 | 3.859375 | 4 | [
"MIT"
] | permissive | import random
def rollem(options):
options_dict = {'quantity': 1, 'maximum': 10, 'minimum': 1, 'modifier': 0}
for option in options:
try:
value = int(option['value'])
except:
raise Exception('You must enter an Integer.')
options_dict[option['name']] = value
... | true |
188639894db0941d2baea93444a2a054c6e2470d | Python | alvas-education-foundation/Lavanya-B | /BinarytoDecimal.py | UTF-8 | 145 | 3.140625 | 3 | [] | no_license | #github repository- Lavanya-B
for i in range(1111112):
if set(str(i)).issubset({"0", "1"}):
print(f"{i:7d} => {int(str(i), 2):3d}") | true |
864a71b111172fa5e87490423b631a14b461aada | Python | paul-lkx/opencvdemo | /waterShed.py | UTF-8 | 1,719 | 2.71875 | 3 | [] | no_license | #!/bin/lib/python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('water_coins.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
# noise removal
kernel = np.ones((3,3),np.uint8)
op... | true |
521cf7d448e11479d8afdddbf23b6c3d69858e36 | Python | phibzy/Contests | /Leetcode/Aug20/160820/q1/q1.py | UTF-8 | 516 | 3.3125 | 3 | [] | no_license | #!/usr/bin/python3
"""
@author : Chris Phibbs
@created : Sunday Aug 16, 2020 12:52:53 AEST
@file : q1
Given an array, return true if there are 3 consecutive odd numbers in it.
Return false otherwise.
"""
class Solution:
def threeConsecutiveOdds(self, arr: List[int]) -> bool:
o... | true |
b5d8f3cb54aa2703572606527cb37e21516556cc | Python | PovertyAction/tkinter-gui-template | /app_backend.py | UTF-8 | 2,891 | 2.78125 | 3 | [] | no_license | import pandas as pd
def log_and_print(message):
#Log file pending
print(message)
def main_function(df_dict):
return True, df_dict
def save_dataset(saving_path, df_dict, output_format='excel'):
if(output_format=='excel'):
writer = pd.ExcelWriter(saving_path, engine='xlsxwriter')
#... | true |
e01603754414a10d942795fa03db2bc17ff3a844 | Python | factsbenchmarks/xiaohua | /egon_xiaohua.py | UTF-8 | 2,072 | 2.953125 | 3 | [] | no_license | import requests
import re
import os
import hashlib
import time
DOWLOAD_PATH=r'D:\DOWNLOAD'
def get_page(url):
try:
response=requests.get(url,)
if response.status_code == 200:
return response.text
except Exception:
pass
def parse_index(index_contents):
# print(type(ind... | true |
ed51a94ca3df43fa8fa6b8e7052bd7792c1d82c8 | Python | gokceneraslan/msa_noise_reduction | /bin/compare_trees | UTF-8 | 3,527 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
# Phylogenetic tree comparison
# Copyright (C) 2012 Gokcen Eraslan, Basak Eraslan, Javeria Ali
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | true |
747f8bd5fa4bf94fbb0681f7ac846387d19443ed | Python | MerosCrypto/Meros | /e2e/Tests/Consensus/MeritRemoval/HundredTwentyTest.py | UTF-8 | 2,147 | 2.671875 | 3 | [
"MIT",
"CC0-1.0"
] | permissive | #Tests proper handling of an Element from the blockchain which conflicts with an Elemenet in the mempool.
#Meros should archive the Block, then broadcast a partial MeritRemoval with the mempool's DataDifficulty.
from typing import Dict, Any
import json
from e2e.Classes.Consensus.DataDifficulty import DataDifficulty, ... | true |
0fa02cbbb89939786c9778a286fef848f8514ec2 | Python | Shiv2157k/leet_code | /data_structures/recurrsion_dp/climbing_stairs.py | UTF-8 | 1,361 | 3.796875 | 4 | [] | no_license | from functools import lru_cache
class ClimbingStairs:
climb_stair_cache = {}
def get_ways(self, val: int) -> int:
"""
Approach: Dynamic Programming
:param val:
:return:
"""
cache = {0: 1, 1: 1}
for i in range(2, val + 1):
cache[i] = cache[... | true |
9011e56630f1929ceb7779f57e368235b9eda0a2 | Python | kg810/hydra | /StratBase/src/AnalysisBacktestResult.py | UTF-8 | 5,938 | 2.5625 | 3 | [] | no_license | import sys
import getopt
import json
import datetime
import pprint
import pandas as pd
def helpMsg():
print "AnalysisBacktestResult -f /path/to/resultFile"
if __name__ == '__main__':
btJson = ""
if (len(sys.argv) < 2):
helpMsg()
sys.exit(0)
try:
opts, args = getopt.getopt(sys.argv[1:], "f:", ["... | true |
73b3df15dbcfe1b664f17b1f93abb084bd37b509 | Python | PlaydataPythonMiniproject/python_chatbot | /memorygame.py | UTF-8 | 1,853 | 3.484375 | 3 | [] | no_license | import random
import time
mg_score = 0
level = [6, 8, 10]
def memoryGame():
global mg_score
message= ' 기억력 테스트 게임 '
print('='*((100-len(message))//2) + message + '='*((100-len(message))//2))
time.sleep(1.5)
print('숫자가 나온 순서대로 입력해주세요!')
time.sleep(1.5)
print('(숫자 사이 스페이스바, 완료 후 엔터... | true |
8fe05fe6dfdd41e632b81891f7e88fd0343ea4b7 | Python | PixElliot/andela-bc-5 | /Word Count Lab.py | UTF-8 | 307 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
def words(my_string):
ls = my_string.split()
new_dict = {}
count = 0
for i in ls:
count = 0
for j in ls:
if i == j:
count += 1
try:
if type(int(i)) == int:
new_dict [int(i)] = count
except ValueError:
new_dict [i] = count
return new_dict | true |
cc624698c434c71c9666d73e80303a466d3ae45d | Python | jgordon510/dice-reader-random-generator | /cv2_functions.py | UTF-8 | 873 | 2.625 | 3 | [] | no_license | import cv2
min_threshold = 50 # these values are used to filter our detector.
max_threshold = 200 # they can be tweaked depending on the camera distance, camera angle, ...
min_area = 30 # ... focus, brightness, etc.
min_circularity = .3
min_inertia_ratio... | true |
4de12db559578de9de667fde3f871c01694f4eec | Python | ImSt150/Python | /Ch11_RE_Ex.py | UTF-8 | 846 | 3.734375 | 4 | [] | no_license | import re
hand = open('regex_sum_1234158.txt') #returning a handle sequence of strings(lines)
lst=list()
for line in hand: #line is both an iteration variable and a python's reserved word
line = line.rstrip()
if re.search('[0-9]+', line): #matching the lines with 1 or more digits
y = re.findall(... | true |
33854664328aaab9e0e795a2f58260d24b1d75bc | Python | VinayakSingoriya/Numerical-Analysis-and-Design | /10_Secant Method/Code - Secant_Method.py | UTF-8 | 1,189 | 4 | 4 | [] | no_license | def eqn(x):
return x*x - x - 1
def secant(a,b,E):
i = 1
m = (a*eqn(b) - b*eqn(a)) / (eqn(b) - eqn(a))
print("-----------------------------------------------------------------------------------------")
print("i\t|\t a\t|\t b\t|\t m\t|\t f(m)\t| f(a)*f(m) |")
print("--... | true |
5803b5715159c97792897c1277dd023d38610b2b | Python | SejDevStuff/OrangeShell | /src/System/Commands/remove.py | UTF-8 | 1,686 | 2.84375 | 3 | [] | no_license | # Copyright (C) 2020 OrangeShell Developers
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... | true |
93336db431f546dde5c7e8111aa02936c055c8ff | Python | pathammar/itsanoceandummy | /ocean.py | UTF-8 | 2,105 | 2.765625 | 3 | [] | no_license | import twitter
import sqlite3
import random
import time
consumer_key = ''
consumer_secret = ''
access_token_key = ''
access_token_secret = ''
api = twitter.Api(consumer_key=consumer_key,
consumer_secret=consumer_secret,
access_token_key=access_token_key,
access_token_secret=access_token_secret)
db = sqli... | true |
4e29eda1fad10e15a3797b58c2e6a87f4320591d | Python | pbreau3/ift6010-h21-team1 | /distance_python2.py | UTF-8 | 3,934 | 3.265625 | 3 | [] | no_license |
# https://stackoverflow.com/questions/2460177/edit-distance-in-python#32558749
from __future__ import with_statement
from __future__ import absolute_import
from typing import List
from itertools import izip
from io import open
def levenshteinDistance(s1, s2):
if len(s1) > len(s2):
s1, s2 = s2, s1
di... | true |
48590e9f69d2530eba1de0cc75cded1c9255ad4c | Python | aiogram/tg-codegen | /aiogram/api/methods/get_file.py | UTF-8 | 1,274 | 2.8125 | 3 | [] | no_license | from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict
from ..types import File
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class GetFile(TelegramMethod[File]):
"""
Use this method to get basic info about a file and prepare it for dow... | true |
1eef149aad91681ee27f4dd986749a99155fe14d | Python | kumardeepakr3/CS676A-Computer-Vision | /Assgn3/vocabTree.py | UTF-8 | 4,985 | 2.609375 | 3 | [] | no_license | import cv2
import numpy as np
import os
from sklearn.cluster import KMeans
from collections import defaultdict
import pickle
import math
k = 11
heightVocabTree = 4
t = 400 # Max number of SIFT features to extract from an image
firstFileName = "Nil"
diSumTotal = 0
total_num_images = 0
pathOfImageFolder = "/home/deepa... | true |
b439284e726801a403cec71f1131e82ce3227bfe | Python | HJ23/Algorithms-for-interview- | /RemoveInvalidParentheses/RemoveInvalidParenthesis.py | UTF-8 | 684 | 3.28125 | 3 | [] | no_license | # Complexity is O(n)
import sys
sys.path.append("..")
from BasicTester import BasicTester
def run(arg):
stack=[]
coord=[]
for index in range(0,len(arg)):
if(arg[index]=="("):
stack.append("(")
coord.append(index)
elif(arg[index]==")"):
if(len(stack)==0):
... | true |
53ed970812c23cd1248fbc44fd7ccfce154cd81b | Python | ngthanhtrung23/CompetitiveProgramming | /VNOJ/livestream1/guessw.py | UTF-8 | 62 | 3.078125 | 3 | [] | no_license | s = 'april fool'
n = int(raw_input()) - 1
print s[n % len(s)]
| true |
f51e9dd370ca7fec5b560f3af756f4b8d295e9d2 | Python | GarrettWells/python | /Sorting Algorithms Visualized/sortingalgs/BubbleSort.py | UTF-8 | 1,569 | 3.125 | 3 | [] | no_license | from typing import Tuple, List
from SortingList import SortingList
from sortingalgs.SortingAlgorithm import SortingAlgorithm
class BubbleSort(SortingAlgorithm):
def __init__(self, list_: SortingList):
super().__init__(list_)
self.index = 1
self.out_of_place = len(self.list)
def __so... | true |
bad0578e6d46be3a5a12d3d545c2cd0b4e2ca7d8 | Python | zhaxuefan/Computer-Vision | /Image matching, stitching and homographies/Stitching Panoramas.py | UTF-8 | 2,908 | 2.53125 | 3 | [] | no_license | import numpy as np
from q2 import *
from q3 import *
import skimage.color
import numpy as np
# you may find this useful in removing borders
# from pnc series images (which are RGBA)
# and have boundary regions
def clip_alpha(img):
img[:,:,3][np.where(img[:,:,3] < 1.0)] = 0.0
return img
# Q 4.1
# this should ... | true |
e73506814f39c53d199f56036d9ddda9e340f48b | Python | TonyCoopeR-62/Python-temp | /usin_list.py | UTF-8 | 508 | 3.8125 | 4 | [] | no_license | shoplist = ['apples', 'mango', 'carrot', 'bananas']
print('I must buy', len(shoplist), 'products')
print('Products:', end=' ')
for item in shoplist:
print(item, end=' ')
print('\nAlso i must buy reece')
shoplist.append('reece')
print('For now my products list:', shoplist)
print('Sort products')
shoplist.sort()
... | true |
fea8d6f5b30006bef8a75013a5284f9533042cef | Python | jlaura/parallel_implementations | /fj/speed_tests/time_test_final2.py | UTF-8 | 4,138 | 2.578125 | 3 | [] | no_license | from random import randint
import fj_serial_time
from mapclassify_time import PFisher_Jenks_MP
import fj_refactored_sp
import fj_refactored_vect_only_sp
import numpy
import matplotlib.pyplot as plt
samples = [125,250,500,1000,2000,4000]#,8000,16000]
classes = [ 5 ]#, 7, 9]
for k in classes:
fj_vec_only_diam=[]
... | true |
4b6f186053b9d3f69dd50048897fd5a5d4fde394 | Python | maddymz/Data-Structures | /maximal_commonality.py | UTF-8 | 418 | 3.15625 | 3 | [] | no_license | #o(n) time
#o(n) space
def findMaxCommonality(stri):
count = [0 for _ in range(26)]
for i in stri:
count[ord(i) - 97] += 1
res = 0
cur = 0
for i in stri:
if count[ord(i) - 97] > 1:
cur += 1
count[ord(i) - 97] -= 2
elif count[ord(i) - 97] == 0:
... | true |
d726e02fba32314a37a0b5bbeccd59085b9003f3 | Python | dacuster/Data_Analytics | /Assignment4/main_code.py | UTF-8 | 2,075 | 3.640625 | 4 | [] | no_license | # coding: utf-8
# !/usr/bin/python -tt
# Tidying Data
# Use pivot and melt to clean up the data.
def main():
# Import the necessary libraries (pandas named pd)
import pandas as pd
# Import the tuberculosis data.
tuberculosis_df = pd.read_csv('tb.csv')
# Melt the data
tuberculosis_df_melt =... | true |
b6a76c5b4f5f1a08d05cb11057cba4391c9edf05 | Python | scott-gordon72/python_crash_course | /chapter_5/conditional_tests.py | UTF-8 | 949 | 3.578125 | 4 | [] | no_license | dog = 'fido'
print("\nIs dog == 'fido'? I predict True.")
print(dog == 'fido')
cat = 'mittenz'
print("\nIs cat == 'mittenz'? I predict True.")
print(cat == 'mittenz')
bearded_dragon = 'beardie'
print("\nIs bearded_dragon == 'beardie'? I predict True.")
print(bearded_dragon == 'beardie')
scared = True
print("\nIs is_... | true |
42035d862d561cc4bb5780ff0a0dcf6c553ca507 | Python | hyperledger/aries-cloudagent-python | /aries_cloudagent/messaging/decorators/localization_decorator.py | UTF-8 | 1,926 | 2.71875 | 3 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0"
] | permissive | """The localization decorator (~l10n) for message localization information."""
from typing import Sequence
from marshmallow import EXCLUDE, fields
from ..models.base import BaseModel, BaseModelSchema
class LocalizationDecorator(BaseModel):
"""Class representing the localization decorator."""
class Meta:
... | true |
ca330e8a580e943b94706c6e9a2040739b529795 | Python | NK2306/COEN446 | /ManagementAPP.py | UTF-8 | 796 | 2.890625 | 3 | [] | no_license | import paho.mqtt.client as mqtt
mqttc = mqtt.Client()
mqttc.connect("localhost", 1883, 60)
while True:
while True:
print("Please enter your name")
name = input()
if name.isdigit():
print("Name must be alphabetical")
continue
else:
print("Name ent... | true |
fe367c44472e311bb819154ccd98a678f7e45b1a | Python | dariomolina93/Code2040Assesment | /challenge4.py | UTF-8 | 2,244 | 3.890625 | 4 | [] | no_license | #module that will allow us to use json format for our dictionaries.
import json
#module that will allow us to connect to the API.
import requests
"""
Name: Dario Molina
Date: 9/3/16
Description: Write a program that connects to Code2040's API. Then, retrive a dictionary with keys prefix and array.
Prefix, is a strin... | true |
bcc6e50358bdec4b8e4569b9892ece779fad53eb | Python | python-hao/XHao_Net_Studio | /yolo.py | UTF-8 | 3,928 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: XHao
# datetime: 2021/1/17 19:43
# ide: PyCharm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: XHao
# datetime: 2021/1/11 17:50
# ide: PyCharm
import torchvision
import cv2
import torch
COCO_INSTANCE_CATEGORY_NAMES = [
'__background__', 'person', '... | true |
a2c1a297a4b9fc0adcd0226c693e950c8c271a14 | Python | tamaragmnunes/Exerc-cios-extra---curso-python | /Desafio019.py | UTF-8 | 549 | 3.953125 | 4 | [] | no_license | # Um professor que sortear um dos seus quatro alunos para apagar o quadro. Faça um programa que ajude ele, lendo os nomes deles
# e escrevendo o nome escolhido
import random
PrimeiroAluno = str(input('Digite o primeiro nome: '))
SegundoAluno = str(input('Digite o segundo nome: '))
TerceiroAluno = str(input('Digite... | true |
32224b9bc52220a12ca0bfd3552ff0b8a8cdf4f4 | Python | TomKite57/advent_of_code_2016 | /py_scripts/day_23.py | UTF-8 | 5,446 | 3.234375 | 3 | [] | no_license | from aoc_tools import Advent_Timer
TGL_MAP = {'inc': 'dec', 'dec': 'inc', 'tgl' : 'inc', 'jnz': 'cpy', 'cpy': 'jnz'}
def isnum(num):
try:
int(num)
return True
except ValueError:
return False
def readfile(fname):
with open(fname, 'r') as file:
return [line.strip() for line ... | true |
8eb2909ee38eedd28620d4a6b68d5edc44f0500e | Python | hendrik-chan/machine-learning-general | /scikit-train-test-split.py | UTF-8 | 2,629 | 3.59375 | 4 | [] | no_license | #https://machinelearningmastery.com/train-test-split-for-evaluating-machine-learning-algorithms/
#Using stratified train test split for imbalanced datasets
from collections import Counter
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
# create dataset
X, y = make_... | true |
e32632d36f345b35647a82adc14fa6ae1ee8e1ef | Python | Nimausfi/Word_Cloud | /word_cloud.py | UTF-8 | 1,749 | 2.96875 | 3 | [] | no_license | from wordcloud import WordCloud, STOPWORDS
from nltk.corpus import stopwords
import matplotlib.pyplot as plt
import pandas as pd
import re
import string
def word_cloud(project_path, csv_file_path_and_file_name):
# Read the file
df = pd.read_csv(project_path+csv_file_path_and_file_name, encoding="latin-1",... | true |
5bf452275527f3da8c25d7fb964ff6efa50e69cf | Python | rpunit/python-programs | /eulerproject/p15_lattice.py | UTF-8 | 507 | 3.15625 | 3 | [] | no_license | #https://projecteuler.net/problem=15
def lattice(start, end, x, y) :
if start == x or end == y :
return 1
s1 = 0
s2 = 0
if m[start + 1][end] != -1 :
s1 = m[start + 1][end]
else :
s1 = lattice( start + 1, end, x , y)
m[start + 1][end] = s1
if m[start][end + 1] != -1 :
s2 = m[start][end + 1]
else... | true |
09d83a76941948bb1d511c2bb8dbb1ae8ea91a71 | Python | duttabhishek0/A_Star_visualizer | /node.py | UTF-8 | 1,966 | 3.359375 | 3 | [] | no_license | import pygame as Game
import gruvbox_colors as Colors
class Node:
def __init__(self, row, col, size, rowCount):
self.row = row
self.col = col
self.size = size
self.rowCount = rowCount
self.x = row * size
self.y = col * size
self.color = Colors.WHITE
... | true |