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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2dc3168176ead09c643b6d8b67b66316f48bcabc | Python | yirano/project_data-structures | /src/binary_search_tree/binary_search_tree.py | UTF-8 | 4,541 | 4.5625 | 5 | [] | no_license | """
Binary search trees are a data structure that enforce an ordering over
the data they store. That ordering in turn makes it a lot more efficient
at searching for a particular piece of data in the tree.
This part of the project comprises two days:
1. Implement the methods `insert`, `contains`, `get_max`, and `for... | true |
16bfaf1ba05d2424825e5bfa79cd9883adc3a970 | Python | abjklk/aps-2020 | /bitwise_substrings.py | UTF-8 | 186 | 4.0625 | 4 | [] | no_license | # Handout 4
# Program to obtain substrings of string using bitwise shift op
a = "ABCD"
n = len(a)
for i in range(1<<n):
for j in range(n):
if i&(1<<j):
print(a[j],end="")
print() | true |
535ed274f70398730b49d117e2c0d3346cf61f2d | Python | zorzonp/Mini_Project_2 | /main.py | UTF-8 | 3,637 | 3.375 | 3 | [] | no_license | ####################################################################
##
## Authors: Peter Zorzonello
## Last Update: 10/20/2018
## Class: EC601 - A1
## File_Name: Main.py
##
## Description:
## This is a test file to test all of the API calls in helper.
## This file will show how the model performed.
##
... | true |
dc6dfb1150e7553d63a14a5119cc64174a6632e4 | Python | bgbutler/TimeSeriesBook | /chapter_11/random_walk_stationarity.py | UTF-8 | 592 | 3.390625 | 3 | [] | no_license | # calculate the stationarity of a random walk
from random import seed
from random import random
from statsmodels.tsa.stattools import adfuller
# generate random walk
seed(1)
random_walk = list()
random_walk.append(-1 if random() < 0.5 else 1)
for i in range(1, 1000):
movement = -1 if random() < 0.5 else 1
value = ran... | true |
31cc65040b083727ce03f1140a71948f0158b5ed | Python | tojov/kat_ran_thru_my_keebord | /kat_ran/kat.py | UTF-8 | 462 | 3.453125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 4 23:12:15 2019
@author: abhijithneilabraham
"""
import random
import time
c=int(input('write in number how much you love a cat \n'))
def catran():
a=random.randint(97,122)
print(chr(a),end="")
r=0.05
for i in range(c):
if i%5=... | true |
6e31925f6c79949b0d2cb4fb124c648b24303af9 | Python | 1nkribbon/stepik_selenium | /alert_task.py | UTF-8 | 656 | 3.046875 | 3 | [] | no_license | import time
import math
from selenium import webdriver
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
link = "http://suninjuly.github.io/alert_accept.html"
browser = webdriver.Chrome()
try:
browser.get(link)
first_button = browser.find_element_by_css_selector(".btn-primary")
first_button.click()
... | true |
9cfc814633b7fcb02e3ab03868aeb7614ebb5845 | Python | mohammedkaifs/python-programs | /16_sets_in_python.py | UTF-8 | 518 | 4.34375 | 4 | [] | no_license | a = {1,3,4,5}
print(type(a))
print(a)
#Important : this syntax will create an empty dictionary and an empty set
a={}
print(type(a))
# An empty set can be using the below syntax:
b=set()
print(type(b))
# adding values to an empty set
b.add(4)
b.add(5)
b.add((7,8))
# b.add({4:5}) # cannot add lists or dictonary in se... | true |
5a20f241d1cecc6b034657094aa409d883fe921e | Python | ilailabs/python | /tutorials/trash/magic_method_operator_overloading.py | UTF-8 | 617 | 4.09375 | 4 | [] | no_license | # Python also provides magic methods for comparisons.
# __lt__ for <
# __le__ for <=
# __eq__ for ==
# __ne__ for !=
# __gt__ for >
# __ge__ for >=
#
# If __ne__ is not implemented, it returns the opposite of __eq__.
# There are no other relationships between the other operators.
# Example:
class SpecialString:
def _... | true |
3e74cba96ddbd8e7e58aaf305d67bc50177de202 | Python | jboegeholz/flask_ajax | /ajax_lists.py | UTF-8 | 1,614 | 2.875 | 3 | [] | no_license | from time import sleep
from flask import Flask, jsonify
from flask import render_template
from flask import request
app = Flask(__name__)
@app.route('/')
def hello_world():
hello_string = "Hello World"
return render_template("index.html",
hello_message=hello_string)
@app.route('... | true |
141790bb72be7a39261013d2f8ebeb8ad5d140bf | Python | Rivarrl/leetcode_python | /leetcode/601-900/719.py | UTF-8 | 967 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# ======================================
# @File : 719.py
# @Time : 2020/12/25 10:08 上午
# @Author : Rivarrl
# ======================================
from algorithm_utils import *
class Solution:
"""
[719. 找出第 k 小的距离对](https://leetcode-cn.com/problems/find-k-th-smallest-pair-dista... | true |
62a930374cc4a780ab3163e653b615ab9cb2278c | Python | shohei/chip-convex-hull | /chipdetect.py | UTF-8 | 1,214 | 2.625 | 3 | [] | no_license | import cv2, matplotlib
import numpy as np
import matplotlib.pyplot as plt
chips = cv2.imread('chip.png')
chips_gray = cv2.cvtColor(chips, cv2.COLOR_BGR2GRAY)
chips_preprocessed = cv2.GaussianBlur(chips_gray, (5, 5), 0)
_, chips_binary = cv2.threshold(chips_preprocessed, 230, 255, cv2.THRESH_BINARY)
chips_binary = cv2.... | true |
a702924713f5d366d56f175082e03b5e87e19a39 | Python | rentainhe/interview-algorithm-collection | /剑指offer/offer-64.py | UTF-8 | 217 | 2.96875 | 3 | [] | no_license | # encoding: utf-8
class Solution:
def sumNums(self, n: int) -> int:
mid = n // 2
if n % 2 == 0: # 判断奇数偶数
return n * mid + mid
else:
return n * mid + n
| true |
12b79fbcb1436e250e17b5ae6ff7a3755f9cdbb5 | Python | alexanu/Python_Trading_Snippets | /data/Netfonds_tick_and_processing/Netfonds_another.py | UTF-8 | 6,715 | 3.28125 | 3 | [] | no_license | import datetime
from datetime import timedelta
from pandas import DataFrame, concat, date_range, read_csv
class Lime:
'''
A simple API for extracting stock tick data.
###Parameters
* start_date -- datetime, date beginning the retrieval window
* end_date -- datetime, date ending the retrieval windo... | true |
6001df227b41931e5959af7082509afa03305d6e | Python | strike1989/Text_Classification | /GRU.py | UTF-8 | 4,767 | 2.6875 | 3 | [] | no_license | #coding:utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import jieba
import pandas as pd
df_technology = pd.read_csv("./data/technology_news.csv", encoding='utf-8')
df_technology = df_technology.dropna()
df_car = pd.read_csv("./data/car_news.csv", enc... | true |
148f60527e05e59c46e4e51c9d52c858bc01bee5 | Python | Louka98/EasyML | /elbow.py | UTF-8 | 531 | 2.8125 | 3 | [] | no_license | from sklearn.clusters import KMeans
import matplotlib.pylot as plt
import numpy as np
import pandas as pd
def elbowvis()
wcss=[]
for i in range(1,30):
kmeans = KMeans(n_clusters=i, init ='k-means++', max_iter=300, n_init=10,random_state=0 )
kmeans.fit(data)
wcss.append(... | true |
0241936e6cd0073b71f7cfac850dc8c49f0cff84 | Python | GSSJacky/neural-painters-pytorch | /neural_painters/transforms.py | UTF-8 | 2,858 | 3.1875 | 3 | [
"MIT"
] | permissive | """
Contains various differentiable image transforms.
Loosely based on Lucid's transforms.py https://github.com/tensorflow/lucid/
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import random
import kornia
class RandomScale(nn.Module):
"""Module for randomly scaling an image"""
def __init... | true |
dab89966eed981400b5add8d42eebf3546520e4b | Python | AatifTripleA/tictactoe_player_vs_player | /tictactoe_ply_vs_ply.py | UTF-8 | 6,097 | 4.09375 | 4 | [] | no_license | # Tic Tac Toe
import random
class TicTacToe:
def __init__(self, board):
self.board = board
def __repr__(self):
return ("<" + self.__class__.__name__ +
" board='" + str(self.board) + "'"
">")
def drawBoard(self):
# T... | true |
d3ea0cd341a60bdcc2fe4004d97813f22ba36587 | Python | stefoxp/codewars | /PlayingWithPassphrases/code/play.py | UTF-8 | 588 | 3.515625 | 4 | [] | no_license | import string
def play_pass(s, n):
result = ""
s_len = len(s)
for i in range(s_len):
single_char = s[i]
if single_char.isdigit():
result += str(9 - int(single_char))
elif single_char.isalpha():
index = string.ascii_uppercase.index(single_char.upper()) + n
... | true |
01d0da6a20a993b760f911c1496369ad548a7670 | Python | jjiayying/cp2019 | /Practical 1/q3_miles_to_kilometre.py | UTF-8 | 162 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[9]:
miles = float(input("miles"))
kilometres = 1.60934 * miles
print("{0:.2f}".format(kilometres))
# In[ ]:
| true |
097461f5ac536c60af4b1d29b5bd708404698433 | Python | christofoo/hard-way | /ex8.py | UTF-8 | 814 | 3.828125 | 4 | [] | no_license | # this names the string of r conversions formatter
formatter = "%r %r %r %r"
# this prints formatter with the fills being integers
print formatter % (1, 2, 3, 4)
#this prints formatter with the conversions being strings
print formatter % ("one", "two", "three", "four")
#this prints the formatter with the conversion fil... | true |
75d879a1d915d43488bcd12ba643d4fae23eaf61 | Python | BE-PROJECTS2018/GroupNo29-Aspect-and-Review-Based-Recommendation-System | /arbrsenv/arbrs/preprocessed/asp_sent_extraction.py | UTF-8 | 3,185 | 2.625 | 3 | [] | no_license | import json
import nltk
import math
import re
import string
from pycorenlp import StanfordCoreNLP
from textblob import TextBlob
from nltk.corpus import wordnet
import asp_sent_rules as rules
import unicodedata
nlp = StanfordCoreNLP('http://localhost:9000')
#f = open("sample_sentences.txt","r")
line = "Camera is very g... | true |
c0a204b98ac8342f61d20be4739a578233cf4e9e | Python | Chacon-Miguel/CodeForces-Solutions | /choosingTeams.py | UTF-8 | 871 | 3.8125 | 4 | [] | no_license | # n is the number of students
# k is the number of times players r needed to play
n, k = [int(a) for a in input().split()]
# List that holds how many times each player has played
PlayedGames = [int(a) for a in input().split()]
# assume all players are eligible
eligiblePlayers = n
# iterate through the PlayedGame... | true |
9b567ec5eb8972c1d7a2898b5467316b38a48e0e | Python | atdog/adbg | /adbg/commands/disasm.py | UTF-8 | 1,504 | 2.609375 | 3 | [] | no_license | from adbg.commands import GDBCommand
import adbg.modules.memory as memory
import adbg.modules.color as color
import adbg.modules.arch as arch
from capstone import *
class CSArch():
def __init__(self, cs_arch, cs_mode):
self._arch = cs_arch
self._mode = cs_mode
@property
def arch(self):
... | true |
e0f2f72f2b397e9d050593a9e1ebc5cb2ef2beee | Python | Rovbau/Robina | /VisualKarte.pyw | UTF-8 | 1,931 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python3
from math import cos,sin,radians,asin,degrees
from tkinter import *
import pickle
import time
#Kartennull für TK
Nullx=200
Nully=380
#Tkinter
root=Tk()
root.title ("Hinderniss-Daten") #Titel de Fensters
root.geometry("700x700+0+0")
can=Canvas(master=root, width=600, hei... | true |
864ddc27c519aba1ae00db99e557cfa77a6a3738 | Python | chinmay0301/GlowHockey | /main.py | UTF-8 | 1,701 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
import cv2
import numpy as np
# init hsv detect function
h = 0
cv2.namedWindow('Original')
def rethsv(event,x,y,flags,param):
global h
if event == cv2.EVENT_LBUTTONDOWN:
#print hsv[y,x]
h=hsv[y,x,0]
cv2.setMouseCallback('Original', rethsv)
# choose de... | true |
391f702ceaa13e85abc2d6722bf9feab86ba6dc2 | Python | pradeepraja2097/Python | /opencv/venv/image_contour.py | UTF-8 | 798 | 2.921875 | 3 | [] | no_license | # contour is nothing but connecting outer boundaries with same colour and same intensity
# it is used for object detection
import cv2
import numpy as np
img=cv2.imread('opencv-logo.png')
imgray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # convert imge to grayscale
ret,thresh=cv2.threshold(imgray,127,255,0) # define the th... | true |
9ad57f016c70d121b70687087844257118e4b589 | Python | amazingyyc/Deep8CV | /MNIST/cnn_minist.py | UTF-8 | 3,056 | 2.71875 | 3 | [] | no_license | # coding=utf-8
import cPickle, gzip, os, sys
import numpy as np
from deep8 import *
def loadData(dataPath):
# Load the dataset
f = gzip.open(dataPath, 'rb')
trainSet, validSet, testSet = cPickle.load(f)
f.close()
return (trainSet[0], trainSet[1], validSet[0], validSet[1], testSet[0], testSet[1])
... | true |
7dd55bcf2fad239690cee795a568cede4f245a54 | Python | letruongthanh24103698/BLE_matlab | /code/server.py | UTF-8 | 2,836 | 2.625 | 3 | [] | no_license | ####****************************Request library****************************####
from estimate_dis import estimate_dis
####***********************************************************************####
#import lib
from scipy.io import loadmat
import requests
import matplotlib.pyplot as plt
import math
####**************... | true |
f5fc4f62c3a078b39c1ded2344607edecbe19e78 | Python | hmaynard8877/dog-shelter-project | /food_calculator.py | UTF-8 | 1,331 | 3.96875 | 4 | [] | no_license | MAX_CAPACITY = 30
def calculate_food(num_small, num_medium, num_large, lbs_surplus):
#Check that number of dog values are integers
if (type(num_small) != int or type(num_medium) != int or type(num_large) != int):
raise TypeError("Error: Number of dogs must be an integer.")
#Check that amount of exc... | true |
3395d43fac4d27d82877b11b5f2752ea02a5a17e | Python | michal037/workspace | /plot1.py | UTF-8 | 186 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plot
def fun(x):
return (np.cos(3*x) / x) ** 2
X = np.linspace(0.3, np.pi, 500)
Y = [fun(x) for x in X]
plot.plot(X, Y)
plot.show()
| true |
bda9079bdbbe9a9c183afc95a84b790e34232f84 | Python | sichen/hrmmdiscuz | /scripts/dz_multiuser.py | UTF-8 | 3,585 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
'''
The python script helps me create discuz users in batch
Created on Nov 14, 2011
@author: sichen
'''
from optparse import OptionParser
import datetime
import time
import sys
import md5
import random
import re
# Globals
# the global salt value
SALT = 'ab12cd'
# the global password
PW = 'rzxlsz... | true |
500d3964d53a1e9784b28170b29c6456b1b47ecc | Python | StarSTRUQ/ND-Tile | /ndtile.py | UTF-8 | 5,614 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Do Tiling for an N-dimensional data set given an input CSV file
containing one point per row. Each point is specified by a set
of independent parameter values followed by the dependent scalar value.
Copyright (c) 2016, Donald E. Willcox
All rights reserved.
Redistribution and use in source and binary forms, with... | true |
bebec923cde95cab21569885180b4777fa46e9b9 | Python | Flaagrah/Deep_Learning_Portfolio | /YOLO/src/yolo_model/normalization.py | UTF-8 | 1,762 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
import os
import numpy as np
import pandas
from yolo_model import B_BOX_SIDE as B_BOX_SIDE
from yolo_model import IMAGE_HEIGHT as IMAGE_HEIGHT
from yolo_model import IMAGE_WIDTH as IMAGE_WIDTH
from yolo_model import CLASSES as CLASSES
num_classes = len(CLASSES)
#Normalize the width ... | true |
2044742f6fe96a08e34dbf233e5610956e69f468 | Python | Aakritisingla1895/Recsys | /regression_collabfilter.py | UTF-8 | 902 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy.optimize import fmin_cg
from scipy.stats import pearsonr
from sklearn.metrics import mean_squared_error
args = None
def load_data(filename, exclusion = False):
users = {}
with open(filename) as reader:
#skip first line
next(reader)
for... | true |
8854f633824c8bb87b7c1df9c8dc7c6070e2f1d8 | Python | amol9/vote | /vote/polls.py | UTF-8 | 1,893 | 2.8125 | 3 | [
"MIT"
] | permissive | import re
from .reddit_post import RedditPost
from .image_poll import ImagePoll, Image
from .straw_poll import StrawPollError, VotePass
class PollError(Exception):
pass
class Polls:
def __init__(self):
self._map = {
'reddit_image_poll' : self._reddit_image_poll,
'reddit_image_poll2' : self._reddit_... | true |
4c949343d08f24e29d85ccd4f25e08efc76de85b | Python | llDataSciencell/CriptoAutoTrade | /TrainModel/XGBoost2/trade_class.py | UTF-8 | 4,462 | 2.796875 | 3 | [] | no_license | #coding: utf-8
'''
default:2239.65016075
after:2436.87876149
##0.4 40%
635.385700015
711.099316173
'''
import numpy as np
import poloniex
import datetime
import time
class TradeClass(object):
def __init__(self):
pass
def getDataPoloniex(self):
polo = poloniex.Poloniex()
polo... | true |
e2c75d047171757b12eee13ce15675c153843030 | Python | venkat-oss/SPOJ | /CHOTU.py | UTF-8 | 139 | 3.0625 | 3 | [] | no_license | import math
T = int(input())
for i in range(T):
a, b = map(int, input().split(' '))
print("%.3f" %(2 * math.sqrt(a * a - b * b)))
| true |
439040318de62e45daf5e31c6ef988310ff33ecf | Python | Damiao-NT/Listas_pythonBrasil | /Q12.py | UTF-8 | 712 | 4.03125 | 4 | [] | no_license | # Foram anotadas as idades e alturas de 30 alunos. Faça um Programa que determine quantos alunos com mais de 13 anos possuem altura inferior à média de altura desses alunos
idade = []
altura = []
media_altura = 0
conte = 0
for i in range (30):
idade.append(int(input("Digite a idade do aluno %d:" %(i+1))))
... | true |
8a66380a6843f9ce15e430554e771187e616457d | Python | 7Cx0/udacity101 | /lesson1/26.py | UTF-8 | 285 | 2.84375 | 3 | [] | no_license | speed_of_light = 299792458 #meters per second
cycles_per_second = 2700000000. #2.7 GHz
cycle_distance = speed_of_light / cycles_per_second
print cycle_distance * 100
cycles_per_second = 2800000000. #2.8 GHz
cycle_distance = speed_of_light / cycles_per_second
print cycle_distance
| true |
3f4c0cfe353a1cb7a7045e8587499ac5377f2436 | Python | pollyanarocha416/desafio-gitHub | /logica-prog-ecencial/Concatenação.py | UTF-8 | 155 | 3.75 | 4 | [] | no_license | text1 = input('digite seu nome: ')
text2 = input('digite seu sobre nome: ')
phrase = text1 + text2
print('seu nome e sobre nome e: ')
print(phrase)
| true |
3d1c2c2c2976bfff1ea7bc6d1e65d7ceba3c453f | Python | ItsNewe/py-sheet | /sheet.py | UTF-8 | 23,426 | 3.984375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
#################################
# FEUILLE DE REVISION DE PYTHON #
# PAR NEWE #
# https://github.com/itsnewe #
#################################
# Basé sur plusieurs tutoriels, mais notamment ... | true |
8b324d04a47cc0f4a40cc322efd9913b40e83ffc | Python | JagritiG/interview-questions-answers-python | /code/set_2_linkedlist/2_add_two_numbers.py | UTF-8 | 2,749 | 4.4375 | 4 | [] | no_license | # You are 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.
# Explanation: 342 + 465 = 807
# Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
# Output: 7 -> 0 -> 8
... | true |
2a38c501ef575909c9bbc7afbd1a3d1c01c65a48 | Python | cn-uofbasel/BACnet | /21-fs-ias-lec/14-BAC-News/dependencies/07-14-logCtrl/src/logStore/appconn/chat_connection.py | UTF-8 | 1,328 | 2.890625 | 3 | [
"MIT"
] | permissive | from .connection import Function
class ChatFunction(Function):
"""Connection to the group chat to insert and output the chat elements"""
def __init__(self):
super(ChatFunction, self).__init__()
def insert_chat_msg(self, cbor):
"""adds a new chat element as cbor
@:parameter event... | true |
d50a0dd67bbd6f2ab5212be7aecf50c42fffc1d0 | Python | DukeFerdinand/developer-portfolio | /api/scripts/seed_db.py | UTF-8 | 1,139 | 2.53125 | 3 | [] | no_license | from os import environ, path
from sys import argv
from json import load
from db.config import connect_db
from db.models.models import Page, PageData
c = {
"MONGO_DB": environ["MONGO_DB"],
"MONGO_HOST": environ["MONGO_HOST"],
"MONGO_USR": environ["MONGO_USR"],
"MONGO_PWD": environ["MONGO_PWD"],
"M... | true |
c27a83f508ad572ed0018dd47595ee75b810b6ba | Python | JuncheolH01469/Nomadcoders | /파이썬으로 웹 스크래퍼 만들기/#1 Theory/1_8 - Code Challenge!/main.py | UTF-8 | 483 | 4 | 4 | [] | no_license | def plus(a, b):
return float(a) + float(b)
def minus(a, b):
return float(a) - float(b)
def times(a, b):
return float(a) * float(b)
def division(a, b):
return float(a) / float(b)
def remainder(a, b):
return float(a) % float(b)
def negation(a):
return -float(a)
def power(a, b):
return fl... | true |
29e362b9d0f4caa7d1e8d9e4f0493b7a94fafe68 | Python | ggoofie/stepic-python-trainer | /duplicates_in_list.py | UTF-8 | 927 | 3.984375 | 4 | [] | no_license | """
Напишите программу, которая принимает на вход список целых чисел и выводит на экран значения, которые повторяются в нём более одного раза.
Для решения задачи может пригодиться метод sort списка.
Формат ввода:
Одна строка с целыми числами, разделёнными пробелом.
Формат вывода:
Строка, содержащая числа, разделённ... | true |
6f84da2181eba387fe5c9e69c1c698f5622d11aa | Python | BingzhaoZhu/Hardware-fridendly-DT | /BIOCAS2019_reconstructed/model_cost.py | UTF-8 | 5,550 | 2.65625 | 3 | [] | no_license | import numpy as np
import lightgbm as lgb
def ReadTree(name, num_tree):
Trees=[]
with open(name,'r') as file:
l=file.readline().rstrip('\n')
for i in range(num_tree):
tree = {}
while not ('Tree='+str(i))==l:
if 'end of trees' in l:
... | true |
3e05a62ffa255aa0677c3750f298e3f8ba005db2 | Python | jeb2162/datadog-metric-explorer | /dd_metric_explorer.py | UTF-8 | 3,659 | 2.890625 | 3 | [] | no_license | # Main file for the Datadog Metric Explore Script.
import sys
from custom_metric_data import custom_metric_usage
from datadog_account_object import datadog_account
from metric_analysis_and_export import analyze_metrics
def main(run_time_parameters):
dd_account_object = datadog_account(run_time_parameters)
# If file_... | true |
726c7e5044e26ee8125cdedddb2012a22c0a63de | Python | orcilano/Mlib | /skiharris.py | UTF-8 | 967 | 2.671875 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from skimage import data, img_as_float
from skimage.feature import corner_harris, corner_peaks
from imageio import imread
def harris(image, **kwargs):
return corner_peaks(corner_harris(image), **kwargs)
def plot_harris_points(image, filtered_coords):
"... | true |
0cd9ca1280030db9e256647eb0376f448e650580 | Python | EricMFischer/two-sum-hash-table | /two_sum_hash_table.py | UTF-8 | 1,681 | 3.71875 | 4 | [] | no_license | '''
The goal of this problem is to implement a variant of the 2-SUM algorithm. The file contains 1
million integers, both positive and negative (there might be some repetitions). The ith row of
the file specifies the ith entry of the array.
The task is to compute the number of target values t in the interval [-10000,1... | true |
c8236be47591a4d00fb9362dd659fc3d9b0eef5b | Python | wuwei23/SpiderLearn | /Spiderlearn/回顾python编程/进程间通信Pipe.py | UTF-8 | 1,156 | 3.140625 | 3 | [] | no_license | import multiprocessing
import random
import os,time
#Pip方法返回(conn1,conn2)代表一个管道的亮度啊女,Pipe方法有duplex参数,
# 如果duplex参数值为True(默认值),那么代表这个管道为全双工模式,若duplex
#值为False,conn1只负责接收消息,conn2只负责发送消息,send和recv方法分别是
# 发送和接收消息的方法,如果没有消息可以接收,recv方法会已知阻塞,如果管道已经关闭
#recv会抛出EOPError
def proc_send(pipe,urls):
for url in urls:
pr... | true |
d3b658d4ba57440deb49dc8dbbfcf60f3f371e5e | Python | jonathanthen/INFO1110-and-DATA1002-CodeDump | /wk5stringsearch2.py | UTF-8 | 725 | 4.03125 | 4 | [] | no_license | def starts_with(word, chs):
if word == "":
return False
elif len(chs) == 0:
return False
else:
i = 0
while i < len(chs):
if word.startswith(chs[i]) == True:
return True
i += 1
return False
# You can put the func... | true |
ba979d194eaef61c2821a6a30843c0d6242298f6 | Python | jaymgonzalez/python-crash-course-exercises | /file_system_exceptions.py | UTF-8 | 4,551 | 3.796875 | 4 | [] | no_license | # read from file
import json
filename = 'pi.txt'
# # with info outside the block
# with open(filename) as file_object:
# lines = file_object.readlines()
# for line in lines:
# print(line.rstrip() * 3)
# with infor within the block
with open(filename) as file_object:
for line in file_object:
print... | true |
0a17c3b60349322f1ae9fc4aecfb56b3d816400a | Python | camilok14/mummy_simulation | /util.py | UTF-8 | 981 | 3.125 | 3 | [] | no_license | from numpy.random import normal, uniform
from random import sample, random
def get_random_attributes(dist, size) -> list:
"""
Returns a list of 3 lists of size random numbers.
Each one of the 3 lists will have a dist distribution.
Parameters
----------
dist : string
If dist is 'normal' t... | true |
76ac87c47c0614b1aeaff5eb004fabd60c1fb7a6 | Python | w893058897/pythonhomework | /hero_factory.py | UTF-8 | 521 | 3 | 3 | [] | no_license | from pythonhomework.Hero import Hero
from pythonhomework.Police import Police
from pythonhomework.Timo import Timo
class HeroFactory(Hero):
def add_hero(self,name):
if name == "Timo":
return Timo()
elif name == "Police":
return Police()
else:
raise Exc... | true |
021cd556e47e83f14e8886bb85a288d6cd355955 | Python | kenny-kim2/algorithm_study | /programmers/2019_2_17/test4.py | UTF-8 | 1,263 | 4.0625 | 4 | [] | no_license | # 문제 설명
# 124 나라가 있습니다. 124 나라에서는 10진법이 아닌 다음과 같은 자신들만의 규칙으로 수를 표현합니다.
#
# 124 나라에는 자연수만 존재합니다.
# 124 나라에는 모든 수를 표현할 때 1, 2, 4만 사용합니다.
# 예를 들어서 124 나라에서 사용하는 숫자는 다음과 같이 변환됩니다.
#
# 10진법 124 나라 10진법 124 나라
# 1 1 6 14
# 2 2 7 21
# 3 4 8 22
# 4 11 9 24
# 5 12 10 41
# 자연수 n이 매개변수로 주어질 때,
# n을 124 나라에서 사용하는 숫자로 바꾼 값을 return ... | true |
1912af9a32beb01d48a39f0a154985e4fa9ce58d | Python | m4Rn1tSCH/flask_api_env | /ml_code/model_data/yodlee_encoder_random_test.py | UTF-8 | 12,976 | 2.53125 | 3 | [] | no_license | '''
Yodlee dataframes encoder
FIRST STAGE: retrieve the user ID dataframe with all user IDs with given filter
dataframe called bank_df is being generated in the current work directory as CSV
SECOND STAGE: randomly pick a user ID; encode thoroughly and yield the df
THIRD STAGE: encode all columns to numerical values a... | true |
53bab15323255537b7683e52a0db417238132f9e | Python | zazuPhil/prog-1-ovn | /Uppgitf2.6-01.py | UTF-8 | 197 | 3.796875 | 4 | [] | no_license | inmatning = float(input('skriv in ett heltal: '))
svar = inmatning % 2
if svar == 1:
print(f'Talet {inmatning} är ojämnt.')
else:
print (f'Talet {inmatning} är jämnt.')
| true |
7cedf1752cf85acf4ea947268a4c80b5958f960f | Python | RodrigoZea/Miniproyecto5 | /fuzzy_logic.py | UTF-8 | 4,485 | 2.96875 | 3 | [] | no_license | from constants import *
# Membership functions for distance
def d_close(x):
if x <= 2:
return 1.0
elif x > HALF_MAX_DIST:
return 0.0
return -0.197197430123091 * x + 1.39439486024618
def d_medium(x):
if x <= HALF_MAX_DIST:
return 0.141421512474792 * x
return -0.1414213124746... | true |
1d14c7be377de1a20203dc3a9e4a598d53345de9 | Python | hiddenSymmetries/simsgeo | /simsgeo/objectives.py | UTF-8 | 5,685 | 2.71875 | 3 | [] | no_license | from jax import grad, vjp
import jax.numpy as jnp
import numpy as np
from .jit import jit
@jit
def curve_length_pure(l):
return jnp.mean(l)
class CurveLength():
def __init__(self, curve):
self.curve = curve
self.thisgrad = jit(lambda l: grad(curve_length_pure)(l))
def J(self):
re... | true |
4aa065eb6431511fa38f838f3fe34bdd3bc5e32b | Python | APochiero/Aeronautical-Communication-Simulation | /scripts/plotResult.py | UTF-8 | 3,239 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import math
import argparse
import seaborn as sns
matplotlib.rcParams['font.family'] = "serif"
t = [4.24, 7.42, 10.59, 13.77, 16.95]
k = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2]
colors = ['#944654', '#08b2e3', '#9d8df1', '#57a773', '#... | true |
51d3e34eb01b9c87086a59b28d338294d9d89eed | Python | orenltr/Photo2 | /SingleImage.py | UTF-8 | 33,880 | 3.28125 | 3 | [] | no_license | import numpy as np
import math
from Camera import Camera
from MatrixMethods import *
import PhotoViewer as pv
import matplotlib as plt
from scipy.linalg import rq,inv
# from scipy.spatial.transform import Rotation as R
class SingleImage(object):
def __init__(self, camera, type='real'):
"""
... | true |
4bb2440ba34cda75e83987dbb69807c124fd91b3 | Python | yanspirit/mytest | /python/tinyPro/hanxin.py | UTF-8 | 255 | 3.140625 | 3 | [] | no_license | #!/usr/local/bin/python
def test(people):
if people%3==2 and people%5==3 and people%7 == 2:
return True
else:
return False
for i in xrange(1,100):
if test(i) == True:
print "least sodiors",i
# else:
# print "" | true |
27784d819ebc01626288cdc2a950640ccfda4e7a | Python | jevandezande/quantum | /quantum/zhamiltonian.py | UTF-8 | 3,817 | 3.4375 | 3 | [] | no_license | from matplotlib import pylab, pyplot as plt
import numpy as np
# 6x6
mat66 = -np.matrix([[100,30, 7, 7, 3, 3, 1, 0],
[ 30,80, 7, 7, 3, 3, 1, 1],
[ 7, 7,90,30, 7, 7, 3, 3],
[ 7, 7,30,70, 7, 7, 3, 3],
[ 3, 3, 7, 7,75,30, 7, 7],
... | true |
275e7db3ac0199c83bea484391d55f2b5734f08e | Python | dlshriver/csce430 | /Assembler/stringToMif.py | UTF-8 | 790 | 3.4375 | 3 | [] | no_license | str1 = "BAab98"
str2 = "Aab9B8"
for i in range(128):
if i < len(str1):
print "\t%s : %06x;" % (i, ord(str1[i]))
else:
print "\t" + str(i) + " : 000000;"
for i in range(128):
if i < len(str2):
print "\t%s : %06x;" % (i+128, ord(str2[i]))
else:
print "\t" + str(i+128) + " : 000000;"
def lon... | true |
1c2ceb998cbc63d29f940350c0003f9e26b76bb6 | Python | MoJoVi/Euler_Project | /euler054.py | UTF-8 | 4,880 | 3.6875 | 4 | [] | no_license | """В карточной игре покер ставка состоит из пяти карт и оценивается
от самой младшей до самой старшей в следующем порядке:
Старшая карта: Карта наибольшего достоинства.
Одна пара: Две карты одного достоинства.
Две пары: Две различные пары карт
Тройка: Три карты одного достоинства.
Стрейт: Все пять карт по порядку, люб... | true |
b6820546219d15eee35d0e8873058208f0b6d48c | Python | sushmitaraii1/Python-Assignment | /IW-Python-Assignment II/6.py | UTF-8 | 370 | 4.53125 | 5 | [] | no_license | # 6. Create a list with the names of friends and colleagues. Search for the
# name ‘John’ using a for a loop. Print ‘not found’ if you didn't find it.
lst = ['Sushmita', 'salina', 'shreya', 'upasana', 'John', 'ojaswee']
for name in lst:
if name == 'John':
print("You have friend named {}.".format(name))
... | true |
ca3a7fb88984d499246b8bc029264f5dfcaa6b31 | Python | Magnum457/smartAquarium | /nivel.py | UTF-8 | 823 | 2.78125 | 3 | [] | no_license | # imports
import RPi.GPIO as GPIO
import time
import res_mqtt as mqtt
# configurando os GPIO
def setup():
GPIO.setmode (GPIO.BCM) # usa o mapa de portas da placa
bot = 13
GPIO.setup (bot, GPIO.IN, pull_up_down=GPIO.PUD_UP)
estado = 0
return bot, estado
def loop_nivel():
try:
while... | true |
169b753b51ae84ea466edde7ec633b730b177245 | Python | JoHyukJun/algorithm-analysis | /src/python/SumOfPartialSequence.py | UTF-8 | 504 | 3.09375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | '''
main.py
Created by Jo Hyuk Jun on 2020
Copyright © 2020 Jo Hyuk Jun. All rights reserved.
'''
import sys
from itertools import combinations
n, s = map(int, sys.stdin.readline().rstrip().split(' '))
arr = list(map(int, sys.stdin.readline().rstrip().split(' ')))
f_arr = []
cnt = 0
for i in range(... | true |
85d245824b18451beea25bc3f848b09c64033dfd | Python | dasarpjonam/sloth | /scripts/cleanUpTheSerializedClasses.py | UTF-8 | 3,721 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
def processStroke(output):
output.write("[")
def processStrokeFinished(output):
output.write("--\n")
def isStroke(line, output):
if line.find('org.ladder.core.sketch.Stroke') != -1:
processStroke(output)
return True
return False
def isStrokeFinished(line, output... | true |
206c6bae1a575ba1e0ad31380419d1c205c99f4f | Python | AndrewAct/DataCamp_Python | /Preprocessing for Machine Learning in Python/Putting it All Together/01_Checking_Column_Types.py | UTF-8 | 1,101 | 3.3125 | 3 | [] | no_license | # # 6/26/2020
# Take a look at the UFO dataset's column types using the dtypes attribute. Two columns jump out for transformation: the seconds column, which is a numeric column but is being read in as object, and the date column, which can be transformed into the datetime type. That will make our feature engineering ef... | true |
7881a762f467e4a872b04fb69ed3c7fa35da4f99 | Python | n1balgo/algo | /permute_brackets.py | UTF-8 | 653 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
count = 0
def _print_brackets(N, M, String, Loc):
if N == 0 and M == 0:
global count
count += 1
print count, ''.join(String)
return
if N > 0:
String[Loc] = '{'
_print_brackets(N-1, M, String, Loc+1)
if M > N:
String[Lo... | true |
c019bd19aced0689ae96ffdf91a4f1577b1729c3 | Python | gabinete-compartilhado-acredito/100-dias-congresso | /analises/xavierUtils.py | UTF-8 | 3,767 | 3.234375 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as pl
### Auxiliary functions ###
def Bold(text):
"""
Takes a string and returns it bold.
"""
return '\033[1m'+text+'\033[0m'
def unique(series):
"""
Takes a pandas series as input and print all unique va... | true |
9333a17469482ac8f235d8b2306fa7325187fe7c | Python | yz5201214/btbbt | /btbbt/spiders/btbbt_drama_series_spider.py | UTF-8 | 11,346 | 2.578125 | 3 | [] | no_license | # 剧集爬取
import scrapy,time,json
from btbbt.myFileItem import MyFileItem
from btbbt.movieInfoItem import movieInfo
from btbbt.pipelines import redis_db, redis_data_btbbt
from scrapy.utils.project import get_project_settings
# 这了一定要注意Spider 的首字母大写
class btbbtDramaSeriesSpider(scrapy.Spider):
settings = get_project_se... | true |
84834e17e26426c69474e387f61c06b7a49a4f5f | Python | caltechlibrary/commonpy | /tests/test_data_structures.py | UTF-8 | 1,175 | 2.828125 | 3 | [
"BSD-3-Clause",
"CC-BY-3.0"
] | permissive | import json
import os
import pytest
import sys
from time import time
try:
thisdir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(thisdir, '..'))
except:
sys.path.append('..')
from commonpy.data_structures import *
def test_dict_basic():
d = CaseFoldDict()
d['A'] = 1
... | true |
dc3531fbd798ffdf55deab075bc17d3dcb2aedc3 | Python | soymintc/zufaelliger | /tests/test_joke.py | UTF-8 | 190 | 2.625 | 3 | [] | no_license | from unittest import TestCase
import zufaelliger
class TestJoke(TestCase):
def test_is_string(self):
s = zufaelliger.joke()
self.assertTrue(isinstance(s, basestring))
| true |
78bba981ae5286497c30d235f1bfee7e3f56a1dd | Python | MustafaEP/PythonKodlari | /Program2.py | UTF-8 | 228 | 3.5 | 4 | [] | no_license | sayı1=5
sayı2=10
print(sayı1)
print(sayı2)
sayı3=sayı1+sayı2
print(sayı3)
#yukarıda sayı1 ve sayı2 toplandı
sayi1=int(input("Bir sayı gir: "))
print("Girdiğiniz sayı: ",sayi1)
print(type(sayi1))
| true |
0a25b986bf0d9a67acee00bc5dd1a9e8dc9a5c96 | Python | yamaton/codeforces | /problemSet/592D-Super_ M.py | UTF-8 | 668 | 3.125 | 3 | [] | no_license | """
Codeforces Round #328 (Div. 2)
Problem 592 D. Super Ms
@author yamaton
@date 2015-10-31
"""
import itertools as it
import functools
import operator
import collections
import math
import sys
def solve(edges, attacked_nodes):
pass
def print_stderr(*args, **kwargs):
print(*args, file=sys.stderr, **kwarg... | true |
bb81617dbe5769a39fa735ac4090ae0a2d44d763 | Python | liuxfiu/simulus | /examples/misc/mm1-numpy.py | UTF-8 | 539 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy # assuming numpy has been installed
import simulus
numpy.random.seed(123)
def job(idx):
r.acquire()
print("%g: job(%d) gains access" % (sim.now,idx))
sim.sleep(numpy.random.gamma(2, 2))
print("%g: job(%d) releases" % (sim.now,idx))
r.release()
def arrival():
i = 0
while True:... | true |
6bb48d10f1f647b6f3a559fa7bc527129a092545 | Python | Vishwash18/vkgithub | /Fibanacci.py | UTF-8 | 631 | 3.515625 | 4 | [] | no_license | a=int(input("Enter Number of test cases"))
def findMin(V):
Amount = [1, 2, 5, 10, 20, 50,
100, 500, 2000]
n = len(Amount)
ans = []
i = n - 1
while (i >= 0):
while (V >= Amount[i]):
V -= Amount[i]
ans.append(Amount[i])
i -= 1
... | true |
771f6d5931aa8cc90b8250551c8108eb245b4bfb | Python | HTML-as-programming-language/HTML-as-programming-language | /HTML_to_C_compiler/htmlc/elements/avr/pin_elements/digital_write.py | UTF-8 | 1,124 | 2.671875 | 3 | [] | no_license | from htmlc.diagnostics import Diagnostic, Severity
from htmlc.elements.element import Element
class DigitalWrite(Element):
def __init__(self):
super().__init__()
self.val = None
self.name = None
self.is_value_wrapper = True
self.require_htmlc_includes = [
"avr/... | true |
8cd24856312de89bf31572dd8ce8c0a45b6760f8 | Python | 514K/sas | /prost.py | UTF-8 | 164 | 2.671875 | 3 | [] | no_license | import requests
url = 'http://oreluniver.ru/schedule/'
requests.get(url)
req = requests.get(url).text
print(req[:600]) #отображение 600 символов
| true |
c680df5b323b2901c1e8345c6efb39ecd3969c0f | Python | earlbread/leetcode | /implement-strstr/implement-strstr.py | UTF-8 | 818 | 3.625 | 4 | [] | no_license | class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
if not haystack and not needle:
return 0
if not haystack:
return -1
if not needle:
return 0
... | true |
cd089cfabc1a40d9f5f754fc29bc60e37520a1bf | Python | tianwei08222/forecast | /tb_forecast_workexper_jobnum.py | UTF-8 | 4,777 | 2.734375 | 3 | [] | no_license | import pandas as pd
import pymysql
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import linear_model
import json
class Forecast_Workexper_Jobnum:
x_list = []
one_year_list = []
two_year_list = []
three_year_list = []
four_year_list = []
five_year_list = []... | true |
853363884cf7aaf8bd563ba2a174a9b4e24e0d2c | Python | celinesf/personal | /2012_py_R_java_BaseHealth/NextBio/ExcelUtils.py | UTF-8 | 26,562 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Utility functions to obtain read and write on excel files
06/19/13- 1.0
"""
__author__ = "Celine Becquet"
__copyright__ = "Copyright 2013, Genophen.com"
__maintainer__ = "Celine Becquet"
__email__ = "becquet@genophen.com"
__status__ = "dev"
import logging, xlrd, copy
from NextBi... | true |
9baf12373f94bb37ab7cb9cdc2c95cb42ef52f64 | Python | julius-risky/praxis-academy | /novice/02-02/latihan/test1.py | UTF-8 | 785 | 3.46875 | 3 | [] | no_license | import unittest
symbol=[('M',1000),('C',900),('D',500),('C D',400),('C',100),('X C',90),('L',50),('X L',40),('X',10),('I X',9),('V',5),('I V',4),('I',1)]
def romannumeral(number):
outstring = ""
while number >0:
for symbol, value in symbol:
if number-value >=0:
outstring += ... | true |
18c47b61f1e7618b410071aaaa3f4249963e7154 | Python | chenxu0602/LeetCode | /1870.minimum-speed-to-arrive-on-time.py | UTF-8 | 2,984 | 3.546875 | 4 | [] | no_license | #
# @lc app=leetcode id=1870 lang=python3
#
# [1870] Minimum Speed to Arrive on Time
#
# https://leetcode.com/problems/minimum-speed-to-arrive-on-time/description/
#
# algorithms
# Medium (32.38%)
# Likes: 224
# Dislikes: 59
# Total Accepted: 9.5K
# Total Submissions: 29.4K
# Testcase Example: '[1,3,2]\n6'
#
# Y... | true |
1046b6a15631ee2ecc012603386a28a92e2157c4 | Python | cmeese456/CISC684_Project1 | /tree_traversal.py | UTF-8 | 770 | 3.375 | 3 | [] | no_license | import sys
def tree_traversal(dt, row):
'''
Follow a row of a test or validation set through a decision tree and
return a leaf.
Arguments:
dt a decision tree Node
row a dict mapping column names to values for a given row in a dataframe
'''
traversal_return = None
if dt.left... | true |
eb0d7c9c90821a59896d5e07ed7ff3b2d8d4e1d8 | Python | pbrown801/AV | /Program/getAVbest2.py | UTF-8 | 2,025 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3.7
def getAVbest2(inputcoordinates):
print(inputcoordinates)
"Coordinates are input as a single string. Output is the recommended Av value for MW reddening, error, and reference"
from astropy.coordinates import SkyCoord
from astropy.coordinates import Angle, Latitude, Longitude
fro... | true |
54a14a939b5a4e28b5617eeec3ab77f12e89ee60 | Python | CompRhys/ornstein-zernike | /process/core/transforms.py | UTF-8 | 10,182 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.fftpack import dst, idst
from core import block
from scipy.signal import savgol_filter
def hr_to_cr(bins, rho, data, radius, error=None, axis=1):
"""
This function takes h(r) and uses the OZ equation to find c(r) this is done via a 3D fourier transform
that is detailed in LAD... | true |
0f4bf737d0db77af52bdb6d0312c9aa75143b53e | Python | rdorgueilsciencespo/ExemplesPyGame | /images.py | UTF-8 | 2,086 | 3.53125 | 4 | [] | no_license | import pygame
import pygame.image
LARGEUR_DU_MONSTRE = 200
HAUTEUR_DU_MONSTRE = 170
ESPACE = 30
def create_layers(size):
screen = pygame.display.set_mode(size)
pygame.display.set_caption("PyGame Images Example")
background = pygame.Surface(screen.get_size())
background = background.convert()
bac... | true |
4f8f24b3689ca890ec12e1836d15f4b3ca4a1808 | Python | MyGitHubRepository/WebParser | /ConsoleMenuGenerator.py | UTF-8 | 2,316 | 3.75 | 4 | [] | no_license | """ Project: Web/Html Scraper, Coder: Hakan Etik, Date:18.08.2016 """
"""Code source http://stackoverflow.com/questions/15083900/console-menu-generator-in-python"""
import sys
import os
import time
#Item class function definitions
class Item:
def __init__(self, name, function, parent=None):
self.name = nam... | true |
a88f43cd2f5a8ce4617afffad9a7fb04f10683a9 | Python | gscr10/TSP-improve | /utils/plots.py | UTF-8 | 3,611 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 20:47:26 2020
@author: yiningma
"""
import torch
import os
from matplotlib import pyplot as plt
import cv2
import io
import numpy as np
def plot_grad_flow(model):
'''Plots the gradients flowing through different layers in the net during trai... | true |
032218b418d7e66d986a9fac412d141de1802594 | Python | OkWilk/disk-image | /src/lib/thread.py | UTF-8 | 989 | 3.171875 | 3 | [] | no_license | """
Author: Oktawiusz Wilk
Date: 10/04/2016
License: GPL
"""
from threading import Thread
class ExtendedThread(Thread):
"""
This class wraps the standard Thread from the Python threading library to add a callback
function in case of exception being raised on the thread. With the callback met... | true |
15032e85401fbceda1b5885b1a327f6693628298 | Python | shagulsoukath/python | /4h.py | UTF-8 | 238 | 3.390625 | 3 | [] | no_license | op=int(input())
s=input().split()
l=[]
l2=[]
l3=[]
l4=[]
for i in s:
l.append(i)
for j in l:
if j not in l2:
l2.append(j)
else:
l3.append(j)
for k in l2:
if k not in l3:
l4.append(k)
print(*l4,sep=' ')
| true |
5ee083930540a5aa0191f1b75cb9474f94e11234 | Python | solderzzc/dicombrowser | /dicombrowser/__init__.py | UTF-8 | 2,417 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | import os
import dicom
from collections import OrderedDict
def browse(directory, select_tags=None):
"""
Browses a directory and returns list of DICOM files and the values of their tags as a dictionary.
The dictionary uses same tag names as those used by pydicom library (mind the spacing and capital/lower... | true |
cf69c0d310505c0828fb8395eca700f8c108fe70 | Python | sanqit/text-based-browser | /Problems/Matching brackets/task.py | UTF-8 | 204 | 3.71875 | 4 | [] | no_license | brackets = 0
for symbol in input():
if symbol == "(":
brackets += 1
elif symbol == ")":
brackets -= 1
if brackets < 0:
break
print("OK" if brackets == 0 else "ERROR")
| true |
9bd57b6ae7ef043ed7763f790d3a6c358bbffb4f | Python | iras/JADE | /src/JADEmodel/Cluster0.py | UTF-8 | 1,973 | 2.6875 | 3 | [
"MIT"
] | permissive | '''
Copyright (c) 2012 Ivano Ras, ivano.ras@gmail.com
See the file license.txt for copying permission.
JADE mapping tool
'''
class Cluster0 ():
'''
sub-model class.
'''
def __init__(self, id0, name0, parent, comm):
'''constructor
@param id0 int
@param name0 string
... | true |
778cad615febfea1511ee75627367660d75e4041 | Python | theNded/Open3D | /examples/Python/Advanced/load_save_viewpoint.py | UTF-8 | 1,045 | 2.59375 | 3 | [
"MIT"
] | permissive | # Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
# examples/Python/Advanced/load_save_viewpoint.py
import numpy as np
import open3d as o3d
def save_view_point(pcd, filename):
vis = o3d.visualization.Visualizer()
vis.create_window()
vis.add_geometry(... | true |
06f55878fdea24d4cb631d150ade8b7adf24a72d | Python | valeonte/advent-of-code-python | /2022/day-17.py | UTF-8 | 3,383 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Advent of Code 2022 day 17.
Created on Tue Dec 20 18:35:37 2022
@author: Eftychios
"""
import os
import re
from time import time
import numpy as np
import pandas as pd
from typing import List, Set, Iterator, Tuple
from random import shuffle
os.chdir("C:/Repos/advent-of-code-python/202... | true |