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 |
|---|---|---|---|---|---|---|---|---|---|---|
51305fab8075648522aa2411789dfd5babddc870 | seanchen513/leetcode | /sorting/0280_wiggle_sort.py | UTF-8 | 2,270 | 4.34375 | 4 | [] | no_license | """
280. Wiggle Sort
Medium
Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]....
Example:
Input: nums = [3,5,2,1,6,4]
Output: One possible answer is [3,5,1,6,2,4]
"""
from typing import List
########################################################################... | true |
e6bc3d983ec3c84ddabb597ef6eef889f269207b | creaiter/Quantization-Implementations | /quantization/pact/qnn.py | UTF-8 | 3,126 | 2.828125 | 3 | [
"MIT"
] | permissive | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class Quantizer(torch.autograd.Function):
@staticmethod
def forward(ctx, x, b):
n = 2 ** b - 1
x_q = (x * n).round() / n
return x_q
@staticmethod
def backwa... | true |
1401876c8878d4d585f6b0ba0d3eedcdb06d9446 | jessicarush/flask-microblog | /app/auth/forms.py | UTF-8 | 2,723 | 2.65625 | 3 | [] | no_license | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, Email, EqualTo, ValidationError
from flask_babel import _, lazy_gettext as _l
from app.models import User
class LoginForm(FlaskForm):
user_or_email = StringField(_... | true |
169bea8907406ace7e4f8e67d86b616f87f8c90f | heba-ali2030/word_count | /word_count.py | UTF-8 | 423 | 4.21875 | 4 | [] | no_license | # ask the user about his/ her thoughts
prompt = input(f' what\'s on your mind today? \n')
# put the user answer in a string
string=' '
prompt_string= string.replace(string, prompt)
# convert string into a list
word_list = prompt_string.split(' ')
# count the words in the list
count = len(word_list)
# tell the u... | true |
83c3a683d7377713d9048f872d25e308fe87f0fa | DanwazieGoldfinger/Goldfinger | /goldfinger-HNG-05117.py | UTF-8 | 239 | 2.609375 | 3 | [] | no_license | first_name = 'Daniel'
last_name = 'Awazie'
full_name = 'Daniel Awazie'
ID = 'HNG-05117'
email = 'danwaziegoldfinger@gmail.com'
lang = 'Python'
print('Hello World,''this is', full_name,'with HNGi7 ID', ID,'and email', email,'using', lang, "for stage 2 task")
| true |
8704502552fe8d8958432bbc91f47989ae9fb30f | javimuflo16/openfda | /openfda-3/Programa4.py | UTF-8 | 2,125 | 3.171875 | 3 | [] | no_license | import http.client
import json
import http.server
import socketserver
PORT = 8014
#Vamos a crear una lista para obtener los datos de los medicamentos
def ten_drugs():
list_drugs = [] #Inicializamos una lista vacia.
headers = {'User-Agent': 'http-client'}
con = http.client.HTTPSConnection('api.fda.gov')
... | true |
35913b57fddf2182235997a062b8d7e3067f0cd7 | tg12/pandas-ta | /pandas_ta/overlap/t3.py | UTF-8 | 3,061 | 2.8125 | 3 | [
"MIT"
] | permissive | '''THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE
DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OT... | true |
08ce52db69663a9442e654967a05291be255fbad | shae128/CodeLearning | /Python/PythonCertification/Exersices/PCA_5_7_27.py | UTF-8 | 106 | 2.921875 | 3 | [] | no_license | def outer(par):
loc = par
def inner():
return loc
return inner
var = 1
fun = outer(var)
print(fun()) | true |
5e09ad2407a45a3d7db80661b2f9c5148bb5350b | MarkAYoder/BeagleBoard-exercises | /displays/blue/blinkOneLED.py | UTF-8 | 227 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
import Adafruit_BBIO.GPIO as GPIO
import time
LED = "USR0"
delay = 0.25
GPIO.setup(LED, GPIO.OUT)
while True:
GPIO.output(LED, 1)
time.sleep(delay)
GPIO.output(LED, 0)
time.sleep(delay) | true |
0023f9414905a9776d55408e44867f8ab6f42bdf | braincs/PyCommon | /basic/simple_param_passing.py | UTF-8 | 581 | 3.109375 | 3 | [] | no_license | #!usr/bin/env python #-*- coding:utf-8 _*- """
"""
@file: simple_param_passing.py
@version:
@time: 2020/09/29
@author: shuai
@function:
"""
print("hello world!")
def append_a(str):
str.append('a')
def add_a(a):
print(id(a))
a = a + 1
# a += 1
print(id(a))
return a
def display(a):
... | true |
40a94d449a35c6015bd5c3a3518b5904e22ee732 | AhnJG/Algorithm | /BaekJoon/Print/10992_별찍기-17.py | UTF-8 | 155 | 3.34375 | 3 | [] | no_license | n = int(input())
print(' '*(n-1)+'*')
if n != 1:
for i in range(2, n):
print(' '*(n-i) + '*' + ' '*((i-1)*2-1) + '*')
print('*'*(2*n-1)) | true |
e74ad7dae72e20af8158f181a818c8d843b3c324 | Kevinrobot34/atcoder | /abc/abc_126_211/abc191/d.py | UTF-8 | 634 | 3.1875 | 3 | [] | no_license | def main():
from decimal import Decimal
import math
xc, yc, r = map(Decimal, input().split())
xc, _ = math.modf(xc)
yc, _ = math.modf(yc)
ans = 0
for y in range(math.floor(yc - r) - 2, math.ceil(yc + r) + 2):
y = Decimal(y)
if r**2 < (y - yc)**2:
continue
... | true |
10205ab8c6b6717a44769b4770fdd0a5485587a4 | laggardkernel/tutorial-py-web-scraping-with-python | /chap03/0301-all-links.py | UTF-8 | 370 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
simple demo to get all links from wiki page Kevin_Bacon
'''
from urllib.request import urlopen
from bs4 import BeautifulSoup
html = urlopen('https://en.wikipedia.org/wiki/Kevin_Bacon')
bs = BeautifulSoup(html, 'html.parser')
for link in bs.find_all('a'):
if 'href'... | true |
b1dc2c01b1a9cbbcd604cbe00fd90662de8592d4 | devroom-org/devroom-ps-contest | /devroom-ps1/g-code-without-chars/testcase_generator.py | UTF-8 | 1,928 | 2.796875 | 3 | [] | no_license | import re
from pathlib import Path
import shutil
import zipfile
syntax = re.compile(r"[#\[\\\]^{|}~]")
replace_map = {
"#": "=",
"[": "(",
"\\": "/",
"]": ")",
"^": "'",
"{": "<",
"|": "!",
"}": ">",
"~": "-",
}
output_root = Path(".") / "output"
output_path_list... | true |
73754996f803a41d84412885a775f1940e0d3862 | hikaru4215/Python-izm | /basic-Python-izm/python-izm-17.py | UTF-8 | 201 | 3.734375 | 4 | [] | no_license | counter = 0
while counter < 10:
counter += 1
print(counter)
print("=======================================")
counter = 0
while True:
counter += 1
print(counter)
if counter == 10:
break
| true |
20d4ddcb859f97f4c95ce7eeb240120216363753 | polyaB/nn_anopheles | /source/find_gaps.py | UTF-8 | 3,552 | 2.78125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import cooler
import os
import logging
from BedReader import BedReader
logging.basicConfig(format='%(asctime)s %(name)s: %(message)s', datefmt='%I:%M:%S', level=logging.INFO)
#This function merge bin gaps in big gaps.
# minimum_gap_between - minimum distance between gaps to cons... | true |
eaea14ff70ab61750384ae451069bb2314e7b29d | biothomme/Linalool | /2022_10_code/scent_pca_primula.py | UTF-8 | 27,325 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 08:56:47 2020
@author: Thomsn
"""
# github
# pip install git+https://github.com/erheron/scipy.git
# imports:
import numpy as np
import scent_genetics_primula as sgp
import matplotlib as mpl
# functions:
def load_arguments():
'''
this i... | true |
d8babeff01749ad890d0d2845abb868d1d00ff57 | XifeiNi/LeetCode-Traversal | /python/two_pointers/num-of-substrings-containing-all-three-occurance.py | UTF-8 | 428 | 3.109375 | 3 | [] | no_license | class Solution:
def numberOfSubstrings(self, s: str) -> int:
start, end = 0, 0
ret = 0
slidingMap = {'a': 0, 'b' : 0, 'c' : 0}
while end < len(s):
slidingMap[s[end]] += 1
while slidingMap['a'] and slidingMap['b'] and slidingMap['c']:
slidingMap... | true |
956b7439313df7308b7027f85f799ccd97dc289e | thebazman1998/School-Projects | /Grade 10/Unit 1/Bp_U1_Assignment8/methods.py | UTF-8 | 8,010 | 3.265625 | 3 | [] | no_license | import sys
def BI_welcomeScreen(): # Clear the screen, then welcome the player
Ib_clear(50)
print " __________________________"
Ib_wait(0.1)
print " / \ \ "
Ib_wait(0.1)
print " | \______ _____\ "
Ib_wait(0.1)
p... | true |
fec81dcbdbf61fcdb0342cfff5e6644761a698ac | yiyanwannian/python-crawler | /utility/httphelper.py | UTF-8 | 1,331 | 2.59375 | 3 | [] | no_license | import requests
import utility.utility
from utility.logger import logger
class HttpHelper(object):
@staticmethod
def post_request(url, method = None, params = {}):
resp = None
try:
resp = requests.post(url, json={"method": method, "params": params}, headers={"content-ty... | true |
8cf70e3e9bdb20c9b50bfe9d35d4518c5c182055 | AliHammoud/NDU-CSC210 | /sketch_18_Mouse_Follower/sketch_18_Mouse_Follower.pyde | UTF-8 | 1,469 | 3.34375 | 3 | [] | no_license | class Mover:
def __init__(self):
self.location = PVector(random(width), random(height))
self.velocity = PVector(0, 0)
self.acceleration = PVector(0, 0)
self.top_speed = 3
#mouse is a private variable (set using trailing double underscores)
__mouse = PVecto... | true |
737750fb004f8fca26064ba8c740b1ed3fb8371d | deepakag5/Data-Structure-Algorithm-Analysis | /Linked_Lists/detect_cycle.py | UTF-8 | 2,932 | 4.125 | 4 | [] | no_license | from Singly_Linked_List import Node
class Linked_List:
def __init__(self):
self.length = 0
self.head = None
def addNode(self, node):
if self.head is None:
self.addBeg(node)
else:
self.addLast(node)
def addBeg(self, node):
newNode = node
... | true |
5a4b2c3d535d51bbf2e18163e738b67129e32e2d | eytan-c/NLP_HW | /project/Pre trained embeddings/Data Preprocessing.py | UTF-8 | 7,931 | 2.75 | 3 | [] | no_license | #### Vocabulary
"""
SOS_TOKEN = 0
EOS_TOKEN = 1
UNKNOWN = 2
MAX_LENGTH = 20
#class Vocab:
class Vocab(object):
def __init__(self, name):
self.name = name
self.word2index = {}
self.index2word = {UNKNOWN:'__unk__'}
self.n_words = 3
def index_sentence(self, sentence, write=Tr... | true |
9a722280105294c95bccce2c5976a18f67902731 | landot/DOL_Project | /test2.py | UTF-8 | 3,245 | 2.65625 | 3 | [] | no_license | __author__ = 'timl'
from lxml import html
import requests
import time
import pymongo
from datetime import datetime, timedelta
# Connection to Mongo DB
try:
conn = pymongo.MongoClient('localhost', 27017)
print "Connected successfully!!!"
except pymongo.errors.ConnectionFailure, e:
print "Could not connect ... | true |
f3d11c16aa706e74fbd6fa3c755488146bb1d900 | copyleftdev/supawc | /examples/bs4_example_0.py | UTF-8 | 267 | 3.046875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
try:
r = requests.get("http://pythonscraping.com/pages/page1.html")
soup = bs(r.content, "html.parser")
print soup.html.body.h1
except Exception as e:
print "Unable to establish connection to host"
| true |
266d7d71ac21808bf7f2f867c142234097ef9d12 | christopherc1331/CodeChallenges | /11-21-20/Remove_Dup_Words.py | UTF-8 | 211 | 3.328125 | 3 | [] | no_license | def remove_duplicate_words(s):
cache = {}
new_str = ""
for i in s.split():
if i not in cache:
cache[i] = i
new_str += i + " "
return new_str.strip()
| true |
0d085db294d461bada3a1f2d7daec8cdcafc815c | hw355/recsys_realtor | /RECSYS_realtor_02_duplictes.py | UTF-8 | 1,226 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # Duplicate examples in Home dataset
# In[1]:
import pandas as pd
import numpy as np
import datetime as dt
# In[34]:
pre_home = pd.read_csv('./Data_Source/home.csv').drop_duplicates().reset_index(drop = True)
pre_home['last_update'] = pd.to_datetime(pre_home['last_update'... | true |
4225bff6ebb5315e317f5ea02af48e5943045d04 | cosmos512/PyDevoir | /StartingOutWithPy/Chapter 05/ProgrammingExercises/10_pattern2.py | UTF-8 | 239 | 3.640625 | 4 | [] | no_license | # Write a program that uses nested loops to draw this pattern:
# ##
# # #
# # #
# # #
# # #
# # #
NUM_STEPS = 6
for r in range(NUM_STEPS):
print('#', end='')
for c in range(r):
print(' ', end='')
print('#')
| true |
74dfda18764fc35e5cdf3b620056c523d3e575c0 | JackBuck/Robo-Plot | /roboplot/dottodot/job_processing_station.py | UTF-8 | 2,980 | 3.1875 | 3 | [] | no_license | import queue
import threading
import time
class Job:
def __init__(self):
self.return_value = None
self.print_output = []
self.complete = False
self.exception = None
def do_work(self):
try:
self._do_work_core()
finally:
self.complete = Tr... | true |
17635bf716c911a0a9b31ce5277f773200796660 | canerkaynak/Basic-OPENCV-Examples | /Salt and Pepper Noise/saltAndPepper.py | UTF-8 | 693 | 2.703125 | 3 | [] | no_license | import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
img = cv.imread("saltAndPepperNoise.png")
img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
kernel = np.ones((5, 5), np.float32)/25
filtered = cv.filter2D(img, -1, kernel)
blur = cv.blur(img, (5, 5))
gaussian = cv.GaussianBlur(img, (5... | true |
1b2035cdcfbd158cfcab1f4ecacf90c36009f043 | hackingmath/sketches | /polygonFractal2.pyde | UTF-8 | 1,778 | 3.890625 | 4 | [] | no_license | '''Polygon Fractal
with Jared
November 20, 2018'''
def setup():
global sides
size(600,600)
noFill()
colorMode(HSB)
sides = 3 #beginning value
def draw():
global sides
background(0) #black background
translate(width/2,height/2) #center the sketch
#change the polyg... | true |
f7513e8d55cdd38cc086f5c3c3c27bf28d2e6460 | danlun99/W2D2HW | /W2D2HW.py | UTF-8 | 872 | 5.03125 | 5 | [] | no_license | # Exercise 1
# Given a list as a parameter,write a function that returns a list of numbers that are less than ten
# For example: Say your input parameter to the function is [1,11,14,5,8,9]...Your output should [1,5,8,9]
# Use the following list - [1,11,14,5,8,9]
l_1 = [1,11,14,5,8,9]
def lessThan(lst):
lst2... | true |
fd69db7bc37201fd5da63335e9b8db133a5cba2f | nestoor22/TakeALookWebSite | /backend/show/strategy.py | UTF-8 | 1,593 | 2.609375 | 3 | [] | no_license | from .models import Shows, ShowActors, ShowGenre, Actors, Genres
class ShowStrategy(object):
model = Shows
def __init__(self, show_id=None):
self.show_id = show_id
@classmethod
def get_objects(cls):
return cls.model.objects.all()
def create_show_actor_relation(self, actors):
... | true |
c29d8347981f50fb00ea62bbff75c573291129e3 | danong/leetcode-solutions | /solutions/sort_colors.py | UTF-8 | 710 | 2.890625 | 3 | [] | no_license | class Solution:
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
next_0 = 0
next_2 = len(nums) - 1
for idx in range(len(nums)):
while nums[idx] == 0 or nums[idx] == 2:
... | true |
6aa1096750551e5f6c8b79e13b384d5148d690c8 | AlexxNica/moon | /moon_manager/tests/unit_python/api/test_models.py | UTF-8 | 1,833 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import json
import api.utilities as utilities
def get_models(client):
req = client.get("/models")
models = utilities.get_json(req.data)
return req, models
def add_models(client, name):
data = {
"name": name,
"description": "description of {}".format(name),
"meta_rules": ["met... | true |
f0831e61c32dfe026c601506bdb92cb3417af257 | sangramch/deepvideo | /utils/video_tools.py | UTF-8 | 6,482 | 2.625 | 3 | [
"CC0-1.0"
] | permissive | # imports
import torch
import tempfile
import numpy as np
from utils import img_t
import skvideo.io as sk
from ipywidgets import *
from .flow_tools import flow_to_image
from torchvision.utils import make_grid
"""
Function: display_flow
displays a sequence of video flow alongside one another
Args:
... | true |
d1ffe5eb65b603846145b8962852aec36f4b8c9c | introprogramming/exercises | /exercises/chat/zmq_chat.py | UTF-8 | 3,988 | 2.6875 | 3 | [
"MIT"
] | permissive | import socket
import sys
import time
from multiprocessing import Process, Lock
import zmq
# print zmq.pyzmq_version()
def receive_loop(connect_to, channel):
"""Connects to a client on this channel. Listens for and prints messages indefinitely."""
local_context = zmq.Context()
subscribe = local_context.... | true |
91c4edfc4cb913057f81b4bef1b63ceff6328d35 | YozhPy/python-KPI-labs | /lab28.py | UTF-8 | 183 | 3.28125 | 3 | [] | no_license | m = int(input("Please, input your m: "))
n = 1 if m>=0 else -1
n = n*int(bin(abs(m))[0:2]+bin(abs(m))[-1:1:-1],2)
print("According to the task, an appropriate number for m is:", n) | true |
7c5ee7b3e11a6c0b16bba13b61b4027ea25349a1 | JanakPanchal/PythonBasic | /Class/global.py | UTF-8 | 265 | 2.75 | 3 | [] | no_license | x = 300
def myfunc():
print(x)
myfunc()
print(x)
x = 300
def myfunc():
x = 200
print(x)
myfunc() #200 or #300
print(x) #300 or #300
def myfunc():
global x
x = 300
myfunc()
print(x)
"NO of Tyer : 4"
"No of door: 4"
"Type of enign : Micro or Mini" | true |
87f230ded0a469332739d792ede2711c4ca5ec78 | abhi472/Pluralsight | /ProjectEuler/projectE_4.py | UTF-8 | 1,862 | 4.03125 | 4 | [] | no_license | # A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit
# numbers is 9009 = 91 × 99.
#
# Find the largest palindrome made from the product of two 3-digit numbers.
from BeyondBasicFunctions.elapsed_time import get_elapsed_time as time
def isPalin(x):
if (type(x)... | true |
3abbef2f8511ef10adbaf78170b7b681f37dadfe | vanlossing/worldview | /tasks/python3/mergeConfigWithWMTS.py | UTF-8 | 2,688 | 2.671875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"NASA-1.3"
] | permissive | #!/usr/bin/env python
from util import dict_merge
from copy import deepcopy
from optparse import OptionParser
import os
import sys
import json
prog = os.path.basename(__file__)
base_dir = os.path.join(os.path.dirname(__file__), "..")
version = "2.0.0"
help_description = """\
Concatenates all configuration items a dir... | true |
3cc5c65a11a61f5a823ca95e8d0eff013995256f | Candy-YangLi/ylscript | /python/firstdemos/demo1.py | UTF-8 | 182 | 3.25 | 3 | [] | no_license | import sys
def putmovie(the_list,fn=sys.stdout):
for inneritem in the_list:
if isinstance(inneritem,list):
putmovie(inneritem)
else:print(inneritem)
| true |
2dcceefeecd6bcff4611f611e891986fd5e245d4 | francopw/proyecto_django | /clase_python2.py | UTF-8 | 285 | 3.703125 | 4 | [] | no_license | def mostrar(lista):
for e in lista:
print(e)
def cargar(lista):
for i in range(len(lista)):
lista[i] = int(input('Ingrese un nuevo elemento: '))
def main():
lista = ['Fede', 1]
cargar(lista)
mostrar(lista)
if __name__ == '__main__':
main() | true |
be798d10cbfa80a2f0466b3fcc781f4800e43a65 | DavidCoughlan8519/Project | /ScraperFirebase/Scraper.py | UTF-8 | 4,339 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 5 12:10:43 2018
@author: David
"""
import datetime
import urllib.request
from bs4 import BeautifulSoup, Comment
import firebase_admin
from firebase_admin import credentials
from firebase.firebase import FirebaseApplication, FirebaseAuthentication
from firebase_admin impo... | true |
e7472512c27c1aa578aca2e6703c61c07d37a2da | TheCsr/sl | /7A/7a.py | UTF-8 | 444 | 3.34375 | 3 | [] | no_license | class student:
def __init__(self,usn,name,mark1,mark2,mark3):
self.usn=usn
self.name=name
self.mark1=mark1
self.mark2=mark2
self.mark3=mark3
def calculate(self):
print "Total"," = ",self.mark1+self.mark2+self.mark3
def prints(self):
print "Name", " : ",self.name
print "Usn", " : ",self... | true |
0c59b9eb662bf21a8d0dbedb3f7c9cad7dfa2841 | ivallesp/awesome-optimizers | /plot_tools.py | UTF-8 | 4,873 | 3.046875 | 3 | [
"MIT"
] | permissive | from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import numpy as np
from autograd import grad
def plot_contourf(cost_f, figsize=[10, 10], _show=True):
fig = plt.figure(figsize=figsize)
ax=fig.gca()
x = np.arange(cost_f.xmin, cost_f.xmax, 0.1)
y = np.arange(cost_f.ymin, cos... | true |
e6cffd4b4fdef6475e2464f498add8fd93e119fc | prasenjitj/practice_programs | /singletons_as_decorator.py | UTF-8 | 1,260 | 3.15625 | 3 | [] | no_license | class AutoIncrementSinglton(object):
_instance = None
def __new__(self, *args, **kwargs):
if not self._instance:
self._instance = super(AutoIncrementSinglton,
self).__new__(self)
self.value = 0
self.value += 1
return self.value
... | true |
2af7b629b623dd357b2f251395920dd96347f825 | alexdesigns/Python-Tech-Degree | /unit-3/phrasehunter/game.py | UTF-8 | 3,730 | 4.09375 | 4 | [] | no_license | #methods for starting game, handling interactions, getting a random phrase,
#checking for a win/loss state, and removing "lives"
import time
# Import your Phrase class
from phrasehunter.phrase import Phrase
# Create your Game class logic in here.
class Game:
def __init__(self, phrase):
self.guessed_list... | true |
b2c3e5b3c5ca5bf3d1377159d7f417ae0de5a8b5 | modora/mediama-data | /scraper/spiders/anime.py | UTF-8 | 4,854 | 2.796875 | 3 | [] | no_license | import scrapy
from urllib.parse import urljoin
class NyaaSpider(scrapy.Spider):
name = "nyaa"
allowed_domains = ["nyaa.si", "myanimelist.net"]
MAL_LIMIT = 1000
@staticmethod
def generate_start_url():
pass
@staticmethod
def format_url(
query="",
search_filter="no ... | true |
15bf54357a5b23f01e4f1944485d0b22ac45b45e | ddsprasad/datascienceNotes | /Utilities.py | UTF-8 | 2,632 | 3.1875 | 3 | [] | no_license | ##UTILITIES
#########References
def createDF_fromdir_csv(path):
import pandas as pd
import glob
"""
This will create dataframe from a dir with all csv files in it
input param:
"""
all_files = glob.glob(path+"/*.csv")
li = []
for file in all_files:
df = pd.rea... | true |
57880407888d41354a1e8e5221422901c087a6e0 | alexis2013/TP3_algo2 | /pila.py | UTF-8 | 696 | 3.484375 | 3 | [] | no_license | from listas_enlazadas import ListaEnlazada
class Pila:
def __init__(self):
self.items = []
def esta_vacia(self):
"""Devuelve True si la lista está vacía, False si no."""
return len(self.items) == 0
def apilar(self, x):
"""Apila ... | true |
2a607da7eda784b1aabfcb84b0019bd0427d247a | birusainju/web-miner | /Web-miner/normalizer.py | UTF-8 | 1,139 | 2.609375 | 3 | [] | no_license | # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied... | true |
a508d317c99abe7a51c7030c4cf72a5d7575b417 | waildahbi/M2 | /Check_if_same_CT.py | UTF-8 | 745 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from tempfile import NamedTemporaryFile
import shutil
import csv
filename = "pairs.csv"
tempfile = NamedTemporaryFile(mode="w", delete=False)
fields = ["mention 1", "annotation 1", "N° phrase 1", "fichier", "mention 2", "annotation 2", "N° phrase 2","resultat"]
with open(filename, "r") as c... | true |
df54b2af31661333db3837a45675751561566050 | SoojinY/Algorithm | /큐-10845.py | UTF-8 | 863 | 2.984375 | 3 | [] | no_license | import sys
from collections import deque
que = deque()
opNum = int(sys.stdin.readline())
for i in range(opNum):
op = sys.stdin.readline().split()
if op[0] == 'push':
que.append(int(op[1]))
else:
if op[0] == 'pop':
if que:
out = que.popleft()
else:
... | true |
b2e55c9c827b36e3877c7f7a0fdf882995cd07d6 | yusuke0128/imageProcessing | /Mozaiku.py | UTF-8 | 507 | 2.65625 | 3 | [] | no_license | import cv2
import sys
argvs=sys.argv
if (len(argvs) != 2):
print 'Usage: # python %s filename' % argvs[0]
quit()
imagefilename = argvs[1]
try:
img=cv2.imread(imagefilename, 1)
except:
print 'faild to load %s' % imagefilename
quit()
oimg = img
origsize=img.shape[:2][::-1]
... | true |
08871c4701c141046882c3d1c235e77413a47e4b | thedarkknight513v2/daohoangnam-codes | /Daily studies/09_June_18/123.py | UTF-8 | 51 | 2.640625 | 3 | [] | no_license | import time
hour = time.strftime("%H")
print(hour) | true |
06b2adb9f1ae78c349fb399efb4a3eb4e0eaa755 | Meet00732/DataStructure_And_Algorithms | /Longest_Common_Sequence/LCS.py | UTF-8 | 1,003 | 3.703125 | 4 | [] | no_license | import time
def LCS(x, y):
m = (len(x) + 1)
n = (len(y) + 1)
c = []
for i in range(0, n):
c.append([])
for j in range(0, m):
c[i].append(0)
for i in range(1, n):
for j in range(1, m):
if x[j-1] == y[i-1]:
c[i][j] = c[i-1... | true |
07aa4a7ef1a3036e1ec1084a96c58a0a84319a64 | nberger62/Udemy-ArcPy | /model_RandBufferSize.py | UTF-8 | 292 | 3.25 | 3 | [] | no_license | def rand_buffer_size(min, max):
from random import randint
randInt = randint(min, max)
bufSizeKm = randInt * 100
return "{0} Kilometers".format(bufSizeKm)
# expression - rand_buffer_size(%Min%,%Max%)
# data type - Linear Unit
# Test data set Min to 1 and Max to 5
| true |
77ffca3dde066cab25f85ab690355dc09cd0bdce | johnbrichard/Pi-Weather | /CSIT216/tempLog/tempJson.py | UTF-8 | 1,410 | 3.4375 | 3 | [] | no_license | # This script will check for a data_file.json for sensor data.
# If log file exists, it will append with new sensor data
# (to include date and time as given by the OS.)
# If log file does not exist, it will create a new file
# and add a title.
import os
import time
import Adafruit_DHT
import json
#---set sensor to... | true |
084aa38664e68b1c08e6199c56051698b4f93092 | debanaskar13/Project-Euler | /project_euler#1.py | UTF-8 | 260 | 3.234375 | 3 | [] | no_license |
import sys
t = int(input().strip())
for a0 in range(t):
n = int(input().strip())
n3=(n-1)//3
n5=(n-1)//5
n15=(n-1)//15
val3=3*n3*(n3+1)//2
val5=5*n5*(n5+1)//2
val15=15*n15*(n15+1)//2
total=val3+val5-val15
print(total)
| true |
9b0bdeab9b88a4af5aca2c27bcac97cdb1a60e26 | williamchan614/Python-Project | /Check-Semigroup/main.py | UTF-8 | 3,671 | 2.859375 | 3 | [] | no_license | import copy
from queue import *
import sys
import numpy as np
def check_semigroup(L):
hashmap = {}
first = L[0]
second = L[1]
q = Queue(0)
count = 2
# hash right away
for matrix in L:
v = hash(str(matrix))
if v in hashmap:
vv = hashmap[v]
vv.append(matrix)
hashmap[v] = matrix
... | true |
036be5dd0332b1800f734b0706fae62333f0a7cc | yuseon27/counterUAV | /KalmanFilter/kalman.py | UTF-8 | 831 | 2.828125 | 3 | [] | no_license | import numpy as np
import pylab as pl
import matplotlib.pyplot as plt
from pykalman import KalmanFilter
rnd = np.random.RandomState(0)
n_timesteps = 100
x = np.linspace(0, 100, n_timesteps)
observations = 5 * (x + 5*rnd.randn(n_timesteps)) # y with noise
observations = observations[::-1]
kf = KalmanFilter(transit... | true |
5f70cfe0ba5206e4d39ba250ab1457d771946590 | id9502/RLFrame | /core/logger/logger.py | UTF-8 | 792 | 2.734375 | 3 | [
"MIT"
] | permissive | from core.common import ParamDict
class Logger(object):
def __init__(self):
self.logger_dict = {"default": self.default_logger}
self.logger_type = "default"
self.default_name = None
def init(self, config: ParamDict):
self.default_name = "default"
def __call__(self, *args... | true |
a9debfd1aff3bf1582efe9b7bf69b86252862851 | AnikaitSahota/Encryption-Algorithms | /RSA.py | UTF-8 | 4,830 | 3.375 | 3 | [
"MIT"
] | permissive | import gmpy2
class RSA :
"""class for all RSA calculations.
Containing key genration and encryption / decryption of messages.
"""
def __init__(self , p , q) -> None:
"""constructor to genrate set of private and public keys for RSA
Parameters
----------
p : int or string
large prime number
... | true |
222a0050048ac04647526c706880d73b406f68b9 | gloriousxu/dm | /svm.py | UTF-8 | 1,157 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
#coding:utf-8
class matchrow:
def __init__(self,row,allnum=False):
if allnum:
self.data=[float(row[i]) for i in range(len(row)-1)]
else:
self.data=row[0:len(row)-1]
self.match=int(row[len(row)-1])
def loadmatch(f,allnum=False):
rows=[]
with open(f) as file:
for line in file.read... | true |
1935c47573c9faac1875702f027e5a380cc1a948 | judymao/capstone | /capstone_website/capstone_website/src/data.py | UTF-8 | 6,123 | 2.890625 | 3 | [] | no_license |
import pandas as pd
import numpy as np
import urllib.request
import zipfile
from scipy import stats
from scipy.optimize import minimize
from scipy.stats import skew, pearson3
class Data:
# Anything Data Related
def __init__(self, stock_prices, risk_free, universe=None, factor_type='PCA', period='M'):
... | true |
d1988ea3d8cc84d742b5b46948c83219dfabcfbd | olesyasenyk/Python_tasks | /words_to_hex.py | UTF-8 | 1,258 | 4.84375 | 5 | [] | no_license | '''Convert the words that make up a string into hexadecimal values that will be read as colour values.
A word is defined as a sequence of ASCII characters between two white spaces or the first or last word.
Each word will represent a hexadecimal value by taking the first three letters of each word
and find the ASCI... | true |
e87c2e6dc706e315843032d3e2400254fde7abe1 | NutthanichN/grading-helper | /grader/files_mai/6210546650_task1.py | UTF-8 | 2,394 | 4.0625 | 4 | [] | no_license | # Chanathip Thumkanon
# 6210546650
import random
NUMOFSYM = 3
def check_valid_input(s):
return convert_to_num(s) >= 0
def convert_to_num(s):
if s == 'rock':
return 0
elif s == 'paper':
return 1
elif s == 'scissors':
return 2
return -1
def convert_to_string(n):
if n... | true |
8fcd5db8fc414246ae1bba74be742246e51ff99d | jerrymakesjelly/autoremove-torrents | /autoremovetorrents/condition/sortbase.py | UTF-8 | 1,585 | 2.515625 | 3 | [
"MIT"
] | permissive | #-*- coding:utf-8 -*-
from .base import Condition
from autoremovetorrents.compatibility.inf_ import inf_
class ConditionWithSort(Condition):
def __init__(self, action):
Condition.__init__(self)
self._action = action
def sort_torrents(self, torrents):
handlers = {
'remove-o... | true |
dc6f56530b14cc8d3f283c37463501702d9bff38 | Expert68/SALE_PREDICTION | /sale_prediction/feature_engineering.py | UTF-8 | 4,196 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # 特征工程及数据清洗
import pandas as pd
import numpy as np
import datetime
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.base import TransformerMixin
# ---------------------------定义数据填充类-------------------------
class DataFrameImputer(TransformerMixin):
def fit(self, X, y=None):
... | true |
36ce285e97bb2bfece4b763eff355218c013036d | databio/pypiper | /example_pipelines/count_reads.py | UTF-8 | 3,266 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
"""
Counts reads.
"""
__author__ = "Nathan Sheffield"
__email__ = "nathan@code.databio.org"
__license__ = "GPL3"
__version__ = "0.1"
import os
import re
import subprocess
import sys
from argparse import ArgumentParser
import yaml
import pypiper
parser = ArgumentParser(
description="A pip... | true |
25cb7b75912bddab63da903c9e808c035083eafa | github5815/AI_Practice | /predictor_runner.py | UTF-8 | 3,338 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import math
from sklearn.metrics import mean_squared_error
import configurator
import dataset_preparator
import trainer
import predictor
#
# Initialize the dataset properator
#
def get_ds_preparator(cvs_path, config):
ds... | true |
92019b572e47084a0be755f8ac3ea1c59e346157 | damithsenanayake/CGA1 | /aligner2.py | UTF-8 | 5,379 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import sys
from Bio import SeqIO, pairwise2
# Support Class to create alignments and check relationships between alignments
from Bio.pairwise2 import format_alignment
class Alignment:
def __init__(self, chr, pos, strand):
self.chr = chr
self.pos = pos
self.strand = s... | true |
2a37472d23f0ea792218e6a90b666802896c03f5 | LaboratoireLSD/LSD-scripts | /Meta file/metaFile.py | UTF-8 | 1,938 | 2.96875 | 3 | [] | no_license | import subprocess
import getopt
import datetime
import sys
import os
from os.path import join
def showHelp():
print("Possible arguments : \n")
print("-p, --path Path of the folder to calculate meta file.")
print("[-m, --meta] Name of the meta file. Default = '.meta'")
def folderSize(... | true |
952b86e7a32c5117e4978596b0d5c1336853f0e1 | ipeterov/random-stuff | /Вычислить по IP/get_adress_by_ip.py | UTF-8 | 182 | 2.65625 | 3 | [] | no_license | import pygeoip
ip = input('Input IP: ')
gip = pygeoip.GeoIP('GeoLiteCity.dat')
for key, value in gip.record_by_addr('64.233.161.99').items():
print('{}: {}'.format(key, value))
| true |
35c748ccdc8d5a0e4d7c59063be3f24fb513c721 | apanana/rosalind | /subs.py | UTF-8 | 487 | 3.53125 | 4 | [] | no_license | """
Given: Two DNA strings s and t (each of length at most 1 kbp).
Return: All locations of t as a substring of s.
"""
def subs(s,t):
locs = []
for i in range(len(s)-len(t)+1):
if s[i:i+len(t)] == t:
locs.append(i+1)
return locs
"""
Sample Dataset:
GATATATGCATATACTT
ATAT
Sample Output:
2 4 10
"""
# print(s... | true |
c4192c68766f5d9af27294922435968f19bc47f9 | shrekee/code | /python3/exercise/my_sock_client.py | UTF-8 | 409 | 2.71875 | 3 | [] | no_license | #!/usr/local/bin/python3
#_*_ coding:utf-8 _*_
#导入 socket sys模块
import socket
import sys
#创建 socket 对象
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#获取本机主机名
host = socket.gethostname()
#设置端口号
port = 12345
#连接服务,指定主机和端口
s.connect((host,port))
#接受小于1024字节的数据
msg = s.recv(1024)
s.close()
print(msg.decode('... | true |
1c6ac1d409a3bbfd9702ab5042f451a7d08f203e | kumbharswativ/Core2Web | /Python/DailyFlash/03feb2020/MySolutions/program1.py | UTF-8 | 363 | 4.34375 | 4 | [] | no_license | '''
Write a Program that checks whether the entered number is a
Prime Number or not.
{Note: A Prime Number is that number which is only divisible by 1 & that
number only.}
Input: 5
Output: 5 is Prime Number.
'''
n=int(input("Input:"))
c=0
for i in range(1,n+1):
if(n%i==0):
c=c+1
if(c==2):
print(n,"is prime numb... | true |
ebe4437e67b83b0b0e5ff3e0ab9b3dbc2f8ffa8c | ronggh/ml_math_basic | /概率论/01_计算N个人生日相同的概率.py | UTF-8 | 544 | 3.765625 | 4 | [] | no_license | import matplotlib.pyplot as plt
def mydiv(n):
a = 1.0
for i in range(n):
b = 365 - i
c = b / 365.0
a = a * c
return a
if __name__ == "__main__":
# 定义一对数组
x = [i for i in range(51)]
y = [i for i in range(51)]
for i in range(1, 51):
f = 1.0 - mydiv(i)
... | true |
40ce0ade1dd7c90e7cb440815807380649d2f5c5 | Xynoclafe/leetcode | /medium/reverseLinkedListII.py | UTF-8 | 1,231 | 3.390625 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def reverseBetween(self, head: ListNode, m: int, n: int) -> ListNode:
firstNode = None
prev = None
count = 0
node = head
whil... | true |
d245ddd30ed40acc513410c4b075cd879d83ac75 | catboost/catboost | /contrib/python/scipy/py3/scipy/stats/tests/test_discrete_distns.py | UTF-8 | 17,946 | 2.671875 | 3 | [
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"Qhull",
"BSD-3-Clause",
"BSL-1.0",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | import pytest
from scipy.stats import (betabinom, hypergeom, nhypergeom, bernoulli,
boltzmann, skellam, zipf, zipfian, binom, nbinom,
nchypergeom_fisher, nchypergeom_wallenius, randint)
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal, ass... | true |
59a30b7f6157300c4d2867f1c6f41caaf0d7a1d4 | matlipson/urban-plumber_pipeline | /convert_UTC_to_local_time.py | UTF-8 | 2,517 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | '''
Urban-PLUMBER processing code
Associated with the manuscript: Harmonized, gap-filled dataset from 20 urban flux tower sites
Copyright (c) 2022 Mathew Lipson
This software is licensed under the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at: http://www.apache.org/licenses/LICE... | true |
0ddc20df5ae24a3139d8f59ef2080a7ddd223168 | date-cocoa/corona | /src/get_data_soudan.py | UTF-8 | 1,893 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from selenium import webdriver
from bs4 import BeautifulSoup
import requests
import chromedriver_binary
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def get_text_data(url):
"""
東京都のサイトにアクセスしてテクスト形式で相談件数データを取得
"""
driver = webdriver.Chrome()
driv... | true |
501ca508df5d72b0190b933f07c4bd505d7090c0 | facebookresearch/CrypTen | /crypten/config/config.py | UTF-8 | 3,052 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from contextlib import contextmanager
import yaml
from omegaconf import OmegaConf
class CrypTenConfig:
... | true |
31f458cd7597a9f166f31e697418dee30df5d054 | SWATISIGNATURE/Python_Code | /Python_Code_Practice/LeetCode/Easy/387. First Unique Character in a String.py | UTF-8 | 564 | 4.125 | 4 | [] | no_license | """
Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode"
return 2.
Note: You may assume the string contains only lowercase English letters.
"""
from collections import Counter
class Solution:
def fi... | true |
4cd2aae55ef0a197fd63e03d826c5fc0c9d724d1 | xaidc/Python | /第一阶段/hw1/hw11.py | UTF-8 | 566 | 3.828125 | 4 | [] | no_license | '''
11.我国古代数学家张邱建在《算经》中出了一道“百钱买百鸡”的问题,
题意是这样的: 5文钱可以买一只公鸡,3文钱可以买一只母鸡,1文钱可以买3只雏鸡。
现在用100文钱买100只鸡,那么各有公鸡、母鸡、雏鸡多少只?请编写程序实现。
'''
boy_chicken = 5
girl_chicken = 3
child_chicken = 1/3
for i in range(20):
for j in range(33):
x = 100 - i - j
if boy_chicken*i + girl_chicken*j +child_chicken*x ==100:
print("公鸡有%d只,母鸡有%d只... | true |
4443f112b5357845af2d0835c371518d2784e1fb | Anthonyyma/Cookie-Clicker-Bot | /Cookie Clicker Bot.py | UTF-8 | 709 | 2.859375 | 3 | [] | no_license | from selenium import webdriver
PATH = "C:\Programming\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://orteil.dashnet.org/cookieclicker/")
def main():
driver.implicitly_wait(5)
cookie = driver.find_element_by_id("bigCookie")
Counter = driver.find_element_by_id("cookies"... | true |
bbf50658dd1c9e4bad64d0e68ad976707603b8da | jereneal20/TIL | /ps/linked-list-cycle-ii.py | UTF-8 | 800 | 3.34375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]:
# start to meeting point of 2 pointer is same as the length of cycle
if not he... | true |
64c823777d8b59d3c0d2a2ccbfd32e32b375e99c | shrutikabirje/Day1-Day-2-Python | /day5p5.py | UTF-8 | 319 | 3.46875 | 3 | [] | no_license | Iterate a given list and check if a given element already exists in a dictionary as a key’s value if not delete it from the list.
l=[1,23,56,67,34,45,87]
d={"shru":23,"adii":67,"yasu":46,"Maria":45}
for i in l:
for j in d.values():
if i==j:
l.remove(i)
print("edited list is:",l)
| true |
dfc2dc010e550cd242ed585969f4030d45c84305 | jdunck/khanacademy | /badges/points_badges.py | UTF-8 | 1,875 | 2.59375 | 3 | [] | no_license | import models
import util
from badges import Badge, BadgeContextType, BadgeCategory
# All badges awarded for getting a certain number of points inherit from PointBadge
class PointBadge(Badge):
def is_satisfied_by(self, *args, **kwargs):
user_data = kwargs.get("user_data", None)
if user_data is Non... | true |
da80b6cd0d709959c6b693e0f402087b3ac1980c | koapham/NTU-Canteen-App | /Support Files/finale_screen.py | UTF-8 | 5,630 | 3.203125 | 3 | [] | no_license | import pygame, sys
from pygame.locals import *
from google_images_download import google_images_download
import pandas as pd
from pandas import DataFrame
import text_class
Data = pd.read_csv("canteen.csv", encoding = "ISO-8859-1")
df = DataFrame(Data, columns = ["Canteen","Food", "Stall", "Cuisine", "Halal","V... | true |
51853333ec80264900650456c6adbef1de43b8bc | firstdata/Marketplace-Consumer | /consumer-python/model/LeadHistoryResponse.py | UTF-8 | 480 | 2.53125 | 3 | [] | no_license | import json
from model import LeadHistory
class LeadHistoryResponse:
def __init__(self, j):
self.__dict__ = json.loads(j)
leadId = ""
dealId = ""
applicationHistory = [LeadHistory]
def __str__(self):
return "LeadHistoryRequest{" \
"leadId='" + self.leadId + \
... | true |
dc280a667a45156e678cef1d836f50ac53c81b14 | rahuldbhadange/Python | /Python/python programs/datatypes/int2.py | UTF-8 | 85 | 2.859375 | 3 | [] | no_license | x=10
print(x)
print(id(x))
print(type(x))
y=20
print(y)
print(id(y))
print(type(y))
| true |
38a483d7b09f658bc8a2ed25ee78f351d1d4ba09 | forest134/TensorFlow-write | /Test_minst.py | UTF-8 | 8,274 | 2.546875 | 3 | [] | no_license | # coding=utf-8
from skimage import filters
import scipy.misc
from tkinter import *
import os, glob
import tensorflow as tf
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import model
TEST_PATH = r'D:\Python\mnist\test_my\ok1/*'
def select(event):
global img_dir
img_dir... | true |
d387fdd5687f940cb955e016803daae14765d1d5 | erickkdaniel/IPC2_PRACTICA1 | /main.py | UTF-8 | 3,139 | 3.34375 | 3 | [] | no_license | import os
class Nodo:
def __init__(self,data):
self.prev = None
self.next = None
self.data = data
class Cola:
def __init__(self):
self.first = None
self.last = None
def Empty(self):
return self.first == None
def Inqueue(self,data):
if self.Empty():... | true |
1f3485eb6c60612f5bc34cb1e3187cfc8542edd5 | byAbaddon/Advanced-Course-PYTHON-May-2020 | /4.0 Comprehensions - Lab/04. Flattening Matrix.py | UTF-8 | 123 | 2.96875 | 3 | [] | no_license | matrix = [[int(x) for x in input().split(', ')] for _ in range(int(input()))]
print([x for row in matrix for x in row ])
| true |
4bc2d7fc482a082cb3cdb563d190b854b570ec88 | ICURO-AI-LAB/covid-rpi | /src/sanitation_control/scripts/odom_tracking.py | UTF-8 | 1,069 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
import serial
import rospy
import time
import re
from std_msgs.msg import String
from nav_msgs.msg import Odometry
global file_object
def callback(data):
global file_object
#print str(data)
t = time.localtime()
current_time = time.strftime("%D-%H:%M:%S",t)
timeString = str(current_time)
... | true |
20c7949860de736d3b49a961811ea1538acaa510 | clivejan/python_fundamental | /classes/my_cars.py | UTF-8 | 206 | 2.59375 | 3 | [] | no_license | from cars import Car, ElectricCar
my_dream_car = Car('Audi', 'Q5', 2019)
print(my_dream_car.get_descriptive_name())
my_tesla = ElectricCar('tesla', 'model s', 2019)
print(my_tesla.get_descriptive_name())
| true |
899c4d3486ec1fb31623bbdb2898f07a14925bcf | totoroyyw/network-tools | /network-switcher/network-switcher/definedroutes.py | UTF-8 | 1,858 | 2.796875 | 3 | [
"Unlicense"
] | permissive | import utils
class DefinedRoutes:
class SystemRouteTable:
def __init__(self, route, table_id, fwmark):
self.table_id = table_id
self.fwmark = fwmark
self.route = route
def add(self):
utils.system("ip route add default %s table %d" % (self.rou... | true |
d2e3399bed5cbcf8b9341d25fe8a12e136054522 | swu45/mini_program | /mail_sent.py | UTF-8 | 1,495 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: siwu
@software: PyCharm Community Edition
@time: 2017/7/10 14:09
"""
# 备注:拢共需要输入四个内容: 发件邮箱、密码,以及收件人和SMTP地址
# 功能较简单,仅为文本内容发送,需要插入附件、内容加密等可参考文档:
# http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432005226355aadb8... | true |