blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
f97bd065f36aa501c9bc47e7c2db3c76a3aadce7 | Python | xyp8023/LeetCode_Python | /806_NumbersOfLinesToWriteString.py | UTF-8 | 771 | 3.484375 | 3 | [
"MIT"
] | permissive | class Solution:
def numberOfLines(self, widths, S):
"""
:type widths: List[int]
:type S: str
:rtype: List[int]
"""
ord_a = ord('a')
units_left = 100
lines_number=1
for string in S:
i = ord(string)-ord_a
if units_left-wid... | true |
9dfa7d935185678b85ef042b788f6165d5f1b0a4 | Python | YpeZ/EK-Voetbal | /ek-voetbal/main.py | UTF-8 | 1,355 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import pandas as pd
from constants import groepen
from Match import Match
from Group import Group
for groep_idx, teams in groepen.items():
groep = Group(groep_idx)
print(f'Group {groep_idx}')
for fixture in groep.fixtures[:]:
fixture.print_stats()
# Second round
print("Second r... | true |
0bdb8208fbdde930100b1e9d834c5f5ec36776f4 | Python | enricorusso/incubator-ariatosca | /aria/utils/type.py | UTF-8 | 4,833 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | true |
c9a83db14205881560cd57f19da3eece83bdc550 | Python | psklight/volume_grating | /volume_grating/sources.py | UTF-8 | 6,305 | 3.171875 | 3 | [
"MIT"
] | permissive | import numpy as np
import sympy.vector as vec
from .utilities.validation import validate_input_numeric
from .utilities.geometry import ndarray_to_vector
from . import materials
from .systems import GCS
class Source(object):
"""
Source is a base class for all optical source classes.
:param material: an in... | true |
8f61c6c5f24c0baeb88ca417ea5e1b79f1c32713 | Python | kwhit2/holbertonschool-higher_level_programming | /0x0B-python-input_output/12-pascal_triangle.py | UTF-8 | 504 | 4.53125 | 5 | [] | no_license | #!/usr/bin/python3
""" Technical interview preparation:
Create a function def pascal_triangle(n): that returns a list of lists
of integers representing the Pascal’s triangle of n: """
def pascal_triangle(n):
""" pascal_triangle method:
Args:
n (int)
Returns:
A list ... | true |
b7d79d7d0f09493355596386965b9c67ce8d6d03 | Python | sanjeevz3009/QJet | /Qjet/emailValid.py | UTF-8 | 21,595 | 2.625 | 3 | [] | no_license | #Importing the necessary modules.
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMessageBox
#Imports the system module.
import sys
#Imports the other python files as modules.
#Imports the database file.
from qjetdatabase import *
#Imports the login window.
from log... | true |
11272813c1e4a4ac138ae42259380d48e7343ad6 | Python | ParkerLLF/LanQiaoCode_Python | /计蒜客省赛训练营/day1字符串和日期/升级版三角形.py | UTF-8 | 813 | 3.9375 | 4 | [] | no_license | '''
特殊的三角形
输入:9
输出:
1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
输入:C
输出:
A
ABA
ABCBA
'''
n = input()
if ord(n) < 65:
n = int(n)
for i in range(1, n+1):
for j in range(1, n + 1 - i):
... | true |
b3c6955cae707acd908081829b4a6100a8812b02 | Python | Donggeun-Lim3/ICS3U-Unit5-01-Python | /convert_the_temperature.py | UTF-8 | 473 | 3.859375 | 4 | [] | no_license | #!/usr/bin/env python3
# Created by: Donggeun Lim
# Created on: Jan 2019
# This program convert the temperature
def convert_temperature():
# conver temperature
# input
tc = int(input("Enter the temperature in degrees Celsius (°C): "))
# process
tf = (9/5) * tc + 32
# output
print("The ... | true |
d296953b56d1af052d48f367eb9c2ff5354861da | Python | jafer11/blog | /jwt_test.py | UTF-8 | 2,157 | 2.875 | 3 | [] | no_license | import base64
import json
import time
import copy
import hmac
class Jwt():
def __index__(self):
pass
@staticmethod
def b64encode(content):
return base64.urlsafe_b64encode(content).replace(b'=', b'')
@staticmethod
def b64decode(b):
sem = len(b) % 4
if sem > 0:
... | true |
75a6c3ad7809487b383b6cc532aec63bea5a77ce | Python | green-fox-academy/attilavaczy | /week-4/tue/pip_modul_practice.py | UTF-8 | 204 | 3.171875 | 3 | [] | no_license |
my_file = open("reversed_zen_order.txt", "r")
lines = my_file.readlines()
print(lines)
my_file.close()
reversed_lines = lines[::-1]
# print(lines)
for line in reversed_lines:
print(line.rstrip())
| true |
1d9f436c457fa9d9f761f19a6c5b9057c931bb17 | Python | dotysan/binwalk | /src/binwalk/filter.py | UTF-8 | 6,749 | 3.171875 | 3 | [
"MIT"
] | permissive | import re
import binwalk.common as common
from binwalk.smartsignature import SmartSignature
from binwalk.compat import *
class MagicFilter:
'''
Class to filter libmagic results based on include/exclude rules and false positive detection.
An instance of this class is available via the Binwalk.filter object.
Note th... | true |
cb23c179876692830974873b18fdc2d749039d6a | Python | MilenkoVizLore/LCI-FIC2-SE | /Activity_and_Context_Recognition/Classifier/utilities.py | UTF-8 | 4,301 | 2.796875 | 3 | [] | no_license | import numpy as np
from scipy.signal import butter, lfilter, medfilt
from scipy.interpolate import interp1d
activity_table = {"Sitting Hand\n": 1,
"Sitting Pocket\n": 2,
"Walking Hand\n": 3,
"Walking Pocket\n": 4,
"Standing Hand\n": 5,
... | true |
7889ea06ff0d0eda88cdb9f83be62fa60943e758 | Python | epzgwu2017/PowerSimu | /text/multip2.py | UTF-8 | 3,634 | 3.296875 | 3 | [] | no_license | #
# import subprocess
#
# print('$ nslookup')
# p = subprocess.Popen(['nslookup'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# output, err = p.communicate(b'set q=mx\npython.org\nexit\n')
# print(output.decode('utf-8'))
# print('Exit code:', p.returncode)
# import threading
#
# # 创建全局Thr... | true |
e7c1b3ce0a1f17081134ceeee6220302c191bd20 | Python | Ken-Leo/DL-ChannelDecoding | /notebooks/On Deep Learning-Based Channel Decoding.py | UTF-8 | 9,827 | 2.578125 | 3 | [] | no_license | # To add a new cell, type '#%%'
# To add a new markdown cell, type '#%% [markdown]'
#%% Change working directory from the workspace root to the ipynb file location. Turn this addition off with the DataScience.changeDirOnImportExport setting
# ms-python.python added
import os
try:
os.chdir(os.path.join(os.getcwd(), 'no... | true |
31cec2cdd6ccc37036925f67c8cb32518e6d7b96 | Python | someOne404/Python | /pre-exam2/higher_lower.py | UTF-8 | 1,299 | 3.5625 | 4 | [] | no_license | import random
num = random.randrange(1, 101)
self_pick_answer = int(input('What should the answer be? '))
number_of_guesses = int(input('How many guesses? '))
guess = int(input('Guess a number: '))
number_of_guesses_used = 1
while self_pick_answer != guess and number_of_guesses_used < number_of_guesses:
if self_p... | true |
14625bcafb593dafd2595238a16cac3c191b1041 | Python | aashya/Reinforcement-Learning | /Grid_world.py | UTF-8 | 3,775 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
class Grid:
def __init__(self, rows, columns, start):
self.rows = rows
self.columns = columns
#current location will be seen through instance variales i and j
self.i = start[0]
self.j = start[1]
#... | true |
b7f497d9221f642df0ea472cdbf3fba3d2c1539d | Python | d333pav/Python-Life | /Tests.py | UTF-8 | 1,789 | 3.25 | 3 | [] | no_license | import unittest
import Life_Game
def life_test(lines_number=0, columns_number=0, turns_number=0, test=''):
ocean_array = []
for element in test.split():
ocean_array.append(list(element))
ocean_array = Life_Game.life(lines_number, columns_number,
turns_number, ocean... | true |
17c8b8f7b9aad49b9c225e4ea03b364e95f6f0a8 | Python | ditya2607/basic-python-b6-b | /List.py | UTF-8 | 421 | 3.921875 | 4 | [] | no_license | nilai = [1,2,3,4,5]
print(nilai)
data = int(input("Tambahkan nilai : "))
#menyisipkan data
nilai.append(10)
nilai.append(12)
nilai.append(14)
nilai.append(data)
print(nilai)
#print berdasarkan indeks
print(nilai[2])
print(nilai[4])
print(nilai[6])
#panjang isi
print(len(nilai))
#ganti data
nilai[1] = 20
print(nilai)... | true |
394f8c18fb63da25ee719e5865bb78aa5581177f | Python | masonSmigel/auto_set_project | /plug-ins/autoSetProject.py | UTF-8 | 4,269 | 2.75 | 3 | [
"MIT"
] | permissive | """
Plugin to automatically set the maya project when a file opens.
Derived from mSetProject which is not supported in versions after maya 2020
original author website: www.skymill.co.jp
Author: Mason Smigel
Date: Aug 2021
"""
import inspect
import sys
import os
import traceback
import maya.api.OpenMaya as om2
impor... | true |
d99968f73aacd31705e5351222427c72b50b4f32 | Python | harshkhurana6/projects-with-python | /Inventory System Project/strings.py | UTF-8 | 1,204 | 3.6875 | 4 | [] | no_license | name="Harsh"
age="20"
str=name+" is "+str(age)+" yr old"
print("name and age",str)
rate=625.7135
print("rate is %.2f"%(rate))
s="i like python"
ns=s.capitalize()
print(ns)
s=input("enter the string:")
if len(s)>2:
x=s[0:2]+s[-2:]
print(x)
else:
print("string length should be >=2")
s=input("Enter any string:"... | true |
5e7f4fbde75e8f826d5b856f58228ed2cb665a75 | Python | alucebur/notebird | /notebird/db/helpers.py | UTF-8 | 1,201 | 2.828125 | 3 | [
"Unlicense",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | """Helper functions to start and close database connections."""
import time
import logging
from db import dbhelper
from utils import exceptions
def connect_to_database(database: str) -> dbhelper.DBHelper:
"""Connect to the given database."""
while True:
try:
db = dbhelper.DBHelper(databas... | true |
2f26a502e080f58e055ae662b3c00c6110cb0e99 | Python | kevinpCroat/floober | /record_data.py | UTF-8 | 1,220 | 2.703125 | 3 | [] | no_license | #import packages
import sqlite3 as sql
import logging
import json
import traceback
import time
import random
logging.basicConfig(filename='db_exceptions.log', level=logging.DEBUG)
#setup the database conn
db = sql.connect('/tmp/floober.db')
#instantiate the cursor class
cur = db.cursor()
def record_trip_event(clien... | true |
03fa6325510049ae86ea3909881120232b963f8c | Python | xiaoguangjj/leetcode | /Numbers/62_maximum69Number.py | UTF-8 | 934 | 4 | 4 | [] | no_license | """
给你一个仅由数字 6 和 9 组成的正整数 num。
你最多只能翻转一位数字,将 6 变成 9,或者把 9 变成 6 。
请返回你可以得到的最大数字。
输入:num = 9669
输出:9969
解释:
改变第一位数字可以得到 6669 。
改变第二位数字可以得到 9969 。
改变第三位数字可以得到 9699 。
改变第四位数字可以得到 9666 。
其中最大的数字是 9969 。
示例 2:
输入:num = 9996
输出:9999
解释:将最后一位从 6 变到 9,其结果 9999 是最大的数。
"""
class Solution:
def maximum69Number(self, num):... | true |
addd89b911b8b73f62c36df2302e6b0c40d6d199 | Python | tokoroten/sg_level_design_sim | /sgStage.py | UTF-8 | 3,758 | 3.046875 | 3 | [] | no_license | #coding:utf-8
import sgPlayer
import random
class sgStage:
def __init__(self):
self.players = []
self.stages_difficult = []
self.stages_result = []
self.stat_round_num = 5
def create_player(self):
for i in xrange(10000):
self.players.append(sgPlayer.sgPlayer... | true |
9bced020df70c7e5cde6d4b0b88f29626a4fb9c3 | Python | JiminLee411/algorithms | /191114/swep_1953_탈주범검거.py | UTF-8 | 1,331 | 2.578125 | 3 | [] | no_license | import sys
sys.stdin = open('swep_1953_input.txt', 'r')
from collections import deque
def bfs(x, y, l):
visited = [[0] * M for _ in range(N)]
q = deque()
q.append((x, y))
visited[x][y] = 1
cnt = 1
while q:
x, y = q.popleft()
point = unders[x][y]
for dx, dy in direction... | true |
60d63cdc18931f1f10735e05f774fa0f3c7d3d2a | Python | dtmacroh/KattisCode | /character.py | UTF-8 | 295 | 3.3125 | 3 | [] | no_license | # character development
# Author: Debbie Macrohon
# Description: 2^n for all possible subsets within n.
# we subtract 1 for the single node case,
# e.g. n=1, and subtract n for all single nodes
# thereafter.
nodes = int(input())
print((2**nodes)-nodes-1)
| true |
d66a8550aecd0ff4d10f79dc1556c1a419336b06 | Python | NickTrossa/Python | /pruebas/prueba_rk4.py | UTF-8 | 518 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 8 11:13:54 2015
@author: alumno
"""
from biblioteca_propia.rk4 import rk4
import matplotlib.pyplot as plt
import numpy as np
def fun(t,y):
a = 0.5
b = 5
v0 = 1
w = 1
return np.array([(v0*np.cos(w*t) - b*y)/a])
def prueba(t,y):
a = 1
return ... | true |
59d1c6d9a4904b9ded3a33877749c4c95b801d4e | Python | steffanc/Practice | /Python/Cents.py | UTF-8 | 1,034 | 3.671875 | 4 | [] | no_license | # Given an input number of cents, print all combinations of change that
# would total the number of cents
def cents(target):
doCents(target, [], 0, 4)
def doCents(target, output, current, level):
if current == target:
print output
else:
if current+100 <= target and level >= 4:
... | true |
e09a362dc2e3e305ad12c8ff6c148303b661ddd5 | Python | Ale573/DisasterAid_4115 | /handler/user.py | UTF-8 | 3,765 | 2.765625 | 3 | [] | no_license | from flask import jsonify
from dao.user import UserDAO
class UserHandler:
def build_user_dict(self, row):
result = {}
result['uid'] = row[0]
result['ufirstname'] = row[1]
result['ulastname'] = row[2]
result['uemail'] = row[3]
result['uphone'] = row[4]
resul... | true |
c2821fed0ec02298eecee26ec85c6c42fb038bfa | Python | AnkyXCoder/PythonWorkspace | /python basics II/short_circuiting.py | UTF-8 | 290 | 2.921875 | 3 | [] | no_license | # Short Circuiting
is_friend = True
is_user = False
if is_user and is_friend: # short circuit condition False and (True) not checked
print("can message")
if is_friend or is_user: # short circuit condition True and (False) not checked
print("may message") | true |
12d50f5b9a6a7114a8dfab14420c56859c98eafd | Python | andrew-d-l-nelson/workshop | /conditional.py | UTF-8 | 1,827 | 4.625 | 5 | [] | no_license | x = 7 # assigning a value to the variable "x"
day = "Saturday"
if x < 10: #This is a boolian expression here.
print("The day is " + day +
". What a great day!")
else:
print("I don't think that will happen")
x = 7
day = "Saturday"
if x < 10: #This is a boolian expression here.
print("The day is " + ... | true |
ad592cdf829ea400b31c515bdb8983e0ccc11062 | Python | dimmykarson/experiments | /model/DataSet.py | UTF-8 | 103 | 2.609375 | 3 | [] | no_license | class DataSet:
def __init__(self, key, values):
self.key = key
self.values = values | true |
1bb0190478b2fd4080d37973aa22423e9806fa9f | Python | ArkiWang/LeetcodePy | /src/Solution473.py | UTF-8 | 1,223 | 2.953125 | 3 | [
"MIT"
] | permissive | from copy import deepcopy
class Solution:
his = []
flag = False
def handler(self, i: int, nums: [], l, res: [0, 0, 0, 0]):
if i < len(nums) and not self.flag:
res = sorted(res)
for j in range(4):
if res[j] + nums[i] <= l:
res[j] += nums[i]
... | true |
595610a371ba305237a5559de295b2c23b6e752f | Python | BeritMwashe/passLocker | /test_credentials.py | UTF-8 | 3,067 | 2.921875 | 3 | [
"MIT"
] | permissive |
import pyperclip
from credentials import Credentials
import unittest
class TestCredentials(unittest.TestCase):
def setUp(self):
'''setup function that runs everytime a test is run
'''
self.new_credential=Credentials("Instagram","bMwashe","12345")
def test_init(self):
'''test ... | true |
62328a3f163343884c551cc2d799502f2b4aaddc | Python | rafaelperazzo/programacao-web | /moodledata/vpl_data/455/usersdata/287/109911/submittedfiles/programa.py | UTF-8 | 1,026 | 3.390625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
n=int(input('digite o valor de m: '))
while n<3:
n=int(input('digite o valor de m: '))
matriz=[]
for i in range(0,n):
linhas=[]
for j in range(0,n):
linhas.append(int(input('digite os valores (%d,%d): ' %(i+1,j+1))))
matriz.append(linhas)
print(matriz)
#faz... | true |
589b24a6b70947b8263916cf5e406c5bd3a946f1 | Python | mmveres/pythonProject18_09_2021 | /lesson04/__main__.py | UTF-8 | 1,328 | 3.625 | 4 | [] | no_license | def bubble_sort(arr):
global count
for j in range(len(arr) - 1):
for i in range(len(arr) - 1 - j):
count += 1
swap(arr, i, i+1)
def swap(arr, h, k):
if arr[h] > arr[k]:
temp = arr[h]
arr[h] = arr[k]
arr[k] = temp
def partition(arr, l, r):
im = i... | true |
dc0dbb272be16d73d645fdb60a9b66122323f989 | Python | zhaow511602/crm | /yingun/utils/filter_code.py | UTF-8 | 3,181 | 2.78125 | 3 | [] | no_license | import copy
from types import FunctionType
from django.utils.safestring import mark_safe
class FilterOption(object):
def __init__(self, field_or_func, is_multi=False, text_func_name=None, val_func_name=None):
"""
:param field: 字段名称或函数
:param is_multi: 是否支持多选
:param text_func_name: 在M... | true |
91ea6e89ee6a8e88eec60c2036abb711c1442044 | Python | Poulpy/algo_s4 | /hexagone/hexa_modele.py | UTF-8 | 6,303 | 2.953125 | 3 | [] | no_license | #coding: utf-8
import random
import math
class Grille_modele(object):
def __init__(self, observateur, largeur, hauteur):
self.largeur = largeur
self.hauteur = hauteur
self.hexs = {} # dictionnaire de (coordonnees : Hex)
self.observateur = observateur
self.hexs = {} # dict... | true |
1f6e8f77ed0feb85b9e13eb3a39893a59918a135 | Python | MrFragmeister/ecl_paco_tanchon | /Ecole Centrale de Lyon/1A/UEs/INF/tc3/INF_tc3_2017_TD1/simple_raytracer.py | UTF-8 | 22,334 | 3.015625 | 3 | [] | no_license | # module raytracer
from PIL import Image
import numpy as np
import time
import numbers
import functools
import types
###############################################################################
#
# Vecteur 3D compatible numpy
#
###############################################################################
class... | true |
17317704266ad16243ce120cc9130d1b643027d8 | Python | codacy-badger/faddr | /faddr/rancid.py | UTF-8 | 2,237 | 2.546875 | 3 | [] | no_license | import pathlib
import re
import traceback
from faddr.device import Device
class RancidDir:
def __init__(self, rancid_path):
"""Open rancid dir and parse it's content."""
self.path = pathlib.Path(rancid_path)
def is_valid(self):
is_valid = False
if self.path.exists():
... | true |
dc18da7b31d2a7dbd2c739a692daf77e210b1ce4 | Python | markyangliu/replace_polygon | /intersectarea.py | UTF-8 | 2,674 | 3.4375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from shapely.geometry import Polygon
from descartes import PolygonPatch
import math
from replacepolygon import Arc
def calcIntersectArea(poly1, poly2):
'''
:param poly1: list -> [x,y], poly2 contains arc objects
:return: float -> proportion of intersecting are... | true |
2f2604c726609d988cb9979c4e6e56c9ddef4ace | Python | liucaouw/Machine-Learning-Study | /Machine learning excercise/2_Regression/3_1 Fitting a regression line to the student debt data.py | UTF-8 | 907 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 19 15:37:40 2018
"""
import csv
from pylab import *
def linearfit(X, Y):
W =dot(inv(dot(X.T, X)),dot(X.T,Y))
return W
def main():
rfile = 'student_debt.csv'
csvfile = open(rfile, 'rt')
data = csv.reader(csvfile, delimiter = '... | true |
30f0ad7ae7565c6d67254aa7757deb9bad6b7776 | Python | taymoorkhan/maze_project | /maze/test_models_scoremanager.py | UTF-8 | 2,460 | 3.21875 | 3 | [
"MIT"
] | permissive | from models.score_manager import ScoreManager
from models.score import Score
import pytest
@pytest.fixture
def scoremanager():
return ScoreManager()
@pytest.fixture
def score():
return Score(10)
@pytest.fixture
def score2():
return Score(15,'KOBE')
def test_score_manager(scoremanager):
""... | true |
1be248b9133046b3befa2cf6c10ea3c123a3c3ae | Python | bailaohe/py-misc | /gen_quest.py | UTF-8 | 4,205 | 2.953125 | 3 | [] | no_license | import random
import time
import click
from docx import Document
OP_TABLE = ['+', '-', '×']
def gen_question(qnum:int, with_answer:bool=False):
"""gen_question
:param qnum: the count to questions
:type qnum: int
"""
random.seed(time.time())
for i in range(qnum):
first = random.randint... | true |
868e3d1dab7293e558353ea9b06000221b8523e4 | Python | borisStanojevic/python-medical-devices-storage | /storekeepers.py | UTF-8 | 2,396 | 3.4375 | 3 | [] | no_license | from formats import *
import os
#Logika za prijavu. Provjerava da li se uneseni username/password poklapa sa nekim username/passwordom u storekeepers.txt fajlu.
#Vraca True ako nadje poklapanje,False ako ne.
def storekeeperExists() -> bool:
storekeeper_exists = False
storekeepersList = []
with open("storekeepers.tx... | true |
c1c2b5b98751aa06fe8a3202ecc1bf689bfc5476 | Python | qdonnellan/random_questions | /questions/trees_and_graphs/binary_search_tree.py | UTF-8 | 1,258 | 4.3125 | 4 | [] | no_license | # implement a binary search tree in Python
class Node():
def __init__(self, value=None):
self.value = value
self.left = None
self.right = None
class Tree():
def __init__(self):
self.root = None
def add(self, value, node=None, root=True):
'''
add new values to the tree, recursively
'... | true |
f6de66ec6af3505862b20c83b39a2b427087f221 | Python | xiaowei0516/ex-python | /regex/greedy_match.py | UTF-8 | 271 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python
import re
#regular expression is compiled into an Pattern object
pattern = re.compile(r'(\d+)(0*)$')
#Pattern matching using text, obtained matching result, if not match return None
match = pattern.match('10234500')
print match
print match.groups()
| true |
ca13d8babb88d8d0005e1be99fcbc898546c0019 | Python | MNikov/Python-Advanced-September-2020 | /Old/Python-Advanced-Preliminary-Homeworks/Comprehension/06E. Matrix of Palindromes.py | UTF-8 | 312 | 3.546875 | 4 | [
"MIT"
] | permissive | def make_palindrome_matrix(rows, cols):
matrix = [[f'{chr(97 + r)}{chr(97 + c + r)}{chr(97 + r)}' for c in range(cols)] for r in range(rows)]
return [print(" ".join(row)) for row in matrix]
rows_count, columns_count = [int(x) for x in input().split()]
make_palindrome_matrix(rows_count, columns_count)
| true |
cf4e85f642cb2d989ae407c1c0b542c61abb5e2e | Python | sanskarjain2507/full-stack-development | /python/func31.py | UTF-8 | 122 | 2.921875 | 3 | [] | no_license | def add_three(a,b,c):
return a+b+c
print(add_three(5,5,5))
def add_three(a,b,c):
print(a+b+c)
add_three(5,5,5)
| true |
e8bac3a7598d5196bbef246932883c9a62dd744f | Python | LZGod/pr | /hw8/pr2.py | UTF-8 | 920 | 3.359375 | 3 | [] | no_license | def rea(f):
with open(f) as d:
w = d.read()
words = w.split()
return words
#выдаёт список слов из текста в файле
def d(a):
words = rea(a)
unw = []
for word in words:
if len(word) > 1 and word[0] == 'u' and word[1] == 'n':
unw.append(word)
return un... | true |
d30fed07ac1b13ff287235e7ebfa626555985cd2 | Python | aptend/leetcode-rua | /Python/1094 - Car Pooling/1094_car-pooling.py | UTF-8 | 950 | 2.765625 | 3 | [] | no_license | from leezy import solution, Solution
class Q1094(Solution):
@solution
def carPooling(self, trips, capacity):
# 60ms 92.68%
cap = 0
events = []
for t in trips:
# get off
events.append((t[2], 0, t[0]))
# get on
events.append((t[1], ... | true |
242c3eb6ea09cd5351e2688ae95fcfdb1da4dc53 | Python | Wjun0/im | /im/server/demo3.py | UTF-8 | 818 | 2.546875 | 3 | [] | no_license | # 1,协程打补丁,将IO操作变为异步
from eventlet import monkey_patch
monkey_patch()
import socketio
# 2,创建socketio服务器
sio = socketio.Server(async_model='eventlet')
# sio = socketio.AsyncServer()
# app = socketio.ASGIApp(sio)
# app = socketio.WSGIApp(sio,app)
# 3,创建应用,管理im服务器
app = socketio.Middleware(sio)
# 4,监听端口
import eventlet... | true |
b32b0d04a474607dbd159a9d5460d47dbc81795a | Python | devoxel/cpssd | /optionals/twitterbot/loader.py | UTF-8 | 1,650 | 2.828125 | 3 | [] | no_license | """
--> See README.md for info
Author: Aaron Delaney
Email: aaron.delaney29@mail.dcu.ie
Date: 20/11/2015
"""
import sys
import traceback
from twitterbot.markov import MarkovChain, parse_corpus
from twitterbot.helper import safe_get
# import cProfile
# Used to profile code, no longer needed
# - To see profiling... | true |
905675cbb5c93d2f67083b57e7cad85226fc34bb | Python | nut08/selenium-py-peldatar | /python-homework/charsandord.py | UTF-8 | 273 | 3.5 | 4 | [] | no_license | # print(ord("a")) ennek az eredménye a 97
# print(chr(97)) ennek az eredménye az a betű
x = 97
for i in range(10):
i = (str(chr(x)) + str(" ") + str(x) + " " + str(chr(x+5)) + " " + str(x+5) + " " +str(chr(x+10)) + " " + str(x+10))
x += 1
print(i)
pass
| true |
c04f6852f33f5d360728c179249e503866176ba9 | Python | d4rkspir1t/groupdetection-dgmg | /json_to_csv.py | UTF-8 | 866 | 2.71875 | 3 | [
"MIT"
] | permissive | import json
import csv
header = ['fr_no', 'x', 'y', 'w', 'h', 'cx', 'cy', 'cen_dep', 'dep_avg', 'orient', 'group']
f = open('yolo_db_orientation_20210810_cd_1.json')
data = json.load(f)
f.close()
print(data)
with open('yolo_db_orientation_20210810_cd_1.csv', 'w') as f:
csv_file = csv.writer(f, delimiter=';')
... | true |
7364ec2881281693cc96ac8cc32fba50aeb277e7 | Python | iridesc/odf | /redirectStaticPath.py | UTF-8 | 255 | 2.671875 | 3 | [] | no_license | with open('./dist/index.html','r') as f:
text=f.read()
text=text.replace('href=/','href=/static/')
# print(text)
text=text.replace('src=/','src=/static/')
# print(text)
with open('./dist/index.html','w') as f:
f.write(text)
print('redirect done!') | true |
a12d572f497705d42cace059e249a03a888112fe | Python | aadityasingh/automatic-intuitive-physics | /psiturk/analysis/turktable.py | UTF-8 | 3,027 | 2.5625 | 3 | [] | no_license | import json
import numpy as np
import pandas as pd
from scipy.stats import zscore, pearsonr
from fileFuncs import ff
from BlenderStimuli import ramp_shape as shape
As = ["Shape", "Material"]
Bs = ["Density", "Friction"]
Categories = ["{0!s}-{1!s}".format(a,b) for b in shape.materials
for a in shape.materials]
... | true |
662c62681004b274e76889643f6427ade2f6e177 | Python | YourFigo/useAndLearnCode | /deep_learning_code/deep_learning_2018/6_Using_word_embeddings.py | UTF-8 | 2,833 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 27 13:28:04 2018
@author: Figo
"""
################# 将一个 Embedding 层实例化 ########################
from keras.layers import Embedding
# Embedding 层至少需要两个参数:
# 标记的个数(这里是 1000,即最大单词索引 +1)和嵌入的维度(这里是 64)
embedding_layer = Embedding(1000, 64)
# 最好将 Embedding 层理解为一个字典,它接收整数作为输... | true |
7f0ca99cb800882ab463e60baa49107f3c55ffaf | Python | misoi/bootcamp | /assigno/fizzbuzz.py | UTF-8 | 206 | 3.328125 | 3 | [] | no_license | def fizz_buzz(t):
if t % 3 == 0 and t % 5 == 0:
return 'FizzBuzz'
elif t % 3 == 0:
return 'Fizz'
elif t % 5 == 0:
return 'Buzz'
else:
return (t)
print fizz_buzz(15) | true |
2d7fe194208a19058422eaf227eb3649ede7434b | Python | sushrut7898/complete_python_mastery | /generating_random_values.py | UTF-8 | 455 | 3.359375 | 3 | [] | no_license | import random
import string
print(random.random())
print(random.randint(1, 10))
print(random.choice([1, 2, 54, 654, 67564, 67546, ]))
print(random.choices([1, 2, 3, 4, 5, 6], k=2))
# Generating Random Password
print("".join(random.choices("skdbaskjdhksajdhjsa", k=4)))
print(string.ascii_letters)
print("".join(random... | true |
b0e1844574586dc98724fe296d8973e8c749f27b | Python | ashapovalov656/python_training_mantis | /fixture/orm.py | UTF-8 | 878 | 2.515625 | 3 | [] | no_license | from pony.orm import *
from model.project import Project
class ORMFixture:
db = Database()
class ORMProject(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column="mantis_project_table")
name = Optional(str, column="name")
description = Optional(str, column="descripti... | true |
602993fc231fa7787b00d5aeed1e83765399cb98 | Python | chaowyc/leetcode | /missnum.py | UTF-8 | 417 | 3.484375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 18 22:05:01 2015
@author: Understand
"""
import operator
def missingNumber(nums):
"""
:type nums: List[int]
:rtype: int
"""
# n = len(nums)
# return n * (n + 1) / 2 - sum(nums)
a = reduce(operator.xor, nums)
print a
b = reduce(op... | true |
e55e61596d03b5be05821b86053893d0b17a5221 | Python | Jacksgong/wordpress-image-rescue | /wordpress_fix_img.py | UTF-8 | 2,612 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import MySQLdb
import re
import os.path
__author__ = 'jacksgong'
__date__ = 'Jan 22, 2015'
wp_path = raw_input('wordpress path(example: /var/www/blog.dreamtobe.cn/html/): ')
wp_domain = raw_input('domain(example: http://blog.dreamtobe.cn): ')
mysql_user_name = raw_input('mysql user name: ')
mysql_p... | true |
968af5090b302f70aa4299a36a0e29e9778dcf7a | Python | ravi1232015/Python | /reverse.py | UTF-8 | 72 | 3.671875 | 4 | [] | no_license | n=input("Enter any things :")
print(f"Reverse of any things :{n[::-1]}") | true |
bd2d5593b5cf3731ef094ca5c5a3d1a8a110f1d0 | Python | huytd2k/bfpy | /bfpy/__main__.py | UTF-8 | 405 | 2.546875 | 3 | [] | no_license | import argparse
from bfpy.executor import Executor
from bfpy.tokenizer import tokenizer
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="python brainf*ck interpreter")
parser.add_argument("filename")
args = parser.parse_args()
with open(args.filename, "r") as f:
text ... | true |
14ce5cc650f7ecf7bdc1ef54301d72d148b0ea23 | Python | eddieb12345/Pythons-and-Ladders | /Eddies-Code/FizzBuzz.py | UTF-8 | 291 | 3.78125 | 4 | [] | no_license | num = eval(input('Enter a number:'))
line = []
for num in range(1,num+1):
if num%3 == 0 and num%5 == 0:
line.append("Fizz Buzz")
elif num%3 == 0:
line.append("Fizz")
elif num%5 == 0:
line.append("Buzz")
else:
line.append(num)
for numbers in line:
print(numbers)
| true |
47dd8810193371f9f2c42a6cdab0e3255decd9e2 | Python | oliviagwynn1/bme590hrm | /exceed.py | UTF-8 | 524 | 4.0625 | 4 | [
"MIT"
] | permissive |
def exceed(voltage_array, value=300):
"""This function checks if the voltage exceeds a given value.
The for loop runs through the voltage_array, to
determine if any number in the voltage array does exceed the given
value. If so, an exception is raised.
:param voltage_array: array of voltage value... | true |
b22c04b625b89f6651224b859cdaa2f468b1d547 | Python | SaraVeterini/NearestNeighbourSearchRecipes | /lsh.py | UTF-8 | 2,114 | 3 | 3 | [] | no_license | import time
import definitions
''' B is the number of bands
R is the number of rows in each band.
if N is the number of hash functions for calculating minhash,
it must be
B*R = N
(1/B)^(1/R)> 0.8
where 0.8 is the threshold, the value of the jaccard similarity
above which the probability ... | true |
ee21961a72d68114610f8c1e3a8a54fa298ac076 | Python | tousborne/fake_bsg_datastore | /datastore_stressor.py | UTF-8 | 6,508 | 2.875 | 3 | [] | no_license | #!/bin/env python
"""
A module to test pushing and pulling data to/from the Ground's Datastore API.
"""
# Standard libraries
import argparse
import base64
import gzip
import json
import logging
import random
import requests
import string
import subprocess
import time
import typing
DATA_FILE = './data.txt'
SERIAL = ... | true |
68c664f9eddbf75a20490c8607a83884e01c87ed | Python | Sidautomation2017/SeleniumPythonTesting | /Ecommerce/tests/test_HomePage.py | UTF-8 | 632 | 2.5625 | 3 | [] | no_license | import time
import pytest
from pageObjects.HomePage import HomePage
from utilities.BaseClass import BaseClass
from TestData.TestData import TestData
class TestHomePage(BaseClass):
def test_formSubmission(self, getData):
log = self.getLogger(__name__)
log.info("Test is started")
homepage ... | true |
88f2a27514b890bf4eb3d40d3c1e8ff23e4b6ccd | Python | rootong/cpl-parser | /cpl_parse.py | UTF-8 | 3,462 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import click, csv, re
from anytree import Node, RenderTree
@click.command()
@click.argument(
'domain_file',
type=click.File('r')
)
@click.argument(
'cpl_file',
type=click.File('r')
)
def main(domain_file, cpl_file):
write_cpl(cpl_file)
domain_list = get_domains(domain_fi... | true |
ed774516d62dee97723dcf3a5fe87b9909aee04e | Python | venmad/PyBasics | /primenumbers.py | UTF-8 | 829 | 4.375 | 4 | [] | no_license | # Program to check the prime number
def a():
a = int(input("Enter a number "))
if a % 2 == 0 or a == 1:
print("Not a Prime Number")
else:
print("Prime Number")
# program to print the prime numbers between the intervals
def b():
a = int(input("Enter the First Interval "))
b = int(inp... | true |
b37665e21278b71519badce7e111ba901175f4bf | Python | Overflow23/NervosOptions | /tests/test_token.py | UTF-8 | 662 | 3.171875 | 3 | [] | no_license | import web3
toWei = web3.Web3.toWei
def test_name(token):
assert token.name() == 'Ether'
def test_symbol(token):
assert token.symbol() == 'ckETH'
def test_initial_supply(token):
assert token.totalSupply() == 5000000000000000000
"""
def test_balance(accounts, token):
token.mint(accounts[1], 100,... | true |
fc7dbf5e147e63c8a662cd6ff7f75d287cefbaca | Python | yoshinobc/EA | /function/ES/cma_es.py | UTF-8 | 2,293 | 2.71875 | 3 | [] | no_license | import numpy
from deap import algorithms
from deap import base
from deap import benchmarks
from deap import cma
from deap import creator
from deap import tools
import matplotlib.pyplot as plt
N = 2 # 問題の次元
NGEN = 300 # 総ステップ数
creator.create("FitnessMin", base.Fitness, weights=(-1.0,))
creator.create("Individual",... | true |
52bfbd24b49b29567080b2a72d69c2ed12368781 | Python | Srihari88/Web_Python_Automation | /MatchStatus/AdminTab.py | UTF-8 | 910 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
import unittest
class AdminTab(unittest.TestCase):
@classmethod
def setUpClass(cls):
print(" Open Application")
cls.driver = webdriver.Chrome(executable_path='/Library/Python/2.7/site-packages/chromedriver')
cls.driver.get("https://opensource-demo.orang... | true |
fc2f3d524076f3a8757d9c00d70a405c94f0eca4 | Python | mhhuang95/SBD | /SBD_lasso.py | UTF-8 | 2,591 | 2.671875 | 3 | [] | no_license | #Code for Rapid, Robust, and Reliable Blind Deconvolution via Nonconvex Optimization
# Minhui Huang
import numpy as np
from scipy.linalg import dft
import matplotlib.pyplot as plt
import pandas as pd
from scipy.sparse.linalg import svds
def soft(x, lam):
mask = (np.abs(x) > 0)
x[mask] =np.maximum(np.a... | true |
95e2c6af06030c917cbcb5637660d44dff25bcd5 | Python | dcuevasr/actinf | /actinfClass.py | UTF-8 | 23,469 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 15 17:50:25 2016
@author: dario
Base class for Active Inference. It sets up the parameters necessary for
Actinf based on the input MDP. Add small non-zero probabilities to the required
matrices to avoid division by zero and extracts parameters from these matrices
for lat... | true |
76b8e3dc3ad7866f280856d01c9ffff6082fb1be | Python | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4128/codes/1800_2569.py | UTF-8 | 198 | 2.8125 | 3 | [] | no_license | from numpy import*
from math import*
x = array(eval(input("numeros:")))
m = sum(x)/size(x)
d = 0
for i in range(size(x)):
d = d + ((x[i]) - m)**2
total = sqrt(d/(size(x)- 1))
print(round(total,3))
| true |
c19fede173a3c59bdd49c2fbfa196d79f547d482 | Python | mohdsadiq7/Text-Editor | /Text_Editor.py | UTF-8 | 4,876 | 2.921875 | 3 | [] | no_license | """
Created on Sat Oct 19 23:18:18 2019
@author: Sadiq and Manoj
"""
# !/usr/bin/python3
from tkinter import Tk , scrolledtext , Menu , filedialog , END,Label ,messagebox,simpledialog
from tkinter import *
import os
root = Tk(className = " Text Editor")
TextArea = scrolledtext.ScrolledText(root, width = 500 , height... | true |
0846355509ea8c3e50e887081ea4cf8571676097 | Python | EnricoMiccoli/nodal | /nodal/models.py | UTF-8 | 6,131 | 2.765625 | 3 | [
"MIT"
] | permissive | """Core implementation of the nodal analysis procedure.
Provides write_COMPONENT() for all component types. These functions are
used exclusively by the Circuit.build_model() method when writing the
G e = A
linear system.
The matrix G and the vector A are often referenced and modified by
these functions.
"""
def... | true |
5efeccd81a4b79be285083f6cb9a06f4819b61c5 | Python | guangyi/Algorithm | /romanToInt.py | UTF-8 | 1,305 | 3.203125 | 3 | [] | no_license | class Solution:
# @return an integer
def romanToInt2(self, s):
dictR = {'M':1000, 'CM':900, 'D':500, 'CD':400, 'C':100, 'XC':90, 'L':50, 'XL':40, 'X':10, 'IX':9, 'V':5, 'IV':4, 'I':1 }
Sum = 0
i = 0
while i < len(s):
if s[i:i + 2] in dictR:
Sum = Sum ... | true |
ec5e400546138a12b0d5d77afcb7ba7a708beeae | Python | yycho0108/xcor_op | /timer.py | UTF-8 | 326 | 3.265625 | 3 | [
"MIT"
] | permissive | import time
class Timer(object):
def __init__(self, name='timer'):
self.name = name
self.start = 0
def __enter__(self):
self.start = time.time()
return self
def __exit__(self,t,v,tb):
dt = time.time() - self.start
print '[%s] : Took %.3f Seconds' % (self.name... | true |
4d816816b7137550da8fe7baf588775ffefb5763 | Python | Hyjacker-1/mp3player | /main.py | UTF-8 | 891 | 2.671875 | 3 | [] | no_license | import playlist as pl
from tkinter import *
import pygame
pygame.mixer.init()
#For Queue
def add_songs(n,tk):
pl.cursor.execute("create table queue(id int(3) unsigned auto_increment primary key,song_name varchar(1000) not null);")
filename =pl.fd.askopenfilenames(filetypes=(("mp3","*.mp3"),("All files",".")))
... | true |
a97805e7b7f7c5e3144b8d6fc59711a9ffcee19e | Python | ourkov/slack-challenge | /package.py | UTF-8 | 1,424 | 2.53125 | 3 | [] | no_license | #
# Class for handling installing/uninstalling packages
#
from execute import *
class package:
servers = []
name = None
def install(self, changeMgr):
for server in self.servers:
print "checking if we need to install %s on %s" % (self.name, server)
# check if package is installed
cmd = "ssh root@%s dp... | true |
31cf13b4a6599e157e2f3392e1705edb470df3d8 | Python | H00N24/PV056-AutoML-testing-framework | /pv056_2019/outlier_detection/TD.py | UTF-8 | 2,282 | 2.9375 | 3 | [] | no_license | import numpy as np
from sklearn.tree import DecisionTreeClassifier
class TDMetric:
def findLeafDepthWithoutPrunning(self, df, classes):
values = np.empty([0, 0])
estimator = DecisionTreeClassifier()
estimator.fit(df, classes)
n_nodes = estimator.tree_.node_count
# print(... | true |
f07ce895c381a3dd0816afcc586a345d60258c75 | Python | mlarocque22/COMPOSITE | /Industry/Composite_Industry.py | UTF-8 | 2,043 | 2.984375 | 3 | [] | no_license | def main():
file = open(r"NASDAQ\Sorted_Sector_$2.5.txt",'r')
file1 = open(r"NYSE\Sorted_Sector_$2.5.txt",'r')
file2 = open(r"Merged.txt", 'w')
NYSE_list = []
NASDAQ_list = []
COMP_list = []
for line in file:
this_line = line
ticker = t... | true |
ce3ea894e96419e97bca9a1a00e4f9e830368e90 | Python | bing020815/Syracuse-University | /IST664/HW2/Wu_ContactFinder/ContactFinder.base.py | UTF-8 | 6,714 | 3.3125 | 3 | [] | no_license | """
This program was adapted from the Stanford NLP class SpamLord homework assignment.
The code has been rewritten and the data modified, nevertheless
please do not make this code or the data public.
This base version has no patterns, but has two patterns suggested in comments
in order to get you started .
... | true |
d69f9d6ea8ab1039e708623b8a53dd45cb9838ad | Python | kshg1324/2DGP | /Lecture03/character_moves.py | UTF-8 | 1,638 | 3.375 | 3 | [] | no_license | from pico2d import *
from math import *
open_canvas()
grass = load_image('grass.png')
character = load_image('character.png')
x = 0
y = 0
count = 0
theta = -90
radian = math.radians(theta)
while True:
if(count % 2 == 0):
while(x < 800 - 42):
clear_canvas_now()
grass.draw_now(400... | true |
7fece6754cb9da448860b97f1954d882dcc445f8 | Python | Ybenson/Modulo-de-tratamento-de-dados-em-Python | /ValidarEmailVersion2.py | UTF-8 | 3,345 | 2.59375 | 3 | [] | no_license | import threading
import os
import time
start = time.time()
def run(mails):
df_valid_domain = []
class Ping(threading.Thread):
def __init__(self, domain):
threading.Thread.__init__(self)
self.domain = domain
def run(self):
# to windows
... | true |
e01083eac6fa2c7f9e9ad0ec128bf1c47d41542d | Python | reginaldosantarosa/DesignPatterns | /comportamentais/templateMethod/musica/musica/ordenadores/por_estrela.py | UTF-8 | 394 | 3.015625 | 3 | [] | no_license | from musica.ordenador import Ordenador
class PorEstrela(Ordenador):
"""
Ordena as músicas por estrelas.
"""
def vem_antes(self, musica1, musica2):
"""
Verifica se a musica1 tem uma quantidade de estrelas maior
que a musica2
"""
if (musica1.estrelas > musica2.e... | true |
4313cd3f019d2e3b6a1710f296255201771f7d24 | Python | tuanpx9184-cowell/learn-python | /colon/test_itertool.py | UTF-8 | 538 | 3.53125 | 4 | [] | no_license | import itertools
class A:
def __init__(self, name, age):
self.name = name
self.age = age
def get_age(self):
return self.age
a = A('tuan', 10)
a1 = A('tuan1', 11)
a2 = A('tuan2', 12)
a3 = A('tuan3', 19)
a4 = A('tuan4', 14)
a5 = A('tuan5', 18)
a6 = A('tuan6', 16)
a7 = A('tuan7', 17)
... | true |
410d93ec4b5636843bbaf13027ea41f51b305a5c | Python | impradeeparya/python-getting-started | /array/PushDominoes.py | UTF-8 | 1,947 | 3.703125 | 4 | [] | no_license | class Solution:
def pushDominoes(self, dominoes: str) -> str:
dominoes_length = len(dominoes)
output = ['.'] * dominoes_length
left_dominoes = [-1] * dominoes_length
right_dominoes = [-1] * dominoes_length
value = -1
for index, element in enumerate(dominoes):
... | true |
52acddb719338dc748437e9cc3d7a457f25c6bcd | Python | eoinclayton98/CA4006-Concurrent_and_distributed_systems | /Assignment2/Server/file_generator.py | UTF-8 | 2,488 | 3.109375 | 3 | [] | no_license | import re
import os
class F_Generator():
def __init__(self,msg):
self.pattern = msg
a=ord('a')
self.letters = [chr(i) for i in range(a,a+26)]
self.is_valid = True
self.check_valid()
def create_range_format(self,lines):
print('Creating file of the... | true |
0bdad3bb1ebdc040772d2fa774e30b7e62be0cc7 | Python | SebastianAthul/pythonprog | /regular_expression/check_digits_/all_words_except_spcial_char.py | UTF-8 | 168 | 2.78125 | 3 | [] | no_license | import re
x='\w'
matcher=re.finditer(x,"aTh@#uL 69 S3^*BAstIAN@")
for match in matcher:
print("starting=",match.start())
print("Matching Group=",match.group())
| true |
ad71a8dc3f3257e7a2fe9bf7fb16f3ce6db1aa3a | Python | NicolasOrtega/mqtt_cosas | /MQTT_publisher.py | UTF-8 | 586 | 2.546875 | 3 | [] | no_license | # publisher
import paho.mqtt.client as mqtt
client = mqtt.Client()
client.connect('192.168.0.48', 1883) # Aqui te conectas a la IP del broker, sea cual sea, uno público o la misma jetson.
# Esta secuencia es de prueba para enviar mensajes ingresados por la consola a los tópicos que aparecen en el primer argumento.
wh... | true |
47a994f3cc463d8412066e1a0f03952fec2c41d9 | Python | almasluffy/webdev2019 | /Week10/HackerRank/16.py | UTF-8 | 147 | 3.125 | 3 | [] | no_license | line = input()
subLine = input()
for i in range(0, len(line) - len(subLine)):
if line[i:len(subLine)+i] == subLine:
print(i)
break
| true |
db25e669dfa68c536290acd31887f2e7dabe3260 | Python | kvshamray/terracota | /terracotta/locals/overload/mhod/nlp.py | UTF-8 | 2,011 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2012 Anton Beloglazov
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | true |
641bde2613570c1ff2ba9170234141daba206126 | Python | cmccandless/multisite | /tests/helper.py | UTF-8 | 760 | 2.765625 | 3 | [
"MIT"
] | permissive | import unittest
import os
import tempfile
import shutil
class UtilityMethods(unittest.TestCase):
def setUp(self):
self.old_cwd = os.getcwd()
os.chdir('tests')
self.workspace = tempfile.mkdtemp(dir='.')
def tearDown(self):
shutil.rmtree(self.workspace)
os.chdir(self.old... | true |
37031c26cc015597c0d5526d1cf67c60edd35347 | Python | serkanh/uberlearner | /uberlearner/main/management/commands/insert_fake_data.py | UTF-8 | 2,911 | 2.65625 | 3 | [
"MIT"
] | permissive | from allauth.account.models import EmailAddress
from django.core.management.base import BaseCommand
from optparse import make_option
from django.template.loader import render_to_string
from courses.models import *
from django.contrib.auth.models import User
class Command(BaseCommand):
option_list = BaseCommand.opt... | true |
7d55ceab5d138537a5612ca84190f3cd3af23ce6 | Python | c-s-h-i-r/python | /~ProjectEulerExamples/pe36 find palindromic sum.py | UTF-8 | 795 | 4.0625 | 4 | [] | no_license | '''Project Euler 36
The decimal number, 585 = 1001001001 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please note that the palindromic number, in either base, may not include leading zeros.)
'''
def decToBin(n):
'''return ... | true |