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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e6e7c893aed1a560826d905feab545ef4384fdb1 | Python | ningCherry/django_test | /ttsx2/booktest/views.py | UTF-8 | 3,012 | 2.734375 | 3 | [] | no_license | from django.shortcuts import render,redirect
from django.http import HttpResponse,HttpResponseRedirect
# Create your views here.
def index(request):
return HttpResponse('hello cherry!')
def detail(request,p):
return HttpResponse(p)
def detail1(request,p1,p2,p3):
return HttpResponse('years-{},month-{},da... | true |
dcf9b5ae1489bb6e201a9a28dc15d8b40f725ce4 | Python | mabioo/Python-codewar | /20.求整数的字母转化/test.py | UTF-8 | 1,358 | 3.59375 | 4 | [] | no_license | def factorial(n):
S = 1
while n>0:
S=S*n
n = n-1
return S
def dec2FactString(nb):
i = 1
targetList = ""
while (nb >= factorial(i)):
i = i+1
i = i-1
print (i)
while i>=0:
j = 1
while nb>=factorial(i)*j:
j = j+1
j =j-1
... | true |
8ed82d568191c9cb7296aa60ae84ef283ea82ca3 | Python | 26tanishabanik/Interview-Coding-Questions | /Strings/ScoreOfParenthesis.py | UTF-8 | 740 | 4.09375 | 4 | [
"MIT"
] | permissive | """
Given a balanced parentheses string s, compute the score of the string based on the following rule:
() has score 1
AB has score A + B, where A and B are balanced parentheses strings.
(A) has score 2 * A, where A is a balanced parentheses string.
"""
def scoreOfParentheses(s) -> int:
stack = []
ans = 0
... | true |
1f899320f5038d20473df3cced4bc2d3d3260fa9 | Python | tonngw/leetcode | /python/1299-replace-elements-with-greatest-element-on-right-side.py | UTF-8 | 265 | 2.765625 | 3 | [
"MIT"
] | permissive | class Solution:
def replaceElements(self, arr: List[int]) -> List[int]:
rightMax = -1
for i in range(len(arr) -1, -1, -1):
newMax = max(rightMax, arr[i])
arr[i] = rightMax
rightMax = newMax
return arr
| true |
f38dff6fdee210c53d9ff94f987ef88ac0705b55 | Python | frohman04/advent-2017 | /18/main_181.py | UTF-8 | 6,340 | 2.84375 | 3 | [] | no_license | import abc
import fileinput
import logging
import sys
from typing import List
import unittest
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class RegisterFile(object):
def __init__(self):
self._file = {
'pc': 0,
'snd': 0
}
self._file... | true |
6bc3706c2d029e4b2042db109a57373aa932609b | Python | gnprice/ssns-manip | /ssns-manip | UTF-8 | 5,750 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
from dataclasses import dataclass
from datetime import datetime, timedelta
import io
import os
import re
import struct
import sys
from typing import List, Optional, Tuple
import click
def log(*args):
print(*args, file=sys.stderr)
@dataclass
class Instruction:
'''What to do with a par... | true |
4abadb77953d766488c4ee3c5f374edd89550b04 | Python | wavce/classificationx | /core/optimizers/gradient_centralization.py | UTF-8 | 16,220 | 2.546875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MulanPSL-1.0",
"LicenseRef-scancode-mulanpsl-1.0-en"
] | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import ops
from tensorflow.python.keras.optimizer_v2 import optimizer_v2
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.p... | true |
90e0ba8a4e90b287245ab7fc456871491be081c5 | Python | bowen903/python_study | /python_study_0121.py | UTF-8 | 435 | 3.28125 | 3 | [] | no_license | # encoding: utf-8
"""
@author: Xiaoping
@file: python_study_0121.py
@time: 2017/9/10 21:34
"""
#爱奇艺编程题 最长周长的三角形
while True:
try:
s1=raw_input().split()
print s1
s = []
for i in s1:
s.append(int(i))
s.sort()
print s
if s[0]+s[1]>s[2]:
pr... | true |
0c01b140ac6224c274ea0c460ffc0fb1c0bd97ab | Python | curieuxjy/DS-for-PPM | /day3/untitled26.py | UTF-8 | 1,678 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from sklearn import neighbors
m = 1000
X = -1.5 + 3*np.random.uniform(size = (m,2))
y = np.zeros([m,1])
for i in range(m):
if np.linalg.norm(X[i,:], 2) <= 1:
y[i] = 1
C1 = np.where(y == 1)[0]
C0 = np.where(y == 0)[0]
thet... | true |
a2dda3f596017778356f63b1dbd11ec1a8ca800d | Python | Lakshit-Karsoliya/PythonProjects | /NoteApplication.py | UTF-8 | 3,707 | 3.046875 | 3 | [] | no_license | import tkinter
import os
from tkinter.simpledialog import *
from tkinter.scrolledtext import *
from tkinter.messagebox import *
from tkinter import *
import time
root=Tk()
root.update()
root.geometry("300x250+300+300")
root.minsize(height=500,width=500)
root.title("NoteApplication")
#--------THEME COLOR VARIABLES--#
... | true |
05245c8cae3a6976fe8b11e0ad14adabf60c01c9 | Python | CianciuStyles/CodeEval | /Easy/Capitalize Words.py | UTF-8 | 226 | 2.84375 | 3 | [] | no_license | import itertools
import sys
with open(sys.argv[1], 'r') as test_cases:
for test in test_cases:
if test == "":
continue
words = test.strip().split(' ')
print(' '.join([word[0].upper() + word[1:] for word in words])) | true |
617571ac0f179fa704572a6fd678e242bcb05a18 | Python | MrSamuelLaw/Grabbit | /modules/database/tools.py | UTF-8 | 3,530 | 3.15625 | 3 | [] | no_license | import sqlite3
from sqlite3 import Cursor, Connection
from pathlib import Path
from typing import Tuple, Union
from urllib.parse import urlparse
from modules.database.models import TableModel
from modules.scrapers import GritrScraper
class Tools():
# =========== available scrapers ===========
scrapers = [
... | true |
28452e10c6b0888875a3856517a9e4c9e1057f02 | Python | mikejaron1/NLP_side_project | /Text_Clustering.py | UTF-8 | 2,834 | 2.734375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import nltk
import re
import os
import codecs
from sklearn import feature_extraction
# import mpld3b
from nltk.stem.snowball import SnowballStemmer
from sklearn.feature_extraction.text import TfidfVectorizer
# nltk.download()
stopwords = nltk.corpus.stopwords.words('english')
... | true |
41fd58d73e329e30f3e739a3d25120b8672275e6 | Python | Python3pkg/GooseMPL | /examples/plot-cmap.py | UTF-8 | 742 | 2.875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
plt.style.use(['goose','goose-latex'])
x = np.linspace(0, 5, 100)
N = 21
cmap = plt.get_cmap('jet',N)
fig,ax = plt.subplots()
# N.B. to modify the aspect ratio one could replace this line by:
# fig = plt.figure... | true |
1b2f084ac7c6e973bc91f54d558539d100f68329 | Python | DimitriKnd/Skillup_courseP | /DZ01.py | UTF-8 | 509 | 4.25 | 4 | [] | no_license |
a = int(input("Enter 1st number: "))
b = int(input("Enter 2nd number: "))
c = int(input("Enter 3rd number: "))
d = int(input("input 1 to obtain the sum or 2 to obtain the product: "))
if d == 1 :
print("a+b+c =", a+b+c)
if d == 2:
print("axbxc =", a*b*c)
if d != 1 and d != 2:
print("you put a wrong v... | true |
e2e5fe5943f9d0c3503a3c14b4df7ade8f90fd3d | Python | 0xvon/find-similar-pokemon | /main.py | UTF-8 | 2,024 | 2.78125 | 3 | [] | no_license | import cv2
import os
def calc_feature(img_path: str, detector: cv2.ORB_create()):
IMG_SIZE = (100, 100)
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
img = cv2.resize(img, IMG_SIZE)
# 特微量算出
return detector.detectAndCompute(img, None)
# 表示
def show_imgs_match(file):
img1 = cv2.imread('./... | true |
d3b72e0f58a156a59dc7007bbfe12b6f1cc68909 | Python | daelynj/Distributed-Particle-System | /src/client.py | UTF-8 | 3,231 | 2.734375 | 3 | [] | no_license | import grpc
import os
import pygame
import sys
import threading
import time
from queue import Queue
from pygame.locals import *
import proto.particle_system_pb2 as ps
import proto.particle_system_pb2_grpc as rpc
FPS = 30
WINDOW_WIDTH = 1366
WINDOW_HEIGHT = 768
WHITE = (255, 255, 255)
DARK_GREY = (105, 105, 105)
GR... | true |
bcc3f2d8aaf9c31a68ad27f36a5e4fb1237010df | Python | cylinder-lee-cn/LeetCode | /LeetCode/872.py | UTF-8 | 1,680 | 4.84375 | 5 | [] | no_license | """
872. 叶子相似的树
请考虑一颗二叉树上所有的叶子,这些叶子的值按从左到右的顺序排列形成一个 叶值序列 。
872-1.png
举个例子,如上图所示,给定一颗叶值序列为 (6, 7, 4, 9, 8) 的树。
如果有两颗二叉树的叶值序列是相同,那么我们就认为它们是 叶相似 的。
如果给定的两个头结点分别为 root1 和 root2 的树是叶相似的,则返回 true;否则返回 false 。
提示:
给定的两颗树可能会有 1 到 100 个结点。
"""
# Definition for a binary tree node.
# class TreeNode:
# ... | true |
8bfae8b384ad8dacbb3e695b8b51d54a4a1b3f6b | Python | jntp/ForecastSend2.0 | /forecastsend.py | UTF-8 | 11,146 | 2.84375 | 3 | [] | no_license | # main.py is the main python file of ForecastSend2.0 application
import math
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import ObjectProperty
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.uix.... | true |
a1501f46d7450524babb295f3369ab54d0599bf8 | Python | yangjingScarlett/pythonlearning | /a_basicPython/1operator/compare_operator.py | UTF-8 | 476 | 3.546875 | 4 | [] | no_license | # coding=utf-8
a = 21
b = 10
c = 0
if a == b:
print a, " == ", b
else:
print a, " not == ", b
if a != b:
print a, " != ", b
else:
print a, " == ", b
if a < b:
print a, " < ", b
else:
print a, " not < ", b
if a > b:
print a, " > ", b
else:
print a, " not > ", b
# 修改变量 a 和 b 的值
a = 5
... | true |
221732c74d774907b347eebcbf1955d593de4b1a | Python | TalWeisler/Ed-Hitting-Set | /Sunflower.py | UTF-8 | 2,335 | 2.671875 | 3 | [] | no_license | import numpy as np
import math
import copy
def sunflowerAlgorithm(h):
for i in range(h.edges - 1, -1, -1):
if not (h.e_degree[i] == 0):
h.is_dup(h.matrix[:, i], i - 1)
for i in range(h.edges - 1, -1, -1):
if h.e_degree[i] == 0 : # empty edge or edge.degree < h.d
... | true |
0cdc53bffe4f2ce28e20fd4e268f109c30a53392 | Python | nihalmenon/BreastCancerMalignanceClassifier | /main.py | UTF-8 | 1,345 | 2.90625 | 3 | [] | no_license | import sklearn
from sklearn.utils import shuffle
import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn import linear_model, preprocessing
data = pd.read_csv("breast-w_csv.csv")
le = preprocessing.LabelEncoder()
cls = le.fit_transform(list(data["Class"]))
predict = "cl... | true |
23d3cfef3d82ffd7618834d430d693299d490c80 | Python | guangyaai/DARPA | /mid-phase1-text-modality-NetScale/src/splitDB.py | UTF-8 | 4,209 | 3.25 | 3 | [] | no_license | # splitDB.py
# this code splits the dataset into subsets
# these separate dbs can then be used for training/testing
# arguments: dbName perc1 perc2 .. percN
# generates N+1 db files that split dbName into the
# corresponding percentages
# each perc argument should be [1 - 99], and they should
# sum to < 100
from OpenT... | true |
972379ad6d0f2445567252d4c63b7bac83e08e56 | Python | wammar/wammar-utils | /prune-long-lines.py | UTF-8 | 958 | 2.84375 | 3 | [] | no_license | import re
import time
import io
import sys
import argparse
from collections import defaultdict
# parse/validate arguments
argParser = argparse.ArgumentParser()
argParser.add_argument("-tokens", type=str, help="prune line if it has more than this many tokens")
argParser.add_argument("-in", "--input_filename", type=str,... | true |
b38da6187db5fd5e6733b9309517c6e8db538314 | Python | Sidray-Infinity/Buffer | /nextRight.py | UTF-8 | 527 | 3.640625 | 4 | [] | no_license | class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
def mark(root):
if(root != None):
mark(root.right)
mark(root.left)
print(roo... | true |
75a3f3c0db1ba0c9cd4a51b2c35eed664ef6641b | Python | art2mkl/projet_IMDB | /.ipynb_checkpoints/scraping-checkpoint.py | UTF-8 | 5,907 | 2.984375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
# à intégrer dans le fichier .py
class Dbase:
def connect_IMDB(self,i):
url = f"https://www.imdb.com/search/title/?groups=top_250&sort=user_rating,desc&start={i}&ref_=adv_nxt"
response = requests.get(url)
... | true |
827910685def873f54e6a63cf37f9ee00a978458 | Python | sgeorgiev87/QuickBaseExercise | /WebDriverIO/common/page_objects.py | UTF-8 | 6,762 | 2.796875 | 3 | [] | no_license | from WebDriverIO.common.page_objects_selectors import *
from Configuration.BasePage import *
from selenium.webdriver.common.keys import Keys
class HomePage(BasePage):
def __init__(self, driver, timeout=10):
BasePage.__init__(self, driver=driver, timeout=timeout)
def open_homepage(self, url):
... | true |
81b5f9182c225ab11e3f38294193e367b4eb8b68 | Python | CharlesMontgomery2/Python-Class-Exercises | /Files and Exceptions/welcome_guest.py | UTF-8 | 1,006 | 4.75 | 5 | [] | no_license | # 2) Write a while loop that prompts users for their name.
# When they enter their name, print a greeting to the screen and add a line recording their visit in a file called guest_book.txt.
# Make sure each entry appears on a new line in the file.
file = "guest_book.txt" # create a txt file
print("Enter 'quit' when... | true |
24245eabcd7a1a36b3597fbc56be664b93fc2688 | Python | jonvaljean/pidev14 | /lwcycler.py | UTF-8 | 1,472 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
#Simple LED-Warrior14 scratch for send data
from __future__ import print_function
import sys
import time
import smbus #use smbus for i2c
from time import sleep
from lwheadmodule import *
#modify this model according to requirements of setting
NR_ARGS = 4
#run the programm
if __name__ == "__m... | true |
00d690f06d89dfd7156ac4b599023d5ae9f8c85a | Python | L200183043/Praktikum-Algopro | /Kegiatan 1.py | UTF-8 | 374 | 3.140625 | 3 | [] | no_license | x = {"Segitiga":"L = 0.5 * a * t" ,
"Persegi":"L = s * * 2" ,
"Persegi panjang":"L = p * l" ,
"lingkaran":"L = pi * r * * 2" ,
"Jajaran genjang":"L = a * t" }
print "|%-4s||%-17s||%-17s"%("No", "Nama Bangun", "Rumus Luas")
print "|%-4s||%-17s||%-17s"%("-"*4, "-"*7, "-"*17)
a = 1
for i in ... | true |
aa5bee1997a1ae3f9bd249acc000e3661460e1c8 | Python | sarvex/commons | /src/python/twitter/common/metrics/gauge.py | UTF-8 | 3,774 | 3.09375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | # ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | true |
3312b616a7e3cc08f43c50464ee74d63a8ae3808 | Python | stanleychilton/portfolio | /exmaple files/testcode/painter1.py | UTF-8 | 9,458 | 2.734375 | 3 | [] | no_license | import pygame
pygame.init()
white = (255,255,255)
red = (255,0,0)
light_red = (220,0,0)
green = (0,220,0)
light_green = (0,255,0)
blue = (0,0,255)
light_blue = (0,0,220)
black = (0,0,0)
grey = (220,220,220)
orange = (229,160,11)
light_orange = (234,165,16)
pink = (231,62,238)
light_pink = (236,67,242)
yellow = (238,2... | true |
b0c08bbdd4b99356480d9d930ad5d12b3e697c26 | Python | Sophie-Williams/GameAI-DoomBot | /TF_DoomBot_LDQN/ReplayMemory.py | UTF-8 | 2,435 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 22 18:56:04 2018
@author: jk
Paul Murray
This file holds to replymemory class to enable minibatch optimazation
"""
from __future__ import division
from __future__ import print_function
from vizdoom import *
import itertools as it
from random import ... | true |
eefe5df76f4125a48d22044328b67fae79f40751 | Python | tottaz/Basic-Python-RESTful-Server | /env/lib/python2.7/site-packages/luminoso_api/jstime.py | UTF-8 | 464 | 3.265625 | 3 | [] | no_license | # Load timestamp methods
from datetime import datetime
from time import mktime
def datetime2epoch(dt):
"""Convert a datetime object into milliseconds from epoch"""
return int(mktime(dt.timetuple())*1000)
def epoch2datetime(t):
"""Convert milliseconds from epoch to a local datetime object"""
return dat... | true |
e59d4bd1b37ab1d3cb3cae16d88739aa302f6c53 | Python | SoftwareDeveloper007/Automate-Functional-Tests-for-Web-App-and-Chrome-Extension | /Steps/C011.py | UTF-8 | 7,060 | 2.796875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC
from sele... | true |
3fc5d494421745e5d6b428271db091a77d05f1c0 | Python | jessicagainesbmi203/Final_Project_Skeleton | /scripts/NN.py | UTF-8 | 5,363 | 2.671875 | 3 | [] | no_license | import numpy as np
class NeuralNetwork:
#def __init__(self, setup=[[68,25,"sigmoid",0],[25,1,"sigmoid",0]],lr=.05,seed=1,error_rate=0,bias=1,iter=500,lamba=.00001,simple=0):
def __init__(self,inputs,outputs,activation='sigmoid',lr=0.05,bias=1,iter=500,lamda=0.00001,shape=(8,3,8)):
self.activation = 'si... | true |
0af8fcbb15cec7f5661675e4fafc96948418e7e5 | Python | pints-team/pints | /pints/toy/_beeler_reuter_model.py | UTF-8 | 8,168 | 2.875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | #
# Beeler-Reuter model for mammalian ventricular action potential.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import numpy as np
import pints
import scipy.integr... | true |
0b6ea6aa676345a0fd148c998945b8ba71955f1a | Python | xuefenga616/mygit | /ML_stu/Kaggle/CatVsDog/numpy_test.py | UTF-8 | 613 | 3.296875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
# a = tf.random_normal((100, 100))
# b = tf.random_normal((100, 500))
# c = tf.matmul(a, b)
# sess = tf.InteractiveSession()
# print(sess.run(c))
import matplotlib.pyplot as plt
x = np.arange(0., np.e, 0.01)
y1 = np.exp(-x)
y2 = np.log(x)
fig = plt.figure()
ax1 = fig.add_... | true |
fc5a455d6749c0d8bce1776acb53968fc3bc2071 | Python | lanstonpeng/Squirrel | /lanstonpeng/Distinct_Subsequences_sub_problem.py | UTF-8 | 553 | 2.921875 | 3 | [] | no_license | import pdb
S = "rabbbit"
T = "rabbit"
result = []
def combination(s,n):
temp = ""
for i in range(1,len(s)):
temp = temp + combination(s[i:],n - i)
if n == 0:
result.append(temp)
return ""
else:
return temp
t = []
r = []
def combination2(start,end):
#pdb.set_trace()
... | true |
194de15022e3d667b125bc2a38641e773bb38c17 | Python | wachira90/python-ssl | /check-ssl-expire.py | UTF-8 | 681 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import OpenSSL
import ssl, socket
import argparse
# get domain
parser = argparse.ArgumentParser()
parser.add_argument("domain")
args = parser.parse_args()
domain = args.domain
# get SSL Cert info
cert = ssl.get_server_certificate((domain, 443))
x509 = OpenSSL.crypto.load... | true |
bf91e997b76e577f6f8c536c87e2b90ef371ce3a | Python | pandeconscious/leetcode | /course_schedule/course_schedule.py | UTF-8 | 1,015 | 3.234375 | 3 | [] | no_license | class Solution(object):
def _cycle(self, node):
if self.visited[node] == 0:
self.visited[node] = 1
for nbr in self.adj_list[node]:
if self.visited[nbr] == 0:
if self._cycle(nbr):
return True
elif self.visited[nbr] == 1:
... | true |
79056ae5955608b392a6a92b9fb23993e9393e43 | Python | charleschestnut/PracticasAII | /EXAMEN-WHOOSH/Lisa-Code.py | UTF-8 | 5,089 | 2.6875 | 3 | [] | no_license | '''
Created on 19.11.2018
@author: Lisa
'''
'''
Created on 19.11.2018
@author: Lisa
'''
from tkinter import *
from tkinter import messagebox
import os
from whoosh.index import create_in,open_dir
from whoosh.fields import Schema, TEXT, KEYWORD, DATETIME, NUMERIC
from whoosh.qparser import QueryParser
import urllib.req... | true |
4adc7865cf5223b1cee9b7c2aceb28871247b3a1 | Python | Sridhar-R/Python-basic-programs | /ques4.py | UTF-8 | 233 | 3.515625 | 4 | [] | no_license | a = input("Enter the number between 1 and 20 : " )
b = 0
def diction():
d=dict()
for i in range(1,21):
d[i]=i**2
print d[i]
if (a < 21):
diction()
else:
print "Please Enter the number between 1 and 20 "
| true |
cfc6f5ce716347b700be0a9c2c7b22d354cbada2 | Python | alexandraback/datacollection | /solutions_2453486_0/Python/ymgve/prog.py | UTF-8 | 1,604 | 2.828125 | 3 | [] | no_license | import sys
import psyco; psyco.full()
def main():
f = open(sys.argv[1], "rb")
ncases = int(f.readline())
for i in xrange(ncases):
s = ""
for j in xrange(4):
s += f.readline().strip()
f.readline()
if len(s) != 16:
raise "WTF not proper bo... | true |
d498a81c79188de4bc4eb4e6682f25215dad2fff | Python | emilberwald/mathematics | /tests/number_theory/test_combinatorics.py | UTF-8 | 7,636 | 3.09375 | 3 | [] | no_license | import itertools
from math import gamma
import numpy as np
import pytest
from pytest import raises
from mathematics.number_theory.combinatorics import *
from mathematics.tools.decorators import timeout
from .. import name_func
class TestRiffleShuffles:
def test_riffle_shuffles(self):
"""
https://en.w... | true |
ba71163091e266132dcfd586e6b7ce8f5b514385 | Python | alextimofeev272/rosalind | /PROT.py | UTF-8 | 1,205 | 2.609375 | 3 | [] | no_license | #coding: utf_8
#Дана цепочка РНК, мРНК(матричная РНК)
#Построить протеин
a = ('UUU','CUU','AUU','GUU','UUC','CUC','AUC','GUC','UUA','CUA','AUA','GUA')
a = a + ('UUG','CUG','AUG','GUG','UCU','CCU','ACU','GCU','UCC','CCC','ACC','GCC')
a = a + ('UCA','CCA','ACA','GCA','UCG','CCG','ACG','GCG','UAU','CAU','AAU','GAU')
a =... | true |
cab2311fe58ae58fc507296d0865284183ddb8a7 | Python | L-ingqin12/LanQiaoCup-Python | /src/2 基础练习/基础练习 十六进制转十进制.py | UTF-8 | 361 | 3.21875 | 3 | [] | no_license | #第一种无脑函数法
'''
print(int(eval('0x'+input())))
'''
#第二种要自己写进制转换的算法(这个也A了...)
def sixteen2ten(n):
ten = 0
for i in range(len(n)):
c = n[-i-1]
if c.isalpha():
c = ord(c)-55
else:
c = int(c)
ten += c*16**i
return ten
print(sixteen2ten(input()))
| true |
ba427af0d390f07dcd9313b63e402f1e1097731a | Python | Aasthaengg/IBMdataset | /Python_codes/p02861/s399988311.py | UTF-8 | 233 | 2.921875 | 3 | [] | no_license | import math
X=list()
Y=list()
s=0
N=int(input())
for i in range(N):
x,y=map(int,input().split())
X.append(x)
Y.append(y)
for i in range(N):
for j in range(N):
s+=math.sqrt(((X[i]-X[j])**2)+((Y[i]-Y[j])**2))
print(s*(1/N)) | true |
d3438687f1fc937617f3f218dcf0e80bfdd42fa5 | Python | Nexosis/nexosisclient-py | /nexosisapi/vocabulary_summary.py | UTF-8 | 2,029 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from nexosisapi.data_source_type import DataSourceType
import dateutil.parser
class VocabularySummary(object):
"""Summary information about a Vocabulary"""
def __init__(self, data_dict=None):
if data_dict is None:
data_dict = {}
self._id = data_dict.get('id', None)
self._d... | true |
28f69959a6d9b1a7ef1f0d94fb0d640b31ebc3d5 | Python | siyujiang7/NBC_competition | /try.py | UTF-8 | 38 | 2.78125 | 3 | [] | no_license | n = ['a','b','c'].index('d')
print(n) | true |
88a05c27da11084101abef237fac1fbeefacb8fd | Python | diane630/Diane-LeetCode | /133. Clone Graph.py | UTF-8 | 1,191 | 3.46875 | 3 | [] | no_license | """
# Definition for a Node.
class Node:
def __init__(self, val = 0, neighbors = None):
self.val = val
self.neighbors = neighbors if neighbors is not None else []
"""
class Solution:
def __init__(self):
self.visited = {}
def cloneGraph(self, node: 'Node') -> 'Node':
... | true |
d9977159e18cae200eb566118b1407819fd83a91 | Python | WesleyCastilho/CodeSignalChallenges | /arrays/rotate_image/rotate_image.py | UTF-8 | 101 | 2.5625 | 3 | [] | no_license | class RotateImage:
def rotate_image(self):
return [list(reversed(x)) for x in zip(*self)] | true |
9ee97dc7b6de36ab5db8b904941dac258bdaadb2 | Python | jcagumbay/python-sorting | /test/test_sorting.py | UTF-8 | 382 | 3.171875 | 3 | [] | no_license | import pytest
from src.quick import Quick
from src.selection import Selection
from src.bubble import Bubble
class TestSorting:
@pytest.mark.parametrize("instance", [Selection(), Bubble(), Quick()])
def test_sort(self, instance):
unsorted = [1, 3, 2, 7, 8, 5]
expected_result = [1, 2, 3, 5, 7, ... | true |
95e329554c6db8df97c632f577f51b3c148bcb5c | Python | LiamAlexis/programacion-en-python | /clase 1/_5_Estructuras_selectivas.py | UTF-8 | 1,550 | 4.5625 | 5 | [] | no_license | """
Estructuras selectivas
"""
# operadores de comparacion
# > mayor que
# >= mayor o igual que
# < menor que
# <= menor o igual que
# == igual que
# != distinto que
# condiciones and, or y not
# if 2 > 1:
# print("2 es mayor que 1")
# if 2 >= 1:
# print("2 es mayor o igual que 1")
# if 2 < 3:
# p... | true |
5a885230c92420610bfc14b9bc0d35c6e79b9aa3 | Python | Anthncara/MEMO-PersonnalChallenges | /Python Challenges/SecondsToMinutesConverter/TimeConverteribrahim.py | UTF-8 | 883 | 3.890625 | 4 | [] | no_license | def convertMillis(millis):
seconds=(millis//1000)%60
minutes=(millis//(1000*60))%60
hours=(millis//(1000*60*60))%24
d = [hours,minutes,seconds]
return (d)
print("### This program converts milliseconds into hours, minutes, and seconds ###")
print("To exit the program, please type 'exit'")
print("Ple... | true |
64608e8e0efc2816e92c07cdce2fbb336a57b776 | Python | richardtguy/catanex | /app/orderbook.py | UTF-8 | 2,299 | 2.765625 | 3 | [] | no_license | import datetime
from operator import attrgetter
from queue import Queue
import logging
from app import models, db, app
import config
class Messenger():
"""
Add messages about executed trades to queue to send to clients by websocket connections
"""
def __init__(self, queue):
self.q = queue
def send_message(s... | true |
71c34a2954d646f2dc0544b42fc18750bac0e548 | Python | astrax/FormationPythonHAP2019-2020 | /docs/.src/cours2/solution/ex7.py | UTF-8 | 58 | 3.421875 | 3 | [] | no_license | x = []
for n in range(21):
x.append(n**2 + 1)
print(x) | true |
fd05fbc0df8e74f4863b2b6fa6c367d74c1f7471 | Python | libo999/DataFrameJK | /p5.py | UTF-8 | 2,202 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 24 14:26:47 2020
@author: Libo
作业题第5题
"""
def greedy_algorithm_p5(task_num, start_time, lasting_time):
time_now = 0 # 表示当前时间节点
task_finished_num = 0 # 已经完成的任务数量
tasks_list = [] # 每个时间节点安排的任务
max_start_time = max(start_time)
while t... | true |
000f2dcbe1b9f3886cd7392b44c28464cf20d4e0 | Python | enderyildirim/python_demo | /utils.py | UTF-8 | 262 | 2.71875 | 3 | [] | no_license | import yaml
class ConfigParser:
@staticmethod
def parse(path=None):
with open(path or "config.yaml", 'r') as stream:
try:
return yaml.safe_load(stream)
except Exception as err:
print(err)
| true |
9e83018645c7ac55055d00e9463363ea3c13108b | Python | wisec/restler-fuzzer | /restler/test_servers/test_socket.py | UTF-8 | 1,967 | 2.9375 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
""" Mock TCP socket that forwards requests/responses to/from a test server """
from test_servers.unit_test_server.unit_test_server import *
from engine.transport_layer.response import HttpResponse
class TestSocket(object):
__test__ = False
... | true |
c4ffe5e7f229ee9ff1728c37b6e3813265c4d2f0 | Python | eanikolaev/funnelsort | /gen_data.py | UTF-8 | 195 | 2.796875 | 3 | [] | no_license | import random
FILENAME = "data"
MAX = 100500
if __name__ == '__main__':
f = open(FILENAME, 'w')
for i in range(MAX):
f.write( str(random.randint(0,MAX)) + ' ' )
f.close()
| true |
f0dc9c08f6222924e7d80842a41af9824ba6ff4d | Python | narimiran/advent_of_code_2016 | /python/day_02.py | UTF-8 | 1,551 | 3.484375 | 3 | [] | no_license | with open('./inputs/02.txt', 'r') as infile:
puzzle = infile.readlines()
DIRECTIONS = {
'R': 1,
'L': -1,
'D': 1j,
'U': -1j,
}
KEYPAD_1 = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
KEYPAD_2 = [
[0, 0, 1, 0, 0],
[0, 2, 3, 4, 0],
[5, 6, 7, 8, 9],
[0, 'A','B','C', 0],... | true |
382a5a3c1e91c1612281ff8c6e8602a525f23b91 | Python | karsyboy/dc29_badge_generator | /badge_code_gen.py | UTF-8 | 1,209 | 3.078125 | 3 | [] | no_license | # PySerial is required to run this script make sure to install it with python3 and as sudo
import serial,io
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=1) # Make sure the serial device is set to the proper port
sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))
badge_str_1 = "CHANGE-ME" # First for characters o... | true |
59a291c07bf24e5bdc90a1c3b7bf34fb185376e6 | Python | alexlu07/AI_from_scratch | /NeuralNetwork/number_network.py | UTF-8 | 795 | 2.625 | 3 | [] | no_license | from network import Network
import numpy as np
import pandas as pd
class NumberNetwork(Network):
def __init__(self):
super().__init__(784, 128, 128, 10)
def train_with_dataset(self):
ip = np.load('mnist/train-images.npy')
ip = ip.reshape([ip.shape[0], -1])
ip = ip.astype("floa... | true |
6aea1f96edadbc3e1f5bc311388487aafc8fbbf7 | Python | mujizi/algo | /src/predict/bayes.py | UTF-8 | 977 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/9/3 下午12:11
# @Author : Benqi
import numpy as np
from base import Base
import util.load_data as load_data
class Bayes(Base):
"""bunch.metrix: like list, every list element is a sample data
predicted: 1d numpy.array,like a list
"""
def __init__(self, di... | true |
9bf4fa24446e052b78d3dd85594b3720ffa7666c | Python | gschen/where2go-python-test | /1906101038江来洪/day20191112/Test_2_10.py | UTF-8 | 249 | 3.109375 | 3 | [] | no_license | #输出华氏-摄氏温度转换表
l,u = map(int,input('请输入两个数:').split())
if l>u:
print('Invalid')
else:
print('fahr celsius')
f = l
while l<=f<=u:
c = 5*(f-32)/9
print(f,' ''%.1f'% c)
f += 2
| true |
fd13ca4f237ea6d5d15b51ba50dcaa991a342900 | Python | gunal89/python-Interview_workout | /class_static_mtd.py | UTF-8 | 1,130 | 2.859375 | 3 | [] | no_license | class clsstatic():
var1 = 'PARAMAGURU'
var2 = 'JAVA'
def set_ins(self):
self.var1 = "MUTHU"
def print_ins(self):
print "varl : ",self.var1
@classmethod
def set_cls(cls):
cls.var2 = 'PYTHON'
@classmethod
def print_cls(c... | true |
900c2d8ed30eccc38f96339375d12fcdcfc9fd6f | Python | 1ucian0/qiskit-terra | /qiskit/exceptions.py | UTF-8 | 3,582 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | true |
49944fa1d504075d1cf1df2a6dcde8e5db594800 | Python | Gasan66/Coursera | /The Basics of Python Programming/solution2.py | UTF-8 | 150 | 3.328125 | 3 | [] | no_license | def sum(a, b):
if b > 0:
b -= 1
a += 1
return sum(a, b)
return a
x, y = int(input()), int(input())
print(sum(x, y))
| true |
b11266823c60a4725fee173d50490058572ec073 | Python | 0000duck/METR4202-T6 | /robot_ws/catkin_ws/src/servo_node/scripts/servo_control.py~ | UTF-8 | 3,108 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import rospy
import RPi.GPIO as GPIO
import time
from std_msgs.msg import String
from control_logic_node.msg import CurrentJointState, DesJointState
from sensor_msgs.msg import JointState
ROBOT_FREQ = 10
class Servo_Controller:
# Desired joint states for all the servos
def cb_desired_... | true |
ec2f134b00548fad3bb54f5a85dc78bf7f062256 | Python | danipj/unicamp-mc906 | /project_3/tcgdataset/tcgcrop.py | UTF-8 | 848 | 2.53125 | 3 | [] | no_license | import os
import cv2
root_folder = "./dataset"
folders_path = os.listdir(root_folder)
target_size = (300, 238)
standard_size = (240,330)
# percorre todas as pastas no root folder
for folder in folders_path:
root_path = os.path.join(root_folder,folder)
files_path = os.listdir(root_path)
for file_path in ... | true |
7e8f79b28116b1a33da78a79caf295f6a6dc4e55 | Python | jonasanso/surveys | /surveys/tests.py | UTF-8 | 1,093 | 2.765625 | 3 | [] | no_license | from django.test import TestCase
from surveys.models import Survey, SurveyResponse
from surveys.exceptions import NoMoreAvailablePlacesError
class SurveyResponseModelTests(TestCase):
def test_reduce_available_places_after_creating_survey_response(self):
"""
Creating a survey response must reduce... | true |
f8f1e28ee4d088be10c7b9174d5df6fb855d97b6 | Python | andrew-hsiao/SDC | /T1/lenet.py | UTF-8 | 4,878 | 3.46875 | 3 | [] | no_license | """
LeNet Architecture
HINTS for layers:
Convolutional layers:
tf.nn.conv2d
tf.nn.max_pool
For preparing the convolutional layer output for the
fully connected layers.
tf.contrib.flatten
"""
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.c... | true |
23786af68b57cd9cea0bce8c2d898dbd02907eb9 | Python | David-Byrne/CART-ML | /driver.py | UTF-8 | 1,268 | 3.46875 | 3 | [] | no_license | import random
from statistics import mean, stdev
from cart import Cart
def main():
# read in and preprocess data
with open("owls15.csv") as file:
content = file.readlines()
data = []
for entry in content:
readings = entry.rstrip("\n").split(",")
attributes = [float(r) for r i... | true |
2df2295e596ddf4014b1fc5af0ce973c78a36c64 | Python | keskinselim/Numbers | /Numbers/Numbers.py | UTF-8 | 367 | 4.25 | 4 | [] | no_license | 25*25
#This is correct but you can not anything like this if you want to see it you should print it
print(25*25)
# or
number=25*25
print(number)
#in python you can use " + " , " - " , " * " , " / "
print(25+25)
print(25-5)
print(12*12)
print(12/4)
#you can check it type
type(34657)
#this is int but if you wr... | true |
92d666ae828ba6f885514652177c6ac1f616e323 | Python | legauchy/tp1TLI | /trace.py | UTF-8 | 4,473 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from math import *
def trace(function, xmin, xmax, nstep, output):
#output.write("x, %s\n" % function)
output.write("%!\n")
func_save = function
function = eval("lambda x:" + function)
x_values = []
y_values = []
ymin = sys.maxint
ymax = -sys.max... | true |
981e4e3bd53e0566118aa5369d5ac1cdcf9a4ef3 | Python | sevenlabs/pjabberd | /pjabberd.py | UTF-8 | 6,147 | 2.640625 | 3 | [] | no_license | """Main module for starting the server"""
import os, sys
import pjs.conf.conf
import logging
from pjs.db import DB, sqlite
class PJSLauncher:
"""The one and only instance of the server. This controls all other
components.
"""
def __init__(self):
"""Initializes the server data"""
self.... | true |
731781526c31f51761469c0e0d0204492c510d3a | Python | mobinrg/rpi_spark_drives | /JMRPiSpark/Drives/Display/RPiDisplay.py | UTF-8 | 5,466 | 2.75 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2018 Kunpeng Zhang
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | true |
4576375a8cbd4a1898ef589c3565c242f443e8ea | Python | chulkx/ejercicios_python_new | /Clase11/alquiler.py | UTF-8 | 790 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 27 03:17:42 2021
@author: chulke
"""
import numpy as np
import matplotlib.pyplot as plt
def ajuste_lineal_simple(x,y):
a = sum(((x - x.mean())*(y-y.mean()))) / sum(((x-x.mean())**2))
b = y.mean() - a*x.mean()
return a, b
superficie = ... | true |
7c3cb57fb66833a4c54314f35b4a309f523e3973 | Python | programmerQI/python | /CSCI2824/hw7/selSort.py | UTF-8 | 444 | 3.3125 | 3 | [] | no_license | def selSort(list):
l = len(list)
cnt = 0
for i in range(0, l):
min = list[i]
id = i;
for j in range(i + 1, l):
cnt = cnt + 1
if list[j] < min:
cnt = cnt + 2
min = list[j]
id = j
a = list[i]
list[i... | true |
deac99b3ee7fdef6453a837dd110740cd30fbc73 | Python | sontolesquad/Mrsontolexv2 | /module/SpamMail.py | UTF-8 | 4,396 | 2.59375 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | #!/usr/bin/python
# - Spammer-Email
# | Author: P4kL0nc4t
# | Date: 13/11/2017
# | Reupload: Mrsontolex
# | Date: 03/06/2018
# | Editing author will not make you the real coder :)
import argparse
import requests
import time
import datetime
import random
import string
import smtplib
print """\
/\/\/\/\/\/\/\/\/... | true |
d0e2a7d11407d8773b1a2866156a3d7bafd8700b | Python | VicDCruz/minimax-game-implementation | /Tictactoe.py | UTF-8 | 2,163 | 3.90625 | 4 | [] | no_license | """
Programa que implementa reglas básicas para jugar el juego de Gato (Tic-Tac-Toe)
"""
from Gameboard import Gameboard
from copy import deepcopy
SCORE = 10
def canMove(board):
"""
Checar si hay movimientos disponibles
"""
for i in range(3):
for j in range(3):
if (board[i][j] == "... | true |
9be434c4ebad805e5544f99c21b28934626bfb87 | Python | ISISComputingGroup/ibex_utils | /installation_and_upgrade/ibex_install_utils/ca_utils.py | UTF-8 | 2,034 | 2.703125 | 3 | [] | no_license | import os
from genie_python.utilities import dehex_and_decompress
class CaWrapper:
"""
Wrapper around genie python's channel access class providing some useful abstractions.
"""
def __init__(self):
"""
Setting instrument is necessary because genie_python is being run from a network d... | true |
7fc570f662eb19c3bc930711f8517007c9fa4281 | Python | Bigpig4396/PyTorch-Deep-Deterministic-Policy-Gradient-DDPG | /DDPG_GPU.py | UTF-8 | 7,533 | 2.90625 | 3 | [] | no_license | import random
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
class ReplayBuffer:
def __init__(self, capacity):
self.capacity = capacity
self.buffer = []
self.position = 0... | true |
7ee9445de3c9556e76f18975565400d96ee3945e | Python | BGCX067/faint-graphics-editor-svn-to-git | /tags/release-0.6/build/genhelp.py | UTF-8 | 19,507 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2012 Lukas Kemmer
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You
# may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | true |
298ffe533f97b7753e2a4bb5539f1b098c9dddd8 | Python | HWal/RPi_HAN_Receive_Web_Relay_Output | /Python_AMS/copyprices_2.py | UTF-8 | 752 | 2.65625 | 3 | [] | no_license | # Generate log files and save on USB stick
# To be executed as cron job every day at 23:55
import datetime
import time
import sys
import shutil
# Extract today's date as string
toDay = datetime.date.today()
shortDateToday = toDay.strftime("%Y") + toDay.strftime("%m") + toDay.strftime("%d")
# Save file for long term ... | true |
28a800a41007909557f5dc0bb42ebbcea46fc117 | Python | janbohinec/gen-i | /AdventOfCode/2017/Day9/day9.py | UTF-8 | 997 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 23 17:51:22 2017
@author: Jan
"""
import numpy as np
import pandas as pd
from itertools import count
import time
## Advent of Code 2017, Day 9
data = open('day9.txt', 'r')
def goThrough(data):
data = data.read()
cancel = False
garbage = False
... | true |
5df3b43f47496c93088cb0d8a7e915140b605f92 | Python | AdamF42/MLSamples | /activationFunctions/softmax.py | UTF-8 | 324 | 3.03125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def softmax(z):
z_exp = np.exp(z)
sum_z_exp = np.sum(z_exp)
return np.array([round(i/sum_z_exp, 3) for i in z_exp])
def graph(formula, x_range):
x = np.array(x_range)
y = formula(x)
plt.plot(x, y)
plt.show()
graph(lambda x: softmax(x), range(-6, ... | true |
f09ed864014b758389aca83e03dc5a41ff8c4dec | Python | SafonovMikhail/python_000577 | /001146StepikPyBegin/Stepik001146PyBeginсh11p02st09TASK08_20210203.py | UTF-8 | 524 | 3.96875 | 4 | [
"Apache-2.0"
] | permissive | '''
Дополните приведенный код, используя операторы конкатенации (+) и
умножения списка на число (*), так чтобы он вывел список:
[1, 2, 3, 1, 2, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, 11, 12, 13].
numbers1 = [1, 2, 3]
numbers2 = [6]
numbers3 = [7, 8, 9, 10, 11, 12, 13]
print()
'''
numbers1 = [1, 2, 3]
numbers2 ... | true |
47163e09cf543094f1999a93a5d0ff7910fc3d58 | Python | asevans48/DeduplicationUtils | /blocking/blocking.py | UTF-8 | 7,548 | 3.21875 | 3 | [] | no_license | """
A blocking record iterator using minLSH hash. Redis can be used to store
records for matching.
@author Andrew Evans
"""
import re
from datasketch import MinHash, MinHashLSH
from nltk.tokenize import word_tokenize
from sql.record.pgrecord_iterator import PGRecordIterator
class BlockingRecordIterator:
"""
... | true |
96b84dccbd3467dc35cefc29ea18acf671a80139 | Python | thesniya/pythonProgram | /language_fundamentals/flow_control/if-else_samples/if_else.py | UTF-8 | 386 | 4.1875 | 4 | [] | no_license | '''num=int(input('enter value'))
if(num>0):
print('num is positive')
elif(num<0):
print('num is negative')
else:
print('num is 0')'''
num1=int(input('enter 1st value'))
num2=int(input('enter 2nd value'))
if(num1>num2):
print(num1,'is greater')
elif(num1<num2):
print(num2,'is greater')
elif(num1==nu... | true |
149b107ded76f17220dc8057927a0d024fe88523 | Python | emersonff/CMEECourseWork | /Week2/Code/lc1.py | UTF-8 | 1,695 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python3
"""Write three different
lists containing the latin names, common names and mean body masses for
each species in birds, respectively"""
#(1) Write three separate list comprehensions that create three different
# lists containing the latin names, common names and mean body masses for
# each spec... | true |
53a02ab90d437f39c919127f152aa4b3b3dae5ac | Python | Arturo-Valdez/PYTHON | /Funciones/ejerciciosb2/ejercicio3.py | UTF-8 | 352 | 4.59375 | 5 | [] | no_license | """
Programa que compruebe si una variable esta vacia y si esta vacia
, rellenarla con texto en munusculas y mostrarlo en mayusculas
"""
texto = ""
if len(texto.strip()) <= 0:#strip sirve para eliminar espacios
texto = "hola soy un texto en minusculas"
print(texto.upper())
else:
print(f"La va... | true |
52225714e0632db507634a06381631b6e2612f50 | Python | albusdemens/Twitter-mining-project | /Exam_ Python code file/s131135\Twitter_Topic_Mining.py | UTF-8 | 2,983 | 3.46875 | 3 | [
"MIT",
"Python-2.0"
] | permissive | # This program try to answer what people are talking about right now by the following two steps
# First, grab the most popular topics in Twitter
# Second, mine the tweets of a specific topic to have a deeper looking inside the trending issues
# It will not work unless you fill in belowing empty string values that ar... | true |
5f0ca097f5c907dc1bea3a364880b50a47b6c142 | Python | Amnay/ntt | /software_python/nttFuncs.py | UTF-8 | 2,335 | 2.734375 | 3 | [] | no_license |
from nttUtils import *
def addPadding(n, vec):
res = vec.copy()
res.extend([0] * (n-len(vec)))
return res
def delPadding(vec, m, n = 1):
t = m + n - 1
return vec[:t]
def preprocess(a, b):
veclen = int(math.pow(2, math.ceil(math.log(len(a)+len(b)-1, 2))))
x = addPadding(veclen, a)
... | true |
c4aa69f69a687b1cb250501f577fba85789fda25 | Python | Alex-GCX/multitask | /processing/processing-pool.py | UTF-8 | 1,054 | 3.25 | 3 | [] | no_license | from multiprocessing import Pool
import time
import os
import random
def worker(msg):
start_time = time.time()
print('----------%s开始执行,进程号%d' % (msg, os.getpid()))
time.sleep(random.random())
end_time = time.time()
print('----------%s执行结束, 耗时%0.2f' % (msg, (end_time - start_time)))
# 异常测试
... | true |
ddfe62fb8fabf25b39d05f8bd552937f495c8dd0 | Python | SWU-1008/swu-car | /src/vcu_pkg/scripts/vcu_control_node.py | UTF-8 | 733 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 发布 /turtle1/cmd_vel 话题,消息类型 geometry_msg::Twist
import rospy
from geometry_msgs.msg import Twist
from Can_Utils import CanUtil
can_util = CanUtil()
def callback(twist):
can_util.drive(twist)
rospy.loginfo(twist)
def vuc_controller():
# ROS node init
... | true |
26a8dfd57a4226b5ea9a9f70652358118a723f54 | Python | MSchauperl/propertyestimator | /propertyestimator/substances.py | UTF-8 | 19,960 | 3.171875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
An API for defining and creating substances.
"""
import abc
import math
from enum import Enum
import numpy as np
from propertyestimator import unit
from propertyestimator.utils.serialization import TypedBaseModel
class Substance(TypedBaseModel):
"""Defines the components, their amounts, and their roles in ... | true |
feba3827a20502ff9a19c8a2fc5eb0e65275b383 | Python | foxscotch/advent-of-code | /2017/09/p1.py | UTF-8 | 1,181 | 3.53125 | 4 | [
"MIT"
] | permissive | # Python 3.6.1
# Requires: anytree 2.4.2
from anytree import AnyNode as Node, PreOrderIter
def get_input():
groups = ""
with open("input.txt", "r") as f:
i = 0
stream = f.read()
garbage = False
while True:
if i == len(stream):
break
char... | true |
f704f8f6fdfd8c6ceee91af043d5413d44ab2714 | Python | sclwh/FSRMASS | /main.py | UTF-8 | 647 | 2.546875 | 3 | [] | no_license | def on_button_pressed_a():
global MODE
MODE = 1
basic.show_string("FSR")
input.on_button_pressed(Button.A, on_button_pressed_a)
def on_button_pressed_b():
global MODE
MODE = 2
basic.show_string("VEL")
input.on_button_pressed(Button.B, on_button_pressed_b)
MASS = 0
B = 0
M = 0
FSR = 0
MODE = 0
... | true |