blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
1bd4d07ab65e293976d93381d301781a07065bf1 | Python | fljotavi/inliner | /inliner/passes/inline.py | UTF-8 | 12,069 | 2.671875 | 3 | [] | no_license | import ast
import inspect
from .base_pass import BasePass
from ..common import a2s, parse_expr, make_name, parse_stmt
from ..transforms import ContextualTransforms
class FindCall(ast.NodeTransformer):
def __init__(self, inliner, globls):
self.call_obj = None
self.call_expr = None
self.inl... | true |
e21372fba8e40bb33dac7d350ed2bae228819a05 | Python | GazzolaLab/PyElastica | /tests/test_rigid_body/test_cylinder.py | UTF-8 | 5,781 | 2.8125 | 3 | [
"MIT"
] | permissive | __doc__ = """Tests for cylinder module"""
import numpy as np
from numpy.testing import assert_allclose
from elastica.utils import Tolerance
from elastica.rigidbody import Cylinder
# tests Initialisation of cylinder
def test_cylinder_initialization():
"""
This test case is for testing initialization of rigi... | true |
6fd847564d0ba2271ffa6b3af8a675f5f69f8eae | Python | unkleted/Practice-Problems | /summation_of_primes.py | UTF-8 | 204 | 3.375 | 3 | [] | no_license | # Problem 10
#
# The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17
#
# Find the sum of all the primes below two million
from math_stuff import primes_less_than
print(sum(primes_less_than(2_000_000))) | true |
d1de164a82a5186752f1399481f3e799f03575fe | Python | sofiamay/Mood-Tracker | /app/models.py | UTF-8 | 1,125 | 2.765625 | 3 | [] | no_license | from app import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
first_name = db.Column(db.String(64), index=True, unique=True)
last_name = db.Column(db.String(64), index=True, unique=True)
email = db.Column(db.String(120), index=True, unique=True)
moods = db.relationship('Mood... | true |
a9599817f9fdedfa7e86e47c03e6d393e6434d52 | Python | Zazzerpoof/DONOTUSE-Code | /CompSciClass/Chapter1/yeeterino.py | UTF-8 | 286 | 3.671875 | 4 | [] | no_license |
class player:
def __init__(self,health,holding):
self.health = health
self.holding = holding
def stats(self):
return 'Health:{} \nHolding:{}'.format(self.health, self.holding)
p1 = player(50,"sword")
p2 = player(6,"dagger")
print(p1.stats())
| true |
9f8f7018919db2ebc6a4e5432a3c0fed7a6d7955 | Python | vsmalladi/mrboddy | /boddyinc/boddyinc/playgame.py | UTF-8 | 661 | 3.203125 | 3 | [] | no_license | '''
Created on Nov 5, 2011
@author: bryanj
'''
from player import Player
from game import Game
from board import Board
from gamerules import GameRules
def main():
current_game = Game()
while True:
num_players = int(raw_input("Enter the number of players (3-6): "))
if num_players >=3:
... | true |
ddd2722afc83e4f0ecd49d195aec4a9526922c3d | Python | fanyy14068/python_learn | /common/dict_study.py | UTF-8 | 474 | 3.671875 | 4 | [] | no_license | def dict_sort(a):
"""
a = {0: 1, 1: 2, 5: 3, 4: 2}
"""
sorted_by_keys = sorted(a.items())
assert sorted_by_keys == [(0, 1), (1, 2), (4, 2), (5, 3)]
sorted_by_values = sorted(a.items(), key=lambda x: x[1], reverse=False)
assert sorted_by_values == [(0, 1), (1, 2), (4, 2), (5, 3)]
sorted... | true |
6cf7b062a5bf2bf2128041664e15533c80cf0efb | Python | MoisesHer/gluon-nlp | /src/gluonnlp/data/bert/squad.py | UTF-8 | 10,786 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | """Utility functions for BERT squad data preprocessing"""
__all__ = [
'tokenize_and_align_positions', 'get_doc_spans',
'align_position2doc_spans', 'improve_answer_span', 'check_is_max_context',
'convert_squad_examples'
]
import collections
def tokenize_and_align_positions(origin_text, start_position, en... | true |
99596f3c6a5cab6bf9aca8a3b20570a06ac08308 | Python | akashrl/Cryptocurrency-Trading-Simulation-Project | /server/errors/handlers.py | UTF-8 | 2,361 | 2.59375 | 3 | [] | no_license | import werkzeug
import traceback
from flask import Blueprint, json, jsonify
from marshmallow.exceptions import ValidationError
errors_bp = Blueprint('errors', __name__)
@errors_bp.app_errorhandler(werkzeug.exceptions.HTTPException)
def handle_http_exception(e):
""" Handle generic HTTP Exception """
... | true |
8f48047b60b8bfec7bab203b44f36defcdd51668 | Python | Mpreyzner/tdd_in_python | /test_11_supermarket_checkout.py | UTF-8 | 2,664 | 3.90625 | 4 | [
"MIT"
] | permissive | # https://github.com/TDD-Katas/supermarket-checkout
# In a normal supermarket, things are identified using Stock Keeping Units, or SKUs.
# In our store, we’ll use individual letters of the alphabet (A, B, C, and so on).
# Our goods are priced individually.
# In addition, some items are multipriced: buy n of them, and ... | true |
032f36ecfe6d24d0343baa66591aa06b6a2bafcc | Python | onsunsl/onsunsl.github.io | /note/demo/async/demo6.py | UTF-8 | 300 | 3.265625 | 3 | [] | no_license | import asyncio
'''
协程调用链
'''
async def world() -> str:
print("world")
await asyncio.sleep(1)
return "world"
async def hello():
print("hell")
await asyncio.sleep(1)
print("hello " + await world())
asyncio.run(hello())
"""
输出:
hell
world
hello world
""" | true |
01e840942beb4c777cc8289d3220736bc654fc2f | Python | spa542/PythonPracticePrograms | /ResearchFiles/ICAExcelProgram/excelIcaAuto.py | UTF-8 | 6,270 | 3.5 | 4 | [] | no_license | from sklearn.decomposition import fastica # FastICA algorithm
import numpy as np # Numpy Arrays
import matplotlib.pyplot as plt # Used for plotting numpy arrays
from numpy import linalg as la # Used for finding the eigen values and vectors of a numpy array
import matplotlib.pyplot as plt # Used for graphing
import math... | true |
9d6e171fa15ee394898b1e979560127181db00ee | Python | MelanX/scripts | /sendmail.py | UTF-8 | 1,827 | 2.84375 | 3 | [
"MIT"
] | permissive | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# Default settings:
dsmtp = ''
dport = ''
dfromname = ''
dfrommail = ''
dpsw = ''
drecipient = ''
dsubject = ''
dmailtext = ''
# server config
smtp = ''.join(input(f'Enter the smtp adress (gmail is "smtp.gmail.com"): {d... | true |
a9524d2c071cb4147ad44585bc4ce6848a7322c4 | Python | ptrourke/zenpub | /test/test_dateparser.py | UTF-8 | 5,285 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import re
import doctest
from zen import dateparser
from zen.dateparser import regex_patterns, to_iso8601
TEST_DATES = """
# Lines starting 'ISO:' contain an ISO date. The tester does a
# round-trip test of the date, to make sure it matches, then uses the
# date as a reference date for the successive dates, until th... | true |
c6d64816917f5852d7142ba943bdd653d08e7832 | Python | coci41/eng-bot | /DirectionSender.py | UTF-8 | 2,538 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import cv2
import numpy as np
import rospy
from cv_bridge import CvBridgeError, CvBridge
from sensor_msgs.msg import CompressedImage
from std_msgs.msg import String
class DirectionSender():
def __init__(self):
self.HUE_VAL = 28
self.lower_color = np.array([self.HUE_VAL - 10,... | true |
8e12ace8844ee9718e55fab002819c52c209cb10 | Python | nathanbry2/ADM-HW3 | /collector_utils.py | UTF-8 | 3,080 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
# We get all movies URL from movies2.html, movies3.html and movies1.html
def parse_movies():
import pandas as pd
from bs4 import BeautifulSoup
import requests
#movies2.html
url = 'https://raw.githubusercontent.com/CriMenghini/ADM/master/20... | true |
eb63e0a5035dca66c8c5c60e1c6d9c10205ec7b9 | Python | 1AS-Paleocapa/Martinelli | /ex018.py | UTF-8 | 329 | 4 | 4 | [] | no_license | from math import radians, sin, cos, tan
ang = float(input("Digita un angolo: "))
a = radians(ang)
print("-" * 80)
print("L'angolo di {:.1f}° ha un:".format(ang))
print()
print("> SENO di {:.3f}.".format(sin(a)))
print("> COSENO di {:.3f}.".format(cos(a)))
print("> TANGENTE di {:.3f}.".format(tan(a)))
print("-"... | true |
40e35386e6f4af616dc39d83dc93870cb22e50cc | Python | Najarin321/Python-codes | /Python-codes/Mundo 1 e mundo2/exercicio45curso.py | UTF-8 | 1,228 | 4.09375 | 4 | [] | no_license | import random
from time import sleep
print("""
Crie um programa que faça o computador jogar jokenpo com você""")
def jokenpo():
minha_escolha = input("""Digite uma opção:
- Papel
- Pedra
- Tesoura\n""").upper()
possibilidades = ['PAPEL','TESOURA','PEDRA']
escolha_maquina = random.cho... | true |
6283c83ca19395fd96577678eb898539d54eb055 | Python | vinodh1988/django-site | /mysite/applicants/views.py | UTF-8 | 854 | 2.546875 | 3 | [] | no_license | from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
# get datetime
import datetime
from .models import Applicants
from .forms import ApplicantForm
# create a function
def home_view(request):
# fetch date and time
now = datetime.datetime.now()
# conv... | true |
85964cd9a76eda39dc881851c3d69b7e28687358 | Python | mozillahispano/smw-reminder | /reminder/smw-reminder.py | UTF-8 | 1,110 | 2.625 | 3 | [] | no_license | import argparse
from tasks import Tasks
from meetings import Meetings
def tasks(parsed_args):
Tasks().taskoverdue()
Tasks().taskthreedays()
Tasks().taskonday()
def meeting_threedays(parsed_args):
Meetings().meetingsthreedays()
def meeting_today(parsed_args):
Meetings().meetingstoday()
parser=arg... | true |
af00831643589431dac83c502a4677d57698a3d0 | Python | stagnet/python_3 | /BEyond_basics/textpro.py | UTF-8 | 970 | 4.21875 | 4 | [
"MIT"
] | permissive | def sentence_builder(phrase): # *define a fucn with arg 'phrase'....
capital_sent = phrase.capitalize() # !create a variable which will capitalize the sentence as provied inside the func
if phrase.startswith(('how','what', 'why','who')): # TODO: to check weather sentence starts with an interogative word...
... | true |
19e2dc3bb2b4e5ca2a083cbb27bef0f7d62a5590 | Python | Matheus-Pontes/Serial-Tkinter-Pic-Arduino | /Interface/interface.py | UTF-8 | 6,604 | 3.171875 | 3 | [
"MIT"
] | permissive | # ================================================
# Serial comunication with RS-232
# and this interface used by tkinter module
# because, this module comes with python download
#
# Reading sensor LM35 and blynk leds on pic16f877a
# Plus convert celsius in kelvin and fahrenheit
#
# Close the serial port before des... | true |
47e7ee18026304edef6de7e66eca257f6c01de78 | Python | JoaquinAzurmendi/CameraAdquisition | /CameraStream/WidgetMenu.py | UTF-8 | 2,446 | 3.328125 | 3 | [] | no_license | from tkinter import *
# Codigo copiado de: https://docs.hektorprofe.net/python/interfaces-graficas-con-tkinter/widget-menu/
# El primer widget menú que creamos hace referencia a la barra de menú, de ahí que se le suele llamar menu_bar
def create_menu():
menu_bar = Menu(root)
root.config(menu = menu_bar)
... | true |
44460cae48b316311b8817502ac1a7014ac9f573 | Python | Zhangyang823/code | /input_data.py | UTF-8 | 3,063 | 2.8125 | 3 | [] | no_license | # encoding:utf-8
import pickle as pkl
import networkx as nx
import numpy as np
import pandas as pd
import scipy.sparse as sp
def get_matrixM(path):
res = {}
user_list = []
item_list = []
with open(path) as f:
line = f.readline()
#按行读数据
while line:
eles = line.split... | true |
b9173fa408ae69e50374dd7eeac5a8b7450c3de7 | Python | SudhirGhandikota/LeetCode | /Python_solutions/maxProfit.py | UTF-8 | 579 | 3.859375 | 4 | [] | no_license | # https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
class Solution:
def maxProfit(self, prices: list[int]) -> int:
min_val = float('inf')
max_profit = 0
for price in prices:
min_val = min(min_val, price) # updating the "best time to buy"
profit = price - ... | true |
362be24964abf394dc7a163bb6363fb76b50ec24 | Python | sprainhill/Lambda-Intro-Python-I | /src/08_comprehensions.py | UTF-8 | 1,581 | 4.6875 | 5 | [] | no_license | """
List comprehensions are one cool and unique feature of Python.
They essentially act as a terse and concise way of initializing
and populating a list given some expression that specifies how
the list should be populated.
Take a look at https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions
for ... | true |
34f684f0dcbebb549bdb677659531ca83f0022f0 | Python | blogassuo/sudoku_solver | /solver.py | UTF-8 | 4,175 | 3.28125 | 3 | [] | no_license | '''
Solver is based on ideas of Constrain Propagation and Search, presented by
Peter Norwig in a tutorial: http://norvig.com/sudoku.html
'''
from utilities import *
#
# Strageties to solve Sudoku
#
# QUESTION: Code works for given tests but it runs into trouble for boards from internet,
# namely -- code does... | true |
f476b8470bc0aa191e15fb0d3bfdbf125e4c40d9 | Python | zopepy/leetcode | /levelorder.py | UTF-8 | 1,351 | 3.640625 | 4 | [] | no_license |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __str__(self):
return str(self.val)
def __repr__(self):
return str(self)
class Solution:
def levelOrder(self, root):
"""
:type root: TreeNode
:rt... | true |
fe0e8e834934663cd7940ca2a742374dbbeb5266 | Python | kyojinatsubori/RoadToRedCoder | /kyoji/ABC167/D.py | UTF-8 | 369 | 2.75 | 3 | [] | no_license | n,k=map(int,input().split())
a=list(map(int,input().split()))
i=0
pasta=[1]
memo=[0]*n
while True:
if memo[a[i]-1]>0:
roopy=pasta.index(a[i])
roop=pasta[roopy:]
break
else:
memo[a[i]-1]+=1
pasta.append(a[i])
i=a[i]-1
if k>len(pasta):
k-=len(pasta)
k%=len(r... | true |
2b23adcb0be5296c42b6d960172a4c27fe95cd94 | Python | smjolame/Fortgeschrittenenpraktikum | /Mikrowellen/mode.py | UTF-8 | 1,484 | 2.828125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def parabel(U,a,b,c):
return a*U**2+b*U+c
U1_lin = np.linspace(200, 246)
U2_lin = np.linspace(115, 161)
U3_lin = np.linspace(62, 109)
# 1. Mode
V10 = 220
V11 = 210
V12 = 236
A1 = 6.4
V1 = np.array([V10,V11,V12])
Y1 = np.array([A1,0,0])
U1 = np.array([[V10**2,V10,1... | true |
75a0d0bf8bb4af0476fec7d2d8d3eaa0fc55c810 | Python | pvl1175/NT_Scripts | /test2.py | UTF-8 | 63 | 2.75 | 3 | [] | no_license | str = 'OK'
print(str)
arr = bytearray(str.encode())
print(arr) | true |
fb328a1455213bb6eb2acca121141377aecfd99d | Python | cybelewang/leetcode-python | /code1023CamelcaseMatching.py | UTF-8 | 3,614 | 3.765625 | 4 | [] | no_license | """
1023 Camelcase Matching
A query word matches a given pattern if we can insert lowercase letters to the pattern word so that it equals the query. (We may insert each character at any position, and may insert 0 characters.)
Given a list of queries, and a pattern, return an answer list of booleans, where answer[i... | true |
27c32b7d3cf5dd513b9974280e984ccfd635d23f | Python | layusso/-ifpi-ads-algoritmos2020 | /Atividade_Fabio02a/Fabio02a_16_notas(aprovado_reprovado).py | UTF-8 | 471 | 3.78125 | 4 | [] | no_license | def nota():
nota_1 = float(input('Insira a primeira nota:'))
nota_2 = float(input('Insira a segunda nota:'))
media = (nota_1 + nota_2) / 2
if media >= 7.0:
print('Aprovado!')
elif media < 7.0:
nota_final = float(input('Insira a nota do exame final:'))
media_final = ... | true |
9c2377593d7c0582660f66c567ba884064d528e7 | Python | snkaplan/DistractedDriverDetection | /src/Models/semester1/pytorch.py | UTF-8 | 8,898 | 2.625 | 3 | [] | no_license | import torch
import torch.nn as nn
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
import torch.utils.data
#%% Device config
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
print("Device: ",device)
#%% Dataset
def read_images(path, num_img):
array = np.z... | true |
b5330542e137444f1b02c91c52c8672ffb4150a0 | Python | superoven/code4grub | /textfile.py | UTF-8 | 1,347 | 2.84375 | 3 | [] | no_license | import re, operator
from scipy.stats import mode
class textfile:
def __init__(self, filename):
self.filein = open("files/" + filename, 'r')
data = self.filein.read()
self.words = self._getwords(data)
self.sortedwords = sorted(self.words.iteritems(), key=operator.itemgetter(1), reverse=True)
se... | true |
3eb26f71ec331837ffdb7ab2dfd164a7f34bd1fb | Python | strategist922/kaggle-Google-NLP-competition | /Bag of Words Meets Bags of Popcorn/movie_sentiment_analysis.py | UTF-8 | 5,467 | 3.0625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import pandas as pd
import nltk
import os
import re
from bs4 import BeautifulSoup
from sklearn.ensemble import RandomForestClassifier
from gensim.models.word2vec import Word2Vec
from sklearn.model_selection import train_test_split
from sklearn.metrics import classific... | true |
08177a08c23b2e0fcd5278490f6d8bf2b8fbbd83 | Python | kuyanov/markov-substitutions | /markov.py | UTF-8 | 1,666 | 3.671875 | 4 | [] | no_license | def test_function(function, tests):
for args, ans in tests:
out = function(*args)
if out != ans:
print('Error in function {};\nInput: {};\nOutput: {}\nCorrect: {}\n'.format(
function, args, out, ans))
def apply_substitution(word, first, second):
left = word.find(fir... | true |
fb3bc42498c8a626e066320997f482c06a4fee0b | Python | digehode/lib110ctPython | /src/Py110.py | UTF-8 | 21,457 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
import threading,time
import math
from Queue import Queue
import pygame as pg
__author__ = 'James Shuttleworth <csx239@coventry.ac.uk>'
__version__="0.7"
cVersion=__version__
cDate="2012-12-05"
#To discuss with Mike
# setPos vs setPosition
# showHide vs setVisible
#TODO: send kill event back t... | true |
cb6b7b92f0866c9fb4c95bf6cbb8a4b5716d359d | Python | shalujha/Python_Programs | /ToggleCase.py | UTF-8 | 120 | 3.796875 | 4 | [] | no_license | str=input()
for c in str:
if c.isupper():
print(c.lower(),end='')
else:
print(c.upper(),end='')
| true |
0e7f4f054c44a356355764cc60f88fb936416f04 | Python | aWilsonandmore/PatternFinder | /patternfinder/geometric_helsinki/old_algorithms/w2.py | UTF-8 | 7,668 | 2.515625 | 3 | [] | no_license | from LineSegment import LineSegmentSet
from queue import PriorityQueue
from geomtric_helsinki.algorithms.base import W
from NoteSegment import K_entry
import music21
import copy
import pdb
class W2(W):
def algorithmAlsoOld(self):
"""
Algorithm W2 returns "time-warped" and "partial" occurrences of ... | true |
bc3c99af441c114e7d23eba22516accdf2a92220 | Python | zdimon/time-control | /djangoprj/main/management/commands/load_users.py | UTF-8 | 2,182 | 2.5625 | 3 | [] | no_license | from django.core.management.base import BaseCommand, CommandError
import requests
from djangoprj.settings import API_KEY
import hashlib
import json
'''
1. You can form GET or POST request to the Worksection API using URL http://your-domain.com/api/admin/, where your-domain.com - account address registered in Worksecti... | true |
3d0baddc495ef9b8aaff49ccde9460159b793334 | Python | bmfreis/signal | /signals.py | UTF-8 | 11,900 | 2.953125 | 3 | [] | no_license | """
====================================================================================
signals
====================================================================================
Description: signals available on wavelab
====================================================================================
"""
import ... | true |
af3a0ad352d38c2f580dc4ec7cec2e4467b6e1d2 | Python | MarcP79/cs50ai | /lec5/traffic/traffic_test.py | UTF-8 | 469 | 2.578125 | 3 | [] | no_license | """
Acceptance tests for traffic.py
Make sure that this file is in the same directory as traffic.py!
'Why do we fall sir? So that we can learn to pick ourselves up.'
- Batman Begins (2005)
"""
from traffic import IMG_HEIGHT, IMG_WIDTH, load_data
images, labels = load... | true |
94dcf56d3bd4a40d3043a23444b19c82eb7f68f6 | Python | Icelain/Jsolver | /jsolver.py | UTF-8 | 2,270 | 2.65625 | 3 | [] | no_license | __author__="icelain17l"
__version__="0.1.3"
from collections import OrderedDict
import colorama
from progress import bar
import argparse,sys,subprocess
from itertools import permutations
def __banner__():
print(colorama.Fore.CYAN)
subprocess.call(["banner","Jsolver"])
print(colorama.Style.RE... | true |
e40aa45b73d9e229eb0f2d23c4edf77321bf1a57 | Python | RolfHut/HC-SR04Tools | /python/imaging.py | UTF-8 | 9,072 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import random
import time
###########################################################################################
# Imaging script for DEF assignment
# Authors: Eric Verschuur, Rolf Hut
# Date : March 20, 2019
# Delft University of Technology... | true |
7e1a2a70652f0d2e95a0c8597f66c3b3e5f5d560 | Python | edkaresli/General_Programming | /Python_Shape/shape.py | UTF-8 | 1,540 | 4.21875 | 4 | [] | no_license | """ this is a comment to ensure Git is working """
class Shape:
def __init__(self, name):
"""
(str) --> none
name ... name of shape object
"""
self.name = name
return
def draw(self):
"""
virtual base method
"""
print("Base method ... | true |
78cf63801eaae405b610daf1a8fc8205122089a4 | Python | davidtvs/kaggle-hpaic | /core/trainer.py | UTF-8 | 15,399 | 2.890625 | 3 | [
"MIT"
] | permissive | import os
import torch
from tqdm import tqdm
from copy import deepcopy
from .early_stop import EarlyStopping
from .checkpoint import Checkpoint
from metric.metric import Metric, MetricList
from torch.optim.lr_scheduler import ReduceLROnPlateau
class Trainer:
def __init__(
self,
model,
num_... | true |
c1e20b2f085670ab43e372b402570ee93e682f94 | Python | zDudaHang/CG-INE5420-05208-20211 | /src/util/clipping/cohen_sutherland_clipper.py | UTF-8 | 3,198 | 3.28125 | 3 | [] | no_license | from src.model.point import Point3D
from src.model.graphic_object import Line
from copy import deepcopy
class CohenSutherlandLineClipper():
INSIDE = 0 # 0000
LEFT = 1 # 0001
RIGHT = 2 # 0010
BOTTOM = 4 # 0100
TOP = 8 # 1000
def __init__(self, line: Line, window_min: Point3D = Point... | true |
63f1f3871b4de942b80dd9373b4d800211e43f77 | Python | shahakshay11/Two-Pointers-2 | /merge_sorted_array.py | UTF-8 | 2,814 | 4 | 4 | [] | no_license | """
// Time Complexity : O(n)
// Space Complexity : O(1)
// Did this code successfully run on Leetcode : Yes
// Any problem you faced while coding this : Trying to come with intuitve soln of
negative indexing
// Your code here along with comments explaining your approach
Algorithm Explanation
Iterate till i < nums1 le... | true |
9788fe51e16aa278d0386e7e5e8d82c9d90fe300 | Python | denis-svg/data-structures | /python/dequeue.py | UTF-8 | 2,579 | 3.765625 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.data = data
self.next = None
self.previous = None
def set_data(self, data):
self.data = data
def get_data(self):
return self.data
def set_next(self, next):
self.next = next
def get_next(self):
... | true |
f455b6f5fb4ce76a513c113aa305d8ce45dda3bf | Python | sh1nu11bi/network-manager-scripts | /manage-3g-profiles.py | UTF-8 | 3,365 | 2.65625 | 3 | [] | no_license | import dbus,sys
from uuid import uuid4
bus = dbus.SystemBus()
nm_inst="org.freedesktop.NetworkManager"
def print_con(sets):
print "{0}) \"{1}\"".format(sets['no'],sets['id'])
print " UUID: {0}".format(sets['uuid'])
print " Autoconnect: {0}".format(sets['autoconnect'])
print " Number: {0}".format(sets['nu... | true |
0186eeb2a1e1c26eeb9f43d8c3fa6a64bad1b79a | Python | CodingDojoDallas/python_feb_2017 | /john_lee/Python OOP Advanced Concepts/Underscore.py | UTF-8 | 1,291 | 3.71875 | 4 | [] | no_license | class Underscore(object):
def map(self,list,function):
newlist = []
for element in list:
if type(element) is list:
for array_index in element:
newlist.append(function(array_index))
else:
newlist.append(function(element))
... | true |
2032b0b6df44c6f9fa78b61530a7b9ef3f805cea | Python | dhruvchamania/TSE_Final_Project | /src/edge_editing.py | UTF-8 | 4,144 | 2.765625 | 3 | [] | no_license | ## Aim of this script is to return an anonymised graph after performing Edge Editing. Essentially, this script uses the helpers
## function to obtain the target degree sequence. After this, we add random edges to fulfill this target degree sequence.
from __future__ import division
import networkx as nx
import c... | true |
467d55c5d7e071d49b4be8e2f9e08838f2f65c94 | Python | ijanos/advent2017 | /python/day17/part1.py | UTF-8 | 181 | 2.6875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
from collections import deque
INPUT = 324
spinlock = deque()
for n in range(2017):
spinlock.append(n)
spinlock.rotate(-INPUT)
print(spinlock[0])
| true |
5acbbf26078f219b1fd1b829cf5f133274eed5b2 | Python | ReverseSystem001/SimilarCharacter | /Pronunciation.py | GB18030 | 1,789 | 2.65625 | 3 | [
"MIT"
] | permissive | # coding=gbk
from pypinyin import pinyin,Style,lazy_pinyin
import Dict
import Character
from tqdm import tqdm
symbol = Character.Symbol_lst()
def similar(char1,char2): # char1,char2Ϊƴ
if char1[0:2] not in ['zh','ch','sh']:
fst1 = char1[0] # ˴Ϊĸĸȡ
end1 = char1[1:]
else:
fst... | true |
35a40c3c8d8fd011ff92279d63e56f78d44d3fee | Python | SekthDroid/StringCalculator-Kata | /strcalculator/string_calculator.py | UTF-8 | 1,253 | 3.453125 | 3 | [] | no_license | __author__ = 'SekthDroid'
class StringCalculator(object):
def add(self, param):
if not param:
return 0
delimiter = ","
if self.contains_different_delimiter(param):
delimiter = param[2]
param = self.remove_delimiter_line(delimiter, param)
if sel... | true |
74ea49d3aece7e94f0977bba72137dd8f0bfa1d4 | Python | morrislab/pairtree | /lib/diversity_indices.py | UTF-8 | 4,136 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import numpy.ma as ma
import util
def _fix_eta(eta):
assert np.allclose(1, np.sum(eta, axis=0))
# Remove non-cancerous population from eta.
eta = eta[1:]
# prevents divide by zero error if a sample contains only the non-cancerous populuation
eta = np.divide(eta, np.sum(eta, axis=0), out=n... | true |
e98f0fcf8cfce0f10b99728b719d05bdb60df591 | Python | volnt/image-processing | /challenge/challenge1.py | UTF-8 | 639 | 3.15625 | 3 | [] | no_license | from PIL import Image
BYTE_LEN = 8
BIT_MAP = {
'0': '\x00',
'1': '\xff',
}
def left_pad(string, lenght=BYTE_LEN, char='0'):
return char * (BYTE_LEN - len(string)) + string
def char_to_byte(char):
return left_pad(bin(ord(char))[2:])
def text_to_bytes(text, size, height):
output = ''
for _ ... | true |
8348d353e6fdea77c9c994d541db1420ef57a797 | Python | yueyang1101/ece143team15 | /src/plots/FeatureVSObservedTemp.py | UTF-8 | 1,429 | 3.1875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import plotly.graph_objects as go
from matplotlib import pyplot as plt
def plot_feature_VS_Observed(feature, df, linecolor):
"""
This function plots the 1880-2004 time series plots for the selected feature and observed earth
:param
Input: df -- > The dataframe... | true |
27e0c3e61ad63f72e3f9f1d71d5e77c1e7a6e5b3 | Python | sisco0/casper-python-sdk | /pycspr/api/get_account_info.py | UTF-8 | 1,642 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import typing
import jsonrpcclient as rpc_client
from pycspr.api import constants
from pycspr.client import NodeConnectionInfo
def execute(
connection_info: NodeConnectionInfo,
account_key: bytes,
block_id: typing.Union[None, bytes, str, int] = None
) -> dict:
"""Returns on-chain account inform... | true |
b83d96dc81d1314ac2b040728c85e8db8df79066 | Python | harrispilton/auswerten | /ffc/Glyzerin d3 test/testfit.py | UTF-8 | 1,339 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
import glob
import re
import itertools
import numpy as np
import scipy as sp
from scipy.optimize import curve_fit
from scipy.optimize import brentq
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, CheckButtons
from scipy.optimize import leastsq
from lmfit import minimiz... | true |
75d0cf3f8c2bdbfc9c98bdfd7e662280a4390fcc | Python | sanjitroy1992/PythonCodingTraining | /coderbyte/first_factorial.py | UTF-8 | 133 | 3.34375 | 3 | [] | no_license | def FirstFactorial(num):
if num > 1:
num = num*FirstFactorial(num-1)
return num
print(FirstFactorial(int(input())))
| true |
18eb7dd62fffdb5b38152f22da18a96e656f6d8e | Python | a2468834/Machine_Learning_Grad | /HW_Kaggle/testAUC.py | UTF-8 | 346 | 2.8125 | 3 | [] | no_license | import numpy
from sklearn import metrics
y_1 = numpy.array([10, 20, 30, 40, 50])
y_2 = numpy.array([1, 2, 3, 4, 5])
y_true = numpy.array([0, 1, 0, 1, 1])
fpr, tpr, tt = metrics.roc_curve(y_true, y_1)
roc_auc1 = metrics.auc(fpr,tpr)
fpr, tpr, tt = metrics.roc_curve(y_true, y_2)
roc_auc2 = metrics.auc(fpr,tpr)
print... | true |
3dc7d1af15536262e8e707f780e7d27cffd444be | Python | CASchultzII/PolyGun | /game/configuration.py | UTF-8 | 4,301 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
from configparser import ConfigParser
from pygame.locals import *
from pygame import Rect
import pygame, sys, os
"""
Holds the configuration options for the game.
"""
class Configuration:
def __init__(self, config):
self.config = ConfigParser()
self.config.read(self._ge... | true |
27d32012ae440e937295e9aab62c6f0f6ee3690e | Python | 0xZDH/passwd-strength | /passwd-strength.py | UTF-8 | 2,386 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
# This is assuming 20,000 MH/s (20,000,000,000 passwords/second) < Default - can be changed by user
# This baseline is based on the following cracking configuration:
# 8x NVIDIA GTX 1080 Ti GPUs
# Hashtype: NTLMv2
# Test password: P4$sword
from __future__ import division
from getpass imp... | true |
d57747eabf0ff16bf1362192f18c6a3a093e627c | Python | titusowuor30/dj_rest_jwt_auth_api | /venv/Lib/site-packages/npx/_main.py | UTF-8 | 2,583 | 3 | 3 | [] | no_license | from functools import reduce
from operator import mul
import numpy as np
import numpy.typing as npt
# math.prod in 3.8
# https://docs.python.org/3/library/math.html#math.prod
def _prod(a):
return reduce(mul, a, 1)
def dot(a: npt.ArrayLike, b: npt.ArrayLike):
"""Take arrays `a` and `b` and form the dot prod... | true |
b8f8e7c2f84e76c24304da69b04bda3ac0cf4855 | Python | sam20fonsa1098/icompML | /pythonScripts/codebench.py | UTF-8 | 2,288 | 2.640625 | 3 | [] | no_license | """
Imports
"""
import tarfile
import requests
from utils import codebench_dataset, codebench_base_zip
from osFiles import OsFiles
class CodeBenchData():
def __init__(self):
self.baseUrl = codebench_dataset
self.zipUrl = codebench_base_zip
self.chunk_size = 128
def checkClass(self):
... | true |
5b7bdcce0b6622cd367edf631307e3bd1bc08718 | Python | Bulkin/pycheckers | /board.py | UTF-8 | 5,641 | 2.671875 | 3 | [] | no_license | import gtk
from checkers import Checkers
class BoardView(gtk.DrawingArea):
def __init__(self):
gtk.DrawingArea.__init__(self)
self.tile_size = 100
self.tile_count = 8
self.w = self.h = self.tile_count * self.tile_size
cmap = self.get_colormap()
sel... | true |
b804f371d95c18b122fb87df2d96ce4b095c5ea7 | Python | igor-morawski/FIR_CNN_LSTM | /join_gifs.py | UTF-8 | 2,241 | 2.90625 | 3 | [
"MIT"
] | permissive | '''
stacks corresponding gifs from the passed directories horizontally frame by frame
gifs must be the same lenght
e.g. python join_gifs.py --output=\tmps\visualize\joined \tmps\visualize\temperature \tmps\visualize\optical_flow
'''
import os
import argparse
from glob import glob
import collections
import imageio
imp... | true |
f19c95f29aebe648784b6b6e1ef6601053b525e3 | Python | saumya-singh/CodeLab | /HackerRank/Implementation/Circular_Array_Rotation.py | UTF-8 | 614 | 3.390625 | 3 | [] | no_license | #!/bin/python3
#https://www.hackerrank.com/challenges/circular-array-rotation/problem
import sys
def rotation(a, k):
ans = []
rot_factor = k % len(a)
for i in range(len(a) - rot_factor, len(a)):
ans.append(a[i])
for i in range(len(a) - rot_factor):
ans.append(a[i])
... | true |
f97e0446aeda444ed63235c900b96ff41ddd9c8f | Python | paypark/scanner-admin-app | /src/services/USBStorageService.py | UTF-8 | 1,482 | 2.8125 | 3 | [] | no_license | import time
from PartitionService import PartitionService
from EnvironmentService import EnvironmentService
class USBStorageService(object):
@staticmethod
def saveFile(src):
PartitionService.ensureIsMounted()
if not PartitionService.isSufficientDiskSpaceAvailable(src):
raise Excep... | true |
8b3509005c26581d01b4fba9a6864f29bf2d0275 | Python | Rimon24/MachineLearningLeukemiaDetection | /binary_classification/boosted_tree.py | UTF-8 | 1,328 | 2.890625 | 3 | [] | no_license | import xgboost as xgb
from sklearn.metrics import roc_auc_score
from util import roc_results, results
def xgb_training(x_train, y_train):
"""
:param x_train: the x-values we want to train on (2D numpy array)
:param y_train: the y-values that correspond to x_train (1D numpy array)
:return: XGBoost Clas... | true |
302c43dd2eee9bb91ddd0c822e5f5f57d1181bd0 | Python | Aiooon/MyLeetcode | /python/Offer_47. 礼物的最大价值.py | UTF-8 | 1,355 | 3.90625 | 4 | [] | no_license | """
剑指 Offer 47. 礼物的最大价值
在一个 m*n 的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 0)。
你可以从棋盘的左上角开始拿格子里的礼物,并每次向右或者向下移动一格、直到到达棋盘的右下角。
给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物?
示例 1:
输入:
[
[1,3,1],
[1,5,1],
[4,2,1]
]
输出: 12
解释: 路径 1→3→5→2→1 可以拿到最多价值的礼物
提示:
0 < grid.length <= 200
0 < grid[0].length <= 200
date: 2021年3月3日
"""
from typing impo... | true |
8729ebbc044ded8b22b67bf4d36f7fd06ead6c93 | Python | danpatrickoneill/Intro-Python-II | /src/item.py | UTF-8 | 462 | 3.46875 | 3 | [] | no_license | class Item:
def __init__(self, name, description):
self.name = name
self.description = description
def __str__(self):
return self.name.capitalize() + "\n" + self.description
def get_name(self):
return self.name
def get_desc(self):
return self.description
d... | true |
54c369d2daa223a557fe9781bf46abe609cc34a8 | Python | Sunkek/sunbot | /discord-bot/cogs/embedder.py | UTF-8 | 11,396 | 3 | 3 | [] | no_license | """Embed creator and formatter"""
import discord
from discord.ext import commands
import re
from typing import Optional
def parse_foreign_emoji(content):
"""This will try to find any "<foreign_emoji=number>" substrings and turn them
into "<:_:number>" so the emoji is shown (if possible)"""
re... | true |
4449c112b834afcc88081f42cea3cbc930f57ce6 | Python | Aax114514/2048 | /PyQt/2048.py | UTF-8 | 9,337 | 2.765625 | 3 | [] | no_license | import json
import time
import threading
from random import randint
from PyQt5.QtWidgets import QMainWindow, QFrame, QDesktopWidget, QApplication
from PyQt5.QtCore import Qt, QBasicTimer, pyqtSignal
from PyQt5.QtGui import QPainter, QColor
class Score():
def __init__(self):
self.current = 0
self... | true |
969996251c217d49086e2abea17807b5276c0cf1 | Python | iridium-browser/iridium-browser | /native_client/site_scons/site_tools/command_output.py | UTF-8 | 6,920 | 2.609375 | 3 | [
"BSD-3-Clause",
"Zlib",
"Classpath-exception-2.0",
"BSD-Source-Code",
"LZMA-exception",
"LicenseRef-scancode-unicode",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"LicenseRef-scancode-philippe-de-muyter",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-intel-osl-1993",
"HPND-sell-var... | permissive | #!/usr/bin/python2.4
# Copyright 2009 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Command output builder for SCons."""
from __future__ import print_function
import os
import signal
import subprocess
import sy... | true |
fe435f1221990d951d775f3eda33cbc92d24cddc | Python | Dearyyyyy/TCG | /data/3901/AC_py/518435.py | UTF-8 | 83 | 3.03125 | 3 | [] | no_license | # coding=utf-8
n=int(input())
i=n-1
s=1
while i>0:
s=2*(s+1)
i=i-1
print(s) | true |
41f38ccae43d43c7dbfd24449f99dafc29dfa502 | Python | huyhuynh1905/Python-Tutorial | /thirdweek/SlicingList.py | UTF-8 | 152 | 3.34375 | 3 | [] | no_license | list1 = [0,1,2,5,8,4,3,3,6,5,4,0,2,8,9,7,3,5]
print(list1)
print(list1[3])
print(list1[0:4])
print(list1[0::3])
print(list1[0:-5:1])
print(list1[::-2])
| true |
74f80896ec2245c388e425794d7a673a69071f0b | Python | Johnxjp/aoc2019 | /python/d7p1.py | UTF-8 | 2,983 | 2.953125 | 3 | [] | no_license | from itertools import permutations
from typing import Sequence, Tuple
from helper import loadv2
def parse_opcode(opcode: int) -> Tuple[int, Sequence[int]]:
params = [0] * 3
if len(str(opcode)) <= 2:
return opcode, params
opcode_str = str(opcode)
opcode = int(opcode_str[-2:])
modes = opcod... | true |
eadd61afa3ba7e0d8d4cf11dd97191b41c3cbed3 | Python | gfhcs/programma-spec | /lang-gen/csyntax/IdentifierToken.py | UTF-8 | 640 | 3.09375 | 3 | [] | no_license | '''
Created on 20.04.2015
@author: gereon
'''
from Token import Token
from util.util import *
class IdentifierToken(Token):
'''
Represents an identifier as found in the source code.
'''
def __init__(self, language, code, position):
'''
Creates a new identifier token
'''
... | true |
5f43be32960430af6e003b6b5aaa2bb970e9cc09 | Python | mistersingh179/opencv-fundamentals | /code_examples/Chapter_6_Histographs_and_Color_Schemes/detect_green_tshirt.py | UTF-8 | 1,587 | 3.125 | 3 | [] | no_license | import cv2
import imutils
def detect_tshirt(image):
# HSV by using interactiveColorDetect.py
lower_range_in_lab = (0, 85, 115)
higher_range_in_lab = (255, 110, 135)
labimage = cv2.cvtColor(image, cv2.COLOR_BGR2LAB)
blurred_lab_image = cv2.GaussianBlur(labimage, (5, 5), None)
thresh = cv2.inRa... | true |
d481e2ad477b3406036ac1e8059648db2da09e04 | Python | santoshmagar1922/python | /day2/Pandas.py | UTF-8 | 2,757 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 10 12:25:30 2019
@author: smq3434
"""
'''
Pandas used for :
Data import/ export,
data manipulation - selction, filtering
data cleaning
basic statistical analysis
data aggregation
data visualization
1. Pandas Series-... | true |
74011e2a46a1dc279b7b72cb5dadf9232c8d19dc | Python | yoshidev523/atcoder | /abc1/c.py | UTF-8 | 1,342 | 2.84375 | 3 | [] | no_license | # coding: utf-8
if __name__ == '__main__':
deg, dis = map(float, raw_input().split())
# print deg, dis
v = dis / 60
if v < 0.25:
print 'C 0'
exit()
if deg < 112.5:
degs = 'N'
elif deg < 337.5:
degs = 'NNE'
elif deg < 562.5:
degs = 'NE'
elif deg < ... | true |
2f29b6f2c1311f0f845bcd56852c5e95e149ab6e | Python | JesseMaitland/redscope | /redscope/project/database/executor.py | UTF-8 | 877 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import os
import psycopg2
from typing import Tuple
def execute_query(connection_name: str, query: str, include_columns: bool = True, *params) -> Tuple:
with psycopg2.connect(os.getenv(connection_name)) as connection:
with connection.cursor() as cursor:
if params:
print(f"we run... | true |
c2ea0613b79cfcbc02bdabb399c150e9c3f8d824 | Python | rgkaufmann/PythonCodes | /PHYS203/OmegaOverOmegaMax.py | UTF-8 | 747 | 3.25 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def Omega(x, N):
return np.exp(-N*x**2/(Beta*(1-Beta)))
def plot(x, N1, N2, N3):
plt.title("Ratio of Multiplicity at X and the Maximum for Different Number of Oscillators")
plt.xlabel("x")
plt.ylabel("Omega/OmegaMax")
plt.xlim(xmax=0.35, xmin=-0.3... | true |
0b31117e89725ec0ad654f01d950cb5f522cc1b6 | Python | jermzblake/MyDevSkills-Django | /main_app/models.py | UTF-8 | 834 | 2.59375 | 3 | [] | no_license | from django.db import models
from django.urls import reverse
from django.contrib.auth.models import User
LEVELS = (
(1, 'Fundamental Awareness'),
(2, 'Novice'),
(3, 'Intermediate'),
(4, 'Advanced'),
(5, 'Expert')
)
class Skill(models.Model):
description = models.TextField(max_length=80)
s... | true |
e54491777a4e1b9fa79700370da7d7c5fdde70e9 | Python | elainy-liandro/mundo1e2-python-cursoemvideo | /Desafio 9.py | UTF-8 | 325 | 3.8125 | 4 | [] | no_license | tab = int(input('Digite a tabuada de multiplicação que você quer ver: '))
tab1 = int(tab * 1)
tab2 = int(tab * 2)
tab3 = int(tab* 3)
tab4 = int(tab* 4)
tab5 = int(tab * 5)
print('A tabuada de {} é:\n'
'{}x1={}\n{}x2={}\n{}x3={}\n{}x4={}\n{}x5={}'.format(tab, tab, tab1, tab, tab2, tab, tab3, tab,tab4, tab, tab5))
... | true |
44e19a3bb460be0d81fec8c991ab76cff0031ecc | Python | rydtran/device-graph-34 | /scripts/cleanup/AllSizesDistribution.py | UTF-8 | 1,759 | 2.75 | 3 | [] | no_license | #coding:utf-8
#ignore when their parents are size of 0, 10 and up
import json
# from tqdm import tqdm
def Json_Read_All_Content(Path):
"""Json read everything"""
with open(Path, 'r') as json_file:
return json.load(json_file)
# TXT_insertaline
def TXT_Insert_A_Line(Path, Text):
with open(Path, ... | true |
97c8c2f85baf6d89ef81d3ed8548d6385ab0c069 | Python | jemtca/CodingBat | /Python/String-2/mix_string.py | UTF-8 | 816 | 4.28125 | 4 | [] | no_license |
# given two strings, a and b, create a bigger string made of the first char of a, the first char of b, the second char of a, the second char of b, and so on
# any leftover chars go at the end of the result
def mix_string(a, b):
s = ''
length_a = int(len(a))
length_b = int(len(b))
if length_a > length_... | true |
2f177ce43833340d22e394d89b01eaa51684bea2 | Python | SkqLiao/Project-Euler | /code/51-100/59.py | UTF-8 | 361 | 2.953125 | 3 | [] | no_license | from collections import Counter
if __name__ == '__main__':
with open('p059_cipher.txt', 'r') as f:
cipher = list(map(int, f.read().split(',')))
space_ascii = ord(' ')
key = [Counter(cipher[i::3]).most_common(1)[0][0] ^ space_ascii for i in range(3)]
cycles = len(cipher) // 3
res = sum([x ^ y for x, y in... | true |
7701898b52d55c214c86fbbe21ecbf51ac22451f | Python | linyuehzzz/bikeability_ConvNet | /lane_width.py | UTF-8 | 3,308 | 3.625 | 4 | [
"MIT"
] | permissive | def extract_first_three_lanes(polys):
"""
Extract the first three lanes
Input
polys: all lanes
Ouput
the first three lanes
"""
return polys[:3]
def calculate_max_width(poly):
"""
Calculate the maximum width of a polygon and
the cooresponding y coordinate of the vert... | true |
5745ae69ed68e9f61ad0ad8e71de0a7c28ee6e1b | Python | Aasthaengg/IBMdataset | /Python_codes/p03600/s218661000.py | UTF-8 | 511 | 2.6875 | 3 | [] | no_license | import copy
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]
b=copy.deepcopy(a)
for k in range(n):
for i in range(n):
for j in range(n):
b[i][j]=min(b[i][j],b[i][k]+b[k][j])
for i in range(n):
for j in range(n):
if b[i][j]!=a[i][j]:
print(-1)
exit()
ans=0
for i in range(... | true |
814d9e4a4a2f4731336f21fb850820e89a859607 | Python | 0xInfty/testingDocs | /iv_plot_module.py | UTF-8 | 25,150 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 15 15:08:08 2019
@author: Vall
"""
import iv_save_module as ivs
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.widgets as wid
import os
from tkinter import Tk, messagebox
#%%
def interactiveLegend(ax, labels=False, show_default=True,
... | true |
08f7c1ec5fde7bae5710b62368c184638f6f2f9e | Python | orangewangjie/Algorithm-Dryad | /07.UF/399.除法求值.py | UTF-8 | 4,186 | 3.4375 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=399 lang=python
#
# [399] 除法求值
#
# https://leetcode-cn.com/problems/evaluate-division/description/
#
# algorithms
# Medium (59.38%)
# Likes: 468
# Dislikes: 0
# Total Accepted: 32.1K
# Total Submissions: 54.1K
# Testcase Example: '[["a","b"],["b","c"]]\n' +
'[2.0,3.0]\n' +
'[["a","... | true |
8d8a7e2e450af26f328531fa9309dbd9cbdd35c3 | Python | astropy/astroquery | /astroquery/vo_conesearch/validator/inspect.py | UTF-8 | 5,129 | 2.65625 | 3 | [] | permissive | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Inspect results from :func:`astroquery.vo_conesearch.validator.validate`."""
# STDLIB
import sys
# LOCAL
from ..vos_catalog import get_remote_catalog_db
# Import configurable items declared in __init__.py
from . import conf
__all__ = ['ConeSearchRes... | true |
cb2feb6c7f06b8b1ee59797f06763a3408b9dd2f | Python | SpeedyCows/SpeedyCow15 | /object/leaf.py | UTF-8 | 1,360 | 3 | 3 | [] | no_license | from object import Object
from dirt import Dirt
import pygame, random
class Leaf(Object): # represents the water, not the game
MAX_SPEED = 2
def __init__(self, dimension):
""" The constructor of the class """
super(Leaf, self).__init__(dimension)
self.image = pygame.image.lo... | true |
e9915fc173f04ad5b5827dca4ab21a39e7110745 | Python | waitle/2nd-grade-sunrin | /Python/4.6/6.py | UTF-8 | 232 | 3.453125 | 3 | [] | no_license | ax=int(input("ax"))
ay=int(input("ay"))
bx=int(input("bx"))
by=int(input("by"))
if(ax>bx):
print("w: ", (ax-bx))
else:
print("w: ", (bx-ax))
if(ay>by):
print("h: ", (ay-by))
else:
print("h: ", (by-ay))
| true |
56d974b642bb3b4961b8d2adb486f5b6814b49f7 | Python | ubaid4j/Digital_Image_Processing | /Week3/test.py | UTF-8 | 71 | 2.6875 | 3 | [] | no_license | name = "pics/B1.png"
file_name = name.replace("/", "")
print(file_name) | true |
343222edaa6fcfd06dd3b8085a3311512704297e | Python | KimTaesong/Algorithm | /CodingTest_Study1/week13/ex2805.py | UTF-8 | 471 | 3.65625 | 4 | [] | no_license | # BOJ 2805 나무 자르기
import sys
input = sys.stdin.readline
n, m = map(int, input().split()) # 나무의 수 n, 나무의 길이 m
trees = list(map(int, input().split())) # 나무 배열
start, end = 1, max(trees)
while start <= end:
mid = (start + end) // 2
slicing_tree = 0
for tree in trees:
if tree > mid:
slicin... | true |