blob_id 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 |
|---|---|---|---|---|---|---|---|---|---|---|
478c2f459fe8ab5ac848d97910ca971a8838ba2f | jayzhan211/Python-Crawler-Startups | /IG/main.py | UTF-8 | 1,897 | 2.59375 | 3 | [] | no_license | import requests
import re
from bs4 import BeautifulSoup
from pyquery import PyQuery as pq
import os
class IG_Crawler:
def __init__(self):
self.base_url = 'https://www.instagram.com/'
self.headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, lik... | true |
6c7b792ffede3e64ccc8666afa1bb8ecb91e1db7 | mikehung/leetcode | /7.Reverse_Integer.py | UTF-8 | 502 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
import math
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
n, y = 0, abs(x)
while y > 0:
d, m = divmod(y, 10)
n, y = n*10+m, d
if n > 0x7fffffff:
return 0
ret... | true |
992dec53053b6deb9b6b419114061ec25e95e30a | rising-stop/IMB-Infinate-Mario-Bros--AI | /utils/tree_drawer.py | UTF-8 | 3,342 | 3.109375 | 3 | [] | no_license | from utils.utils import random_ID
import networkx as nx
import matplotlib.pyplot as plt
import random
class tree_node:
node_size = 1
default_interval = 1
scale = 0.1
def __init__(self, id):
self.id = id
self.child = []
self.node_interval = []
self.total_width = tree_no... | true |
55fd41dbceb361d0804ccfe7c2f6817c15ee443b | madelgi/euler | /Python/euler/p100/p076.py | UTF-8 | 411 | 3.6875 | 4 | [] | no_license | """
How many different ways can one hundred be written as a sum of at least two
positive integers
"""
def partition(n):
"""
Determine how many ways you can write a number n as a sum of integers.
"""
coeffs = [0]*(n+1)
coeffs[0] = 1
for k in xrange(1, n+1):
for i in xrange(0, n-k):
... | true |
60b6e8d1aa95f429f50f7d5b07de238de906643f | Oscar-Oliveira/Data-Structures-and-Algorithms | /E_Data_Structures/B_Data_Structures/queue_with_head.py | UTF-8 | 682 | 3.390625 | 3 | [
"MIT"
] | permissive | """
Queue
"""
from B_Data_Structures.queue_adt import QueueADT
class Queue_with_head(QueueADT):
def __init__(self):
self.length = 0
self.head = None
def insert(self, obj):
node = QueueADT.Node(obj)
if self.is_empty():
self.head = node
else:... | true |
4270372ced2281a28b94cf0100f19d8bdde5d85a | Vkutti/Calculator | /AddFunctions.py | UTF-8 | 497 | 3.78125 | 4 | [] | no_license | def adding(a, b):
if a is None:
return b
if b is None:
return a
type1 = type(a)
type2 = type(b)
acceptable_types = [int, float, complex]
check_type(acceptable_types, type1, 'First')
check_type(acceptable_types, type2, 'Second')
return a + b
def ch... | true |
5a0cf125486a44f47e348ab36ab10cb7bed77660 | mrn01/Blockchain_Project | /blockchain_davidcoin/Module 1 - Create a Blockchain/use_your_own_API.py | UTF-8 | 795 | 2.828125 | 3 | [
"MIT"
] | permissive | # Import libraries
from requests import get
from json import dumps
# Your own local host's url
URL = "http://127.0.0.1:5000/"
# Names of active pages
mine_block = "mine_block"
get_chain = "get_chain"
is_valid = "is_valid"
# Define function for to check if API works and use the API.
def check_request_a... | true |
7a3003b47ca59814d419352326429e6a5291cd16 | kazamari/CodeAbbey | /209_suffix-array-advanced.py | UTF-8 | 3,090 | 3.71875 | 4 | [] | no_license | '''
So let us try building suffix array over the larger text. Good books, like The Holy Bible or Lord of the Rings contains
usually few hundreds thousand words, so let us create similar data set.
We will load words from our favorite words.txt file into single list.
Then we set up Linear Congruential Generator ... | true |
e34f393d5d21657a68d61be3e7bbd45150b863ff | bsameera/Udacity-data-structures-and-algorithms | /project2/union_and_intersection_6.py | UTF-8 | 6,892 | 4.375 | 4 | [] | no_license | # Union and Intersection of Two Linked Lists
# Your task for this problem is to fill out the union and intersection functions. The union of two sets A and B is the set of elements which are in A, in B, or in both A and B. The intersection of two sets A and B, denoted by A ∩ B, is the set of all objects that are members... | true |
45800ce4692201f42635a24856460b1c5ca686b8 | Srijanjha/FormulaCLI | /formulacli/helpers.py | UTF-8 | 556 | 3.234375 | 3 | [
"MIT"
] | permissive | import time
import os
import sys
def clear_screen() -> None:
if sys.platform in ["linux", "linux2", "darwin"]:
os.system("clear")
elif sys.platform == "win32":
os.system("cls")
else:
print("\n" * 50)
class Timer:
def __init__(self) -> None:
self.t1: float = 0
def... | true |
da4d97b9bbea158dc7391bdb1e57a1e9848e1fca | CNR-ITTIG/plasodfaxp | /plaso/parsers/safari_cookies.py | UTF-8 | 7,229 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""Parser for Safari Binary Cookie files."""
import construct
from plaso.events import time_events
from plaso.lib import errors
from plaso.lib import eventdata
# Need to register cookie plugins.
from plaso.parsers import cookie_plugins # pylint: disable=unused-import
from plaso.parsers impo... | true |
e2da6fa653afa5c126d73b5dbb95577644b872be | hyeon21-p/python | /Pycharm/BOJ/Binary_search/Binary1.py | UTF-8 | 272 | 2.765625 | 3 | [] | no_license | #BOJ 52329
N = int(input())
A = list(map(int, input().split(" ")))
M = int(input())
B = list(map(int, input().split(" ")))
for i in B:
for j in range(0, M):
if i == A[j]:
print(1)
break
elif j == len(A)-1:
print(0) | true |
b25f2326c8e02d23cedf70a3f22a2d12cd03f597 | huangyingw/remove_comments | /418.sentence-screen-fitting.233033386.Accepted.leetcode.py | UTF-8 | 504 | 2.796875 | 3 | [] | no_license | class Solution(object):
def wordsTyping(self, sentences, rows, cols):
sentence = '-'.join(sentences)
sentence += '-'
index_in_sentence = 0
for row in range(rows):
index_in_sentence += cols
if sentence[(index_in_sentence%len(sentence))] == '-':
index_in_sentence += 1
else:
while index_in_senten... | true |
c46a666f207b32ead021a96894c13809207fc498 | dileeshvar/footopiaProject | /footopia/models.py | UTF-8 | 27,574 | 2.515625 | 3 | [] | no_license | from django.db import models
from django.db.models import Min, Max, Sum, Avg
from django.contrib.auth.models import User
from django.db import transaction
import datetime, pytz
import utility
from django.db.models import Q
class Team(models.Model):
team_cd = models.CharField(max_length = 3)
team_api_id = models.Int... | true |
2f394d56039a629a1091c2ab1cfb8653e5042fcf | phcs2018/mini_project_python-3 | /ccnumbers | UTF-8 | 326 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
python find_cc_regex.py -F <input file>
import ccnumbers.txt as ccnumber
#Establish that we are searching for a string of 16 digits or 4 groups of 4 numbers with -
for ccnumbers in ccnumber:
if ccnumber.length == 16 OR ccnumber = string.match(\d{4})
print("These are credit card numbers!" ccnu... | true |
a87d55dce1f751ba4c4321157084fc833152533b | rajeevdodda/Codeforces | /CF-A/1201-1300/CF1270-A.py | UTF-8 | 301 | 2.6875 | 3 | [] | no_license | # https://codeforces.com/problemset/problem/1270/A
for _ in range(int(input())):
n, k1, k2 = map(int, input().split())
first_max = max(map(int, input().split()))
second_max = max(map(int, input().split()))
if first_max > second_max:
print("YES")
else:
print("NO") | true |
165b70b9f506a493388f7c3b75d12ccdb31d467e | zhoukunpeng504/pydnspod | /pydnspod/user.py | UTF-8 | 2,718 | 2.609375 | 3 | [] | no_license | from pydnspod.base import Api
class User(Api):
"""
dnspod account information
"""
def detail(self):
"""
get user detail information
:return:
"""
uri = '/User.Detail'
ret = self._do_request(uri)
return ret.get('info').get('user')
def modify_... | true |
18eb874b1c5193fb3f259bf045d9037e84ec371f | vijayjag-repo/Big-Data-Analysis | /part3/NYT/Code/stemming.py | UTF-8 | 1,508 | 2.796875 | 3 | [] | no_license | import nltk
import csv
import re
import stemming
from nltk.corpus import stopwords,wordnet
from nltk.stem import PorterStemmer, WordNetLemmatizer
from nltk.tokenize import word_tokenize
def main():
stop_words = stopwords.words('english') + ['advertisement','support']
print(stop_words)
#stop_words.append('said')
... | true |
ae8304893012938b898f0498c8be07562e2606c2 | piotrmaslanka/satella | /satella/exception_handling/global_eh.py | UTF-8 | 3,623 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import sys
import threading
import typing as tp
from satella.coding import wraps
from satella.coding.structures import Singleton
from satella.instrumentation import Traceback
from .exception_handlers import BaseExceptionHandler, FunctionExceptionHandler, \
exception_handler
__all__ = [
'GlobalExcepthook'
]
... | true |
67b03f1823d9d4d9ca14a16387c97b9639d58391 | vincesanders/CS-Build-Week-2 | /day1/containsduplicates.py | UTF-8 | 625 | 3.734375 | 4 | [] | no_license | class Solution:
def containsDuplicate(self, nums):
# Create a set to keep track of nums already encountered in the array
visited = set()
# Iterate through the list
for num in nums:
# if the number is already in the set,
# that means we h... | true |
c1a743c058329a04fdf8caabd372fb52880c7d02 | nganhkhoa/ai-ass1-demo | /bloxorz/stages/stage3.py | UTF-8 | 849 | 2.6875 | 3 | [] | no_license | from typing import List
from bloxorz.game.Stage import Stage
from bloxorz.game.Tile import Tile
from bloxorz.game.TileType import TileType as T
def stage3():
arr = [[] for i in range(6)]
arr[0] = [None for i in range(6)]
arr[0] += [Tile() for i in range(7)]
arr[1] = [Tile() for i in range(4)] + [No... | true |
be8cdee757bc4dbb0cfbec98947480a3c7034749 | Tarkovistan/Tap-man-A-Level-Game-project | /collectibles.py | UTF-8 | 552 | 2.9375 | 3 | [] | no_license | import pygame
W, H = (1280, 720)
win = pygame.display.set_mode((W, H))
from non_animated_images import fireball2
class collectibles(object):
def __init__(self, x, y, width, height, visible):
self.x = x
self.y = y
self.width = width
self.height = height
self.... | true |
00e2f7cef55fc03ece9d32be255d2f65ec97d803 | MeghnaM/rosalind | /point-mutations.py | UTF-8 | 479 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# Hamming distance - The minimum number of symbol substitutions required to change one string into another of equal length
def count_pt_mutations(s,t):
if (len(s) != len(t)): return -1
hdist = 0
los = list(s)
lot = list(t)
for i in range(len(los)):
if los[i] != lot[i]: hdist ... | true |
b0e79f18a43de2f29d155d502be0778033592915 | deepprakashp354/my-playground | /POCs/Bckend - Python/grid-server-django-master/grid/views.py | UTF-8 | 7,290 | 2.625 | 3 | [] | no_license | from django.http import HttpResponse
from django.conf import settings
import smtplib, ssl
import json
from . import models
from . import polygon
fishnet, plotFishNet, kmToDeg, nesw, point, shapelyPolygon = polygon.fishnet, polygon.plotFishNet, polygon.kmToDeg, polygon.nesw, polygon.point, polygon.shapelyPolygon
# cre... | true |
704f882c0ddc217b9709450bf075f06a5fe0d213 | chocochun/FameForecaster | /code/2_cleandata.py | UTF-8 | 6,893 | 2.65625 | 3 | [] | no_license | # clean data
import pandas as pd
import numpy as np
import pickle
import re
from datetime import datetime
class Clean_rawdata():
'''
A class to clean raw data from blouinartsales
'''
def __init__(self):
# load data
self.tempdata = pickle.load(open("/Users/minchunzhou/Desk... | true |
e3fcb49818ab2938e21d8b7701a777add666309a | GiladFine/ImageApproximation | /shapes.py | UTF-8 | 2,656 | 3.3125 | 3 | [] | no_license | import random
from aggdraw import Draw, Brush
from utils import *
class Shape(object):
def __init__(self, color):
self.color = color
def mutate_gene(self, val, prob, step, min_val = None, max_val = None):
'''
Changes an input value, with some input probability, with input step size, whi... | true |
93bed0bce3f21001110f16dc2b81e80aeb48077e | WinstonPais/QSUniversityRankingWebScraper | /crawler2.py | UTF-8 | 4,300 | 2.625 | 3 | [] | no_license | import os
from selenium import webdriver
from time import sleep
import json
CHROMEDRIVER_LOCATION = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)),"chromedriver_win32"),"chromedriver.exe")
def getUrls():
return json.load(open('result1.json',))
def runCrawler():
urls = getUrls()
chr... | true |
0d8b2da4a7da77b8aa49a76578d1c22d7e2ad1af | AnthonyAndroulakis/mat2obj | /mat2obj.py | UTF-8 | 3,946 | 3.046875 | 3 | [] | no_license | #mat2obj.py, wrote 2 functions, found 1 function & 1 class on stackoverflow, read below for sources, 2019
#How to run:
#import mat2obj
#mat2obj.filename('filename')
#
#How to convert mat to dictionary:
#mat2obj.loadmat('filename')
#
#
# function loadmat is from stackoverflow, written by users cs01 and jpapon:
# https:/... | true |
33485ecd82ba9a735cf4d06386978cc6c6e1a644 | Yuchen112211/Leetcode | /problem735.py | UTF-8 | 2,721 | 4.34375 | 4 | [] | no_license | '''
735. Asteroid Collision
Medium
We are given an array asteroids of integers representing asteroids in a row.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed.
Find out the state ... | true |
660121f27dcd161d682aaaefc1c19760b9c33f02 | herojelly/Functional-Programming | /Chapter 7/7_11.py | UTF-8 | 551 | 4.46875 | 4 | [] | no_license | # Gregory Jerian
# Period 4
def main():
print("This program determines if a year is a leap year.")
try:
year = eval(input("Enter the year: "))
if year % 4 != 0:
print("That's not a leap year.")
elif year % 100 == 0:
if year % 400 == 0:
print("Yes... | true |
f02b96dad1abc1aa4c5721a5bddec6d48329cb79 | n1kolayvas1lev/PythonPY100 | /Занятие4/Практические_задания/task1_2/main.py | UTF-8 | 82 | 2.609375 | 3 | [] | no_license | if __name__ == "__main__":
n = 10
print([i ** 2 for i in range(2, n, 2)])
| true |
85f1bfa1141d9545bcceaf570cae5d07f546bf97 | chipperrip/IN1900 | /veke 10/Backward2.py | UTF-8 | 2,480 | 3.5625 | 4 | [] | no_license | """
Frå boka
Exercise 9.11: Implement a new subclass for differentiation
"""
import numpy as np
class Diff:
def __init__(self, f, h=1E-5):
self.f = f
self.h = float(h)
def error (self, x, exact):
return abs(exact - self(x))
class Backward1(Diff):
def __call__(self, x):
f ... | true |
587e143cbdfd775a5125d1a89cc2d47b0c4f6a55 | AmsterdamUMC/AmsterdamUMCdb | /tests/test_scores.py | UTF-8 | 5,144 | 2.5625 | 3 | [
"MIT"
] | permissive | """
# Test script for AmsterdamUMCdb using both PostgreSQL and Google BigQuery
Tests SOFA functions
## Requirements
### Databases
- Working PostgreSQL server with fully setup AmsterdamUMCdb
- Access to AmsterdamUMCdb instance on Google BigQuery
### Config files:
- config.ini, by copying the config.SAMPLE.ini file and... | true |
55605b66e10387d6f2b2a73482942cfc5850633d | physoce/physoce-py | /physoce/stats.py | UTF-8 | 3,286 | 3.484375 | 3 | [
"CC-BY-4.0"
] | permissive | import numpy as np
import numpy.ma as ma
from scipy import stats as st
def nancorr(x,y):
"""
r = nancorr(x,y)
Calculate correlation matrix, treating NaN values as missing data
"""
x_msk = ma.masked_invalid(x)
y_msk = ma.masked_invalid(y)
r = ma.corrcoef(x_msk,y_msk)
return r
def maxcor... | true |
e322aae7afb533b4e0fd994b765f148c453c3394 | DavidBitner/Aprendizado-Python | /Curso/ExMundo2/Ex066Break1Soma.py | UTF-8 | 241 | 3.984375 | 4 | [
"MIT"
] | permissive | total = 0
soma = 0
while True:
n = int(input('Digite um numero [999 para parar]: '))
if n == 999:
break
total += 1
soma += n
print(f'Foram digitados {total} numeros!')
print(f'A soma dos numeros digitados é {soma}')
| true |
74079d80e9690fbdd38531ba0bba2df6fa1e3c0c | alador101/helloworld | /helloworld.py | UTF-8 | 149 | 3.78125 | 4 | [] | no_license |
print(pow(5,4))
num_one = input('enter a number:')
num_two = input('enter another number:')
result = float(num_one) + float(num_two)
print(result)
| true |
5747ed4ca7e71a5b93240e831e09fc21d7905fa8 | mrob95/MR-commands | /my_commands/utils/navigation.py | UTF-8 | 3,079 | 2.71875 | 3 | [] | no_license | from dragonfly import *
from dragonfly.actions.action_mouse import get_cursor_position
import time, struct
# import utilities
from my_commands.utils import utilities
key_wait = 0.05
def duple(n, esc=True):
cb = Clipboard(from_system=True)
if esc: Key("escape").execute()
Key("home, s-end, c-c, end").execu... | true |
6591d55379ecdf825688a447e5180812c8ad330c | alex2201/PatternRecognition | /classifier/main.py | UTF-8 | 6,305 | 2.625 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
from Classifiers.BayesianClassifier import BayesianClassifier
from Classifiers.KNNClassifier import KNNClassifier
from Classifiers.ClassifierClass import ClassifierClass
from Classifiers.EuclideanClassifier import EuclideanClassifier
from Classifiers.MahalanobisClassifier ... | true |
3dceff084d0d24e55a33b21d3eed30d677a07c16 | dheeraj7596/Coarse2Fine | /create_preds_df.py | UTF-8 | 1,116 | 2.640625 | 3 | [] | no_license | import pickle
import pandas as pd
from sklearn.metrics import f1_score
if __name__ == "__main__":
dataset = "nyt"
data_path = "./data/" + dataset + "/"
pred1_path = data_path + "pred1/"
pred2_path = data_path + "pred2/"
df_fine = pickle.load(open(data_path + "df_fine.pkl", "rb"))
parent_to_chi... | true |
8c87240509222744c06618348080a3b65818edac | mackeper/AlgorithmsAndDataStructures | /kattis/betting/main.py | UTF-8 | 194 | 3.203125 | 3 | [] | no_license |
import sys
def main() -> None:
for line in sys.stdin:
v = int(line)
print(f'{(100-v)/v+1:.10f}')
print(f'{v/(100-v)+1:.10f}')
if __name__ == '__main__':
main() | true |
3425b26b99eb0b4617e153465cef31cbc88fb49e | skrajendiran/LetsUpgrade-Assignment | /Day1Assignment.py | UTF-8 | 533 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[41]:
import numpy as np
import pandas as pd
import matplotlib as mat
import matplotlib.pyplot as pl
# In[42]:
#Assignment 1
x= np.arange(0,11)
y= x*x
pl.plot(x,y,color='green', marker='o', linestyle='dashed',linewidth=2, markersize=10)
pl.title("LinePlot")
pl.xlabel("... | true |
b8c66db6fc2f9080202b10e208c2fe6a4fb26299 | jhonatang1988/holbertonschool-higher_level_programming-1 | /0x0C-python-almost_a_circle/tests/test_models/test_base.py | UTF-8 | 458 | 2.875 | 3 | [] | no_license | #!/usr/bin/python3
"""
Unittest for base class
"""
import unittest
from models.base import Base
from models.rectangle import Rectangle
from models.square import Square
class Testbaseclass(unittest.TestCase):
def testcreateelems(self):
b = Base()
b1 = Base(76)
b2 = Base()
self.as... | true |
fe022765c6cae8fcb4b80a041574adc859834645 | janhon3n/MarkovMaze | /SearchTrees/dijkstraPlayer.py | UTF-8 | 1,701 | 2.96875 | 3 | [] | no_license | from player import *
from stage import *
from stateAnalyser import *
import time
class PathFinderPlayer(Player):
activeNodes = None
moves = None
gameWindow = None
def __init__(self, stage, gameWindow):
super().__init__(stage)
self.gameWindow = gameWindow
self.searchMap = State... | true |
5fbef12f001e7ce62845931dc2d502161535d8ec | ignLopez/aaaa | /resources/modo_report.py | UTF-8 | 4,837 | 2.875 | 3 | [] | no_license | from tkinter import LabelFrame,Label,Frame, Button
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import sqlite3
import pandas as pd
from tkinter import font as tkfont
from resources import base_paths
class ModoReport:
def __init__(self, newWindow, window):
... | true |
9a998ec60b2b591fd1f6f9afdf423f6ee2963833 | walles/px | /tests/px_cpuinfo_test.py | UTF-8 | 1,867 | 2.609375 | 3 | [
"MIT"
] | permissive | import os
from px import px_cpuinfo
def test_get_core_count():
physical, logical = px_cpuinfo.get_core_count()
assert physical >= 1
assert logical >= physical
assert logical % physical == 0
def assert_core_counts_from_file(filename, expected_physical, expected_logical):
my_dir = os.path.dirnam... | true |
fbf4362caf590b97e150e09c7454c5e8495d03d2 | othierie/SGF-Viya-Streaming-Integration | /flask-video-streaming-master-SGF/queuetutor.py | UTF-8 | 4,396 | 3.109375 | 3 | [
"MIT"
] | permissive | import queue
import threading
import time
from base_camera import BaseCamera
import os
import sched
class DirectoryHandler(object):
readEvent = threading.Event()
streamEvent = threading.Event()
readQueue = queue.Queue()
timer = 0
def findFilesInFolder(self, path, pathList, extensio... | true |
4d5698df165aa8f30e547439f031c2168cd0c05f | ForTheGold/AlgorithmsAndDataStructures | /DSF/DSFWeek3/test.py | UTF-8 | 325 | 3.390625 | 3 | [] | no_license | dictionary = {}
dictionary[1] = "good"
dictionary[4] = "great"
dictionary[3] = "grand"
dictionary[2] = "wonderful"
dictionary[5] = "no yelling on the bus"
print(dictionary[1])
print(dictionary[4])
print(dictionary[3])
print(dictionary[2])
print(dictionary[5])
try:
print(dictionary[6])
except:
print("No he did... | true |
6a0759f99289501e5de5904083649a9250aba23b | jBordagi/pyalgo | /hello.py | UTF-8 | 811 | 4.34375 | 4 | [] | no_license | """
Algotithm #0.0.1
Declare var
Store some aithmetics into the var
Display result
Operands, operators, functions
@version 0.0.2
Add two operands and replace compute method
"""
"""
function setting
"""
def addition(operande1, operande2):
if operande1 < 0:
operande1 = operande1 *... | true |
f5471f16a1be409206a64b1c31f8521afeba9780 | shingjay/dealchan | /scripts/nlp/convert_sql_text.py | UTF-8 | 1,574 | 2.671875 | 3 | [] | no_license | import pymysql
import os
import re
import nltk
from corpus import getStopwordsCorpus
text_path = './datatext'
db_host = '127.0.0.1'
db_port = 3306
db_username = 'root'
db_password = 'password'
db_dbname = 'sd'
table_name = 'asia_deals_clean'
def processTitle(title):
stopwords = getStopwordsCorpus()
pattern = re.com... | true |
62f722a1df064c5d8d597139b21331a31ec37fcd | digital-cube/edu | /python/2017-01-30/test1.py | UTF-8 | 226 | 3.3125 | 3 | [] | no_license |
class A(object):
klasna_promenljiva = 0
def __init__(self):
A.klasna_promenljiva += 1
@staticmethod
def ppp():
print(A.klasna_promenljiva)
aaa = A()
aaa.ppp()
bbb = A()
bbb.ppp() | true |
9dd4a8bea6d079f6bd3883fe53949bfbb1d58f1b | AndreasWJ/Plot-2d | /curve.py | UTF-8 | 2,638 | 4.0625 | 4 | [] | no_license | class Curve:
def __init__(self, curve_function, color, width):
self.curve_function = curve_function
self.color = color
self.width = width
def get_pointlist(self, x_interval, precision=1):
'''
The point precision works by multiplying the start and end of the interval. By ... | true |
4f25b079969759fbaa49bc587b5484ff0beb4445 | minghsu0107/Mango-Prediction | /read.py | UTF-8 | 1,025 | 2.609375 | 3 | [] | no_license | import os
import csv
import cv2
import random
import time
import numpy as np
#import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
DIR = 'data/'
filenames = os.listdir('data')
def MakeLabel(flag, sz):
res = []
with open(DIR + flag + '.csv', 'r') as f:
reader = csv.read... | true |
229f2ea25a46ed2047bd529995c6b286385bab2d | RishiWig3/Robotics | /Math functions.py | UTF-8 | 994 | 3.4375 | 3 | [] | no_license | import math
def areaCircle(radius):
Circlearea = float(math.pi * (radius**2))
return Circlearea
def volumeCylinder(radius, height):
CylinderVolume = float(((math.pi * (radius**2)) * height))
return CylinderVolume
def areaTriangle(base, height):
TriangleArea = float((base * height) * 0.... | true |
f281d578121824c6b0cfaefaee4f5e0c948d6541 | MustacheYu/webTest | /pageobjects/base_page.py | UTF-8 | 7,220 | 2.921875 | 3 | [] | no_license | # encoding=utf-8
import os
import time
from selenium.common.exceptions import NoSuchElementException
from common.Log import Log as Log
from common import common
log = Log(logger="BasePage")
logger = log.get_logger()
def ele_pathvalue(page_name, element_name):
element_dict = common.get_xml_dict(page_name, element... | true |
ddc9198ac65991ffd055f87ec81ceafd532401f9 | lvbenson/Multitask_Alife | /categories_analysis.py | UTF-8 | 16,334 | 2.546875 | 3 | [] | no_license |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 19 13:15:50 2020
@author: Lauren Benson
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
#viz to compare: (1) variance against lesions. (2) mutual information against lesions.
# Lesions = "ground truth"
#use directory: Local3
dir =... | true |
65a7fcf427697e7960a9a76024a56cab1ce4dc0c | lauram15a/Fundamentos_de_programacion | /CUADERNOS DE TRABAJO/CUADERNO 7/ej 2 cuadreno 7 (método insercion) ordenar array descendentemente por la longitud de la cadena.py | UTF-8 | 1,329 | 4.09375 | 4 | [
"MIT"
] | permissive | #LAURA MAMBRILLA MORENO
#Ej 2 Cuaderno 7
"""
Realice un programa que almacene 10 frases diferentes en un array y nos
permita ordenar el array descendentemente por la longitud de la cadena
usando el método de inserción.
"""
#funciones
def mayor(frase1, frase2):
"""
"""
return len(frase1) > len(frase2)
""... | true |
ef4fb493f04be1615286317d7be0f90d2efcb7d0 | dvirs12345/star-tracker | /rotationDetection.py | UTF-8 | 4,133 | 2.796875 | 3 | [] | no_license | import numpy as np
import cv2
import pandas as pd
import matplotlib.pyplot as plt
from PIL import Image
import math
galagys8aol = 80
picsize = 0
SValue = 12000000
def calc_distance(x1, x2, y1, y2):
return math.sqrt(((x1 - x2) ** 2) + ((y1 - y2) ** 2)) # Distance between two points formula
def ... | true |
d7cb49be9bb8bde2c0145d5e6651f397c4b813c6 | el-ideal-ideas/MocaTwitterUtils | /src/moca_modules/moca_log/MocaFileLog.py | UTF-8 | 5,423 | 2.984375 | 3 | [
"MIT"
] | permissive | # -- Imports --------------------------------------------------------------------------
from typing import (
Optional, Union
)
from pathlib import Path
from queue import Queue
from datetime import datetime
from traceback import format_exc, print_exc
from ..moca_core import tz, ENCODING, NEW_LINE
from ..moca_file i... | true |
6e648ca8180166c1a8bb5c88ea071f19e7e6c690 | jvitorbarbosa/thesis_project | /draw_two_strategies_freq.py | UTF-8 | 1,241 | 2.84375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
def main():
name = "two_str_comparison_e001_lac1.png"
y_label = "Strategy Frequency"
x_label = "Learned Strategies"
str_names = ["S{0:02d}".format(i) for i in range(16)]
count1 = [0] * 16
data1 = pd.read_csv("oldraw/strat... | true |
e0da32dc5a9691d79902b9c2d80ad0e516fb101a | chenjb04/fucking-algorithm | /LeetCode/数组/1两数之和.py | UTF-8 | 1,371 | 4.28125 | 4 | [] | no_license | """
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。
你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。
示例:
给定 nums = [2, 7, 11, 15], target = 9
因为 nums[0] + nums[1] = 2 + 7 = 9
所以返回 [0, 1]
"""
from typing import List
"""
暴力破解 双层循环
"""
def twoSum(nums: List[int], target: int) -> List[int]:
for i in range(len(n... | true |
29c3d9d845fb80d939e4c40bc388241d50b9c5ed | malihanda/march-mad | /rank.py | UTF-8 | 2,444 | 3.625 | 4 | [] | no_license | FILE_PATH_ALL = "words-all-time.csv"
FILE_PATH_YRS = "words.csv"
FILE_PATH_OUT = "ranked.csv"
# Turn year in to a multiplier that rewards recency
def mult(y):
# Most recent = 2020
# Oldest = 1993
if y == 2020:
return 50
elif y >= 2015:
return 40
elif y >= 2010:
return 10
... | true |
8bb983d1e1409ae773d33adbbf7bd026a3143a66 | anuragtyagi04/robotics-carpuzzle | /image_processing/training and tutorials/opencv_change_video_resolution.py | UTF-8 | 1,070 | 3.046875 | 3 | [] | no_license | import cv2
# methods to change resolution
# recommendation is to only do downscale
def make_1080p():
video.set(3,1920)
video.set(4, 1080)
def make_720p():
video.set(3,1280)
video.set(4, 720)
def make_480p():
video.set(3,640)
video.set(4, 480)
def change_res(width, height):
video.set(3,w... | true |
d628881433c32533c03cf44ab883294425dc2ede | DSA-Classe-Gennaio-2021/Repo_PE | /ML project/Rain Australia/Rain_Australia.py | UTF-8 | 8,812 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
df_original = pd.read_csv('weatherAUS.csv')
df_original.shape
# In[3]:
df_original.head()
# The dataset i... | true |
cee494d14a0a422fb073f07701bbfee2cf52d663 | RVJonah/VetCalculationsPractice | /helpers.py | UTF-8 | 1,204 | 2.546875 | 3 | [] | no_license | import urllib.parse
from flask import redirect, render_template, request, session, jsonify, current_app
from functools import wraps
def apology(message, code=400):
#Render message as an apology to user.
def escape(s):
# escapes special characters
for old, new in [("-", "--"), (" ", "-"), ("_"... | true |
144ca913ea7adddfe82f934a8053b884f04285ee | qianlv/learning | /python/network_programming/tcpcliserv/tcpcli01.py | UTF-8 | 962 | 2.703125 | 3 | [] | no_license | """ a simple tcp client """
# encoding=utf-8
import socket
import time
import signal
import sys
from lib import entry_retry
from lib import tcp_connect
MAX_RECV = 16
def readn(client_sock, size):
nleft = size
res_data = ''
while nleft > 0:
data = entry_retry(client_sock.recv, min(nleft, MAX_RECV... | true |
558fb6e7592c68f8e50ece67f4d1e2a5fa28c15c | ceevaaa/Eyantra-2016 | /Task_1_CC/Experiment/Task1A_Practice/gridWrite.py | UTF-8 | 2,260 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
**************************************************************************
* IMAGE PROCESSING (e-Yantra 2016)
* ================================
* This software is intended to teach image processing concepts
*
* MODULE: Task1A
* Filename: gridWrite.py
* ... | true |
a5a83ea3a050ef5f2ff17e03c0c4cacbf402b9d7 | Jiekai77/MSCA_RT | /week5/5.3.py | UTF-8 | 4,207 | 3.21875 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
from collections import deque
#
# Complete the 'TradingStrategy' class below.
#
#
# Python program to get average of a list
def average(lst):
return sum(lst) / len(lst)
class TradingStrategy:
def __init__(self):
self.small_windo... | true |
b1d34d2b79f678fac339cdefba218372d34b94b0 | alphafan/Python_Web_Scraping | /tuto_asyncio_scrape/simple_asyncio.py | UTF-8 | 944 | 3.609375 | 4 | [] | no_license | # Simple Asyncio Example and Compare with Non-Asyncio
import time
import asyncio
def job(t):
print('Start job', t)
time.sleep(t)
print('Job takes', t, 'seconds')
def execute_jobs():
[job(t) for t in range(1, 3)]
async def async_job(t):
print('Start job', t)
await asyncio.sleep(t)
prin... | true |
bebddf4a63575f010f67ca926b46f22507f1d4b7 | LetoMurakai/fundamentosPython | /aula04.py | UTF-8 | 527 | 4.03125 | 4 | [] | no_license | # Coleções(Listas)
'''
preco_1 = 20
preco_2 = 50
preco_3 = 200
'''
#Listas
precos = [20,50,200]#indices [0,1,2,...]
print(precos[1])#(precos.index(50))
diversidade = [18,'Leto',True]
print(diversidade[0])
print(diversidade[1])
print(diversidade[2])
# Laços em iteráveis
for preco in precos:
print(preco)
# Some os v... | true |
93bff9cec9a31f79b4ecfc46e2e24eeca9442c08 | tjkendev/procon-library | /python/range_query/rsq_raq_bit.py | UTF-8 | 557 | 3.21875 | 3 | [] | no_license | # N: 処理する区間の長さ
N = ...
data0 = [0]*(N+1)
data1 = [0]*(N+1)
# 区間[l, r)に x を加算
def _add(data, k, x):
while k <= N:
data[k] += x
k += k & -k
def add(l, r, x):
_add(data0, l, -x*(l-1))
_add(data0, r, x*(r-1))
_add(data1, l, x)
_add(data1, r, -x)
# 区間[l, r)の和を求める
def _get(data, k):
... | true |
832a7eca6cad04a12572688e7530a8497ca5ef73 | ivanlyon/exercises | /kattis/k_textencryption.py | UTF-8 | 781 | 3.625 | 4 | [
"MIT"
] | permissive | '''
Encode text with transposition cipher
Status: Accepted
'''
###############################################################################
def main():
"""Read input and print output"""
while True:
decoder = int(input())
if decoder == 0:
break
text = input().upper().r... | true |
2934f1c0d8b84dd4d9e77bbdabee52203f0c685d | martinmacko47/chcemvediet | /poleno/datacheck/datacheck.py | UTF-8 | 3,650 | 2.65625 | 3 | [] | no_license | # vim: expandtab
# -*- coding: utf-8 -*-
import functools
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL
from poleno.utils.misc import FormatMixin
class Issue(FormatMixin, object):
def __init__(self, level, msg, *args, **kwargs):
self.level = level
self.issuer = None
self.auto... | true |
1aa98d06b0366a3f8871c7861dbd826d134cadd2 | varun-kilaru/Miller-Rabin | /miller_rabin.py | UTF-8 | 902 | 3.515625 | 4 | [] | no_license | import random
die = random.SystemRandom() # A single dice.
import time
def single_test(n, a):
exp = n - 1
while not exp & 1:
exp >>= 1
if pow(a, exp, n) == 1:
return True
while exp < n - 1:
if pow(a, exp, n) == n - 1:
return True
... | true |
daa2ef71fd35e5e4537e836c59e728ca9cca8050 | UULIN/automation_test | /unit7_unittest_expand/test_case/test_parameterized_baidu.py | UTF-8 | 942 | 2.78125 | 3 | [] | no_license | import unittest
from time import sleep
from selenium import webdriver
from parameterized import parameterized
class test_baidu(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.driver = webdriver.Chrome()
cls.base_url = "https://www.baidu.com/"
@classmethod
def tearDown... | true |
640b67e2b1d430c228c2704c8f3ab68a90a78c86 | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode/1001-1200/001190/001190.py | UTF-8 | 808 | 3.09375 | 3 | [] | no_license | from collections import deque
class Solution(object):
def reverseParentheses(self, s):
"""
:type s: str
:rtype: str
"""
res = []
stk = deque()
for ch in s:
if ch != ')':
res.append(ch)
else:
while res[-1... | true |
dc810c0eb27b6b052fe84e198cf005c986525ffe | Nicolas-Wursthorn/Exercicios-Python-Brasil | /EstruturaSequencial/exercicio14.py | UTF-8 | 949 | 3.75 | 4 | [
"MIT"
] | permissive | # João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do estado de São Paulo (50 quilos) deve pagar uma multa de R$ 4,00 por quilo excedente. João precisa que você f... | true |
c028f3215acb6633a382f1f6c808a4c0164eea60 | optimus1009/wiki_exp_sim_base_tfidf | /wiki_word2vec.py | UTF-8 | 1,136 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author : lin.xiong
import gensim
from gensim.models import Word2Vec
import segmenter
class sentences_generator():
def __init__(self, file_path):
self.filepath = file_path
def __iter__(self):
with open(self.filepath,'r') as input_file:
for line in input_f... | true |
df0d9db78d0a5f61321ce36fc765d9097f2361a0 | simgenurcankaya/cracking-the-coding-interview | /1_6.py | UTF-8 | 801 | 3.40625 | 3 | [] | no_license | import unittest
def stringCompression(inp):
retval = ""
i = 0
while(i< len(inp)):
times = 0
for j in range(i,len(inp)):
if(inp[i] == inp[j]):
times +=1
if(j == len(inp) -1):
retval += inp[i]+ str(times)
i = ... | true |
d724dcc81e20c5b3c96f55937913c30df804d763 | brandr/Platformer | /LevelEditor/leveldata.py | UTF-8 | 1,499 | 2.90625 | 3 | [] | no_license | # NOTE: not sure this is actually used by leveleditor clalsses.
#NOTE: this class might need to be accessed by classes outside the leveleditor.
# TODO: implemeent dungeon travel data
class LevelData(object):
"""docstring for LevelData"""
def __init__(self, name, coords1, coords2, sunlit = False, bg_filename = None,... | true |
ca9b0ad49017dfd413616346525953dce728b0dd | bimri/learning-python | /chapter_39/timerdeco2.py | UTF-8 | 3,177 | 3.71875 | 4 | [] | no_license | "Adding Decorator Arguments"
import time
def timer(label='', trace=True): # On decorator args:retain args
class Timer:
def __init__(self, func): # On @: retain decorated func
self.func = func
self.alltime = 0
def __call__(self, *args,... | true |
ad524fe60e84f7b9fd1302c6909748937fcae73b | 1ucian0/qiskit-terra | /qiskit/pulse/instructions/snapshot.py | UTF-8 | 2,864 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | true |
f29a1e50f83784dd8efab0330b46604b4b9589b8 | capeterson3/fffl_old | /postgres_functions.py | UTF-8 | 4,060 | 2.96875 | 3 | [
"MIT"
] | permissive | import psycopg2
import pandas as pd
from psycopg2 import Error
def create_table():
try:
connection = psycopg2.connect(
user="postgres",
password="rodgers12",
host="127.0.0.1",
port="5432",
database="fffl",
)
cursor = connection.c... | true |
1250810035bacd319f688a894925a6bff858ab5d | SnehalRaj/CS335 | /Project/Milestone-1/Submission/src/ast.py | UTF-8 | 4,767 | 2.5625 | 3 | [] | no_license | from antlr4 import *
from java9Lexer import java9Lexer
from java9Listener import java9Listener
from java9Parser import java9Parser
import argparse
import subprocess
# from HelloLexer import HelloLexer
# from HelloListener import HelloListener
# from HelloParser import HelloParser
# from HelloVisitor import HelloVisitor... | true |
13ef1f1407216c538bbaf0ababa50b9b8ae96df0 | Aasthaengg/IBMdataset | /Python_codes/p03545/s999645533.py | UTF-8 | 600 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 21 22:53:14 2020
@author: liang
"""
S = input()
ans = S[0]
for i in range(8):
tmp = int(S[0])
lis = list()
for j in range(3):
lis.append(i>>j&1)
for i in range(3):
if lis[i] == 1:
tmp += int(S[i+1])
else:
... | true |
0703eef36c718338a86e2cff3e4544f2f15db214 | JuniorCardoso-py/Udemy | /Aula22/Trocando_Valores.py | UTF-8 | 82 | 3.359375 | 3 | [] | no_license | x = 10
y = 'Luiz'
z = 'Otavio'
x,y,z = z,x,y
print(f'x=z :{x} y=x :{y} z=y :{z}') | true |
89caa6c7f10354748342fba28f2230c82e7a7a37 | OmarMaysour/RoadEye | /Services/ClassificationService.py | UTF-8 | 1,954 | 2.578125 | 3 | [] | no_license | import os
import time
import cv2
from termcolor import colored
from DTOs.AnomalyDTO import AnomalyDTO
from DataManagment.CacheManager import get_cache_manager_instance
from Logics.ClassificationLogic import get_classification_logic_instance
class ClassificationService:
def __init__(self):
self._cacheMan... | true |
f2818f1ada95c93d336da16ad6858dd8915abeb9 | kaobeosolu78/Scientific_Study_Analysis | /Study.py | UTF-8 | 1,111 | 3 | 3 | [] | no_license | import pickle
# loads pickled files
def load_obj(datatype):
with open("{}".format(datatype) + '.pkl', 'rb') as f:
return pickle.load(f)
class studies:
def __init__(self,kw,all=[]):
self.key = kw
self.all_studies = all
def add_study(self,stud):
self.all_studi... | true |
39ddecd504fde2c57b5c940c4b4b31dad1a57b97 | dhvfanny/DCASE-Acoustic-Scene-Classification-Python | /runs/2016/dnn2016med_traps/traps33/src/general.py | UTF-8 | 704 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
import json
import os
def check_path(path):
"""Check if path exists, if not creates one
Parameters
----------
path : str
Path to be checked.
Returns
-------
Nothing
"""
if not os.path.isdir(path):
os.... | true |
34dc6348a14e31277b19f0f725425b880acef068 | sujoyp/subgoal-discovery | /subgoal-discovery/subgoals/utils.py | UTF-8 | 1,966 | 2.765625 | 3 | [] | no_license | import numpy as np
import glob
def write_to_file(dname, dmap, cmap, itr):
fid = open(dname + '-results.log', 'a+')
string_to_write = str(itr)
for item in dmap:
string_to_write += ' ' + '%.2f' %item
string_to_write += ' ' + '%.2f' %cmap
fid.write(string_to_write + '\n')
fid.clo... | true |
330ac858a0ae32dd5b13f63f1ae10a209f2e99d6 | zidarsk8/ProjectEuler | /python/e75.py | UTF-8 | 787 | 2.828125 | 3 | [] | no_license | import numpy as np
from itertools import chain
from collections import defaultdict
A = np.array([[-1,2,2],[-2,1,2],[-2,2,3]])
B = np.array([[1,2,2],[2,1,2],[2,2,3]])
C = np.array([[1,-2,2],[2,-1,2],[2,-2,3]])
arr = [[np.array([3,4,5])]]
limit = 1500000
while len(arr[-1]) > 0:
arr.append([])
for i in arr[-... | true |
487bbae1dff30488e507b563e375266b7bc88e25 | jeffself/lahmandbscripts | /importallstar.py | UTF-8 | 554 | 2.765625 | 3 | [] | no_license | import csv
import sqlite3
con = sqlite3.connect('baseballstats.db')
c = con.cursor()
# Create the table
c.execute("""create table allstars (
playerID text,
yearID integer,
lgID text)""")
# csv.DictReader uses the first line in the file as column headings by default
da... | true |
d1b8d7b9ae2332ce8f7f5130d7870f285fecc176 | colinsongf/unsupervised-prototypes | /sae_mnist.py | UTF-8 | 1,492 | 2.53125 | 3 | [] | no_license | import numpy
import pylab
from unsupervised.sae import SparseAutoEncoder
from tools import load_mnist, scale_features, test_classifier
if __name__ == "__main__":
numpy.random.seed(0)
train_images, T = load_mnist("training", 60000)
train_images -= train_images.mean(axis=0)
test_images, T2 = load_mnist... | true |
6261604e2a20fc3e530978d69f9bf67c7d327c02 | yc-hu/dm_apps | /lib/templatetags/custom_filters.py | UTF-8 | 5,448 | 3 | 3 | [] | no_license | import textile
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.safestring import mark_safe
from html2text import html2text
import re
register = template.Library()
@register.filter
def multiply(value, arg):
"""will multiple value and arg and return the product... | true |
86978fade5adb002f013e7a5902adec80927d2c9 | fagan2888/uk-steel-trade | /scripts/download_comtrade_data.py | UTF-8 | 1,666 | 3.015625 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python
"""Download COMTRADE data from the API and save to disk.
Usage:
download_comtrade_data.py YEAR FILENAME
Copyright 2019 Richard Lupton
"""
from docopt import docopt
import json
import requests
from logzero import logger
# Reporter 826 == United Kingdom
URL_PATTERN = 'https://comtrade.un.or... | true |
9f78e702d5de1d994cd1006d5985b92e5d5f4117 | yunbingH/database | /admin.py | UTF-8 | 8,182 | 2.6875 | 3 | [] | no_license | from PyQt5.QtWidgets import (QMainWindow,QAction,QApplication,QDesktopWidget,QComboBox,QTextEdit,QLineEdit,QPushButton,QMessageBox,QToolTip)
from PyQt5.QtGui import QFont
import sys
import pymysql
class UI_admin(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(sel... | true |
c25cfc9ecf4909454efa96baecc7a78fc8998f32 | anj96/Practicals | /stack.py | UTF-8 | 233 | 3.015625 | 3 | [] | no_license | a=int(input())
x=list()
while a>0:
a-=1
p=input()
#print(p)
if p[0]=='1':
s=int(p[2:])
#print(p[0])
x.append(s)
elif p[0]=='2':
x.pop()
else:
print(max(x))
#print(x) | true |
93f9479a47fd96427b2aa5767d259fb7dd058f59 | Iso-luo/python-assignment | /practice/Ch5_Conditionals&Recursion/Exercise5.5_recursion.py | UTF-8 | 371 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# !/usr/bin/env python
# @Time: 2020-05-02 3:29 p.m.
import turtle
def draw(t, length, n):
if n == 0:
return
angle = 50
t.fd(length * n)
t.lt(angle)
draw(t, length, n - 1)
t.rt(2 * angle)
draw(t, length, n - 1)
t.lt(angle)
t.bk(length * n)
bob = ... | true |
5237d80b4e05300dfe9a1f43314488302161509c | Chiafl/Wallbreakers-Cohort-3 | /python3/Week 3/valid-anagram.py | UTF-8 | 599 | 3.390625 | 3 | [] | no_license | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
return self.partition(s)==self.partition(t)
def partition(self, s: str) -> str:
if len(s)<=1:
return s
return self.merge(
self.partition(s[0:len(s)//2]),
self.partition(s[len(s)//2:len(... | true |
9e8f19c3a50f781d582b91bb85d0dfdd21b214da | iTeam-co/pytglib | /pytglib/api/functions/get_file_mime_type.py | UTF-8 | 741 | 3.0625 | 3 | [
"MIT"
] | permissive |
from ..utils import Object
class GetFileMimeType(Object):
"""
Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously
Attributes:
ID (:obj:`str`): ``GetFileMimeType``
Args:
file_name (:obj:`str`):
The n... | true |
9508221aa368b64c14a3949ba04987f6985b13ce | JaspervDalen/Vanishing_Point | /vanishing_point/vanishing_point.py | UTF-8 | 8,364 | 3.125 | 3 | [] | no_license | import sys
from numpy import ndarray
import numpy as np
from typing import NamedTuple, List, Tuple
import math
import cv2
class Point(NamedTuple):
x: int
y: int
class Line(NamedTuple):
start: Point
end: Point
def read_image(path: str) -> ndarray:
return cv2.imread(path)
def convert_to_gray_... | true |