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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bcb599d6bf90fc4e56e39fc4cc723e5535b1ecb9 | Python | tachibanamei22/grondementbot | /convobot.py | UTF-8 | 3,591 | 2.734375 | 3 | [] | no_license | import logging
from telegram import ReplyKeyboardMarkup
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, ConversationHandler)
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
CHOOSING, TYPING_REPLY,... | true |
b894588b3a87f1dceaeb5746efe82103278861a1 | Python | Piorys/Test_shop_selenium | /Tests/SearchTestTrue.py | UTF-8 | 842 | 2.734375 | 3 | [] | no_license | import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
targetSite = "http://automationpractice.com"
class SearchTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
def testSearchDress(self):
driver = self.driver
self.dri... | true |
3360e2f8fdbc65b4f0cba8e35c1367a925e30b63 | Python | baumanproject/Topic-Modeling-Recommendation-System | /data_transform/run.py | UTF-8 | 1,090 | 2.734375 | 3 | [
"MIT"
] | permissive | from data_transform import tokenizer, nlp, stopwords_en, data_folder, logger
import fitz
def lemmatizer(text):
try:
text_lem = ' '.join([token.lemma_.lower() for token in nlp(text)])
except:
logger.warn("Unexpected error during stage lemmitizer")
return " "
return text_lem
def pr... | true |
48cc6a0b0e366558bce232d470ee64d3e0df6c2a | Python | nstoik/farm_monitor | /api/tests/conftest.py | UTF-8 | 2,649 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | """Defines fixtures available to all tests."""
# pylint: disable=redefined-outer-name, unused-argument
import pytest
from flask import url_for
from flask.testing import FlaskClient
from fm_database.base import create_all_tables, drop_all_tables, get_session
from fm_database.models.user import User
from fm_api.app imp... | true |
e88d1414690ddf708210705cad511dc24335bf9c | Python | zspasztori/Portfolio | /AugmentedRelityEngine/StreamTest.py | UTF-8 | 9,503 | 2.5625 | 3 | [] | no_license | import pyyolo
import numpy as np
from collections import deque
from StreamingRecognition import Client
from googletrans import Translator #using this because cloud translate does not work for me
from multiprocessing import Process, Pipe
import cv2
from math import fabs,ceil
from unidecode import unidecode
from scipy.si... | true |
47c4da02c04ca2712dba3503481c4e397673b618 | Python | CaveLabs-1/PanQAyuda | /panqayuda/clientes/views.py | UTF-8 | 3,988 | 2.671875 | 3 | [] | no_license | from django.shortcuts import render, get_object_or_404, redirect, reverse
from .models import Cliente
from .forms import FormCliente
from django.contrib import messages
from django.http import HttpResponseRedirect, HttpResponseNotFound, JsonResponse
from panqayuda.decorators import group_required
import datetime
from v... | true |
984c2ebf18701337de7927071a537a75692e28d9 | Python | z1abl/packages_calculator | /packages.py | UTF-8 | 2,745 | 3.4375 | 3 | [] | no_license | import unittest
UNIT = 3
sm = UNIT
md = UNIT*2
lg = UNIT*3
# as input takes order_size number in range 1-100
# returns dictionary "result" with packages type/quantity
# i.e. {'order_size': 32, 'small': 0, 'medium': 1, 'large': 3, 'bunch': 2}
def calculate_packaging(order_size):
if not order_size:
return... | true |
f2c9daa5d4cf8933096ffe9bd95c2f1166f8dd31 | Python | lamsoa729/BeamerFactory | /beamer_CG.py | UTF-8 | 4,569 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# In case of poor (Sh***y) commenting contact adam.lamson@colorado.edu
# Basic
import sys
import os
# Testing
import pdb
# import time, timeit
# import line_profiler
# Analysis
# import numpy as np
# import matplotlib.pyplot as plt
# import matplotlib as mpl
# import pandas as pd
import yaml
impor... | true |
69e7596c2591199630982483d37c4bbbc73d5a19 | Python | emmentch/todolist | /taskManagerSQLite.py | UTF-8 | 6,628 | 3.375 | 3 | [] | no_license | import re,sqlite3
from sqlite3 import Error
from os import system, name
sort_by = "name"
sort_order = "ASC"
'''
Uses system call to clear console, found online, not my own method
'''
def clear():
if name == 'nt':
_ = system('cls')
else:
_ = system('clear')
'''
returns the max length of the nam... | true |
c85670a102b465879ef10eb7e541d83606d2b93e | Python | lifor9/git.python.src | /RestApi/json/Read_JSON.py | UTF-8 | 1,683 | 3.703125 | 4 | [] | no_license | # coding=utf-8
import json
from pprint import pprint
# with를 이용해 파일을 연다.
# json 파일은 같은 폴더에 있다고 가정!
with open('example.json') as json_file:
# json_data는 json 전체를 dictionary 형태로 저장하고 있음
json_data = json.load(json_file)
# JSON 과 Python 타입 비교
# =========================
# JSON | Python
... | true |
5245bd556f3bbf16e806a42020557d21075c2e36 | Python | daniel-reich/ubiquitous-fiesta | /CNpZrDFf3Ct7MzQrw_6.py | UTF-8 | 191 | 3.09375 | 3 | [] | no_license |
def trouble(num1, num2):
i = 0
while i < 10:
n1 = str(num1).count(str(i))
if n1 >= 3 and str(num2).count(str(i)) >= 2:
return True
else:
i += 1
return False
| true |
ba8e6f03aefdc4c5986cb53a07b800551c8cbb64 | Python | SorenLittle/medicare_data_analysis | /data_manipulation.py | UTF-8 | 26,538 | 2.65625 | 3 | [] | no_license | import numpy as np
import os
from datetime import datetime
import time
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import getting_json as get
# providers_df = get.get_dataframe("b27b-2uc7", 1000) # ALL ROWS = 15616
# surveys_df = get.get_dataframe("gx3u-faec", 1000) # ALL ROWS = 46450
... | true |
ecc08364f4559ba53c517f861e77f5a291ecc027 | Python | vidisha566/Web-Client-and-Multi-threaded-Web-Server | /client.py | UTF-8 | 940 | 2.625 | 3 | [] | no_license | #NAME: VIDISHA NARENDRA SHETTY UTA ID: 1001672826
#Cite 1: https://github.com/suziesu/Computer-Networking/tree/master/assignment1
#Cite 2: https://www.geeksforgeeks.org/socket-programming-multi-threading-python/
#Cite 3: https://www.bogotobogo.com/python/python_network_programming_server_client_file_transfer.ph... | true |
daa6c3f2a9f124eb728bf095a285198b0b2cc821 | Python | xdhao/cplinguistics | /p2/word2vec/Word2Vec/Word2Vec.py | UTF-8 | 3,456 | 3.09375 | 3 | [] | no_license | from pyspark.sql import SparkSession
from pyspark.ml.feature import Tokenizer
from pyspark.ml.feature import StopWordsRemover
from pyspark.ml.feature import CountVectorizer
from pyspark.ml.feature import IDF
from pyspark.ml.feature import Word2Vec
spark = SparkSession\
.builder\
.appName("SimpleApplic... | true |
42a8b7ec366d531ec650e1632f22ff4002411d3d | Python | felixcharvin/SmartFlat | /Scripts/ultrason_senseur.py | UTF-8 | 1,911 | 2.9375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
TRIG = 24
ECHO = 23
LED = 18
DOOR = 25
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
GPIO.output(TRIG, False)
GPIO.setup(LED, GPIO.OUT)
GPIO.output(LED,GPIO.LOW)
GPIO.setup(DOOR,GPIO.IN,pull_up_down = GPIO.PUD_UP)
mean_distance = 0
pu... | true |
5ade9ef9818ebb4f877336b31a4cf7c369f19335 | Python | nayanigc/Programmation-R-seau-Proxy | /Exo2/Serveur/CacheServeurTCP.py | UTF-8 | 1,636 | 2.6875 | 3 | [] | no_license | from socket import *
from threading import *
serverPort = 9999
serverSocket = socket(AF_INET,SOCK_STREAM)
serverSocket.bind(('',serverPort))
serverSocket.listen(1)
print('server ready')
http = 'HTTP'
httpoOkHeader = "HTTP/1.1 200 OK\r\nServer : Microsoft-IIS/5.0\r\nDate : Sat, 15 Jan 2007 14:37:12 GMT\r\nContent-Typ... | true |
24be4de7cd5af9cd613cd85c0bcc2539e4b5514e | Python | shon-otmazgin/transactions-anomaly-detection-unsupervised-learning | /iterative_gmm.py | UTF-8 | 2,119 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.mixture import GaussianMixture
from utils.scale_and_split import split_train_test, RANDOM_STATE
from utils.visualizations import plot_recall_precision_curve_samples_scores, plot_recall_precision_change
from utils.iterative_method import iterative_clf
from utils.metri... | true |
02c2305d2f32b104ff2cbbd526ff2ab7a349abe5 | Python | Vagus30/feature_engineering_project | /q03_skewness_sqrt/build.py | UTF-8 | 440 | 2.78125 | 3 | [] | no_license | # %load q03_skewness_sqrt/build.py
# Default imports
from scipy.stats import skew
import pandas as pd
import numpy as np
ny_housing = pd.read_csv('data/train.csv')
# Write your Solution Here:
def skewness_sqrt(data):
df = data.copy()
df['GrLivArea'] = np.sqrt(df['GrLivArea'])
df['SalePrice'] = np.sqrt(df... | true |
b82ff15f1ec61f4163814fad524d1dec2ccfc3aa | Python | ankitwagadre/My-Competitive-Programming-Code | /python/SieveOfEratosthenes.py | UTF-8 | 281 | 3.390625 | 3 | [] | no_license | n = 100
a = []
for i in range(0, n+1): a.append(True)
for i in range(2, n+1):
if i*i > n:
break
if a[i]:
j = i*i
while j < n+1:
a[j] = False
j = j + i
for i in range(2, n + 1):
if a[i]:
print(i) | true |
c817570f04818e4330a86c4873f64cc03b203523 | Python | ThainaMarini/Python | /Mundo 1/014.py | UTF-8 | 121 | 3.796875 | 4 | [] | no_license | n1 = float(input('Digite a temperatura em C° = '))
new = ((9*n1)/5)+32
print('{}°C corresponde a {}°F'.format(n1,new)) | true |
f988e90fcb0481972b044eff6345e7520d56ed75 | Python | django/django-localflavor | /localflavor/ch/forms.py | UTF-8 | 4,276 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | """Swiss-specific Form helpers."""
import re
from django.core.exceptions import ImproperlyConfigured
from django.core.validators import RegexValidator
from django.forms import ValidationError
from django.forms.fields import CharField, RegexField, Select
from django.utils.translation import gettext_lazy as _
from ..g... | true |
db887fa745af26c64b37f9967f1aa13b5716ae3a | Python | KirillKras/python_basic | /pb_les3_e1.py | UTF-8 | 811 | 4.09375 | 4 | [] | no_license | # Задание-1:
# Напишите функцию, округляющую полученное произвольное десятичное число
# до кол-ва знаков (кол-во знаков передается вторым аргументом).
# Округление должно происходить по математическим правилам (0.6 --> 1, 0.4 --> 0).
# Для решения задачи не используйте встроенные функции и функции из модуля math.
TEN ... | true |
afd04db8ae6a83b3c5ab9eef9fed737a8f2841bf | Python | richford/nma-dl-modality-mongoose | /dice_loss.py | UTF-8 | 457 | 2.828125 | 3 | [
"MIT"
] | permissive | import torch
class diceloss(torch.nn.Module):
def init(self):
super(diceloss, self).init()
def forward(self, pred, target):
smooth = 1.0
iflat = pred.contiguous().view(-1)
tflat = target.contiguous().view(-1)
intersection = (iflat * tflat).sum()
A_sum = torch.s... | true |
1206d31e84149bf70c4b1524af126353f030dfc4 | Python | u0min/Codeup-100_practice | /Codeup-100/Codeup-20~29.py | UTF-8 | 4,287 | 4.28125 | 4 | [] | no_license | # CodeUp 기초 100제 풀기
# 20) 주민번호 입력받아 형태 바꿔 출력하기
'''
주민번호는 다음과 같이 구성된다.
XXXXXX-XXXXXXX
앞의 6자리는 생년월일(yymmdd)이고 뒤 7자리는 성별, 지역, 오류검출코드이다.
주민번호를 입력받아 형태를 바꿔 출력해보자.
입력예시 : 000907-1121112 출력예시 : 0009071121112
'''
'''
answer = input().split("-")
print(answer[0], answer[1],sep="")
'''
# 21) 단어 1개 입력받아 그대로 출력하기(설명)
'''
1개의 단... | true |
b703b3ddb10d22728a3f0a1c38b95c2a5cde60b6 | Python | qbxlvnf11/tsne-graph-nodes-neighbors-pytorch | /select_feature.py | UTF-8 | 1,686 | 2.75 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--feature", type=str, default="features.pt", help="torch feature file name")
parser.add_argument("--label", type=str, default="labels.npy", help="numpy label file name")
parser.add_argument("--index_text", type=int,... | true |
e314ee4b2ac1f4bc904212f2f097d09aec324ab2 | Python | jonasfontouras/curso_python | /modulos.py | UTF-8 | 158 | 2.90625 | 3 | [] | no_license | import modulopersonalizado as mod
texto = mod.read("Digite uma mensagem: ")
print(texto)
numero = mod.numfloat("Digite um número qualquer: ")
print(numero) | true |
17eba40bdd19b969d07847c3b72f2058054606be | Python | Washington5827/get_topic_sentence | /TF_IDF.py | UTF-8 | 3,030 | 3.015625 | 3 | [] | no_license | import sqlite3
import re
import math
def word_frequency(word):
'''在表wae中计算词频'''
db = sqlite3.connect("PythonLP.db")
cur = db.cursor()
# 选取
sql = 'SELECT*FROM WaE WHERE WORD LIKE "%s";' % (word)
cur.execute(sql)
result = cur.fetchone()
db.close()
try:
return result[1]
e... | true |
fea1298da8f66a78462642aafb68a6bcb3240641 | Python | GalMoore/robot_identify | /scripts/identify_node.py | UTF-8 | 5,886 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
# import roslib
# roslib.load_manifest('my_package')
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import face_recognition
import numpy as np
from os.path imp... | true |
9127fd97835e5b27451b47963cd6d74c96282fd6 | Python | AlbertGithubHome/Bella | /python/function_test.py | UTF-8 | 1,984 | 3.578125 | 4 | [] | no_license | #functon test
print('abs(-45) =', abs(-45))
print('max(-45, 1, 2, 89.9, 45) =', max(-45, 1, 2, 89.9, 45))
my_abs = abs
print('my_abs(-45) =', my_abs(-45))
print('bool(1>0) =', bool(1>0))
print('float(10) =', float(10))
print('hex(254) =', hex(254))
def myabs(x):
if x >= 0:
return x;
else:
... | true |
b3958bcc7a4e5aec0a1b55b7b1229b55892af412 | Python | tanmayaggarwal/SentimentRNN | /pre_process.py | UTF-8 | 2,132 | 3.28125 | 3 | [] | no_license | import numpy as np
import torch
from string import punctuation
from collections import Counter
def pre_process(reviews):
# remove all punctuation
reviews = reviews.lower()
all_text = ''.join([c for c in reviews if c not in punctuation])
# split by new lines and spaces
reviews_split = all_text.spli... | true |
a613fdd4fafd905a6d97cd845e6dec44adc3894d | Python | JimmyLindstrom/Adv-Prog | /section_1/10878_decode_the_tape/main.py | UTF-8 | 608 | 3.1875 | 3 | [] | no_license | import sys
sys.stdin = open("input_data", "r")
def start():
new_line = input()
new_line = input()
while new_line:
character = ""
if new_line[0] == "|":
for char in new_line:
if char == "|" or char == ".":
continue
elif char == ... | true |
a6fb1ad94e1499e77fa116ff9e3f117ed6700a6d | Python | bradyz/sandbox | /challenges/ipsc/d.py | UTF-8 | 1,670 | 2.640625 | 3 | [] | no_license | import sys
e = 47
t = 1466253000.000
c = "red green blue yellow orange pink".split()
s = [
(75, 75),
(75, 175),
(75, 275),
(180, 75),
(180, 175),
(180, 275)
]
r = [
(300, 75),
(300, 175),
(300, 275),
(500, 75),
(500, 175),
(500, 275)
]
def h():
global e
a = lis... | true |
e637d3ee511242fdd25ec4ecf7dc165f4f0a8c32 | Python | yougukepp/wbdp | /WBDPSpider.py | UTF-8 | 1,197 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import urllib.request
from WBDPJsoner import WBDPJsoner
from WBDPConfiger import WBDPConfiger
class WBDPSpider:
def __init__(self):
configer = WBDPConfiger()
self.mUrl = configer.GetUrl()
data = self.__GetData__(self.mUrl)
jsoner = W... | true |
4242bfed54103f0bfd6316499583f821f047ef5e | Python | monika200/PYTHON-REPO | /DAY12/DAY12.PY | UTF-8 | 3,352 | 3.65625 | 4 | [] | no_license | Question 1: From given data set print first and last five rows.
For First five rows
import pandas as pd
df = pd.read_csv("Downloads\\Automobile_data.csv")
df.head(5)
For last five rows
import pandas as pd
df = pd.read_csv("Downloads\\Automobile_data.csv")
df.tail(5)
Question 2: Clean data and update the CSV file.
d... | true |
7a075be34db158fbd63c9f45f5f3b1e417186acf | Python | tmiyachi/pymet | /examples/contour.py | UTF-8 | 644 | 2.546875 | 3 | [] | no_license | # coding:utf-8
import matplotlib.pyplot as plt
from pymet.metplt import MyBasemap
from pymet.io import GradsIO
from datetime import datetime
# read data from OpenDAP
io = GradsIO(Echo=False)
io.open('http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.derived/pressure/hgt.mon.mean.nc')
io.setdim(lon=(0... | true |
ecbb9549d2b014517f02ed2153c6c3e5ff64afef | Python | veechand/AlgorithmsPractise | /Practise-2021/kthSmallestInBST.py | UTF-8 | 1,048 | 3.703125 | 4 | [] | no_license | # Definition for a binary tree node.
"""
Inorder and inorder[k-1] <- O(n)
Number of elements in the tree
"""
class TreeNode(object):
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution(object):
def kthSmallest(self, root... | true |
4e137c102b66950755cd41e7acaaee4c37d0735f | Python | onselaydin/pytry | /DataAnaliz/pandastest.py | UTF-8 | 4,641 | 3.625 | 4 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
from numpy.random import randn
labels_list = ["Önsel","Yağmur","Şennur","Ege","Pınar","Polat","Meriç"]
data_list = [10, 20, 30, 40, 50, 60, 70]
final_list = pd.Series(data_list, labels_list)
#print(final_list)
data_dict = {"Önsel":30,"Yağmur":40,"Şennur":50} # data dictionery
#pr... | true |
a61e1735445631eed0152c5f7745cbf55aa41218 | Python | tianchengcheng-cn/LeetCode | /双指针/287-寻找重复数.py | UTF-8 | 1,222 | 3.65625 | 4 | [] | no_license | """
给定一个包含 n + 1 个整数的数组 nums ,其数字都在 1 到 n 之间(包括 1 和 n),可知至少存在一个重复的整数。
假设 nums 只有 一个重复的整数 ,找出 这个重复的数 。
示例 1:
输入:nums = [1,3,4,2,2]
输出:2
参考解析:
https://leetcode-cn.com/problems/find-the-duplicate-number/solution/miao-dong-kuai-man-zhi-zhen-by-wo-you-dian-ben/
https://blog.csdn.net/LittleNyima/article/details/105349081
时空... | true |
74aafd34a931d17b6b4bc6edc89a0307173c3527 | Python | dvannucci/NBA-Hackathon | /V2.py | UTF-8 | 28,563 | 2.5625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import csv
class Player:
def __init__(self, team, id):
self.team = team
self.id = id
self.pointsWhileOnFloor = 0
self.pointsAgainst = 0
self.pointsPersonal = 0
self.offPos = 0
self.defPos = 0
self.freeThrowsMade ... | true |
20b406abd3709548d4d05d38e3089561a09283bc | Python | bamboo3892/AtCoder | /arc117/arc117b.py | UTF-8 | 395 | 2.78125 | 3 | [] | no_license | import math
import numpy as np
MOD = pow(10, 9) + 7
def main():
N = int(input())
A = np.array([int(a) for a in input().split(" ")], dtype=np.int64)
A = np.sort(A)[::-1]
result = 1
for i in range(N - 1):
result *= (A[i] - A[i + 1] + 1)
result %= MOD
result *= (A[N - 1] + 1)
... | true |
cb20e2209ce7fe764738289b01891cbca0bb323b | Python | xuguangmin/Programming-for-study | /python_study_code/embedded/emb/ari.py | UTF-8 | 130 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
#coding:utf-8
#test
def add(x, y):
print "add a, b"
return x+y
def mul(x, y):
print "mul a, b"
return x*y
| true |
bdb6b62add78ee7c406dc4bf7af41d0f1a68f80a | Python | YellowPig-zp/cs189-code | /hw09-data/plot2.py | UTF-8 | 3,295 | 3.296875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from starter import *
def neural_network(X, Y, X_test, Y_test, num_neurons, activation):
"""
This function performs neural network prediction.
Input:
X: independent variables in training data.
Y: dependent variables... | true |
9049e78c335d7695b185ebab3f8aa93e05b302cf | Python | pdp2121/Metoo-College | /test.py | UTF-8 | 200 | 3.125 | 3 | [] | no_license | from datetime import datetime
timestamp = 1508158113
dt_object = datetime.fromtimestamp(timestamp)
date = str(dt_object).split(' ')[0]
print("date =", date)
print("type(dt_object) =", type(dt_object)) | true |
f43775a8247f8543f90db465eb8b50caf95580bf | Python | mikemej/mikeRepo | /simple_mouse_click.py | UTF-8 | 1,119 | 3.359375 | 3 | [] | no_license | #simple of mouse input
import simpleguitk as simplegui
import math
#Globals
WIDTH = 450
HEIGHT = 300
ball_pos = [WIDTH / 2, HEIGHT / 2]
BALL_RADIUS = 15
ball_color = "Blue"
#Helper function
def distance(p, q):
'''
The function verifies the distance between the circles
'''
return math.sqrt((p[0] - q[0... | true |
39138c265e3e4c547062ee1dd8dfda5b13e4d45b | Python | fritzo/pythlog | /test2/match_assign_test.py | UTF-8 | 1,005 | 4.03125 | 4 | [] | no_license | # Assignments on the form:
# - x + 1 == 0
# - f(a, b, c) >= g()
# etc, are called "match statements". They are syntactic sugar for:
# - x = free; assert x + 1 == 0
def match_assign_test0_simple_arithmetic_match():
a + 1 == 2
assert str(a) == "1"
(b + a) * 2 == 6
assert str(b) == "2"
def fu... | true |
7ced9bf4f1657d9d88dec884f1ddc2b3158d361e | Python | ziejaCode/CLI_Project1 | /Click_Tutorial/basic_cli.py | UTF-8 | 531 | 3.375 | 3 | [] | no_license | import click
@click.command()
@click.option('--firstname','-f',help="First name", type=str, default="Friend")
@click.option('--num','-n',help="number", type=int, default=1)
@click.option('--salary','-s',nargs=2)
@click.option('--city','-c', help="Your cities", multiple=True)
@click.version_option('0.01',prog_name='bas... | true |
2fb4927174e3bba67060b9e1c539a70f2eb24bf7 | Python | AchrafAsh/rocket-launcher | /components/requests.py | UTF-8 | 3,660 | 2.796875 | 3 | [] | no_license | import sqlite3
import subprocess
from components.constants import formats
def create_table():
conn = sqlite3.connect('directories.db')
c = conn.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS directories(
name TEXT,
path TEXT,
format TEXT
)
''')
conn.commit()
... | true |
db8172b3d0718e047afaab74c9f9489947666098 | Python | d-karlss/flowlog-pprint | /flowlog_pprint/flowlog_pprint.py | UTF-8 | 3,256 | 2.515625 | 3 | [
"MIT"
] | permissive | import gzip
from colorama import Fore
import ipaddress
import datetime
import math
import sys
PROT_NAMES = {
1: 'ICMP',
2: 'IGMP',
4: 'IPv4',
6: 'TCP ',
17: 'UDP ',
41: 'IPv6'}
FLAG_DICT = {
'FIN': 1,
'SYN': 2,
'RST': 4,
'PSH': 8,
'ACK': 16,
'URG': 32}
def parse_tcp_f... | true |
6e33e0efcaf98eda808445cf5196c5e4eaaeaac6 | Python | PraisyPrasad/luminarpythonprograms | /flow controls/decision/salary.py | UTF-8 | 142 | 3.765625 | 4 | [] | no_license | salary=int(input("enter salary"))
exp=int(input("enter experience"))
if(exp>5):
print("bonus is",0.05*salary)
else:
print("no bonus")
| true |
368ce81d813730b00bbe1749ebf4049c401b430e | Python | dedya/python-configparser-example | /config.py | UTF-8 | 554 | 3.09375 | 3 | [] | no_license | import configparser
config=configparser.ConfigParser()
folderPath = "<path-to-your-config-file>"
#Read the config file
config.read(folderPath+'/config.ini')
#Get the value of the config
mysqlHost = config['mysql']['host']
mysqlUser = config['mysql']['user']
mysqlPassword = config['mysql']['password']
postgreHost = c... | true |
dc8e68ce74e8b22e0f9816e2dae23734e6611b15 | Python | Aasthaengg/IBMdataset | /Python_codes/p03000/s329683574.py | UTF-8 | 130 | 2.6875 | 3 | [] | no_license | N,X = map(int, input().split())
dis = 0
cnt = 1
for L in map(int, input().split()):
dis += L
cnt += dis <= X
print(cnt) | true |
1e4da08dc5efce1abe19e576331275a01082d610 | Python | drppsy/mysite | /blog/models.py | UTF-8 | 2,839 | 2.640625 | 3 | [] | no_license | from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from ckeditor_uploader.fields import RichTextUploadingField
from read_statistics.models import ReadNumExpandMethod,ReadDetail
class BlogType(models.Model):
type_name = models.Char... | true |
a835512adf89d4da04bd3cc657cb3a247d4edf0a | Python | ckdwlsrh/algorithm-stack | /baekjoon/10845/Lactea98/10845.py | UTF-8 | 556 | 3.171875 | 3 | [] | no_license | import sys
queue = []
num = int(sys.stdin.readline().strip())
for _ in range(num):
command = sys.stdin.readline().strip().split(" ")
if command[0] == "push": queue.append(command[1])
elif command[0] == "pop": print("-1" if len(queue) == 0 else queue.pop(0))
elif command[0] == "size": print(len(queue)... | true |
411bb5ffc794062240cd53bc6277353d86c4383b | Python | rache1park/veritas_fall2018 | /Veritas/veritas_lib.py | UTF-8 | 851 | 3 | 3 | [] | no_license | import random
_list=['r','p','s']
def get_comp():
#result=random.choice(_list)
comp=random.randint(0,2)
if comp==0:
result='r'
elif comp==1:
result='s'
else:
result='p'
return result
def who_is_winner(user,computer):
if (user=='r') and (computer=='p'):
return ... | true |
2ec9bc2bbe24b19ffd459d76177cd8a57e051746 | Python | dettmar/gym-swirl | /gym_swirl/animator.py | UTF-8 | 6,871 | 2.6875 | 3 | [
"MIT"
] | permissive | import os
import torch
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from IPython.display import HTML
matplotlib.rcParams['animation.embed_limit'] = 2**32
class Animator:
def __init__(self, env, start_frame=0, end_frame=int(1e4), lock_frame=False, show_arrows=True, scene_... | true |
39858f78082f6b058bd0227dc5512cb24584d281 | Python | Venkatesh123-dev/100-Days-of-code | /Day_08_03.py | UTF-8 | 1,604 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 20:19:04 2020
@author: venky
Given an array of positive integers. Your task is to find the leaders in the array.
Note: An element of array is leader if it is greater than or equal to all the elements to its right side. Also, the rightmost element... | true |
c3657eefd36e66bb30e003312fb4378a361cfa2b | Python | AInsolence/udacity_edu | /transponse_matrix.py | UTF-8 | 260 | 2.734375 | 3 | [] | no_license | correct = [[1,2,8],
[2,3,1],
[7,1,5]]
def check(data):
new = []
for e in data:
new.append([])
for i in range (0, len(data)):
for j in range (0, len(data)):
new[i].append(data[j][i])
return new
print check(correct) | true |
57fe519231f06bc5e091e9be7f795599d7e9e6d8 | Python | xegg/JustSomeLearningNoteAndScript | /algorithm/beauty_of_code/4-3.py | UTF-8 | 498 | 3.578125 | 4 | [] | no_license | def calc_time(length, pos, ant_num, speed, min, max):
total_time = length / speed
max = 0
min = 0
for i in range(ant_num):
current_max = 0
current_min = 0
if pos[i] > (length / 2):
current_max = pos[i] / speed
else:
current_max = (length - pos[i... | true |
df02e99024f2839a663bdf2f2661c07bd6617e02 | Python | EliTheCreator/AdventOfCode | /2015/day14/task1.py | UTF-8 | 674 | 3.046875 | 3 | [] | no_license | import re
def main():
with open("input", "r") as file:
data = [tuple([line.split(" ")[0]] + [int(x) for x in re.findall("\d+", line)])
for line in file.readlines()]
duration = 2503
distances = []
for _, speed, workTime, restingTime in data:
fullRuns = duration // (work... | true |
4f0bfeaa0369826b2da616bb511fc0f3ddd839d5 | Python | hazutecuhtli/Disaster-Response-Pipelines | /app/run.py | UTF-8 | 8,349 | 3 | 3 | [] | no_license | #*****************************************************************************************************
#Importing Libraries
#*****************************************************************************************************
import json
import plotly
import pandas as pd
from nltk.stem import WordNetLemmatizer
from nl... | true |
d603d116310d2e069be3f4c31aedca26b496e2df | Python | igorgallon/PanlexApp | /DB.py | UTF-8 | 7,370 | 2.734375 | 3 | [] | no_license | import sqlite3
class DB:
# Inicia Banco de Dados no arquivo db_tasks.db
def __init__(self):
self.__conexao=sqlite3.connect("db_panlex.db")
# Remove conexao com Bando de Dados
def __del__(self):
self.__conexao.close()
# Remove todas as tabelas do Banco de Dados
def... | true |
88d9435d83af4ff127f99a6ec56ed582cbc5af60 | Python | tmu-nlp/100knock2021 | /nakatsuji/chapter07/knock63.py | UTF-8 | 197 | 2.515625 | 3 | [] | no_license | import pickle
#モデル読み込み
#model_file = 'model.sav'
#oaded_model = pickle.load(open(model_file, 'rb'))
if __name__ == '__main__':
print(model.most_similar('United_States', topn=10)) | true |
861e1145580d9a9d3136752a3d66406bc0d9ca0f | Python | behrouzmadahian/python | /hadoop_with_python/spark_with_python/wordCount.py~ | UTF-8 | 605 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
from pyspark import SparkContext
def main():
sc = SparkContext(appName='SparkWordCount')
#reading from local. if from hdfs remove 'file://'
f = sc.textFile('file:///home/cloudera/Spark_with_python/w?.txt')
counts = f.flatMap(lambda line : line.split()).map(lambda word: (word,1)).reduce... | true |
c06cf35ea2411877418eb907564d0df351bcbae3 | Python | ethanschreur/kids-krafts | /tests/test_filters.py | UTF-8 | 2,279 | 2.890625 | 3 | [] | no_license | from unittest import TestCase
import app.filters as filters
class FiltersFileTestCase(TestCase):
def test_filter_products(self):
class Product():
def __init__(self, category):
self.category = category
prod_1 = Product("Selling")
prod_2 = Product("Not Selling")
... | true |
d96d486432a25ccfc691f8e78e94a5d0a9a0f6cd | Python | latajatav/python-project | /lata.py | UTF-8 | 472 | 3.65625 | 4 | [] | no_license |
class Employee:
empCount = 0
def __init__(self,name,salary):
self.name = name
self.salary = salary
Employee.empCount = Employee.empCount + 1
def disp_Name(self):
print self.name
def disp_salary(self):
print self.salary
def disp_count(self):
... | true |
d0eec05440bf4db4bcdef0925beec6ffbec52f14 | Python | SweetmanTech/algorithms | /arrayPartitionI.py | UTF-8 | 389 | 2.96875 | 3 | [] | no_license | class Solution(object):
def arrayPairSum(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
maxSum = 0
numsSorted = sorted(nums)
while len(numsSorted) > 0:
lowest = numsSorted[0]
numsSorted.remove(lowest)
maxSum += lowes... | true |
d0503534318d7f8436a5b69c2fe5e3b31e14e318 | Python | Dopadkar/Data-Science | /MachineLearningSpecializationCoursera-master/course2/week5/task5_1.py | UTF-8 | 1,457 | 2.890625 | 3 | [] | no_license | from sklearn.datasets import load_digits
from sklearn.datasets import load_breast_cancer
from sklearn.naive_bayes import BernoulliNB
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import GaussianNB
from sklearn.cross_validation import cross_val_score
import heapq
from sklearn.tree import Decisio... | true |
12d79df44639a1ec2be54f070bd884ad1131f844 | Python | groscoe/pynads | /pynads/concrete/writer.py | UTF-8 | 4,796 | 4.0625 | 4 | [
"MIT"
] | permissive | from ..abc import Monad
from ..funcs import fmap, mappend
from ..utils import is_monoid
from .list import List
from .mempty import Mempty
class Writer(Monad):
"""The Writer monad stores both a value and some side output, commonly
referred to as a log because its usually used to track transformations
on th... | true |
e2884c7c82196e02a71e615eeccbb1b1cbfcad59 | Python | Aasthaengg/IBMdataset | /Python_codes/p03777/s291311981.py | UTF-8 | 81 | 2.796875 | 3 | [] | no_license | a = input().split()
print(a[1] if a[0] == 'H' else ('D' if a[1] == 'H' else 'H')) | true |
4354c254eaade8ffcdb04d45d7bf52ec9d675550 | Python | Aasthaengg/IBMdataset | /Python_codes/p02881/s050323795.py | UTF-8 | 503 | 3 | 3 | [] | no_license | import sys
INF = 10**60
inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())
n = inint()
min_sum = INF
i = 0
j = 0
... | true |
f4a59faa74719663cc64984da907a6e8762e1508 | Python | Murgowt/CodeBase | /Data Structures/BST-To-BalancedBST.py | UTF-8 | 1,096 | 3.59375 | 4 | [] | no_license | class Node():
def __init__(self,value):
self.data=value
self.left=None
self.right=None
def AddNode(root,value):
if(root.data>value):
if(root.left==None):
root.left=Node(value)
return
AddNode(root.left,value)
else:
if(root.right==None):... | true |
a62ee5a76783e89f1e8f77bba559ffc26e35aaf4 | Python | menaeffat/CTF | /CyberTalents/Crypto/Transposed/encrypt.py | UTF-8 | 1,300 | 2.703125 | 3 | [] | no_license | #-*- coding:utf-8 -*-
def revs(s):
s = s[1:] + s[:1]
s = s[0::2] + s[1::2]
s = s[1:] + s[:1]
return s
def fors(s, w, perm):
r = ""
for j in xrange(0, len(s), w):
for k in xrange(w):
r += s[j:j+w][perm[k]]
s = r
return s
def revso(s):
s = s[-1:] + s[:-1]
l =... | true |
aed319180dd148778a6ef56ec8a0d7414cfae044 | Python | dongyifeng/algorithm | /python/interview/1.4/best.py | UTF-8 | 355 | 3.640625 | 4 | [] | no_license | #coding:utf-8
# 从中间向两端
def isPalindrome(a):
if a is None:return None
n = len(a)
i = int(n / 2) - 1
j = int(n / 2)
if n % 2 != 0:
j += 1
while i >= 0 and j < n :
if a[i] != a[j]:
return False
i -= 1
j += 1
return True
a = 'acebeca'
print isPalindrome(a)
a = 'aceeca'
print isPalindrome(a)
a = 'abc'... | true |
967d895dc3e34a4e52f060aab044c7316a50a1ae | Python | okmand/Steiners_trees | /stein_excel.py | UTF-8 | 3,660 | 3.21875 | 3 | [] | no_license | import xlsxwriter as xls
import time
import random
from stein import initialize_random_graph, levin_algorithm
import webbrowser
import pickle
# тесты по алгоритму.
# number_iterations_random - количество раз, сколько сгенерируется граф с данными n и m
# number_iterations_algorithm - количество раз, сколько пройдет алг... | true |
edd9d9ff49b323d297bd66e28921942b338812fb | Python | yulk/flask101 | /flask_app-13a/main2.py | UTF-8 | 3,755 | 2.75 | 3 | [] | no_license | from flask import Flask, request, render_template, redirect, url_for, flash, make_response, session
from flask_script import Manager, Command, Shell
from forms import ContactForm
app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'a really really really really long secret key'
manager = Manager(app)
c... | true |
62338b7d941b744daed599876950838e6b2d26cd | Python | blitu12345/code-codechef | /testtree.py | UTF-8 | 314 | 2.765625 | 3 | [] | no_license | n = input()
for i in range(0,n):
arr = raw_input()
arr = [bin(int(x)) for x in arr.split()]
a = arr[0][2:]
b = arr[1][2:]
if a == b:
print 0
else:
k = 1
while 1:
if k+1 <=len(a) and k+1<=len(b):
if a[k] == b[k]:
k+=1
else:
break
else:
break
print len(a) + len(b) - 2*k | true |
dd01faf5e06d2a47025d3846f7e6ef57357f65cc | Python | wanghan79/2020_Option_System | /董玉叶2018010987/操作系统实验作业/第一次实验/homework1.py | UTF-8 | 1,195 | 3.171875 | 3 | [] | no_license | """
Author: YY.Dong
Purpose: Using Python language to obtain operating system information
Created: 6/24/2020
"""
import platform
def apply():
print('获取操作系统名称及版本号:',platform.platform() ) #获取操作系统名称及版本号,'Linux-3.13.0-46-generic-i686-with-Deepin-2014.2-trusty'
print('获取操作系统版本号:',platform.version() ) ... | true |
7ccc1cfcc408df6176406d9a691a0fe35d53e703 | Python | razorkam/KlumbaOperatorTelegramBot | /source/client_backend/StorageHandlers.py | UTF-8 | 1,131 | 2.5625 | 3 | [] | no_license | import sqlite3
import os
import logging
from threading import local
import source.config as cfg
ORDERS_DIR = os.path.join(cfg.DATA_DIR_NAME, cfg.ORDERS_DIR_NAME)
logger = logging.getLogger(__name__)
ORDERS_DB = local()
def get_deal_id(digest):
try:
if not hasattr(ORDERS_DB, 'conn'):
ORDERS... | true |
086b73905e937d50a99ac9da583cdd0285d4684e | Python | MattRooke/CP1404_Pracs | /prac_09/cleanup_files.py | UTF-8 | 3,179 | 4.0625 | 4 | [] | no_license | """
CP1404 Practical
This is a program that takes file names in a directory with multiple sub-directories and standardises them.
"""
import shutil
import os
def main():
"""Demo os module functions."""
print("Starting directory is: {}".format(os.getcwd()))
# Change to desired directory
os... | true |
145829f1104491ed56322098418665b7fd0f4b2b | Python | nuratavatar/RandomWalk | /randomWalk.py | UTF-8 | 1,350 | 3.453125 | 3 | [] | no_license | from graphics import *
import math
from random import *
def isBet(lower, var, upper):
if(lower > upper): #This is a stupid proofing for myself because I'm stupid
holder = upper
upper = lower
lower = holder
if(var < upper and var > lower):
return True
else:
return False
#window, starting point, angle, len... | true |
e73759420851256753143890c35af732c20e8621 | Python | yosafatN/OCBC_Python | /Sesi03/app.py | UTF-8 | 1,126 | 4.53125 | 5 | [] | no_license | import person
print("\n# Calling a Function")
def printMe(str):
print(str)
return
printMe("I'm first call to user defined function!")
printMe("Again second call to the same function")
print("\n# Keyword Arguments")
printMe(str="Hacktiv8")
print("\n# Default Arguments")
def printInfo(name, age=26):
... | true |
a7b9cdccfeba22fd8235734cc2672814e0bab6e5 | Python | pdelfino/numerical-analysis | /project/desc-grad.py | UTF-8 | 994 | 3.9375 | 4 | [] | no_license |
import numpy as np
print ("De acordo com Wikipedia, melhor step-size possível")
print ("\n")
def grad(x1,grad,max_iter):
x0 = x1 - 0.001
i = 0
while (abs(x1 - x0) > 0.00001) and (max_iter > i):
gamma = (x1-x0)*(grad(x1)-grad(x0))/((grad(x1)-grad(x0))**2)
x0 = x1
x1 = x1 - gamma*gr... | true |
4861d3570992eabb2d6bde9eb3ea16fab73dbf8e | Python | jijiji21723/grandhotel | /blog/views.py | UTF-8 | 7,231 | 2.578125 | 3 | [] | no_license | # 뷰 작성에 필요한 클래스형 제넥릭 뷰 임포트
from django.views.generic import ListView, DetailView, TemplateView # ch07추가01 TemplateView
# 뷰 작성에 필요한 날짜 제네릭 뷰 임포트
from django.views.generic.dates import ArchiveIndexView, \
YearArchiveView, MonthArchiveView, DayArchiveView, TodayArchiveView
# blog.models.Post 클래스 임포트
from blog.models i... | true |
acffc9a0ef5ff5b6a6b5c009e25dba0903a03226 | Python | umgood/DataAnalysis | /basicFuc.py | UTF-8 | 6,686 | 2.71875 | 3 | [] | no_license | from PyQt5.QtGui import *
# from functools import partial
import copy
# 负责解决Fliter菜单解决的事件
class Filter(object):
def __init__(self, filename):
import xlrd
self.rbook = xlrd.open_workbook(filename)
self.sheet_list = []
self.rsheet = self.rbook.sheet_by_index(0)
self.sheet_st... | true |
cb8691ad8d9f6877bc0ebfd89523ba466f1cc90f | Python | marthaszef/modul3 | /zadanie2.py | UTF-8 | 148 | 3.171875 | 3 | [] | no_license | lista=[]
for i in range (0,100):
if i%5==0:
lista.append(i)
print(lista)
potega=[]
for i in lista:
potega.append(i**3)
print(potega) | true |
ac1b078e1ef47e7ea39c0e5ec50de3c460111d18 | Python | ncanac/infinite_monkeys | /editfile.py | UTF-8 | 512 | 2.859375 | 3 | [] | no_license | import string
f = open('./text files/shake_view.txt', 'r')
text = f.read()
f.close()
n = len(text)
#print ' ' in text
print len(text)
text = text.lower()
for i in range(256):
if chr(i) == '\'':
text = text.replace(chr(i),'')
elif chr(i) != ' ' and chr(i) != '\n' and (i < 97 or i > 122):
te... | true |
84f5a448f8d4b6b1a5ff8e724f1957dc85a9e53e | Python | BenWilop/PrisonersDilemmaTournament | /code/decxjo/gradual.py | UTF-8 | 488 | 2.71875 | 3 | [
"MIT"
] | permissive | def strategy(history, memory):
if memory is None:
memory = (0, 0)
defections = memory[0]
count = memory[1]
choice = 1
if count > 0:
if count < defections:
choice = 0
count += 1
elif count == defections:
count += 1
elif count > defections:
count = 0
elif history.shape[1] >= 1 an... | true |
5769d797b1ebeb0101be6a04c726559ddfe65748 | Python | e-gu21/Ejericicios-resueltos-de-programacion | /Pruebas python/Failed python/e.py | UTF-8 | 72 | 3.015625 | 3 | [] | no_license | import math
x=239.455
print("el valor redondeado es:",round(239.455,2))
| true |
14fd69c5e0edd599022cf46d96602f13e42035b4 | Python | CiscoTestAutomation/examples | /loop/loop_example_job.py | UTF-8 | 399 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | # To run the job:
# pyats run job loop_example_job.py
# Description: This example shows looping and variants in pyats
import os
from pyats.easypy import run
def main():
# Find the location of the script in relation to the job file
test_path = os.path.dirname(os.path.abspath(__file__))
testscript = os.path... | true |
b33701546c921aa0b7140ecbd2a91985cd2c802b | Python | murshidazher/ultimate-hands-on-hadoop | /section-06/CassandraSpark.py | UTF-8 | 1,333 | 2.734375 | 3 | [
"MIT"
] | permissive | from pyspark.sql import SparkSession
from pyspark.sql import Row
from pyspark.sql import functions
def parseInput(line):
fields = line.split('|')
return Row(user_id = int(fields[0]), age = int(fields[1]), gender = fields[2], occupation = fields[3], zip = fields[4])
if __name__ == "__main__":
# Create a Sp... | true |
b6ff315564541e264b28459f38d7f1d60674224b | Python | mpofukelvintafadzwa/qubo-nn | /qubo_nn/plots/gen_qubo_map_pickle.py | UTF-8 | 435 | 2.703125 | 3 | [
"MIT"
] | permissive | import gzip
import pickle
import numpy as np
with gzip.open('../datasets/1.pickle.gz', 'rb') as f:
data, labels = pickle.load(f)
# Calc percentiles.
singles = []
medians = []
for i in range(9):
p = np.percentile(data[int(1e5 * i):int(1e5 * (i + 1))], 90, axis=0)
medians.append(p)
p = data[int(1e5 * ... | true |
618e540c250c2a6d3e2cdf06e6525fa43bf1d58e | Python | joemulray/265 | /Assignments/A2/knight.py | UTF-8 | 2,824 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python
#Joseph Mulray
#Assignment 2
#import sys for arguments and random for random position
import sys
import random
def success(board):
"""check if board is a success or failure"""
isTrue = True
#see if any values where knight was not moved to
for row in board:
for value in row:
if (value... | true |
fb49ae63112d13250550c0165531551275212d44 | Python | welsny/solutions | /83.Remove_Duplicates_from_Sorted_List.py | UTF-8 | 590 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
... | true |
d1c32f99d1ed6a8c91e11ce7cec81c14d718cf11 | Python | duckzhao/tensorflow2_learning | /self_code/tf_often_used_func.py | UTF-8 | 4,356 | 3.828125 | 4 | [] | no_license | # tensor2.0常用函数的记录,包括强制转换数据类型,计算张量某个维度上的最大/最小值,张量均值和 张量sum
# 可训练的变量的生成,tensor的四则运算(数字运算,非矩阵运算),开平方操作
# 矩阵乘法,tf.data的一点知识
# tf打散数据
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 关闭log信息
import tensorflow as tf
import numpy as np
# 1.tf.cast 强制tensor转换为某种数据类型
x1 = tf.constant(value=np.arange(12), dtype=tf.float3... | true |
3efcacd92465efc0dfefaaa3c216a93fc1df8566 | Python | khanmbjob/python | /TextClassificationAyubQadri.py | UTF-8 | 3,939 | 3.265625 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 12 21:54:40 2018
@author: Code from Neighbour
"""
import numpy as np
import pandas as pd
import seaborn as sns
from io import StringIO
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extracti... | true |
59facf80e86a94d782db983a35e3b136b41e702b | Python | Kubisjak/SWP---Python | /Python Support Files/Random_Test.py | UTF-8 | 1,754 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 30 19:25:14 2014
@author: Kubisjak
"""
import numpy as np
import matplotlib.pyplot as plt
class Game(object):
def __init__(self,size):
self.size = size
def random_start(self):
if self.size <= 10 :
print "Size of the board... | true |
6f6c491f047e5c1ecd07abf546441063f477677e | Python | Labib17/RealTimelabs | /RTS_RGR/task.py | UTF-8 | 1,998 | 2.953125 | 3 | [] | no_license | from dataclasses import dataclass, field
from random import uniform, randint
def getIntervals(time):
return [(time[i], time[i + 1] - time[i]) for i in range(0, len(time), 2)]
def getWaitTime(task):
time = task.timestamps
diff = time[0] - task.arrival
if len(time) > 2:
return diff + sum([time[i] - time[i -... | true |
246dcb8399f970db9f02212134a6e952b736bced | Python | nkiruka-app/DeepLearningModel | /pipe_data.py | UTF-8 | 1,089 | 3.015625 | 3 | [] | no_license | import os
import pandas as pd
csv_path = r"C:\Users\Jayee Li\Desktop\torch\dataset.csv"
dataset = pd.read_csv(csv_path)
print("adding data entries.")
audio_directory = r"C:\Users\Jayee Li\Desktop\torch\audio"
text_directory = r"C:\Users\Jayee Li\Desktop\torch\texts"
#look through all files in both data directories
f... | true |
76e35c7583510cd7d89c5fd6a3dfd2f64c90da58 | Python | notionparallax/sensicorn | /indoorSoftware/Python/calSoundSNR.py | UTF-8 | 1,089 | 3.265625 | 3 | [] | no_license | """Send lots of commands to the S^3."""
import receive
import send
import sys
def two_hex(intVal):
"""Convert int to simple hex."""
return str(hex(intVal)[2:])
def sixChar(r, g, b):
"""Take 3 ints and return a value like BADA55."""
r = two_hex(r).rjust(2, "0")
g = two_hex(g).rjust(2, "0")
b ... | true |
7dd1ba5bb9d7d6dafeb28f598757927773b417da | Python | ThomasChevalier/passwordWallet | /Utility/option_parser/parser.py | UTF-8 | 5,805 | 2.703125 | 3 | [
"MIT"
] | permissive | """
option_parser by Thomas Chevalier.
(c) 2018 Thomas Chevalier - All rights reserved.
thomasom.chevalier@gmail.com
Usage :
python parser.py [fileName]
[fileName] : The filename of the xml file describing the option list
"""
import sys
import xml.etree.ElementTree as ET
import datetime
def parse_elem(elem):
"""
R... | true |