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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
04c7fb7da7b3cef7315dfef3c8c84ce244170359 | Python | tcflanagan/transport | /src/tools/stability.py | UTF-8 | 13,361 | 3.5625 | 4 | [] | no_license | """Classes to monitor stability in some value."""
from time import time
from src.tools.general import simpleLinearRegression
class StabilityTrend(object):
"""A class for tracking stability based on trend.
Parameters
----------
bufferSize : int
The number of data points of which to keep t... | true |
66b7d7c3b7b41633b88398c75c4455f03be3a6d7 | Python | puneet4840/Numpy | /Check shape of the array using shape attribute.py | UTF-8 | 245 | 3.609375 | 4 | [] | no_license | # shape attribute is used to chekc hte shape of any array
print()
import numpy as np
a1=np.array([1,2,3,4,5])
print(a1.shape)
a2=np.random.randint(1,21,20).reshape(4,5)
print(a2.shape)
a3=np.array([[[1,2,3],[4,5,6],[7,8,9]]])
print(a3.shape) | true |
6397506c718aa0bda693b1d3a2d67b4e3702f172 | Python | Empythy/Algorithms-and-data-structures | /杨辉三角.py | UTF-8 | 814 | 3.1875 | 3 | [] | no_license | from typing import List
class Solution:
def generate(self, numRows: int) -> List[List[int]]:
ret = []
def helper(i, j):
try:
if ret[i - 1][j - 1]:
return ret[i - 1][j - 1]
except:
if j == 1 or i == j:
... | true |
bd69e804bb4ae136194f84bdb68058372c460121 | Python | X-rayLaser/Hello-RNN | /loaders.py | UTF-8 | 1,550 | 3.171875 | 3 | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | from wordfreq import word_frequency
class SequenceLoader:
def __init__(self, path, max_sequences):
self._path = path
self._sequences = []
self._max_seq = max_sequences
self.load()
def load(self):
sequences = []
with open(self._path) as f:
for index... | true |
b04e4aba06bd8a562ca9adf5c95547ef75d6d97e | Python | someoneAlready/east-text-detection-with-mxnet | /data_iter/core.py | UTF-8 | 8,816 | 2.53125 | 3 | [] | no_license | #-*- coding: utf-8 -*-
import os
import json
import traceback
class ExceptionWrapper(object):
"Wraps an exception plus traceback to communicate across threads"
def __init__(self, exc_info):
self.exc_type = exc_info[0]
self.exc_msg = "".join(traceback.format_exception(*exc_info))
class Video... | true |
e367690a8d4a0ae4064c6c75c960b0e34bf50c16 | Python | johndpope/qrypto | /qrypto/types.py | UTF-8 | 1,063 | 2.640625 | 3 | [] | no_license | from typing import Any, Dict, List, Optional, Union
import pandas as pd
Timestamp = Union[int, pd.Timestamp]
"""A Timestamp can be either an integer representing a unix timestamp, or the
pandas.Timestamp class.
"""
OHLC = Dict[str, Union[Timestamp, float]]
"""
{
'datetime': ...,
'open': ...,
... | true |
f15d97589f441c2b7af533ab18784d145bf59415 | Python | packetchaos/nessus | /nessus/plugins/stop.py | UTF-8 | 359 | 2.6875 | 3 | [] | no_license | import click
from .api_wrapper import request_data
@click.command(help="Stop a Scan by Scan_ID")
@click.argument('scanid')
def stop(scanid):
try:
request_data('POST', '/scans/{}/stop'.format(scanid))
print("\nStopping your scan {} now.\n".format(scanid))
except AttributeError:
click.ec... | true |
0184c8487deed47149a79b022a630e1397db870a | Python | pedrogalan/log-monitor | /mail/Mail.py | UTF-8 | 817 | 2.6875 | 3 | [] | no_license | import sys
sys.path.append('../config')
from config.Config import Config
import smtplib
class Mail:
@staticmethod
def sendMail(body):
message = Mail.__buildMessage(body)
server = Mail.__configureServer()
server.sendmail(Config.get('mail.sender'), Config.get('mail.receiver'), message)
... | true |
8780853b1328c8720b39b924f460667ebf09e6d1 | Python | Tr-1234/seahub | /tools/avatar_migration.py | UTF-8 | 1,906 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Migrate seahub avatar files from file system to MySQL.
Usage: ./avatar_migrate.py /home/user/seahub
Note: seahub database must be MySQL.
"""
import base64
import datetime
import hashlib
import os
import sys
import MySQLdb
if len(sys.argv) != 2:
seahub_root = raw_input("Please enter roo... | true |
4a637518815a8704993538c678beb403ba090720 | Python | MaeMilMook/SV_SocketClient | /src/presentation/FileListReceiverWithPickleSize.py | UTF-8 | 1,225 | 2.71875 | 3 | [] | no_license | '''
Created on 2014. 6. 13.
@author: cho
'''
class FileListReceiverWithPickleSize:
'''
classdocs
'''
def __init__(self):
pass
def receiveFileList(self, conn):
import struct, pickle
BUF_SIZE = 12;
LEN_SIZE_BYTE = 4
TOTAL_VIEW_SIZE = 0;
... | true |
7285da717644d0cf218a4e8202a3745d2bcc45a8 | Python | gammernut/04_journal_v0.5.1 | /journal.py | UTF-8 | 337 | 2.59375 | 3 | [] | no_license | import os
def load(name):
# add from file if it exists.
return []
def save(name, journal_data):
filename = os.path.abspath(os.path.join('./journals/', name + '.jrl'))
print(f"......saving to: {filename}")
file_output_string = open(filename, 'w')
def add_entry(text, journal_data):
journal_d... | true |
502afb01d00c402aed7c26ac54f65142d184a349 | Python | osamascience96/CS50 | /python/loops.py | UTF-8 | 62 | 3.546875 | 4 | [] | no_license | name = "Osama"
for character in name:
print(character)
| true |
518bc578f5e7b8ca67e94b24b5fb71ae3022d07b | Python | reeeborn/py4e | /py4e/chapter11/ex11_01.py | UTF-8 | 448 | 3.9375 | 4 | [] | no_license | # Python for Everyone
# Chapter 11 exercise 1
# Create a grep-like program
import re
filename = input('Enter File Name: ')
try:
fhand = open(filename,'r')
except:
print('file not found:',filename)
exit()
regexp = input('Enter regular expression: ')
count = 0
for line in fhand:
if re.search(regexp,line... | true |
47d0f250303c749b6345f76f2caa48b9a39364da | Python | AEC-Tech/Python-Programming | /remove.py | UTF-8 | 138 | 3.9375 | 4 | [] | no_license | text = input("Enter text ")
ch = input("Enter character to be removed ")
text = text.replace(ch,'')
print("After deletion text is ",text)
| true |
f0927dbe1f0a7f959f37346f7df1612c3ed4edfe | Python | rupaliasma/MLNT | /dataloader.py | UTF-8 | 6,963 | 2.546875 | 3 | [] | no_license | from torch.utils.data import Dataset, DataLoader, TensorDataset
from torch.utils.data.dataset import random_split
import torch
import torchvision.transforms as transforms
from customtransforms import RandomHorizontalFlipTensor, RandomVerticalFlipTensor
import random
import numpy as np
from PIL import Image
import torch... | true |
51fcdbf499c16f971e958a12c00633c15a718f0a | Python | Server250/RoomLang.py | /roomlang.py | UTF-8 | 16,239 | 3.265625 | 3 | [
"MIT"
] | permissive | import os # Used for loading and saving room files
import re # Used for loading room files
"""
author: Cameron Gemmell
github: www.github.com/Server250/
description: Contains Room data structure, as well as a loader and a saver for the RoomLang standard. Documentation available at:
"""
# The data structure for hol... | true |
ccfbc9d23812706ee6668413d5b63417662067e0 | Python | SBU-BMI/quip_cnn_segmentation | /training-data-synthesis/draw_real.py | UTF-8 | 1,659 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from PIL import Image
from os import listdir
from os.path import isfile, join
size0 = 400;
size1 = 400;
npatch_per_tile = 3;
def sample_overlap(x, y, fx, fy, xlen, ylen):
if fx <= x and x <= fx+xlen and fy <= y and y <= fy+ylen:
return True;
if fx <= x+xlen and x+xlen <= fx+xlen and... | true |
f9287e90cb0d8a754722eb7d4da276e5f5edb667 | Python | leticiadedeus/learningPython | /Jokenpo.py | UTF-8 | 796 | 3.578125 | 4 | [] | no_license | import random
import time
print('0 - rock \n'
'1 - paper \n'
'2 - scissors ')
user = int(input('Choose your fighter: '))
pc = random.randint(0, 2)
print('JO')
time.sleep(0.6)
print('KEN')
time.sleep(0.6)
print('PÔ')
time.sleep(0.6)
if user == pc:
print('pc and user tied')
elif user == 0 and pc == 2:
... | true |
577a937c2036c825881a5d88454c34abb2e332c9 | Python | koenkeune/parchis_model | /testing/parchisTests.py | UTF-8 | 12,108 | 3.015625 | 3 | [] | no_license | from model.game import *
from scenarios import *
import copy
class RulesTester():
def __init__(self, game):
self.game = game
self.scenes = Scenarios()
def check_rule1(self):
numPlayers = len(self.game.players)
starts = []
for i in range(100):
starts.... | true |
6d2d14d4eba4e3a3f574a2c7734ed693105b455f | Python | Chuset21/Learning-Python | /basics/chapter-one/password_checker.py | UTF-8 | 310 | 3.734375 | 4 | [] | no_license | def main():
username = input('Enter your username: ')
password = input("Enter your password: ")
password_length = len(password)
hidden_password = '*' * password_length
print(f'{username}, your password {hidden_password}, is {password_length} characters long')
if __name__ == '__main__':
main()... | true |
e1461ebff27dd6df4ed5b73bb862b3bebfd826ad | Python | stivo32/python_wg | /8/At_work/bandit.py | UTF-8 | 704 | 4.03125 | 4 | [] | no_license | from random import choice, randint
class Cell(object):
def __init__(self, max_value):
self.max_value = max_value
def roll(self):
return randint(1, self.max_value)
class Bandit(object):
max_cell_value = 3
def __init__(self, cell_number=3):
self.cells = [
Cell(self.max_cell_value)
for _ in range(cel... | true |
59df8a26b17da31ce68dc879ebf1a2a27a804606 | Python | toru-ver4/sample_code | /2019/009_python_subprocess/subprocess_ctl.py | UTF-8 | 1,377 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
subprocess を使って exe ファイルと通信する。
"""
# import libraries
import os
from subprocess import Popen, PIPE
from threading import Thread
import time
# define
STDOUT_THREAD_TIMEOUT_SEC = 1.0
def print_stdout(proc):
while True:
line = proc.stdout.readline()
... | true |
002fcdaefe2fde4aabdecad057ba666c9abb343c | Python | woutdenolf/spectrocrunch | /spectrocrunch/utils/listtools.py | UTF-8 | 4,307 | 2.984375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import collections
import operator
import itertools
import numpy as np
from . import instance
def flatten(l):
"""Flatten iterables
Args:
l(anything):
Returns:
list
"""
if instance.isiterable(l) and not instance.isstring(l):
try:
it = i... | true |
bbfc39b5c6767a8e0a88b281eaf0b38fd791bca2 | Python | Zer0101/colorize-nn | /app/lib/color/image.py | UTF-8 | 2,926 | 2.75 | 3 | [] | no_license | import tensorflow as tf
class ImageTransformer:
@staticmethod
def rgb_transform_filter():
transform_filter = tf.constant(
[[[
[0.299, -0.169, 0.499],
[0.587, -0.331, -0.418],
[0.114, 0.499, -0.0813]
]]], name="rgb_to_yuv_transform... | true |
77480e8c1e0861daeef541978035c619ddb6cfb4 | Python | jeisenma/ProgrammingConcepts | /05-drawing/moreCircles.pyde | UTF-8 | 848 | 4.25 | 4 | [] | no_license | # J Eisenmann 2013
# jeisenma@accad.osu.edu
greens = [] # a list to hold the green color values of each circle
numCircles = 12 # how many circles are there?
def setup():
global greens
size(400,400)
# create a bunch of random numbers that will represent to green values
for i in range(numCircles):
... | true |
f7914165d39f0eb173921b80016dc522197e50d4 | Python | mns0/DNABindingModel | /helper.py | UTF-8 | 5,111 | 2.5625 | 3 | [] | no_license | import numpy as np
from multiprocessing import pool
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as mpatches
import math
import operator
import random
##globaly define path ##
t = np.arange(-0.3*np.pi,3.9*np.pi,np.pi/30)
x1 = 30*np.exp(0.14*t)*np.cos(t) - 9
y1 = 30*np.exp(... | true |
55f4e3c0ddd2be8ad41689ec850a3c4fdbfa9c6b | Python | zhouxzh/doa | /matrix_record.py | UTF-8 | 1,265 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
from matrix_lite import led
import time
import pyaudio
import wave
def show_direction(angle):
print('The angle is {}'.format(angle))
direction = int(angle // (360/18))
image = ['blue']*led.length
image[direction] = 'red'
led.set(image)
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHA... | true |
1606a01f2ba3efec0f37cc2dac21114f0c889112 | Python | ryanalexmartin/fooji-twitter-scraper | /src/fooji_tracker_bot.py | UTF-8 | 2,428 | 2.609375 | 3 | [
"MIT"
] | permissive | import tweepy
from modules.csv_handler import CsvHandler
import pandas as pd
import csv
from webhook_send_tweet import send_tweet_to_discord_as_webhook
auth = tweepy.OAuthHandler('eHtXXHzhyXH7s8AJpLr1c08bf', 'MByI3bcuHR8bWc9Dh18e5ojKOtzjRp6zKCGEyq6CdmoKVUcO4L')
auth.set_access_token('1348767110441414663-AF1drc9dE0JR9... | true |
1bd34561856d4fa450a250db607c9b46a8ff80f9 | Python | KalashnikovEgor/PythonProject | /for_tests.py | UTF-8 | 970 | 3.90625 | 4 | [] | no_license | import math
class Figure:
def perimeter(self):
raise NotImplementedError
class Circle(Figure):
def __init__(self,radius):
self.radius = radius
def perimeter(self):
return math.pi*2*self.radius
class Rectangle (Figure):
def __init__(self,a,b):
self.a = a
self... | true |
1c00e8b83ece11ee0d34d54e71bcabe8314036f3 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_3/p.oon/C. Coin Jam.py | UTF-8 | 3,554 | 2.609375 | 3 | [] | no_license | import re
import sys
import random
pp = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383... | true |
1b3f883e1276974b7e2cff6f19c24073dcccb0cd | Python | phhuang191129/ocr-test | /crnn/pytorch/medicalRecord.py | UTF-8 | 1,600 | 3.234375 | 3 | [] | no_license | import re
class case:
"""
病例結構化輸出
"""
def __init__(self,result):
self.result = result
self.N = len(self.result)
self.res = {}
self.disease()
self.disposalConsideration()
def disease(self):
"""
病名、診斷
"""
disease = {'disease':''... | true |
8fd5250f79533b6389d76a9e1200afdc844466b2 | Python | adwardlee/leetcode_solutions | /038_Count_and_Say.py | UTF-8 | 1,192 | 4.25 | 4 | [
"MIT"
] | permissive | '''
The count-and-say sequence is the sequence of integers with the first five terms as following:
1. 1
2. 11
3. 21
4. 1211
5. 111221
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n where 1 ≤ n ≤ 30, generate the n... | true |
c7c00fe565860879dab9ee2e4b5c1017dc109039 | Python | shahdharm/PythonBasics | /tqble.py | UTF-8 | 104 | 3.6875 | 4 | [] | no_license | num =int(input("enter the number" ))
for i in range(1,11):
mul = num*i
print(f"{num}*{i}={mul}") | true |
0735d619d5d90f25c073886c49ce73470984f008 | Python | nicktao9/AgriculturalDiseaseClassification | /src/models/xception.py | UTF-8 | 5,063 | 2.65625 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from torchsummary import summary
class SeparableConv2d(nn.Module):
def __init__(self,in_channels,out_channels,kernel_size = 1,stride = 1,padding = 0,dilation = 1,bias = False):
super(SeparableConv2d,self).__in... | true |
d188873ddbf6411ab750d8cae8628955127f06ae | Python | Sapphirine/201912-14-Trending-Topics-Sentiment-Analysis-of-Twitter | /Django_js_web_app/website2/static/data/generate_example.py | UTF-8 | 2,156 | 2.796875 | 3 | [] | no_license | # import json
# import random
# topics = []
# with open('sample-topics.csv', 'r') as f:
# for line in f:
# topics.append(line.strip())
# with open('world-topo-min.json', 'r') as f, open('example-tweet-toptic.json', 'w') as w:
# data = json.load(f)
# geometries = data['objects']['countries']['geom... | true |
15c7ce00255790dc41ed51ba8e178488a4cc13d1 | Python | Rosetta-PLSci/projects | /GlacierInterpretationVisualization.py | UTF-8 | 1,197 | 3.15625 | 3 | [] | no_license | import cv2
import numpy as np
import glob
import pandas as pd
import random
import matplotlib.pyplot as plt
import seaborn as sns
# IMG COLOR RANGE --> 0,0,224,179,248,255
# total 42 main pictures
# TRANSFORM -->
"""
mainImagePath = glob.glob("ICE/*.jpg")
year = 0
for img in mainImagePath:
image = cv2.imread(im... | true |
7812cf0ba874bcfbefa776087156e1edba3a0af8 | Python | wisechengyi/pants | /tests/python/pants_test/util/test_objects.py | UTF-8 | 6,510 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.testutil.test_base import TestBase
from pants.util.objects import Exactly, SubclassesOf, SuperclassesOf, TypeConstraintError
class TypeConstraintTestBase(TestBase):
class ... | true |
64d7e5065dfbf177b6eb557c2c50ec3b3e5e35ab | Python | yashviradia/project_lpthw | /lpthw/ex31.1.py | UTF-8 | 3,198 | 4.09375 | 4 | [] | no_license | print("""This is the game of Space and changing the history of the humanity.
The Space race has begun.
What is your choice:
'Mars' or 'Moon'?""")
place = input("> ")
if place == 'Mars':
print("""You're sharing the vision with Elon Musk.
His vision is to create the human colony on the mars.
Do you agree wi... | true |
661301d18cd5af2e7f006816a4d084154af81a38 | Python | SoftwareSystemsLaboratory/prime-json-converter | /clime_json_converter/main.py | UTF-8 | 2,663 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | from argparse import Namespace
from pathlib import Path
import pandas as pd
from pandas import DataFrame
from progress.spinner import MoonSpinner
from clime_json_converter.args import mainArgs
from clime_json_converter.version import version
def loadDataFrame(filename: str, filetype: str = ".json") -> DataFrame:
... | true |
0234138e32309930eabe9b1b7b47b4edd67df975 | Python | fuzi1996/PythonScript | /auto2File/auto_file.py | UTF-8 | 1,347 | 3.078125 | 3 | [
"MIT"
] | permissive | import os
import datetime
"""
不支持文件名包含中文的文件
"""
# 要复制的目录
path = "D:\\Text"
cmd = "copy "
# 复制到一号机对应目录
out = " y:\输出物提交处\XXX\\test"
list = []
def copy_file(list):
for i in list:
if is_today(os.stat(i).st_mtime):
os.system(cmd+i+out)
print(cmd+i+out)
def list_all_file... | true |
15b0d70a6030ad9f44b69ce0abca7ed8c1c1ce6e | Python | cliffordjorgensen/PYTHON | /dateConversion/dateFunc.py | UTF-8 | 1,818 | 4 | 4 | [] | no_license | #Cliff Jorgensen
#functions for Date conversion program
def convertMonth(mon): #changes month to upper case
mon = mon.upper()
if mon == "JAN": #changes month to number
return"01"
elif mon == "FEB":
return "02"
elif mon == "MAR":
return "03"
elif mon == "APR":
... | true |
bf49ed946db56c7fd7539aae25cf30ed7120afd6 | Python | krab1k/CCL | /ccl/common.py | UTF-8 | 526 | 2.96875 | 3 | [] | no_license | """Common utility functions used within CCL"""
import os
from enum import Enum
from typing import Set
class NoValEnum(Enum):
"""Enum with simplified text representation"""
def __repr__(self) -> str:
return f'{self.__class__.__name__}.{self.name}'
def __str__(self) -> str:
return f'{self.... | true |
6f9bd2a772fbb50563e10e2382ea415a5eb6b434 | Python | ShadowLogan/AlarmClock | /main.py | UTF-8 | 2,139 | 3.6875 | 4 | [] | no_license | import random
round_no = 0
comp_score = 0
player_score = 0
while True:
game_list = ["Rock", "Paper", "Scissors"]
comp_choice = random.choice(game_list)
if comp_choice in ["Rock", "rock", "r", "R"]:
comp_choice = "r"
if comp_choice in ["Scissors", "scissors", "s", "S"]:
... | true |
0f80f1fb84bb09063cc2b021ebd9396ae7062024 | Python | detcitty/100DaysOfCode | /python/2021/other/practice.py | UTF-8 | 271 | 3.375 | 3 | [] | no_license | import numpy as np
import time
values = []
for i in range(0, 10):
values.append(i**i)
print(values)
print(time.strftime("%A", time.localtime()))
print(list(map(lambda x: 2**x, list(range(33)))))
sin_x = np.arange(100)
print(np.exp(sin_x))
print("Hello world")
| true |
d6a4e814b64fa645ddf475eaa5a21a96c769f780 | Python | TheAlgorithms/Python | /strings/snake_case_to_camel_pascal_case.py | UTF-8 | 1,621 | 4.09375 | 4 | [
"MIT",
"Giftware",
"LicenseRef-scancode-proprietary-license"
] | permissive | def snake_to_camel_case(input_str: str, use_pascal: bool = False) -> str:
"""
Transforms a snake_case given string to camelCase (or PascalCase if indicated)
(defaults to not use Pascal)
>>> snake_to_camel_case("some_random_string")
'someRandomString'
>>> snake_to_camel_case("some_random_string... | true |
1868276378aaffa4f836453829131d697b5727d7 | Python | sergio88-perez/pachaqtecH7 | /Grupo6/martin/app/conexion.py | UTF-8 | 2,744 | 2.59375 | 3 | [] | no_license | import utils
log = utils.log("INIT")
# mongoDB
#import pymongo
import pymongo
from pymongo import MongoClient, errors
class conexionBDD:
def conexion(self):
url = 'mongodb://localhost:27017'
try:
conn = pymongo.MongoClient(url)
#db = conn[str(f"{database}")]
... | true |
9c8be35a4f25020fbbd318ef8f564ce8b33276fd | Python | JfGitHub31/jianfeng7 | /t.py | UTF-8 | 220 | 3.1875 | 3 | [] | no_license | import re
a = '<p>Text</p><p>Text1<img src="url1">Text2<img src="url2">Text3</p><p><img src="url"></p>'
r = re.findall(r'>([^<>]+?)<|img src="([^<>]+?)"', a)
b = list(map(lambda i: i[0] if i[0] else i[1], r))
print(b)
| true |
88cf14f374900289bded3fce05cb636dd29378e4 | Python | htcondor/htcondor | /src/condor_tests/test_dagman_futile_nodes_efficiency.py | UTF-8 | 6,485 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env pytest
# test_futile_node_inefficiency.py
#
# LIGO discovered that with very large DAGs with many wide layers
# of nodes can result in DAGMan hanging on the recursive function
# that sets a nodes descendants to FUTILE status. This was due to
# the function being inefficient and always checking... | true |
d835abc49bb21c6d84a7020f77013588675e2e5e | Python | johwiebe/stn | /instances/toy2struct.py | UTF-8 | 1,875 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Toy example of STN with degradation.
Units:
Heater
Reactor
Tasks:
Heating
Reaction_1
Reaction_2
Operating modes:
Slow
Normal
"""
import sys
import os
import dill
os.chdir(os.getcwd() + "/" + os.path.split(sys.argv[0])[0])
sys.path.appen... | true |
78571cfbc1f6bdff1ac4e760dad6b1e871773923 | Python | UHM-PANDA/Mock-Interview-Problems | /Arrays/Pascals_Triangle/Python/main.py | UTF-8 | 436 | 3.203125 | 3 | [] | no_license | def pascal(n):
output = [[1], [1, 1]]
for i in range(2, n):
output.append([1 if j == 0 or j == len(output[i - 1]) else output[i - 1][j - 1] + output[i - 1][j] for j in range(len(output[i - 1]) + 1)])
return output[:n]
def pascal_not_scary(n):
output = [[1], [1, 1]]
for i in range(2, n):
... | true |
2c917a234ba584c11d7220e765d67e8d68262ab9 | Python | kikihiter/LeetCode2 | /Everyday/No331.py | UTF-8 | 1,964 | 3.453125 | 3 | [] | no_license | class Solution(object):
def isValidSerialization(self, preorder):
"""
:type preorder: str
:rtype: bool
"""
"""
"o,#,#"
"o,o,#,#,#"
"o,#,o,#,#"
"o,o,#,#,o,#,#"
"o,o,o,#,#,#,#"
"o,o,#,o,#,#,#"
"o,#,o,o,#,#,#"
... | true |
93a8ce30983b0f3cbb9a48271a64c84d5f71f1a8 | Python | sbrant/pdns | /bin/get_bl_lookup.py | UTF-8 | 1,305 | 2.5625 | 3 | [] | no_license | # --------------------------------------------------------------
#
# Example script to build a blacklist lookup from online sources.
# Please read the terms of use prior to using the MalwareDomains list:
# http://www.malwaredomains.com/?page_id=1508
#
# Grab and process the latest domain list from:
# http://www.malware... | true |
ab25c9316ecac532f9d7e71bf23c412ca504a29d | Python | fedosu85nce/work | /zfrobisher-installer/src/ui/systemconfig/configcompleted.py | UTF-8 | 996 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
#
# IMPORTS
#
from snack import *
#
# CONSTANTS
#
#
# CODE
#
class ConfigCompleted:
"""
Last screen for the configuration application
"""
def __init__(self, screen):
"""
Constructor
@type screen: SnackScreen
@param screen: SnackScreen instance
... | true |
cb24ba1abb2297821316132f88621fb84b1b1bdb | Python | sohailsayed990/Sayed-Sohail | /Gstprogram.py | UTF-8 | 619 | 3.578125 | 4 | [] | no_license | class product:
def __init__(self):
self.product_id=input("Enter the product id =")
self.product_name=input("Enter the product name =")
self.product_price=float(input("Enter the product price ="))
def product_info(self):
print("Product Id :",self.product_id)
print("Product name :",self.product_name)
print(... | true |
0c6103ae930567d8771eef34e588caf26f8259ae | Python | TebelloX/resolvelib | /tests/test_resolvers.py | UTF-8 | 3,417 | 2.78125 | 3 | [
"ISC"
] | permissive | import pytest
from resolvelib import (
AbstractProvider,
BaseReporter,
InconsistentCandidate,
Resolver,
)
def test_candidate_inconsistent_error():
requirement = "foo"
candidate = "bar"
class Provider(AbstractProvider):
def __init__(self, requirement, candidate):
self.... | true |
652ff19bdf92d96011181b9db4b685f17d5fd387 | Python | MarkF88/sudoku | /main.py | UTF-8 | 4,967 | 3.796875 | 4 | [] | no_license | """Represents a value on the Sudoku board, can either be an entered value or a clue
"""
class BaseSquare:
"""Base class for values on the board"""
def __init__(self, value=None):
self._value = None
self.value = value
@property
def value(self):
return self._value
@value.s... | true |
a89e227ce42286ccef739b299b33bb89936efe16 | Python | glycerine/numba | /numba/tests/math_tests/test_nopython_math.py | UTF-8 | 790 | 2.6875 | 3 | [
"BSD-2-Clause"
] | permissive | import math
import numpy as np
import unittest
#import logging; logging.getLogger().setLevel(1)
from numba import *
def exp_fn(a):
return math.exp(a)
def sqrt_fn(a):
return math.sqrt(a)
def log_fn(a):
return math.log(a)
class TestNoPythonMath(unittest.TestCase):
def test_sqrt(self):
self._t... | true |
e21f16915d3cdc2c74e167b06b66d3fe1666cef3 | Python | do5562/SLEDIMedO | /scrapers/scraper_mddsz.py | UTF-8 | 3,586 | 2.921875 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup
import requests
import hashlib
import datetime
from database.dbExecutor import dbExecutor
'''
vse novice so zbrane na eni strani
'''
base_url = 'http://www.mddsz.gov.si'
full_url = 'http://www.mddsz.gov.si/si/medijsko_sredisce/sporocila_za_medije/page/' #kasneje dodas se cifro stran... | true |
f8bf19b17c60f7526d5f88579ea223c56f3e90e4 | Python | Dullz95/BMI-calculator | /class ect.py | UTF-8 | 1,119 | 4.1875 | 4 | [] | no_license | # explanation
class Shapes:
def __init__(self, name, sides):
self.name=name
self.sides=sides
def Area(self):
print("I am a :" + self.name + "\n" + "I have " + self.sides + "Sides")
obj_shapes=Shapes("Shape", "so many ")
obj_shapes.Area()
class Rectangle(Shapes):
def __init__(self,... | true |
ed5aadde35fcbc893b3d3db9681f3e5a4f256e8d | Python | tomwwjjtt/RJB | /crnn/demo_combine_pic.py | UTF-8 | 1,444 | 3.25 | 3 | [] | no_license | import PIL.Image as Image
import os
# 功能:拼接图像
IMAGES_PATH = 'G:/why_workspace/RJB/iam/tmp/images3/' # 图片集地址
IMAGES_FORMAT = ['.jpg', '.png'] # 图片格式
IMAGE_SIZE = 256 # 每张小图片的大小
IMAGE_ROW = 1 # 图片间隔,也就是合并成一张图后,一共有几行
IMAGE_COLUMN = 2 # 图片间隔,也就是合并成一张图后,一共有几列
IMAGE_SAVE_PATH = 'G:/why_workspace/RJB/iam/tmp/... | true |
52081ebc834c007467c98955fd2d1e1a743daf7a | Python | Ahmad-Khalid97/TimeCalculator | /TimeCalculator/time_calculator.py | UTF-8 | 3,851 | 3.375 | 3 | [] | no_license | def add_time(start, duration, *day):
start_time = start.split(':')
duration_time = duration.split(':')
mins = start_time[1]
hr12 = ''
added_string = ''
weekday_list = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
if len(day) != 0:
weekday = (list(day... | true |
a50b4dfd089d72a5dfca4d94824d47f3d94100ed | Python | mastansberry/LeftOvers | /decimal_between_AK.py | UTF-8 | 813 | 4.21875 | 4 | [] | no_license | from __future__ import print_function
def quiz_decimal(low, high):
'''Prints whether user's number is between low and high
low and high are numeric types
returns None
'''
# Prompt fpr the value
print('Type a number between '+str(low)+' and '+str(high)+': ',end='' )
user... | true |
10576128960e69e1545f3401686fb332f851dee0 | Python | soarskyforward/algorithms | /fundamental/sort/heap.py | UTF-8 | 768 | 3.6875 | 4 | [] | no_license | """ HEAPSORT
"""
def left(i):
return 2 * i
def right(i):
return 2 * i + 1
def max_heapify(A, size, i):
l = left(i)
r = right(i)
largest = l if l < size and A[l] > A[i] else i
largest = r if r < size and A[r] > A[largest] else largest
if largest != i:
A[i], A[largest] = A[largest], A[i]
max_hea... | true |
b5bf8a8f3783114d0479d12e4a48f1503eefdc22 | Python | Dan-Staff/ml_flask_tutorial | /ml_flask_tutorial/run.py | UTF-8 | 2,975 | 2.796875 | 3 | [] | no_license | import os
import shutil
from flask import Flask, abort, jsonify, request
from flaskext.zodb import ZODB
from ml_flask_tutorial.models import LinearRegression, DeepThought
def load_model(db, payload):
if payload.get('type') == 'LinearRegression':
new_model = LinearRegression().from_dict(payload)
elif ... | true |
3686887819296f1cd79076bb93b4c0ccbe0c0eea | Python | 891760188/pythonDemo | /test02.py | UTF-8 | 196 | 2.984375 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
#打开一个文件
fo = open("foo.txt",'w')
print '文件名',fo.name,fo.closed,fo.mode,fo.softspace
fo.write("www.runoob.com!\nVery good site!\n我哦我")
fo.close();
| true |
837c51d1ce37841e32b34a23ba80a07c58bd93fa | Python | fzachariah/Gluster-Dashboard | /glusterDashboard-master/gitlab/lib/python3.5/site-packages/perceval/backends/telegram.py | UTF-8 | 12,634 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Bitergia
#
# 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; either version 3 of the License, or
# (at your option) any later version.
#
# This ... | true |
de0c36610cfbfaf25f8aa6d176a64318a0ec4ceb | Python | hkim0991/Project | /Telco_Customer_Churn/2.2_telco_feature_engineering_onehotencoding.py | UTF-8 | 7,330 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 27 02:09:13 2018
@author: kimi
"""
# Import libraries & funtions ------------------------------------------------
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
print(os.getcwd())
#os.chdir('C:/Users/202-22/Documen... | true |
8bb52ba0f4d738913805bc16702698b43671c119 | Python | ankitoct/Core-Python-Code | /21. Numpy One D Ones Function/1. onesFunction.py | UTF-8 | 511 | 4.46875 | 4 | [] | no_license | # 1D Array using ones Function Numpy
from numpy import *
a = ones(5)
#a = ones(5, dtype=int)
print("**** Accessing Individual Elements ****")
print(a[0])
print(a[1])
print(a[2])
print(a[3])
print(a[4])
print()
print("**** Accessing by For Loop ****")
for el in a:
print(el)
print()
print("**** Accessing by For Loop ... | true |
8ea8e43d465d8ea0d925b2691853668345b4bd08 | Python | colbydarrah/cis_202_book_examples | /CH9_serialized_objects.py | UTF-8 | 2,962 | 3.65625 | 4 | [] | no_license | # Colby Darrah
# 3/23/2021
# pg 506
# Serialized Objects
# 1. pickling object pg 506
# 2. unpickling object pg 507
# * serializing an object it is converted to a stream of bytes that can be easily stored
# in a file for later retrieval.
# * sets, dictionaries, lists, tuples, strings... | true |
c0a9fd4d09506aa7cd4dba319b5c9ad069339cfb | Python | S-EmreCat/PythonKursuDersleri | /03-Obje ve Veri Yapıları/lists+3.13uygulama.py | UTF-8 | 782 | 4.09375 | 4 | [] | no_license |
# list=['one','two']
# list2=[3,4,5]
# list3=list+list2 # bu şekilde 2 liste toplanabilir listenin elemanları birbirinden fakrlı olabilir
# # print(len(list3)) # len metodu ile listede kaç eleman var bulunur
# #print(list3[3]) #3. elemanı bastırmak
# # kullanı bilgilerini ayrı eleman olarak bir listede tutma ş... | true |
43c0cb57658a168bfb7951f6f3388917a528cf1a | Python | Inazuma110/atcoder | /cpp/icpcmogi2018/c/main.py | UTF-8 | 881 | 3.046875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(1000000)
from operator import *
ops = {'+':lambda x1, x2: x1 | x2, '*': lambda x1, x2: x1 & x2, '^': lambda x1, x2: x1 ^ x2}
def f(op, s1, s2):
return ops[op](s1, s2)
def toN(s, numbers):
for abc, number in zip(letters, list(numbers)):
s = s.replace(abc, number)
r... | true |
ebe192a8ffda5a2678cfc46c22f6860d4dbae3a6 | Python | chrisgorgo/ClimbingStats | /src/scrappers/route.py | UTF-8 | 3,071 | 2.5625 | 3 | [] | no_license | '''
Created on 21 Nov 2010
@author: Filo
'''
import urllib2, re
from lxml import etree
from StringIO import StringIO
from datetime import datetime
def remove_html_tags(data):
p = re.compile(r'<.*?>')
return p.sub('', data).strip()
def find_date(string):
p = re.compile("\d\d/(Jan|Feb|Mar|Ap... | true |
9d73396dd2eb31d384fafd6f81571e27e877d387 | Python | aayush-kushwaha/python_programming_practice | /Chapter-3/08_pr_04.py | UTF-8 | 119 | 3.859375 | 4 | [] | no_license | #Program to replace double space with single space
st = "I am Aayush Kushwaha"
st = st.replace(" ", " ")
print(st) | true |
0492feeeb2faefc255f07bde4e396829c3db9ac0 | Python | anqichen12/tweeTrend | /real-time/producer.py | UTF-8 | 1,822 | 2.75 | 3 | [] | no_license | import tweepy
import time
from kafka import KafkaConsumer, KafkaProducer
import jsonpickle
from kafka import SimpleProducer, KafkaClient
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import json
from datetime import datetime, timedelta
# twitter setup
consumer_ke... | true |
fa1b887d23a1c9155909b2b961f66d869dec1a93 | Python | AaronRodden/GameAI-FinalProject | /The_Game/classifiers/classifier.py | UTF-8 | 2,147 | 2.625 | 3 | [] | no_license | import keras
import numpy as np
import pandas as pd
import cv2
from matplotlib import pyplot as plt
from keras.models import Sequential
from keras.layers import Conv2D,MaxPooling2D, Dense,Flatten, Dropout
from keras.datasets import mnist
import matplotlib.pyplot as plt
from keras.utils import np_utils
from keras.opti... | true |
ea9a8725544eacb62cb70c867ffd3f3576b391a1 | Python | 5samuel/juego-samuel | /app.py | UTF-8 | 749 | 3.234375 | 3 | [] | no_license | import pygame
import sys
#constatnte
ancho= 800
alto= 600
color_rojo=(255,0,0)
#jugador
jugador_pos =[400,400]
jugador_size=50
#crear ventana
ventana = pygame.display.set_mode((ancho, alto))
game_over = False
#cerrar ventana
while not game_over:
for event in pygame.event.get():
if event.type == pyga... | true |
39f47ecca761ac07d5adee1e28aad5d44ccd4116 | Python | robertobadjio/xlsx-parser | /xlsx-parser.py | UTF-8 | 424 | 2.5625 | 3 | [] | no_license | from openpyxl import load_workbook
wb = load_workbook('')
sheet = wb.get_sheet_by_name('')
import peewee
from peewee import *
db = MySQLDatabase('test', user='root', password='root', host='localhost', port=3316)
Data1 = Table('table1', ('id', 'name'))
Data1 = Data1.bind(db)
maxCountRow = sheet.max_row
for i in ra... | true |
209e265a7011e82db97ab1c90606e2357cada13e | Python | N0NamedGuy/Bitcho | /plugins/console.py | UTF-8 | 1,956 | 2.859375 | 3 | [] | no_license | '''
Created on Nov 6, 2011
@author: David
'''
from plugin_base import PluginBase
from fun_thread import FunThread
import sys
class ConsolePlugin(PluginBase):
def work(self):
while True:
sys.stdout.write("> ")
line = sys.stdin.readline()
if line == "": return
... | true |
0b89ec81ff2a830a68a6da145d9baf378f90f337 | Python | Junga15/Keras2 | /keras2.0/keras10_mlp5_badtest.py | UTF-8 | 6,813 | 2.84375 | 3 | [] | no_license | <<<<<<< HEAD:keras2.0/keras10_mlp5_badtest.py
#keras10_mlp5_badtest.py 실습
#다:다 mlp(다대다 다층퍼셉트론)
#이해 안되는 부분: #3.훈련,평가부분 train size에 대한 주석(앞부분 공부미흡,20210105)
#실습:모델 완전히 쓰레기로 만들어보기
#목표 R2: 0.5이하 / 음수는 안됨
#조건 #2.모델구성부분 layer: 5개 이상,node: 각 10개 이상
#3.훈련,평가 부분 batch_size: 8개 이하, epochs: 30이상
'''
x_test,y_test에 대한 로스외... | true |
9ba3dee5c67258a7eb1df12639e1e300ad579016 | Python | Aasthaengg/IBMdataset | /Python_codes/p00002/s324384362.py | UTF-8 | 108 | 2.78125 | 3 | [] | no_license | import fileinput
for line in fileinput.input():
a, b = map(int, line.split())
print(len(str(a + b))) | true |
dd13f5db75027378796c5f2f7df518adf5a18149 | Python | niwanowa/Information_Theory | /nattobit.py | UTF-8 | 148 | 2.796875 | 3 | [] | no_license | import math
def main():
nat = float(input("nat : "))
bit = nat * math.log2(math.e)
print(bit)
if __name__ == '__main__':
main()
| true |
44388d063f1af6e1ba9f1fba83580b265c9e43fa | Python | m-den-i/bot-server | /channel/contacts.py | UTF-8 | 473 | 2.6875 | 3 | [] | no_license | from typing import Dict
from channel.exceptions import ContactNotFoundException
class Contact:
def id(self):
raise NotImplementedError()
class AddressBook:
def __init__(self):
self.contacts: Dict[str, Contact] = {}
def find_contact(self, search_term: str) -> Contact:
if search_... | true |
6b5abd87a32a158a25cef67e0ac35a1769d0aa53 | Python | ahwinemman/ai_ml_uwaterloo | /ECE 657/Spring 2021/Assignment_2/A2_Q3.py | UTF-8 | 6,809 | 2.6875 | 3 | [] | no_license | import SimpSOM as sps
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from minisom import MiniSom
from sklearn.metrics import mean_squared_error
from sklearn.cluster import KMeans
from random import seed
from random import randint
from tensorflow.keras.models import Sequential, lo... | true |
799c760bc5caab7853b1497b4c56c76d327e1c00 | Python | vstadnytskyi/caproto-sandbox | /caproto_sandbox/io_camera_server.py | UTF-8 | 2,351 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
import termios
import fcntl
import sys
import os
import threading
import atexit
from time import time,sleep
from datetime import datetime
from caproto.server import pvproperty, PVGroup, ioc_arg_parser, run
from numpy import zeros, random
image_shape = (3960,3960)
class Device(object):
dt = 1... | true |
fb2c41301b19c146be4d348e56506d48660f4f35 | Python | ravi4all/Python_Aug_4-30 | /CorePythonAgain/Applications/01-Calculator/02-MenuDrivenCalculator.py | UTF-8 | 707 | 3.9375 | 4 | [] | no_license | def add(x,y):
return x + y
def sub(x,y):
return x - y
def mul(x,y):
return x * y
def div(x,y):
return x/y
def errHandler(x,y):
print("Wrong Choice")
def main():
while True:
print("""
1. Add
2. Sub
3. Mul
4. Div
5. Quit
""")
user_choice = i... | true |
355f7358472f7847db15586db22093ca37535520 | Python | mcohenmcohen/NLP-Recommender | /applicants.py | UTF-8 | 3,791 | 2.78125 | 3 | [] | no_license | import pandas as pd
from lxml import etree, objectify
from StringIO import StringIO
import dataio
dbutils = dataio.DataUtils()
_applicant_df = ''
def get_applicant_data():
'''
Retrieve all relevant user data from the database and preprocess
'''
global _applicant_df
if type(_applicant_df) == pd.Da... | true |
255126a4c29f0be78353ba4f616f6603b8ec9150 | Python | krasznaa/acts-seedfinder-development | /Visualisation/drawSpacePointGroup.py | UTF-8 | 2,271 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python3
#
# Script drawing bottom-middle-top spacepoints corresponding to the same
# SpacePoint group.
#
# Import the necessary module(s).
import argparse
import csv
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
# Parse the command line argument(s).
parser = argparse.ArgumentP... | true |
6e6b77f5ef5ab3ee120e67d19d73dbe4fd93b18e | Python | brian15co/internetPoints | /cloudTools/mainStuff.py | UTF-8 | 247 | 2.890625 | 3 | [] | no_license | '''
This is hopefully something that will work. Hours have been spent
'''
import numpy as np
a = np.array([2,3,4,5])
print a
b = np.append([a], [[3,6,7,7]], axis=0)
print b
for item in b:
for i in item:
print i, | true |
f41b36ad6235f74e532f9f12d1662ffeee4573c6 | Python | FinagleLord/Binance-python-toolkit | /RSIemaCross.py | UTF-8 | 2,094 | 2.796875 | 3 | [
"MIT"
] | permissive | from helper import *
import time, tulipy, os, ctypes, config
from ansicolors import bg, fg, clp
import ansicolors as ac
os.system('cls||clear')
inpos = False
pair = input('What pair: ')
clp('valid intervals - 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M', fg.magenta)
interval = input... | true |
4de0cbd31f432a39bb98219b2e3598b8ee6521d6 | Python | webclinic017/mik-trader | /tests/test_bot.py | UTF-8 | 2,517 | 2.640625 | 3 | [] | no_license | import pytest
from decorators import *
@timer_decorator
def test_available_budget(bot_budget):
available_budget = bot_budget.calculate_available_budget()
assert available_budget["available day trading budget"] == 175
assert available_budget["available hodl budget"] == 0
@timer_decorator
def test_reading... | true |
07dacdab0a2533d41f34f77244d89e74bf68bb68 | Python | defneikiz/MIS3640 | /session02/demo-02.py | UTF-8 | 309 | 3.625 | 4 | [] | no_license | # print('Hello,world')
# print('Hey Jude, Don\'t make it bad')
# print('The sum is', 2+2+2+2)
# print('Hello, {}'.format('world'))
# name= ('Defne')
# print('Congratulations, {:s}, you won {:d}th Academy award.'.format(name, 90))
print('Coordinates of Babson: {lat}, {lon}'.format(lon='71.27W', lat='42.30N')) | true |
c1f6376255fbbe07412076e341b78eaa665ff213 | Python | sontek/sqlalchemy_traversal | /sqlalchemy_traversal/resources.py | UTF-8 | 7,300 | 2.515625 | 3 | [
"MIT"
] | permissive | from sqlalchemy_traversal import get_session
from sqlalchemy_traversal import get_base
from sqlalchemy_traversal import TraversalMixin
from sqlalchemy_traversal import ModelCollection
from sqlalchemy_traversal import filter_query_by_qs
from sqlalchemy_traversal import get_prop_from_cls
from sqlalchemy_traversal import ... | true |
2240250cb3a3d6b438520f77d137b368e798f377 | Python | balanand003/balanand003 | /len21.py | UTF-8 | 77 | 2.859375 | 3 | [] | no_license | P=input()
Q=P[0]
for i in P:
if (P.count(Q)<=P.count(i)):
Q=i
print(Q)
| true |
fee3efc0691c3030c8e1ed554333e8609667b20c | Python | askoj/foulisrandallstudies | /qogpsi/reporting/logs.py | UTF-8 | 762 | 3.28125 | 3 | [] | no_license |
def log_title(title="Insert A Title Here", **kwargs):
indent = kwargs.get('indent', "")
if kwargs.get('new_line', False):
print("\n")
print("%s-------- %s --------" % (indent, title))
def log_subtitle(subtitle="Insert A Subtitle Here", **kwargs):
indent = kwargs.get('indent', "")
if kwargs.get('new_line', Fals... | true |
3e48019aac0b951de112c82da2ab797b8fd8f9ea | Python | HoYaStudy/Python_Study | /playground/pyqt/QThread/worker.py | UTF-8 | 951 | 2.65625 | 3 | [] | no_license | from PyQt5.QtCore import QThread, QWaitCondition, QMutex, pyqtSignal
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QLineEdit
class Worker(QThread):
changed_value = pyqtSignal(int)
def __init__(self):
super().__init__()
self._status = True
self.cond = QWaitCondition()
... | true |
0bc528e261710c085b47d739ad96378da0e06ac4 | Python | ADL175/http-server | /src/test_servers.py | UTF-8 | 2,832 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Test HTTP server."""
import pytest
# # Echo server tests
# LESS_THAN_BUFFER_LENGTH_TABLE = [
# ('yes yes', 'yes yes'),
# ('no no', 'no no'),
# ('what what', 'what what')
# ]
#
# LONGER_THAN_SEVERAL_BUFFER_LENGTHS_TABLE = [
# ('here is a string that is long', 'here is a strin... | true |
16cee799a36300bcc5111abcce45275c08a7aa21 | Python | WachirawitV-code/code-python | /shape.py | UTF-8 | 176 | 3.234375 | 3 | [] | no_license | def calCircle(radius):
return 22/7*(radius**2)
def calTriangle(width,height):
return 1/2*width*height
def calRectangle(width,heigth):
return width*height
| true |
2feb3e361c48080f33df37e5469ad72c2f49d607 | Python | Ayushi13598/PDF-Extraction | /pdf_extractor.py | UTF-8 | 1,098 | 2.859375 | 3 | [] | no_license | import io
from pdfminer.converter import TextConverter
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfpage import PDFPage
def extract_text_from_pdf(pdf_path):
resource_manager = PDFResourceManager()
fake_file_handle = io.StringIO()
... | true |
a63f0b6215d8061dd5a3712ef3469a73dfe8acbb | Python | wmakaben/AdventOfCode | /d06.py | UTF-8 | 596 | 3.15625 | 3 | [] | no_license | file = open("input/d06.txt", 'r')
count = 0
group = 0
questions = {}
def getQuestionCount (questionMap, groupCount):
c = 0
for qCount in questionMap.values():
if qCount == group:
c += 1
return c
for line in file:
line = line.rstrip()
if line == "":
count += getQuestion... | true |
9f06cb82378d170ec689b08f7ab892b8658e3c37 | Python | mouroboros/python_exercises | /Roman/roman_testcases.py | UTF-8 | 674 | 3.890625 | 4 | [] | no_license |
import unittest
def roman (number):
numeral = ''
if number < 5 :
for x in range(number) :
numeral += "I"
else : numeral = "V"
return numeral
class roman_numeral_testcases (unittest.TestCase) :
# notice the roman numeral is a string.
# so you need to build strings
... | true |