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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
86e879817f7e93a279180d3f2c8b31bd3594bd69 | Python | paralleldynamic/challenges | /exercism/python/acronym/acronym.py | UTF-8 | 142 | 3.1875 | 3 | [
"Unlicense"
] | permissive | import re
def abbreviate(words):
w = re.sub(r'[^A-Z0-9 \']', ' ', words.upper()).split()
a = ''.join([c[0] for c in w])
return a
| true |
503907d9d3614c1437c1918c11e1c9104f950443 | Python | freelikeff/my_leetcode_answer | /leet/90answer.py | UTF-8 | 651 | 3.328125 | 3 | [] | no_license | #!E:\pycharm\my_venv\Scripts\python3
# -*- coding: utf-8 -*-
# @Time : 2019/4/20 16:23
# @Author : freelikeff
# @Site :
# @File : 90answer.py
# @Software: PyCharm
from itertools import combinations
class Solution(object):
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
... | true |
dfed1fb9eaf58bc169fa7576b8d782ac6a78e210 | Python | jasontellis/github_commit_summary | /main.py | UTF-8 | 862 | 2.734375 | 3 | [] | no_license | from argparse import ArgumentParser
from GitCommitSummary import GitCommitSummary
parser = ArgumentParser(description='Daywise Github Repository Commits')
parser.add_argument('repo', help='Repository in the form: <owner>/<repo> e.g. kubernetes/kubernetes')
parser.add_argument('--sort', metavar='sort', help='Sort orde... | true |
de8eb567c6e192c6f8d4b5b0b1b99afbb9a27e0d | Python | sycomix/voysis-python | /audio/record_ma.py | UTF-8 | 1,332 | 2.78125 | 3 | [
"MIT"
] | permissive | """
Record a voice query and send to Voysis endpoint
"""
import signal
import threading
import time
import wave
import os
import pyaudio
import six
from voysis.device.mic_array import MicArray
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 16000
WAVE_OUTPUT_FILENAME = "/tmp/{0}_{1}_{2}_output.wav".format(int(time... | true |
67e6181c0f5831db2ddf1bec4e9815372df7bf53 | Python | erickmiller/AutomatousSourceCode | /AutonomousSourceCode/data/raw/squareroot/6d6e4643-5698-4b91-a4aa-615a620e37b7__BruteForce.py | UTF-8 | 850 | 3.234375 | 3 | [] | no_license | '''
Created on Jan 17, 2013
@author: PaymahnMoghadasian
'''
from numpy.ma.core import floor
number = 600851475143
primes = []
factors = []
def find_primes(n):
'''Find all primes <= n'''
for i in range(20, n):
if is_prime(i):
primes.append(i)
def is_prime(n):
'''Checks to see if n is ... | true |
b85fcfd834334c28f6b0d640be3834e8bcf95014 | Python | auerl/rainbow-agent | /rainbow/memory.py | UTF-8 | 5,506 | 2.890625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""memory.py: Memory module containing replay memory classes for DRL agents.
"""
from collections import namedtuple, deque
import torch
import numpy as np
import random
import time
class AugmentedPriorityReplayBuffer(object):
"""Fixed-size buffer to store experience ... | true |
2d165f56dcd6aeee7da89e5fe3cd9233acbf5813 | Python | nesteriv/burger_shop | /core/models.py | UTF-8 | 686 | 2.578125 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Category(models.Model):
category = models.CharField(max_length=200)
def __str__(self):
return self.category
class Subcategory(models.Model):
category = models.ForeignKey(Category)
subcategory = models.CharField(max_length=200)
... | true |
a6beed26a0f192b9a4d99d159f80d30d1f1c5f5c | Python | armory3d/armory | /blender/arm/logicnode/draw/LN_draw_circle.py | UTF-8 | 1,705 | 3.078125 | 3 | [
"Zlib",
"GPL-2.0-only"
] | permissive | from arm.logicnode.arm_nodes import *
class DrawCircleNode(ArmLogicTreeNode):
"""Draws a circle.
@input Draw: Activate to draw the circle on this frame. The input must
be (indirectly) called from an `On Render2D` node.
@input Color: The color of the circle.
@input Filled: Whether the circle i... | true |
9585c34015709bb5ab920ac90455722a9877a535 | Python | shunmian/CS231n | /CNN for VR Part I:入门(一):图片分类.py | UTF-8 | 1,463 | 3.046875 | 3 | [] | no_license | import numpy as np
import pickle
def unpickle(file):
with open(file, 'rb') as fo:
dict = pickle.load(fo)
return dict
def load_CIFAR10(file):
results = []
Xtr = np.zeros([10000,3072])
Ytr = []
for i in range(5):
print("{}/data_batch_{}".format(file,i+1))
dict = unpickle... | true |
1622ac3461f5d7aa6bbb0d6ed2616d8218f98777 | Python | semihsevik/BasicPython | /perfectNumbers.py | UTF-8 | 284 | 4.03125 | 4 | [] | no_license | # Mükemmel Sayılar
#------------------
number = int(input("Enter a number: "))
sum = 0
for i in range(1,number):
if number % i == 0:
sum += i
if number == sum:
print(f"{number} is a perfect number")
else:
print(f"{number} is not a perfect number")
| true |
aea15cdc1c13b8eff51ff3f47c369010a8938a0c | Python | luyixiao95/CS5001 | /src/project9/extension1.py | UTF-8 | 2,158 | 3.859375 | 4 | [] | no_license | #Luyi Xiao
#CS 5001 & CS 5003
#30th March, 2021
#extensition1.py
import turtle_interpreter
import shapes
import random
import math
#create a hexagon tile
def tile1(x, y, scale):
hex = shapes.Hexagon(distance = scale, color = (random.random(), random.random(), random.random()))
hex.draw(x, y+math.sqrt(3)*scale) ... | true |
581d9d493ae8b2a33aea3d581ad127e84587bce6 | Python | jonmkang/fb-cloud | /makecloud.py | UTF-8 | 2,468 | 3.140625 | 3 | [] | no_license | import os
from os import path
import json
from tqdm import tqdm as pbar
from wordcloud import WordCloud
import matplotlib.pyplot as plt
def create_json():
text = ""
for root, dirs, files in os.walk('messages/inbox'):
for dir in pbar(dirs, desc='Converting messages:'):
curr_dir = os.getcwd()... | true |
1145aa9effa3a06f323a356d11fd0032225014ca | Python | L1ght25/Online_shop_demo | /lib/window.py | UTF-8 | 3,511 | 2.5625 | 3 | [] | no_license | import yaml
from PyQt5.QtWidgets import QMainWindow, QPushButton, QInputDialog
from lib.stats import WindowStats
import os
import requests
class ShopWindow(QMainWindow):
def __init__(self, data_path='', data=None):
super(ShopWindow, self).__init__()
self.setWindowTitle('Интернет-магазин')
... | true |
31549966d51718ca54a9a8aed3d767e553080b9d | Python | fengqilr/quant_analysis | /factor_generation/generate_stock_quality_factor.py | UTF-8 | 10,444 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
### balancesheet
def get_balancesheet_data(stock_code):
df = pd.read_pickle("./balancesheet/%s.pkl" % stock_code)
return dropduplicate(df)
def get_income_data(stock_code):
df = pd.read_pickle("./income/%s.pkl" % stock_code)
return dropdup... | true |
c81aff369ca6c7757c0ddc8ddaf9520d22b69122 | Python | siac31/WebCrawlingTest | /Xpath_test/request_test1.py | UTF-8 | 670 | 2.765625 | 3 | [] | no_license | import urllib.request as ur
import urllib.parse as up
url_address='https://tieba.baidu.com/f?kw=%E8%8B%B1%E9%9B%84%E8%81%94%E7%9B%9F&ie=utf-8&pn=50'
'''
kw=英雄联盟&ie=utf-8&pn=100
'''
data ={
'kw':'英雄联盟',
'ie':'utf-8',
'pn': '100'
}
data_1={
'pn': '100',
'ie':'utf-8',
'kw': '英雄联盟'
}
data_url=up.ur... | true |
8889b342e8039680580cb4152f70fa24b5f21aa9 | Python | beatrijz/letscode | /backend/lets/letscode/model/tests/testResultadoTestCase.py | UTF-8 | 678 | 2.515625 | 3 | [] | no_license | from letscode.model.testCase import TestCase
from letscode.model.resultadoTestCase import ResultadoTestCase
from letscode.model.firestore.query import Query
from google.cloud.exceptions import NotFound
import unittest
class TestResultadoTestCase(unittest.TestCase):
def test_deve_carregar_um_objeto(self):
... | true |
62d017ed59e27552a1f6f1d1a8a1f626be7c57d0 | Python | vanleantking/keywords_extract | /homework1.py | UTF-8 | 9,768 | 2.734375 | 3 | [] | no_license | # libraries for dataset preparation, feature engineering
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import model_selection, preprocessing
from sklearn.feature_extraction.text import TfidfVectorizer
from utils import functions, collect_data
from sklearn.linear_model import Logist... | true |
c4c2fc48d63057879a4e37352b7a79fec309daab | Python | KarlKangYu/aesw2016-corpus-gec-classification | /data_transformer.py | UTF-8 | 705 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import codecs
import sys
def data_transforming(datafile_in, datafile_out_wrong, datafile_out_right):
with codecs.open(datafile_in, 'r') as f1:
with codecs.open(datafile_out_wrong, 'w') as f2:
with codecs.open(datafile_out_right, 'w') as f3:
for line in f1.readlines():
... | true |
b2274ce52222811c1fb5459f20f4ad41362c1782 | Python | Denrur/TheLastRogue | /weapon.py | UTF-8 | 20,063 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | import action
from attacker import DamageType, DamageTypes, WeaponMeleeAttacker, WeaponRangedAttacker
import colors
from compositecore import Composite, Leaf
import equipment
from equipmenteffect import CritChanceBonusEffect, ExtraSwingAttackEffect, BleedAttackEffect, DefenciveAttackEffect, CounterAttackEffect, StunAtt... | true |
0c5cc21799a7e4a26672af20556a90a218facbc0 | Python | smyhmahmoodi/PythonFinalProject-4Newbies | /gamefinalv0.7.py | UTF-8 | 9,775 | 3.3125 | 3 | [] | no_license | import pygame
import math
import random
from pygame import mixer # for adding music and sounds to the game
import time
import numpy as np
# initialize game
pygame.init()
# create screen
screen = pygame.display.set_mode((800, 600))
# Background
background = pygame.image.load('barn.png')
# Title and ... | true |
b0097ad37b1ce251c5200a990d9cb203dc5a0c7a | Python | RavenCheng1120/find_QandA_pairs | /find_QA_pairs.py | UTF-8 | 896 | 3.15625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import pysrt
#讀取字幕檔,將所有句子存入list
subtitles = []
subs = pysrt.open('ReadyPlayerOne.srt')
for lines in subs:
line = lines.text.split()
line[0] = line[0].replace('-','')
subtitles.append(line[0])
if len(line)==2:
line[1] = line[1].replace('-','')
subtitles.append(line[1])
#print(subtitles[0... | true |
ff9290b1586ae3f058d9a94f9c21aacf59c558f9 | Python | by-student-2017/DFTBaby-0.1.0-31Jul2019 | /DFTB/Parallization.py | UTF-8 | 2,729 | 2.6875 | 3 | [] | no_license | """
"""
import multiprocessing as mp
from Queue import Empty
import time
class Worker(mp.Process):
def __init__(self, results_queue, finished_queue, ID, **opts):
super(Worker, self).__init__(**opts)
self.ID = ID
self.q = results_queue
self.fq = finished_queue
def run(self):
... | true |
2e768828a3330f6fe08a31c886a354419b25300c | Python | sandromelobrazil/Python_Para_Pentest | /Capitulo 1/2 - nome.py | UTF-8 | 72 | 3.5 | 4 | [] | no_license | nome = raw_input("Digite o seu nome: ") #1
print "O seu nome:", nome #2 | true |
f35cc6c829d7c39e9403f5b1082dbb7328e809cd | Python | featherko/epythopam | /test/hw1/test_task3_minmax.py | UTF-8 | 708 | 2.84375 | 3 | [] | no_license | """Test for task 3."""
import os
from typing import NoReturn, Optional, Tuple
import pytest
from homework.hw1.task3_minmax import find_maximum_and_minimum
@pytest.mark.parametrize(
("value", "expected_result"),
[
(os.path.join(os.getcwd(), "test", "hw1", "test.txt"), (1, 7)),
(os.path.join(o... | true |
8900864e388c3ac2fad3c8488bea6bfcc745d48a | Python | cleissomfb/algoritmos2-2018-2 | /Aula 5/Exercicio 1/OOP/features/steps/espaco_behave.py | UTF-8 | 926 | 3.34375 | 3 | [] | no_license | from behave import given, when, then
from espaco_cideral import criar_estrelas
@given('dois valores inteiros e positivos, 0 e 600')
def range_y(context):
context.y_min = 0
context.y_max = 600
@given('uma lista com os valores 1, 2 e 3')
def range_speed(context):
context.speed_min = 1
context.speed_ma... | true |
1165dd277a5942246ec0144f1f3707f00ba50888 | Python | aeternalis1/Leetcode | /Hard/0041. First Missing Positive.py | UTF-8 | 594 | 2.5625 | 3 | [] | no_license | class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
N = len(nums)+1
nums = nums+[0]+[0]
for i in range(N):
if nums[i] <= 0 or nums[i] > N:
nums[i] = 0
for i in range(N):
... | true |
8d196095a4b4afe0c6734aa92dcc7cb149b63c66 | Python | Mingxing-Liu123/ship | /nodeapp/testsocket/test.py | UTF-8 | 548 | 3.015625 | 3 | [] | no_license | # -*-coding:utf-8-*-
import random as rd
import time
def main():
def logging_tool(func):
def wrapper(*arg, **kwargs):
print('%s is running...' % func.__name__)
func() # 把today当作参数传递进来,执行func()就相当于执行today()
return wrapper
@logging_tool
def today():
print('2018-05-25')
# today = logging_tool(today) #... | true |
522d7088e30d9f9f2ec63de04048afbac8a255dd | Python | mitarai1kyoshi/Python_learning | /ch11.py | UTF-8 | 889 | 3.125 | 3 | [] | no_license | #测试
import unittest
from ch11_test import city_fun
class test_city(unittest.TestCase):
def test_cities(self):
rs = city_fun('Santiago', 'Chile')
self.assertEqual(rs, 'Santiago, Chile')
def test_cities_popu(self):
rs = city_fun('Santiago', 'Chile', 500000)
self.assertEqual(rs, 'Santiago, Chile-population 5... | true |
47c15ec34778be2b1e012c6fa71c4f3697da4975 | Python | Dunes/countdown_game | /astar.py | UTF-8 | 3,795 | 3.640625 | 4 | [
"MIT"
] | permissive | from abc import abstractmethod, ABCMeta
from operator import attrgetter
from collections import Iterable
class AStar(object):
__metaclass__ = ABCMeta
def children(self, node, start, goal):
child_states = set()
for child in self._children(node):
if child.state not in child_states:
child.g = node.g + self... | true |
1c36a84982438dcc08fc6162c437ff9a51298d72 | Python | easy-breezy-xyz/signin-signup-API | /change.py | UTF-8 | 537 | 2.953125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import pickle
def change(loc, email, data):
"""
File where emails are stored are param loc
Email is param email
Returns data if account exists
Returns None if account does not exist
"""
emails = pickle.load(open(loc, "rb"))
nded = True
for eml in emails:
... | true |
cd81b79fa43bbc1fe2a541f752b136f40d5f6e76 | Python | jcraley/jhu-eeg | /scripts/standardize-features.py | UTF-8 | 2,361 | 2.609375 | 3 | [] | no_license | import os
import sys
import torch
import preprocessing.features as features
import utils.pathmanager as pm
import utils.read_files as read
import utils.testconfiguration as tc
def main():
"""Set up the experiment, initialize folders, and write config"""
# Load the configuration files
argv = sys.argv[1:]... | true |
8671a0d7d73c175dc506c2be4459f7618392aef5 | Python | SoravNegi/Sorting-Algorithm-Visualizer-in-Python | /sorting_algorithm_visulatzer.py | UTF-8 | 9,684 | 3.140625 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
import random
# from bubbleSort import bubble_Sort
# from quickSort import quick_Sort
# from mergeSort import merge_Sort
root = Tk()
root.title('Sorting Algorithm Visualisation')
root.maxsize(1000, 700)
root.config(bg='orange')
#Variable
selected_alg = Stri... | true |
4a0464006d1611ea73162206bb92db15816ac72f | Python | graemebrooks/python-warmups | /rps.py | UTF-8 | 1,595 | 3.578125 | 4 | [] | no_license | import random
def rps():
val = None
outcomes = ["rock", "paper", "scissors"]
comp_result = None
while val != "q":
comp_result = outcomes[random.randint(0, 2)]
user_result = input("Type `rock`, `paper`, `scissors` to play or `q` to quit: ")
print(f"You played {user_result}!")
... | true |
fde0fd319094cd06adb3cc0526cfb0634f03e0cd | Python | Gorumo/CEUR_NLP | /main_project_psql.py | UTF-8 | 17,480 | 2.609375 | 3 | [] | no_license | import psycopg2
import string
import os
from bs4 import BeautifulSoup
import uuid
import nltk
from itertools import product
from nltk.corpus import wordnet
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
from collections import Counter
from nltk.corpus import wordnet as wn
from autocorrect ... | true |
334b48719bc11e29878b6bbada6163d9277baba8 | Python | flaviovdf/granger-busca | /scripts/sfp-compare.py | UTF-8 | 1,036 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from gb import simulate
from matplotlib import pyplot as plt
from statsmodels.distributions.empirical_distribution import ECDF
import math
import random
def SFP(n, mu, rho=1):
# first inter-event time
deltat = mu
# list of inter-event times
Deltat = []
for i in range(1, n):
... | true |
c71dae1d5e80e1acac202a8026099dadf577bce9 | Python | kamylaep/algorithms-python | /tests/test_goodoldfibonacci.py | UTF-8 | 2,160 | 2.875 | 3 | [] | no_license | import unittest
from others.goodoldfibonacci import recursive, dynamic, lasttwo
class BinarySearchTest(unittest.TestCase):
def test_recursive(self):
self.assertEqual(0, recursive(0))
self.assertEqual(1, recursive(1))
self.assertEqual(1, recursive(2))
self.assertEqual(2, recursive... | true |
0ad2b2d06620205b0b08482daf2a55ded7e7a654 | Python | devilhtc/leetcode-solutions | /0x0308_776.Split_Bst/solution.py | UTF-8 | 1,074 | 3.3125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def splitBST(self, root, V):
"""
:type root: TreeNode
:type V: int
:rtype: List[TreeNode... | true |
91d0a17bf2b3a49b53534efbc14710d1ef9b9142 | Python | syedriyaz18/NIMS | /loginform2.py | UTF-8 | 2,458 | 2.640625 | 3 | [] | no_license | #from tkinter import *
from Tkinter import *
import tkMessageBox as tm
#import pymysql.cursors
import MySQLdb
import ctypes
import sys
myappid = 'mycompany.myproduct.subproduct.version' # arbitrary string
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
class LoginFrame(Frame):
... | true |
e77a82600e25af31fe21a3320383df5179202849 | Python | R-Strange/AdvancedTopicsInPython | /examples/repr_and_str.py | UTF-8 | 287 | 3.71875 | 4 | [] | no_license | class MyCar:
def __init__(self, mileage, colour):
self.mileage = mileage
self.colour = colour
def __str__(self):
return "a {} car".format(self.colour)
def __repr__(self):
return "car: Mileage {}, Colour {}".format(self.mileage, self.colour)
| true |
51da1e38a1e855f4ed108f75da8e632e316f9b62 | Python | nitishvashisth/Hactoberfest2019 | /Tut2.py | UTF-8 | 1,025 | 4 | 4 | [] | no_license | # taking input from users
#print("enter number")
#a = input()
#print("entered number is")
#print(a)
# Method to print from 1 to N
#print(*range(1, int(input())+1), sep='')
# List comprehensions Examples
import builtins
nums = [1,2,3,4,5]
odd=[]
for n in nums:
if n%2 == 1:
odd.append(n*2)
#print(odd)
podd = [... | true |
8393e7389f7d28adc3d3a39bd398a666e4436ba8 | Python | AlderiusArcantus/Disparity-Graph-Cuts | /app/stereo/ssd.py | UTF-8 | 883 | 2.546875 | 3 | [] | no_license | import numpy as np
from .utils import to_gray
from scipy import ndimage
def convolve(image, kernel):
return ndimage.filters.convolve(image, kernel, mode='constant', cval=0)
def disparity(image_left, image_right, kernel=7, search_depth=30):
gray_left = to_gray(image_left)
gray_right = to_gray(image_right)
... | true |
4564691c9b11fc95bb89a636c7ab159ca3aaf84e | Python | pkulics/train_word2vec | /cut.py | UTF-8 | 563 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: Changsong Li
@contact: lichangsongpku@163.com
@file: train
@time: 2018/9/5 上午11:20
@desc:
"""
import jieba
import io
# 加载自己的词表
jieba.load_userdict("wordlist.txt")
def main():
with io.open('wenben.txt', 'r', encoding='utf-8') as content:
for line in con... | true |
6bad73aa4f752f6939b6f1edb34da3773a8d0e8e | Python | mitsuba-renderer/mitsuba3 | /src/spectra/tests/test_irregular.py | UTF-8 | 1,182 | 2.546875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | # Only superficial testing here, main coverage achieved
# via 'src/libcore/tests/test_distr.py'
import pytest
import drjit as dr
import mitsuba as mi
@pytest.fixture()
def obj():
return mi.load_dict({
"type" : "irregular",
"wavelengths" : "500, 600, 650",
"values" : "1, 2, .5"
})
de... | true |
6c084f7431fa6cd560a89bec5c3d2a0a804d3f3e | Python | enzoampil/fastquant | /examples/notif_bot/slack_notif.py | UTF-8 | 419 | 2.53125 | 3 | [
"MIT"
] | permissive | import sys
import json
import requests
action = sys.argv[1]
today = sys.argv[2]
symbol = sys.argv[3]
# See https://api.slack.com/tutorials/slack-apps-hello-world for more information about Slack apps
webhook_url = YOUR_WEBHOOK_URL
message = "Today is " + today + ": " + action + " " + symbol
requests.post(
webhoo... | true |
d41b2b9f8891366c2e97ece752ab5ded356fa6ef | Python | kgroenke/sorting_algorithms | /quick_sort.py | UTF-8 | 606 | 3.125 | 3 | [] | no_license |
def quickSort(ar):
def partition(pivot, eidx):
if pivot == eidx:
return
else:
lSidx = pivot
for idx in range(pivot+1, eidx):
if ar[idx] < ar[pivot]:
temp = ar[idx]
ar[idx] = ar[pivot+1]
a... | true |
41f762713d17bb0722a54381a02ba1e781bf9ee2 | Python | jo-kwsm/100-knock | /1-10/1.py | UTF-8 | 678 | 2.984375 | 3 | [] | no_license | import os
import pandas as pd
def main():
data_dir = "data/1"
customer_path = os.path.join(data_dir, "customer_master.csv")
item_path = os.path.join(data_dir, "item_master.csv")
transaction_path = os.path.join(data_dir, "transaction_1.csv")
transaction_detail_path = os.path.join(data_dir, "transact... | true |
980750d909ce03f51557efb803f0cb5a030fa78e | Python | blaircalderwood/masterWebApp | /backend/context_retrieval/general_functions.py | UTF-8 | 1,704 | 4.4375 | 4 | [] | no_license | import math
# Adaptation of classic binary search algorithm to search for a string in a given alphabetically sorted list
def binary_search(array, string):
# Given an array, search string and the upper and lower bounds of aforementioned array search for the string
def binary_search_execute(search_array, searc... | true |
5490a72dca7e05623acc72aed16d3e727451852d | Python | hjuju/TF_Study-HAN | /Tensorflow1.14/tf19_cnn1.py | UTF-8 | 1,654 | 2.75 | 3 | [] | no_license | from keras import datasets
import tensorflow as tf
import numpy as np
from icecream import ic
from keras.models import Sequential
from keras.layers import Conv2D
tf.set_random_seed(66)
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
from keras.utils import to_categorical
y_... | true |
84e8837063bc31949a64e95c3bb17fbb3eb2de19 | Python | quannguyenanh/userid_update | /mod_user.py | UTF-8 | 2,346 | 2.671875 | 3 | [] | no_license | from sys import argv
from urllib2 import Request, urlopen, URLError, HTTPError
import paramiko
import os
# args[1]: email
# args[2]: userID
# args[3]: password
# extract params
def extract_input():
if len(argv) != 4:
print "Enter 3 params as: email, userID, password"
email = argv[1]
userID = a... | true |
6a879942a27dae90e91f0c2f3e449aa2edb98ff2 | Python | hk10nis/tetris | /gui_tetris.py | UTF-8 | 2,582 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
#coding:utf-8
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import numpy as np
import sys
from tetris import Tetris
#using class file tetris.py
class gui_tetris(Tetris):
def __init__(self):
super().__init__()
self.timercount = 0
glutInit(... | true |
38bbe162420c5724027a6dd40c4ce19a5eabbc98 | Python | paulzzh/tc_ai_test_python | /Frenchlib/Participle.py | UTF-8 | 2,252 | 2.796875 | 3 | [] | no_license | # - * - coding:UTF-8 - * -
import hashlib
import random
import requests
import time
from urllib import parse
class Participle(object):
# 初始化方法
def __init__(self, ids, keys):
"""
基础文本分析_分词
:param app_id: Appid (Str)
:param app_key: Appkey (Str)
"""
# 请求接口设置
... | true |
219b49018340fce05f3a2344dad68fbf2b92da7c | Python | lasttillend/CS61A | /miscellaneous/ex2_2_data_abstraction.py | UTF-8 | 593 | 4.21875 | 4 | [] | no_license | # 2.2.1 Example: Rational Numbers
# manapulating rational numbers
def add_rationals(x, y):
nx, dx = numer(x), denom(x)
ny, dy = numer(y), denom(y)
return rational(nx * dy + ny * dx, dx * dy)
def mul_rationals(x, y):
return rational(numer(x) * numer(y), denom(x) * denom(y))
def print_rational(x):
print(numer(x),... | true |
c329280f86ed69fedb1d696630bd0ee5ebf923e1 | Python | MagdalenaSvilenova/Python-Fundamentals | /Data Types and Variables/Print part of the ASCII Table.py | UTF-8 | 132 | 3.875 | 4 | [] | no_license | num1 = int(input())
num2 = int(input())
char = 0
for i in range(num1, num2+1):
char = chr(i)
print(char, end = ' ')
| true |
f80c33c7df68adc2226ef28f786882ce56dd50ff | Python | jeekMic/PyQt5Project | /LeftTabWidget.py | UTF-8 | 2,739 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: hongbiao
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import QListWidget, QStackedWidget
from PyQt5.QtWidgets import QListWidgetItem
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QHBoxLa... | true |
551c60a5d1b5920c82b85dd5f3f0af7f13f95f04 | Python | Valijon21/python-lessons | /gipotenuza.py | UTF-8 | 64 | 2.8125 | 3 | [] | no_license |
a =6
b=7
print("uchburchak gipatenuzasi:",(a**2+b**2)**(1/2))
| true |
db27fa2268a11511ba3814152a689e5ad8f40df1 | Python | Sumite321/tree_transversal | /AIv7.3.py | UTF-8 | 3,992 | 3.5 | 4 | [] | no_license |
class Node(object):
def __init__(self,id):
"""
Default constructor
Parameters
----------
id : int
"""
self.id = id
self.children = []
self.parent=None
def set_parent(self,parent):
self.parent = parent
def ge... | true |
c12a95fcbf87cc86b475836ec5a357fa0d0cf03c | Python | magic282/cnndm_acl18 | /Document.py | UTF-8 | 305 | 2.828125 | 3 | [] | no_license | class Document(object):
def __init__(self, doc_sents, summary_sents):
self.doc_sents = doc_sents
self.summary_sents = summary_sents
self.doc_len = len(self.doc_sents)
self.summary_len = len(self.summary_sents)
self.concat_summary = " ".join(self.summary_sents)
| true |
abdf35a008a354030219dc00227c042dfdc07566 | Python | NKcell/leetcode | /7.Reverse Integer/7.py | UTF-8 | 635 | 3.703125 | 4 | [] | no_license | def reverse(x):
"""
:type x: int
:rtype: int
"""
temp = 0
if x == 0:
return x
elif x > 0:
while True:
if x//10 == 0 and x%10 == 0:
break
temp = temp*10 + x%10
x = x//10
if temp > 2147483647:
return 0
... | true |
dd7461b5828477f909c5152a99008dd81d5eb095 | Python | gimquokka/problem-solving | /CodeUp/Basic_100 (기초100제)/cu_1080.py | UTF-8 | 148 | 3.625 | 4 | [] | no_license | # Print output that last one when s is equal or large than e
e = int(input())
s = 0
n = 1
while(s < e):
s += n
if s >= e:
print(n)
n += 1
| true |
119306e6dce56fbadc4d9dacc95aa8fdbdb0896f | Python | mfx22/CS1110 | /Labs/lab2/dice.py | UTF-8 | 1,779 | 3 | 3 | [] | no_license | #dice.py
#Michael Xiao (mfx2)
#8/30/16
def make_email(s):
company = s[s.index('@'):]
if company == '@ubisoft.com':
period = s.index('.')
last = s[:period]
first = s[period+1:s.index('@')]
else:
period1 = s.index('.')
period2 = s.index('.',period1+1)
first = s... | true |
70a782b86ce8618c0da96625445945ca5ad026e6 | Python | ysaicll/HuntRoom | /crawl.py | UTF-8 | 6,021 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import csv
from tqdm import tqdm
from time import sleep
header = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 \
(KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
def crawl_lianjia():
url = 'https://hz.l... | true |
561b9aa925cd50afddb7a1f820a48079e09fab88 | Python | krishnavetthi/Python | /functions.py | UTF-8 | 1,551 | 4.6875 | 5 | [] | no_license | # Functions
#### Ex. Write a function which takes a value as a parameter and returns its factorial
def factorial(n):
fact = 1
for i in range(1, n+1):
fact *= i
return fact
print(factorial(5))
#### Default Argument
def func(name, age = 35):
print("name : ", name)
print("age : ", age)
func(... | true |
59f26937d9cbb85bcaee95bcf63bec5f90fc60a5 | Python | roberthai/Test | /1.py | UTF-8 | 441 | 3.21875 | 3 | [] | no_license | import random
# seed value = 3
random.seed(3)
for i in range(3):
print(random.random(), end = ' ')
print('\n')
# seed value = 8
random.seed(8)
for i in range(3):
print(random.random(), end = ' ')
print('\n')
# seed value again = 3
random.seed(3)
for i in range(3):
print(random.random(), end = ' ')
prin... | true |
3a404a2c75be3fff85f21dadc1e4be06abda89ea | Python | leandrocotrim/curso_R_PY | /Python/MachineLearning/VI - RandomForest.py | UTF-8 | 828 | 2.625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score
from sklearn.ensemble import RandomForestClassifier
from sklearn import datasets
from scipy import stats
df_credit = pd... | true |
720593083bd3d3d0baacc31c30cc569e7d4e8831 | Python | tongpao/tongpao | /libs/db.py | UTF-8 | 8,455 | 2.59375 | 3 | [] | no_license | #! /usr/bin/python
#-*- coding:utf-8 -*-
#Filename: db.py
import MySQLdb,types
class DBConfigError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class db:
def __init__(self, w_db = None, r_db = None):
self.writeable = False # ... | true |
7217f83266f4be96a1504bced71519ef37503fbe | Python | willowmck/pelorus | /exporters/failure/collector_base.py | UTF-8 | 3,117 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | from abc import abstractmethod
import logging
import pelorus
from prometheus_client.core import GaugeMetricFamily
class AbstractFailureCollector(pelorus.AbstractPelorusExporter):
"""
Base class for a FailureCollector.
This class should be extended for the system which contains the failure records.
"""... | true |
c571d01242a835f6f6a342d7965c475943c645f1 | Python | yousra-mansour/edx_scraping | /edx_scrapjng.py | UTF-8 | 2,508 | 2.9375 | 3 | [] | no_license |
# ------------------------------------------
# edx web scraping
# ------------------------------------------
import requests
from bs4 import BeautifulSoup
import os
import csv
import sqlite3
title = []
link = []
time = []
How_study = []
cost = []
db = sqlite3.connect("edx.db")
cr = db.cursor()
cr.execute... | true |
68846f6818482ecf3e11e5813cfd5df10db6e535 | Python | sang-gyeong/Coding_Test | /BINARY_SEARCH/순위검색.py | UTF-8 | 474 | 2.8125 | 3 | [] | no_license | def solution(info, query):
answer = []
for q in query:
count = 0
qArr = q.split()
for i in info:
iArr = i.split()
if (iArr[0] == qArr[0] or qArr[0] == '-') and (iArr[1] == qArr[2] or qArr[2] == '-') and (iArr[2] == qArr[4] or qArr[4] == '-') and (iArr[3] == q... | true |
d120598dfe6c6d4954db2eadf25d74f1864ac316 | Python | yoshikyoto/miasma | /src/infra/api/riot/match_api_client.py | UTF-8 | 689 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from riot_api_client import RiotApiClient
class MatchApiClient(RiotApiClient):
def __init__(self):
super(MatchApiClient, self).__init__()
self.base_url = "https://jp.api.pvp.net"
def match_list_by_summoner_id(self, summoner_id, begin_time=None):
params = {}
... | true |
5956e483f53a2cf1072d6916f7a2d6abadfd8559 | Python | ololobus/algo-pq | /w16/median.py | UTF-8 | 384 | 2.875 | 3 | [] | no_license | file_name = 'Median.txt'
file_name = 'test.txt'
array = open(file_name).readlines()
array = map(lambda i: int(i), array)
length = len(array)
summ = 0
for k in range(1, length + 1, 1):
a = sorted(array[:k])
if k % 2 == 0:
summ += a[k/2 - 1]
else:
summ += a[(k + 1)/2 - 1]
if k % 100 == ... | true |
c2cec7f307a11996bc6ac60dd45c153ab505248d | Python | gabriellaec/desoft-analise-exercicios | /backup/user_153/ch81_2020_09_21_19_42_40_990149.py | UTF-8 | 362 | 3.46875 | 3 | [] | no_license | def interseccao_valores(dicionario1, dicionario2):
lista_interseccao = []
for value in dicionario1.values():
if value in dicionario2.values():
lista_interseccao.append(value)
return lista_interseccao
# d1 = { "banana": 1, "papagaio": 2, "bola": 3}
# d2 = { "bola": 5, "banana": 2, "pne... | true |
2e917ca0cf00cfd420f2351210147c2e933f9bae | Python | harrytsz/spiderman | /SP/pipelines/pipelines_kafka.py | UTF-8 | 1,514 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/5/18 10:16
# @Author : way
# @Site :
# @Describe: 数据实时写到 kafka
import json
import time
import logging
from kafka import KafkaProducer
from SP.settings import KAFKA_SERVERS
logger = logging.getLogger(__name__)
class KafkaPipeline(object):
def __init... | true |
1e30c58db3e01cb2ec2199b339d84551fcebb963 | Python | jpegbert/search_coding | /bm25/demo2/test_bm25.py | UTF-8 | 1,078 | 2.796875 | 3 | [] | no_license | import jieba
from bm25.demo2.bm25_model import BM25_Model
document_list = ["行政机关强行解除行政协议造成损失,如何索取赔偿?",
"借钱给朋友到期不还得什么时候可以起诉?怎么起诉?",
"我在微信上被骗了,请问被骗多少钱才可以立案?",
"公民对于选举委员会对选民的资格申诉的处理决定不服,能不能去法院起诉吗?",
"有人走私两万元,怎么处置他?",
"法律上餐具、饮具集中消毒服务单位的责... | true |
5fb2800074e460943362bae2c71de7605aec4433 | Python | adafruit/circuitpython | /tests/basics/fun_calldblstar2.py | UTF-8 | 509 | 3.890625 | 4 | [
"MIT",
"GPL-1.0-or-later"
] | permissive | # test passing a string object as the key for a keyword argument
try:
exec
except NameError:
print("SKIP")
raise SystemExit
# they key in this dict is a string object and is not interned
args = {'thisisaverylongargumentname': 123}
# when this string is executed it will intern the keyword argument
exec("d... | true |
185e2c92c031923ff23aa17dbb0411346a9f644c | Python | wbglizhizhong/AnnotationPipeline-EVM_based-DClab | /Scripts/filter_most_representative.py | UTF-8 | 1,841 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env/ python
# arg 1 -> bast results
# std.log > unique ids
# std.err > clusters
import sys
hits = {}
#load
max_hits = ["",0]
# Parse blast hits
for line in open( sys.argv[1] ):
candidate1, candidate2 , cov, iden = line.strip().split("\t")
# Add blast hit to dictionary for both candidates
if c... | true |
386aaa1feb459fa94fef05b118e8f2b0ce914d67 | Python | Leopoldino005/POWER-UP | /main_up.py | UTF-8 | 33,015 | 2.765625 | 3 | [] | no_license | ''' Programação do Protótipo - POWER UP do Instrutor'''
# Impotando as blibliotecas
from tkinter import *
from tkinter import messagebox
from tkinter import ttk
import sqlite3
from datetime import date
from datetime import datetime
from random import choice, randint
# Tela para edição da Ficha dos Alunos... | true |
a34687e16dda99272de95ba2d7de015096456db5 | Python | saeed-moghimi-noaa/pylibs | /Utility/mylib.py | UTF-8 | 66,531 | 2.578125 | 3 | [] | no_license | #!/usr/bin/evn python3
from pylib import *
#from pylab import *
#-------misc-------------------------------------------------------------------
def load_bathymetry(x,y,fname,z=None,fmt=0):
'''
load bathymetry data onto points(xy)
Input:
fname: name of DEM file (format can be *.asc or *.npz)
Ou... | true |
1bae8503e203e6b0295552af7260cfd93414cb29 | Python | caitray13/rubbish | /retraining.py | UTF-8 | 4,656 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
import tensorflow as tf
import os
import numpy as np
import matplotlib.pyplot as plt
# In[6]:
# import zipfile
# In[7]:
# zip_ref = zipfile.ZipFile('dataset-resized.zip', 'r')
# zip_ref.extractall('datasets')
# zip_ref.close()
# In[8]:
base_dir = './dataset... | true |
856befbf6a1094eb39565b989de68a10c39b9099 | Python | Spikhalskiy/invest-checker | /settings.py | UTF-8 | 626 | 2.71875 | 3 | [] | no_license | import ConfigParser
from functools import partial
from itertools import chain
class Helper:
def __init__(self, section, file):
self.readline = partial(next, chain(("[{0}]\n".format(section),), file, ("",)))
class Settings:
__MOCK_SECTION_NAME = "Foo"
__config = None
def __init__(self, file... | true |
2059d4ef90da157d9e4c0ad894b123e0f2687e0f | Python | hyperion-ml/hyperion | /hyperion/utils/list_utils.py | UTF-8 | 4,374 | 3.484375 | 3 | [
"Apache-2.0"
] | permissive | """
Copyright 2018 Johns Hopkins University (Author: Jesus Villalba)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Utilities for lists.
"""
import numpy as np
from operator import itemgetter
from itertools import groupby
def list2ndarray(a, dtype=None):
"""Converts python string list to string nu... | true |
08dee0ded4896ecb1c55e7b195e50ac2f32e0a7f | Python | shaimarus/ML | /utilities.py | UTF-8 | 9,732 | 2.78125 | 3 | [] | no_license | import cx_Oracle as __orcl
import datetime as __datetime
import pandas as __pd
import numpy as __np
import matplotlib.pyplot as __plt
import seaborn as __sns
def __get_oracle_datatypes_from_df(df):
d = {
'int64':'number',
'float64':'number',
'datetime64[ns]':'date',
'object':'varcha... | true |
4fba073edf4542b7e009b0ef38bb3f6f86bac14e | Python | preethika2308/code-kata | /midv.py | UTF-8 | 72 | 2.90625 | 3 | [] | no_license | nj = int(input())
num = input().split()
mid = num[int(nj/2)]
print(mid)
| true |
a49eee43d7240c0b5cf227e1ab7843b4d6012b18 | Python | Code360In/07122020PYLVC | /day_01/transcripts/trans_string.py | UTF-8 | 6,539 | 3.546875 | 4 | [] | no_license | Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> s = "python"
>>> type(s)
<class 'str'>
>>>
>>>
>>> type(s) == "<class 'str'>"
False
>>> type(s) == 'str'
False
>>> type(s)
<class 'str'>... | true |
0a0a9c82d0d6c35a38734a197301fa19470c9e31 | Python | nasum121/73ch13 | /common_prefix_of_strin.py | UTF-8 | 2,159 | 2.9375 | 3 | [] | no_license | n=int(input())
if n==2:
string1=input()
string2=input()
s1=list(string1)
s2=list(string2)
new_word=[]
a=len(s1)
b=len(s2)
if a>b:
count=b
else:
count=a
for i in range(count):
if s1[i]==s2[i]:
new_word.append(s1[i])
new="".join(new_word)
... | true |
efbfc992109c5e2411839cbbce8c92125b0c50bb | Python | banuaksom/holbertonschool-higher_level_programming | /0x03-python-data_structures/9-max_integer.py | UTF-8 | 230 | 3.21875 | 3 | [] | no_license | #!/usr/bin/python3
def max_integer(my_list=[]):
if my_list:
max_number = my_list[0]
for i in my_list[1:]:
if max_number < i:
max_number = i
return max_number
return None
| true |
79c2b48729c938c14b07168525a6fe96da932469 | Python | Avineshwaran/RFIDUHF | /database.py | UTF-8 | 7,062 | 2.546875 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
import __main__
from pip._vendor.pkg_resources import null_ns_handler
#def create_database():
def create_connection(db_file):
"""Create a database connection to the DB file test.db"""
try:
conn = sqlite3.connect(db_file)
print (" Create a connection to... | true |
cb5e20121ca396d66363f06d6ac9a6725c4492d6 | Python | ksubrama/astr301 | /ps6/ps6.py | UTF-8 | 2,707 | 2.953125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf as pdf
import numpy as np
import scipy.constants as sc
import scipy.optimize as opt
import sys
def planck_lam(lam, T):
return ((2 * sc.h * (sc.c ** 2) / (lam ** 5)) /
(np.exp(sc.h * sc.c / (lam * sc.k * T)) - 1))
def planck_nu(nu, T)... | true |
9eae8a09ab536ab6142c81835a84f30952f6de1e | Python | chicobentojr/python-exercicios | /exercicio-v/questao-1.py | UTF-8 | 957 | 3.875 | 4 | [] | no_license | """
Classe Animal para operações usando pickle
"""
import pickle
class Animal(object):
def __init__(self):
self.nome = ''
self.especie = ''
self.genero = ''
self.peso = 0.0
self.altura = 0.0
self.idade = 0
def salvar(self):
pickle.dump(self, open('anima... | true |
ab474f15e33d54d89f4ba8c2699e080646273ca4 | Python | justinaustin/graphql-compiler | /graphql_compiler/backend.py | UTF-8 | 1,810 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | # Copyright 2019-present Kensho Technologies, LLC.
from collections import namedtuple
from .compiler import (
emit_cypher,
emit_gremlin,
emit_match,
emit_sql,
ir_lowering_cypher,
ir_lowering_gremlin,
ir_lowering_match,
ir_lowering_sql,
)
from .schema import schema_info
# A backend is ... | true |
1a43b88a744abf9aecccf4200225720725bd62ee | Python | contranton/IIC2233 | /Actividades/AC09/main.py | UTF-8 | 5,746 | 3.53125 | 4 | [] | no_license | """
-- main.py --
Este módulo cuenta con tres clases:
- Tarea,
- Programador,
- Administrador.
"""
from itertools import count
from collections import deque
from random import randint, random
import threading
import time
TOTAL = 8 * 60 * 60 # segundos de simulación --> ocho horas
VELOCIDAD = 3600 # rapidez seg... | true |
2bef0c753fcb4a70453421a22170f27f2c0ff7f3 | Python | bpinkert/bitcoin-calc | /btc_calc.py | UTF-8 | 2,456 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import requests
import json
class BitcoinWorker:
def __init__(self):
self.difficulty = ""
self.hashrate = ""
self.wattage = ""
self.wattcost = ""
self.dailycost = ""
#self.exchrate = get_exchangerate()
#ask for information first
def ask_poolcosts(self):
# the pool maintainer's... | true |
dfaf19e155e81f9a595c601f1493b8af19286b15 | Python | SownBanana/Scaler | /Forecast/forecast.py | UTF-8 | 2,279 | 2.734375 | 3 | [] | no_license | import pandas as pd
import statsmodels.api as sm
import matplotlib.pyplot as plt
path = '../Data/task_events/task_events_cpu/part-{}-of-00500.csv'
ROUND = 120
CUT = ROUND - 1
class Sarima:
def __init__(self, file):
# file là mảng index dữ liệu lấy để dự đoán
# mỗi file chứa khoản thời gian dự đo... | true |
6793ab6c6a3b55f570300246282368227d5cd7fe | Python | aoe1928/my-python-code | /d-Redistribution.py | UTF-8 | 619 | 2.75 | 3 | [] | no_license | # s_num = int(input())
def comb_func(n):
if n == 1 or n == 2:
return {}
elif 3 <= n <= 5:
return {(n,)}
else:
new_set = set()
for c in comb_func(n-1):
# print(c)
for m, i in enumerate(c):
lis = list(c)
# print(m, i)
... | true |
b951c6298d875f95ddb228658353be08f2c4b2f2 | Python | jaoyama73/svm | /mp3_starter_package/mp3.py | UTF-8 | 2,010 | 2.828125 | 3 | [] | no_license | # Starter code for CS 165B HW3
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.svm import LinearSVC
from sklearn import svm
from nltk.c... | true |
b3d946f3591620e402fa8068388eedcf3b9346e0 | Python | awsk1994/DailyCodingProblems | /Problems/day24.py | UTF-8 | 2,509 | 4.34375 | 4 | [] | no_license | '''
This problem was asked by Google.
Implement locking in a binary tree. A binary tree node can be locked or unlocked only if all of its descendants or ancestors are not locked.
Design a binary tree node class with the following methods:
is_locked, which returns whether the node is locked
lock, which attempts to lo... | true |
f00773dd29ea66c2cb8ed80a241e749ea112a489 | Python | anirban-code-to-live/Mars-Orbit-Predictor | /Module-I/SecondProblem.py | UTF-8 | 3,262 | 2.890625 | 3 | [] | no_license | import numpy as np
import math
from scipy.optimize import minimize
class SecondProblem:
def __init__(self, triangulation_index_pair,
triangulation_earth_heliocentric_longitude_in_radian,
triangulation_mars_geocentric_longitude_in_radian):
self._triangulation_index_pair ... | true |
ab606f0d6d94c09f377810a16faffa995a7a1272 | Python | yeongwooCho/Mini_Shopping_Mall | /shopping_django/order/models.py | UTF-8 | 1,046 | 2.515625 | 3 | [] | no_license | from django.db import models
# Create your models here.
class Order(models.Model):
# 누가 주문한지 알기위해 (parameter는 앱안에.모델을 사용한다는 의미이다.)
# ForeignKey를 사용할 때는 on_delete 라는 속성값을 지정해 줘야한다.
# 사용자가 살제되면 어떻게 할 것인가, 삭제할것인가 말것인가? 삭제하도록 설정
objects = models.Manager()
shopuser = models.ForeignKey(
'shopu... | true |
d90ac9508b1a861cc37999cb53515b8776cbb2fa | Python | xianping/leetcode | /LRUCache/LRUCache.py | UTF-8 | 1,857 | 3.25 | 3 | [] | no_license | #!/usr/bin/python
import time,sys,operator
#Definition for a point
class LRUCache:
# @param capacity, an integer
def __init__(self, capacity):
self.capacity = capacity
self.dict_cache = {}
self.dict_key2ts = {}
# @return an integer
def get(self, key):
if key in self.dict_... | true |
ff115ed26642033e386947ca9228db1997c904c7 | Python | globality-corp/microcosm-postgres | /microcosm_postgres/tests/factories/test_engine.py | UTF-8 | 930 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """
Factory tests.
"""
from os import environ
from hamcrest import (
assert_that,
ends_with,
equal_to,
is_,
starts_with,
)
from microcosm.api import create_object_graph
from sqlalchemy.engine.base import Engine
from sqlalchemy.sql import text
def test_configure_engine():
"""
Engine facto... | true |
a62962a58a64101fccabba873eca043f2f1f8e29 | Python | RecursiveMatrix/leetcode_algorithm | /2.add two numbers.py | UTF-8 | 3,561 | 4.3125 | 4 | [] | no_license | # Given two non-empty linked lists representing two non-negative integers. The digits
# are stored in reverse order and each of their nodes contain a single digit. Add the
# two numbers and return it as a linked list.
# Explaination: (2->4->3) + (5->6->4) return (7->0->8)
# since 243 + 564 = 708
class ListNode:
d... | true |