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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1d0b24c040b2e90ab07bc220356805b27cc475b5 | Python | diesnatalis/Codewars---Python | /Square_Every_Digit.py | UTF-8 | 373 | 4.21875 | 4 | [] | no_license | def square_digits(num):
#num = str(num)
list = []
for char in str(num):
list.append(int(char)**2)
s = ''.join(map(str, list))
return(int(s))
# In this kata, you are asked to square every digit of a number.
# For example, if we run 9119 through the function, 811181 will come out.
# Note: Th... | true |
6958c0d6448333b97f5f8fc44af8c5bca1d89edc | Python | salvaom/sequencer | /docs/source/_static/sample_copy.py | UTF-8 | 721 | 2.578125 | 3 | [] | no_license | from __future__ import print_function
import sequencer
import os
import shutil
# Source and target folders
source_dir = 'test/resources/seq_01'
target_dir = 'target'
# List the source files
source_files = [os.path.join(source_dir, x) for x in os.listdir(source_dir)]
# Collect the sequence
seq = sequencer.collect(so... | true |
4dc80a9f1490408a8bbdf1c27b07e704abce370a | Python | btframer/aext | /test_scripts/parse_frame.py | UTF-8 | 502 | 2.984375 | 3 | [] | no_license | import sys
import src.frame as fr
#FILENAME = "input.bin"
FILENAME = ""
if (len(sys.argv) < 2) and len(FILENAME) == 0:
print ("Required parameters: filename")
print ("python parse_frame.py input.bin")
sys.exit(0)
FILENAME = sys.argv[1]
input_frame = fr.Frame()
with open(FILENAME, "rb") as f:
bytes_... | true |
3ee8965226a06f9387eabbf63c7c257785ff28f1 | Python | cadeParade/bio_journal_text_mining | /query_class_def.py | UTF-8 | 1,924 | 3.140625 | 3 | [] | no_license |
class Query(object):
def __init__(self):
self.q1 = None
self.q1_syns = None
self.q1_syns_checked = None
self.q1_search_string = None
self.q2 = None
self.q2_syns = None
self.q2_syns_checked = None
self.q2_search_string = None
syn_dict = None
def make_syn_dict(self, filename):
raw_dict ... | true |
58151d9c38d839d45be43b37adccd6ca02e997ef | Python | mmazepa/learning-python | /src/hangman.py | UTF-8 | 3,140 | 3.4375 | 3 | [] | no_license | import random
from lib.text_based_user_interface import framedText, textWithIndent, inputWithIndent, log, newLine, clear
def header():
textWithIndent(" _ _ ", 3)
textWithIndent("| | | | __ _ _ __ __ _ _ __ ___ __ _ _ __ ", 3)
textWithIndent("| |_| |/ _` | '_ ... | true |
d6f986b7995ab841bd59b7a7f2e6e474adf4728e | Python | carmeleve/AoC-2018 | /Day3/Day3Pt1.py | UTF-8 | 838 | 3.109375 | 3 | [] | no_license |
file_path = r"C:\Users\CarmelEve\Documents\GitHub\AoC-2018\Day3\input.txt"
file_object = open(file_path, 'r')
coord_list = {}
for line in file_object:
line = line.split('@')[1].strip()
coord = line.split(':')[0].strip()
length= line.split(':')[1].strip()
x_start = int(coord.split(',')[0])
y_star... | true |
2b598fd7d8364164b33e9f8a271bedff9044fbc3 | Python | zx2229/web-scraping-with-python | /python3/chapter5-scrapyProject/weather/weather/spiders/wuHanSpider.py | UTF-8 | 1,213 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from weather.items import WeatherItem
class WuhanspiderSpider(scrapy.Spider):
name = 'wuHanSpider'
allowed_domains = ['tianqi.com']
citys = ['shenzhen']
start_urls = []
for city in citys:
start_urls.append('https://www.tianqi.com/'+city+'/')
def pa... | true |
6d726f9b8fcbee8f289a32148c3996dae3dd1997 | Python | kiranmurali93/pyopengl_lab | /ddaAlgo.py | UTF-8 | 1,239 | 3.265625 | 3 | [] | no_license | # dda algo
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
# Function for round off the pixel value
def ROUND(a):
return int(a+0.5)
# init function
def init():
glClearColor(0.0,0.0,0.0,1.0)
glColor3f(1.0,0.0,0.0)
glPointSize(2.0)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluOrtho2... | true |
edfd58076bf24d8ab00cb83add3647a8cc873614 | Python | l-yb/vocabulary | /common/middleware/custom_request_and_response_middleware.py | UTF-8 | 1,516 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-#
#
# Project: vocabulary
# Name: custom_request_and_response_middleware
# Author: lzq
# Date: 4/16/21 3:32 PM
#
from django.http import JsonResponse
from django.utils.deprecation import MiddlewareMixin
# 自定义请求响应处理中间件
class CustomRequestAndResponseMiddleware(Midd... | true |
cd42ef87cade03b5b59d74e8ab0a977e14fb2781 | Python | omar9717/Qodescape | /src/nodetypes/_filename_node.py | UTF-8 | 786 | 3.46875 | 3 | [] | no_license | '''
Create a node for the File name.
Filename or Namespace would be the root node for each file.
e.g. test.php
HOW IT WORKS!
1.) It creates "test" node with following labels if it is not there already.
- FILENAME
- This is the very first node that it creates if there is no "namespace... | true |
073153d9bf1a09afcb386eeb90496da8e4b93af3 | Python | emurph1/ENGR-102-Labs | /Lab03/Activity3.py | UTF-8 | 2,280 | 3.75 | 4 | [] | no_license | # coding=utf-8
# By submitting this assignment, all team members agree to the following:
# “Aggies do not lie, cheat, or steal, or tolerate those who do”
# “I have not given or received any unauthorized aid on this assignment”
# Emily Murphy
# Mason Fields
# Kelsey Wright
# Ryan Oakes
# Lab 03 Activity 3
#... | true |
2e5bd24a71980920b8df9138e747edf2eda7c0a7 | Python | BerilBBJ/scraperwiki-scraper-vault | /Users/J/Julian_Todd/status-of-treaties.py | UTF-8 | 28,080 | 2.5625 | 3 | [] | no_license | # Needs parsing of list of countries per treaty and any signing statements
# Call to action: Which treaties has your nation not signed that you think it should sign?
import scraperwiki
import urllib, urlparse
import lxml.etree, lxml.html
import re, datetime
def Main():
url = "http://treaties.un.org/pages/Partic... | true |
68780cac485233107f7aaccdca2db2528fb1fbed | Python | liushilive/github_exercise_python | /md/exercise/code/116.py | UTF-8 | 261 | 3.828125 | 4 | [] | no_license | def Hanoi(n, ch1, ch2, ch3):
if n == 1:
print(ch1, '->', ch3)
else:
Hanoi(n - 1, ch1, ch3, ch2)
print(ch1, '->', ch3)
Hanoi(n - 1, ch2, ch1, ch3)
N = int(input("请输入盘子的数量:"))
Hanoi(N, 'A', 'B', 'C')
10
| true |
8ce9fdfcac0983b261deaab11d379dad7df974de | Python | isidro1108/Domino | /player.py | UTF-8 | 3,130 | 3.3125 | 3 | [] | no_license | from random import randint
class Player:
def __init__(self, name):
self.name = name
self.points = 0
self.tokens = []
self.directions = {'l': 0, 'r': -1}
self.in_step = ''
def take_tokens(self, table):
for n in range(7):
self.tokens.append(table.token... | true |
c865dbad70dcaf8b56803d9815317d848dbc1293 | Python | Celdir/Reactive | /game/classes.py | UTF-8 | 3,110 | 2.796875 | 3 | [
"MIT"
] | permissive | import flask
import requests
LB_SERVER = "http://aws1.bitwisehero.com/"
class User:
def __init__(self, name, id, clan):
self.name = name
self.id = id
self.clan = clan
self.total_score = 0
self.current_score = 0
def set_total_score(self, score):
self.total_s... | true |
3f30669c62c586df9e364a6b98009da6e0addb69 | Python | mtchibozo/Telecom | /Data Science/Scholar-Affiliation-Recognition-Project/paf-affiliations-data_mining/GROBID_Extractor.py | UTF-8 | 2,264 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Propose des fonctions pour accéder aux informations extraites par Grobid d'un pdf et stockées au format XML
"""
from bs4 import BeautifulSoup
from XMLFinderGenerator import NoSuchTagException
from Metadata_interfacer import Status
# note : est un doublon de la mme fon... | true |
67063d8ce114b0aa6475f55443f4e4e283f344a4 | Python | xdd-xoo/GuestBook | /guestbook.py | UTF-8 | 1,470 | 2.765625 | 3 | [] | no_license | # coding: utf-8
import shelve
from flask import Flask, request, render_template, redirect, escape, Markup
from datetime import datetime
application = Flask(__name__)
DATA_FILE = 'guestbook.dat'
def save_data(name, comment, create_at):
database = shelve.open(DATA_FILE)
if 'greeting_list' not in database:
... | true |
bc0e9a091511af7cdaeb1500300e9f5725fe97ba | Python | yohannbalawender/qoin | /src/blockchain/block.py | UTF-8 | 2,638 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import hashlib
import ecdsa
DIFFICULTY = 1
def has_proof_of_work(hash):
# Number of most significant bytes that are zero.
return int(hash[:DIFFICULTY], 16) == 0
def hash_block(_str):
sha = hashlib.sha256()
sha.update(_str.encode('utf-8'))
return sha.hexdigest()
class Block:... | true |
dbe56139dc8f788debe08ec97bcfa2529a98fd4f | Python | chiragjn/advent-of-code-solutions | /2017/solutions/day15_part1.py | UTF-8 | 905 | 3.40625 | 3 | [] | no_license | """
Tried doing some functional programming stuff
This runs much slower than I expected. I suck at this :|
"""
import functools
import itertools
import operator
def generate(seed_a, seed_b):
prev_a, prev_b = seed_a, seed_b
while True:
next_a = (16807 * prev_a) % 2147483647
next_b = (48271 * ... | true |
b154d903d0d8e18ba3b4deae46a214954b79093b | Python | rena-puchbauer/backup-script | /main.py | UTF-8 | 7,942 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python -tt
"""
Rena Puchbauer, 09/2018
Purpose of script:
As soon as a file is saved on the Desktop,the file should be renamed to the current date+original filename,
so foo.pdf should would be renamed to 2018-08-24-03:46:12_foo.pdf and then moved to a local backup folder. After the
file was moved to the B... | true |
ababa8366ffd6aba1d68dba8039bbc77f974e15d | Python | CHURLZ/Game | /God.py | UTF-8 | 1,029 | 2.5625 | 3 | [] | no_license | class God():
cameraX = 100
cameraY = 0
CAMERA_SPEED_NORMAL = 5
CAMERA_SPEED_FAST = 15
cameraSpeed = CAMERA_SPEED_NORMAL
cameraSpeedX = 0
cameraSpeedY = 0
key_w = False
key_s = False
key_a = False
key_d = False
key_LSHIFT = False
movedSinceLastLoop = True
def __init__(self):
print "allahu akbar"
d... | true |
c7ae3dde924733e07aac85f2804bfacf2f5c9810 | Python | georstef/Python_ObjectOrientedProgramming | /chapter9_Abstract.py | UTF-8 | 2,140 | 3.34375 | 3 | [] | no_license | def format_m(m):
return '0' + m if len(m) == 1 else m
def format_d(d):
return '0' + d if len(d) == 1 else d
def format_y(y):
return '20' + y if len(y) == 2 else y
def format_base_cents(base, cents):
base, cents = (str(x) for x in (base, cents))
if len(cents) == 0:
cents = '00'
elif le... | true |
a1e51120f828cadda0f43c2e5725157b00af8092 | Python | brucehzhai/Python-JiangHong | /源码/Python课后上机实践源代码/ch14-数值日期和时间处理/P13-prg-3-YearMonth从1年1月1日天数Days.py | UTF-8 | 820 | 3.796875 | 4 | [] | no_license | from calendar import *
def ndays(y,m):
#每个月的正常天数
monthDay=[31,28,31,30,31,30,31,31,30,31,30,31]
days = monthDay[ m-1]
if (m==2 and isleap(y)):
days+=1
return(days)
def fromdays(y,m,d):
days = 0
for i in range(1,y):
days += 365
if(isleap(i)): days+=1
f... | true |
3084c217d24b866da3c6855ecef4659e28225449 | Python | FaydSpeare/DQN | /mcts/uct/test.py | UTF-8 | 566 | 2.828125 | 3 | [] | no_license | import time
from games.tictactoe import TicTacToe
from games.connect4 import Connect4
from mcts.uct.uct import uct
if __name__ == '__main__':
state = Connect4()
print(state)
step = 0
while not state.result()[1]:
if step % 2 == 1:
action = int(input('Action: '))
else:
... | true |
2bef816a1850d218025aa6f64ed530664762a817 | Python | behrouzmadahian/python | /python-Interview/9-binarySearchTree/1-search-insertion.py | UTF-8 | 1,918 | 4.59375 | 5 | [] | no_license | '''
Binary Search Tree, is a node-based binary tree data structure which has the following properties:
The left subtree of a node contains only nodes with keys less than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also... | true |
e1f14e804fa513f31a9239297888f877cfc4f432 | Python | aalto-speech/kaldi-utensils | /bottom-drawer/length_ratio_filter_parallel_text.py | UTF-8 | 3,632 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# This script filters parallel texts by a simple length ratio heuristic.
# Also filters texts where either or both texts are empty.
# The idea is from: https://wit3.fbk.eu/papers/WIT3-EAMT2012.pdf
# Essentially:
# "[P]airs of aligned [phrases] are marked as unreliable --
# if their length ratio... | true |
76553eb7dc2f394184e4bd518f7343b023ca431d | Python | Pan0322/Keras-Installation-Guide | /cross_validation_example.py | UTF-8 | 1,197 | 3.578125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Tutorial on how to tune parameters using cross-validation.
In this example, we want to tune the parameters of KNN and find the best parameters 'n_neighbor'.
"""
from sklearn.model_selection import cross_val_score, train_test_split
from sklearn import datasets
from sklearn.neighbor... | true |
c1f85a04a1573a69e736b2aad3271fb10d18abae | Python | Ooblioob/pantheon | /devdash/appring.py | UTF-8 | 2,223 | 2.671875 | 3 | [
"CC0-1.0"
] | permissive | # from https://github.com/dgreisen/django-traversal/blob/master/appring.py
# Apache 2.0 licensed
try:
from django.db.models.loading import AppCache
apps = AppCache()
except:
from django.apps import apps
from django.conf import settings
from importlib import import_module
from types import ModuleType
class... | true |
15975c9047d28d6c253fd9fce84f73d484b4a1ea | Python | nathanb97/TheorieGraphe | /TP1/1-StructuresDeDonnees/graph_networkx.py | UTF-8 | 1,478 | 2.53125 | 3 | [] | no_license | import networkx
def Graph(vertices, edges):
G = networkx.Graph()
G.add_nodes_from(vertices)
if edges:
if len(edges[0]) == 2:
G.add_edges_from(edges)
else:
G.add_weighted_edges_from(edges)
return G
def show(graph, fig=None):
import bqplot.marks
from ipywi... | true |
ff4e946f753783626e56d9688bd0caf8dead5521 | Python | codeants2012/torecsys | /torecsys/models/emb/starspace.py | UTF-8 | 2,080 | 2.640625 | 3 | [
"MIT"
] | permissive | from . import _EmbModel
from torecsys.layers import StarSpaceLayer
from torecsys.functional import inner_product_similarity
from torecsys.utils.decorator import jit_experimental
from functools import partial
import torch
from typing import Callable, Tuple
class StarSpaceModel(_EmbModel):
r"""StatSpaceModel"""
... | true |
312636b13b5d3adf09f7dad0f69699b0f018c717 | Python | xxxvik-xakerxxx/Python | /laba2-2ts.py | UTF-8 | 2,396 | 2.671875 | 3 | [] | no_license | from Tkinter import *
root = Tk()
def add():
winadd = Toplevel (root)
winadd.title("Add")
# fr_ent = Frame (winadd,bg="gray").grid(row=0,column=1,columnspan=2)
ent0 = Entry (winadd).grid(row=0,column=0)
ent1 = Entry (winadd).grid(row=0,column=1)
ent2 = Entry (winadd).grid(row=0,column=2)
... | true |
59cfd0eea2369d84348f3ef63e973f014e129755 | Python | KKGames/VyperPaperScissors | /test.py | UTF-8 | 9,239 | 2.640625 | 3 | [] | no_license | from eth_tester import EthereumTester
import json
from pprint import pprint
import web3
from web3 import Web3
from web3.contract import ConciseContract
# https://pypi.org/project/eth-tester/
# https://web3py.readthedocs.io/en/stable/contracts.html
t = EthereumTester()
accounts = t.get_accounts()
# web3.py insta... | true |
f962f77ccd64f7c11fb26aee1fe61acd3ff56795 | Python | ekiro/haps | /haps/application.py | UTF-8 | 2,059 | 2.796875 | 3 | [
"MIT"
] | permissive | from typing import Any, List, Type
from haps import Container
from haps.config import Configuration
from haps.exceptions import ConfigurationError
class Application:
"""
Base Application class that should be the entry point for haps
applications. You can override `__main__` to inject dependencies.
""... | true |
a6c82a7cb558125143aaecd019e342044334c495 | Python | AWilcke/Dissertation | /src/netreg/utils.py | UTF-8 | 3,335 | 2.6875 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
from torchvision import transforms
import torch
from torch.utils.data.dataloader import default_collate
from torch import nn
def id_init(m, dim=None, *args, **kwargs):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
w = torch.zero... | true |
dfeb816476fb1b497b84eb0907404ddc0b2dc70d | Python | alvinwang1021/ML_Alvin_3.6 | /resource/TestAndLearn/APC1415.py | UTF-8 | 4,094 | 2.515625 | 3 | [] | no_license | '''
Created on 3 Jan. 2018
@author: Alvin UTS
'''
import pandas as pd
import numpy as np
from scipy import sparse
from sklearn.decomposition import LatentDirichletAllocation
def topic(df, num_topics=5):
"""
Represent the topics features of original features
:param df: pandas DataFrame
:p... | true |
c9fb800c3a23dd68fd3d9a824164cc7e99d3586c | Python | csesoc/lab0 | /server/lib/config.py | UTF-8 | 829 | 3 | 3 | [
"MIT"
] | permissive | config: dict
def readConfig(file="settings.ini") -> dict:
_defaultFile = "settings.ini"
_skeletonFile = "settings.example.ini"
import os.path
if file == _defaultFile and not os.path.isfile(file):
if not os.path.isfile(_skeletonFile):
raise Exception("Missing settings skeleton file!"... | true |
cfcf9db91e5db8fd160c0128f0e225d19699a7cf | Python | riven314/DeepLearning-Navigation | /scene_summary.py | UTF-8 | 3,687 | 3.359375 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | """
implement an algorithm for scene understanding
divide segmentation result by grids and describe objects in each grid
"""
import os
import sys
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
def get_names():
names = {}
names[1] = 'wall'
names[2] = 'flo... | true |
3c8036eb3a95ea2df05f652e465b24ec152a4b32 | Python | Hellemos/python-para-zumbis | /Funções/q5.py | UTF-8 | 638 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
5. Faça um programa com uma função chamada somaImposto. A função possui dois
parâmetros formais: taxaImposto, que é a quantia de imposto sobre vendas expressa
em porcentagem e custo, que é o custo de um item antes do imposto. A função “altera”
o valor de custo para inclui... | true |
8e04f716ad3be0fba22816692ce6a936749d1246 | Python | shruti-mathur/Python-Projects | /DataHandling/StringBasic_ConsoleCode.py | UTF-8 | 520 | 3.1875 | 3 | [] | no_license | Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> a = "Lets do this"
\
>>> a[0]
'L'
>>> a[-2]
'i'
>>> a[0:5]
'Lets '
>>> a[3:6]
's d'
>>> a[3:6] # this will go till 6-1 = 5th position
's d'
>>... | true |
60ded38b5e59e2887d997a6dd7f03c893d7c7508 | Python | sesantander/DockerProject | /dash/app.py | UTF-8 | 3,775 | 2.75 | 3 | [] | no_license | import dash
import dash_core_components as dcc
import dash_html_components as html
import mysql.connector
import plotly.express as px
import pandas as pd
import numpy as np
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
connec... | true |
9b8fd0b2a1e182a17bfdaf44ce9d3e7251a4b618 | Python | ryanmahardika/meetingroom | /FullHouse.py | UTF-8 | 15,744 | 2.734375 | 3 | [] | no_license | kartu=['2','3','4','5','6','7','8','9','10','J','Q','K','A'],\
['h','k','s','w']
inc=0
tot=0
# hks-hk
for i in range(13):
for j in range(13):
for k in range(3):
if kartu[0][i] == kartu[0][j]:
continue
else:
print(kartu[0][i],end='')
... | true |
f26a2ceb31f9c3ccf235bebf24418eb1d30702df | Python | JeanChrist/FOR-FUN | /douban_top250.py | UTF-8 | 1,464 | 2.578125 | 3 | [] | no_license | # coding: utf-8
"""
Created on Tue Sep 5 13:42:26 2017
@author: C
"""
from lxml import html
import requests
i = 0
counts = 0
while i <= 250:
url = 'https://movie.douban.com/top250?start='+str(i)+'&filter='
i += 25
r = requests.get(url).content
sel = html.fromstring(r)
title = sel.xpat... | true |
6b9e22e769c53ae59353c804a3f1137acd05a7bd | Python | mpresh/rf | /tests.py | UTF-8 | 2,535 | 2.796875 | 3 | [] | no_license | import optparse
import unittest
import urllib
from BeautifulSoup import BeautifulSoup
#
# Constants
#
WEBROOTS = dict(local = 'http://www.demo.com:8000/',
qa = 'http://qa.ripplefunction.com/',
prod = 'http://www.ripplefunction.com/')
WEBROOT = WEBROOTS.get('local') # Overridden by ma... | true |
7c5da62e502daf127a506148d0b6fc0b7d6a80c4 | Python | RoslinErla/Verklegt_namskeid_1 | /Glærur frá Óla/video_rent/services/VideoService.py | UTF-8 | 523 | 2.671875 | 3 | [] | no_license | from repositories.VideoRepository import VideoRepository
class VideoService:
def __init__(self):
self.__video_repo = VideoRepository()
def add_video(self, video):
if self.is_valid_video(video):
self.__video_repo.add_video(video)
def is_valid_video(self, video):
#he... | true |
aeaf7b84634743673019119731511e04f85da067 | Python | Mrs-wang1/python-test | /homework/6.select_courses/utils/print_log.py | UTF-8 | 408 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: vita
def print_info(info, log_type="info"):
"""
输出提示信息!
:param info: 输入要输出的提示信息
:param log_type: 根据log_type的不同,提示信息的颜色不同
:return:
"""
if log_type == "info":
print("\033[32;1m %s \033[0m" % info)
else:
print("\033[31... | true |
b07e511a206a5f0ca1bce05d57bf1b96bd3d09e7 | Python | himichael/LeetCode | /src/1_100/0088_Merge_Sorted_Array/Merge_Sorted_Array.py | UTF-8 | 628 | 3 | 3 | [
"Apache-2.0"
] | permissive | class Solution(object):
def merge(self, a, n, b, m):
"""
:type nums1: List[int]
:type m: int
:type nums2: List[int]
:type n: int
:rtype: None Do not return anything, modify nums1 in-place instead.
"""
i=n-1
j=m-1
index = n+m-1
... | true |
1a6b5610939e5e34be2bf897f66a48bdf8b5b221 | Python | Hyuto/bangkit-ml-2021 | /prepare.py | UTF-8 | 4,617 | 2.796875 | 3 | [] | no_license | import os, logging, coloredlogs
import urllib.request
from tqdm.auto import tqdm
class DownloadProgressBar(tqdm):
def update_to(self, b=1, bsize=1, tsize=None):
if tsize is not None:
self.total = tsize
self.update(b * bsize - self.n)
def download_url(url, output_path, name):
try:
... | true |
269019ffa10c33a3a8d879a52cb1ec452481a0be | Python | wuqiangroy/something | /cookbook/string_and_text/2.3.py | UTF-8 | 829 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python
# _*_ coding:utf-8 _*_
"""利用shell通配符做字符匹配
*代表多位
?代表一位
"""
from fnmatch import fnmatch, fnmatchcase
a = "aaabbbccc"
print(fnmatch(a, "*cc"))
print(fnmatch(a, "aa*"))
print(fnmatch(a, "?cc"))
names = ["gaojiuli", "hewen", "wuqiang", "xusanduo"]
# 把名字中最后一位含i的找出来
new_names = [name for na... | true |
ff4f40288ba77ba48be474992534cb8999cea2e6 | Python | lujames13/calcuScore | /calcuScore.py | UTF-8 | 2,728 | 3.234375 | 3 | [] | no_license | import sys
import numpy as np
import datetime
import dbTool
'''
input:
UID(int) -- User ID
GID(int) -- Game ID
CID(int) -- Class ID
Time(int) -- the time player used to finish the game.
Manip(int) -- the manipulate times player used in game.
Time_std(int) -- the sta... | true |
e85131c1c45ad22b65bb9744dbe6d2b39d6898b1 | Python | xianlopez/ssd_tf2 | /compute_iou.py | UTF-8 | 2,477 | 2.8125 | 3 | [] | no_license | import numpy as np
def compute_iou_flat(boxes1, boxes2):
# boxes1 (nboxes1, 4) [xmin, ymin, width, height]
# boxes2 (nboxes2, 4) [xmin, ymin, width, height]
nboxes1 = boxes1.shape[0]
nboxes2 = boxes2.shape[0]
boxes1_expanded = np.expand_dims(boxes1, axis=1) # (nboxes1, 1, 4)
boxes1_expanded =... | true |
2ec283fcf691681e5b06c949ec5188316e44795b | Python | joon3007/Algorithm | /greedy/Coin_problem.py | UTF-8 | 954 | 3.578125 | 4 | [] | no_license | '''
description
준규가 가지고 있는 동전은 총 N종류이고, 각각의 동전을 매우 많이 가지고 있다.
동전을 적절히 사용해서 그 가치의 합을 K로 만들려고 한다. 이때 필요한 동전 개수의 최솟값을 구하는 프로그램을 작성하시오.
input
첫째 줄에 N과 K가 주어진다. (1 ≤ N ≤ 10, 1 ≤ K ≤ 100,000,000)
둘째 줄부터 N개의 줄에 동전의 가치 Ai가 오름차순으로 주어진다. (1 ≤ Ai ≤ 1,000,000, A1 = 1, i ≥ 2인 경우에 Ai는 Ai-1의 배수)
output
첫째 줄에 K원을 만드는데 필요한 동전 개수의 최솟값... | true |
0241ab3e5dbe5f422d1a8483dbc36a30b8b972df | Python | rsedlr/Python | /while loop example 2.0.py | UTF-8 | 644 | 4.09375 | 4 | [] | no_license | go = input("Do you want to play? y or n > ")
while go == "y":
TargetNumber = int(input("Tell me a number > "))
guess = int(input("Guess a number between 1 and 10. > "))
while guess != TargetNumber and guess < 10:
print("Wrong, Try again")
guess = int(input("Guess between 1 and 10. > "... | true |
934a3561a7da9dae58f0198833d574059fb3cf42 | Python | mingweihe/leetcode | /_0332_Reconstruct_Itinerary.py | UTF-8 | 557 | 3.40625 | 3 | [] | no_license | import collections
class Solution(object):
def findItinerary(self, tickets):
"""
:type tickets: List[List[str]]
:rtype: List[str]
"""
routes = []
targets = collections.defaultdict(list)
for a, b in sorted(tickets)[::-1]:
# comma , here equals [b]... | true |
5bf26a060e8294238d9eebef9a374b4306e562f9 | Python | lshays/projectEuler | /python/p047.py | UTF-8 | 869 | 3.265625 | 3 | [] | no_license | def primeGen():
p = 2
d = {}
while True:
if p not in d:
yield p
d[p**2] = [p]
else:
for f in d[p]:
d.setdefault(f+p, []).append(f)
del d[p]
p += 1
def getPrimeFactors(n, l):
if n == 1:
return []
for p i... | true |
de987105d2421ea387f79152c95f673c60ba52bd | Python | ribosomeprofiling/ribopy | /ribopy/cli/rnaseq.py | UTF-8 | 3,818 | 2.734375 | 3 | [
"MIT"
] | permissive | from .main import *
from ..rnaseq import *
@cli.group()
def rnaseq():
"""
Display, set or delete RNA-Seq data
"""
pass
@rnaseq.command()
@click.argument('ribo', type = click.Path( ))
@click.option('-n', '--name',
help = "experiment name",
type = click.STRING ... | true |
768e476ff70116c0266b22b7fb2618c9c42ca20f | Python | santoshkjain/python | /hello.py | UTF-8 | 163 | 3.765625 | 4 | [] | no_license | a = int(input('Please enter first number: '))
b = int(input('Please enter second number: '))
c = a + b
print('Output is: ' + str(c))
print('Output is: ' , c)
| true |
9db5f2ce8c73aa2d1e798d96a07a3bbffb42cf9e | Python | dwasse/hfd-crypto | /deribit/deribitWebsocket.py | UTF-8 | 1,401 | 2.53125 | 3 | [] | no_license | import asyncio
import websockets
import json
import ast
import logging
import time
class DeribitWebsocket:
def __init__(self, message_callback=None):
self.channels = []
self.message_callback = message_callback
self.url = 'wss://www.deribit.com/ws/api/v2'
self._shutdown = False
... | true |
d5469b54fa3ddf53877c40de17f6f9e0b38aeb28 | Python | REDsake/CS641A-assignment | /script.py | UTF-8 | 361 | 2.59375 | 3 | [] | no_license | from string import ascii_lowercase
print('3idiots')
print("5pointssomeone")
print("4")
print("read")
print("password")
print("c")
file = open("/home/rajan/Documents/Break-DES-6-round-using-chosen-plain-text-attack-master/input_random.txt",'r+')
for i in range(0,200001):
# for i in range(0,10):
print(file.readline())
... | true |
69591ad77fd036128eeb863bd41defd383a2c6d5 | Python | Sushma3593/illumio | /Firewall.py | UTF-8 | 2,156 | 3.09375 | 3 | [] | no_license | csv_file_path = "firewall_rules.csv"
class Port:
def __init__(self,port):
self.port_range = False
if "-" in port:
pstart,pend = port.split("-")
self.pstart = int(pstart)
self.pend = int(pend)
self.port_range = True
else:
self.port = int(port)
def port_match(self, input_port):
if self.port_ran... | true |
cc5c78ed825b48ba8bb5d567f5d347914166a673 | Python | Thomas-Neill/misc | /patternmatch.py | UTF-8 | 5,359 | 3.09375 | 3 | [] | no_license | import re
class ParseString:
def __init__(self,string):
self.str = string
def munch(self,n):
self.str = self.str[n:]
def accept(self,n):
result = re.match('^' + n,self.str)
assert result
self.munch(len(result.group(0)))
return result.group(0... | true |
6a022f9f58ebb8b29b1a6a28ab0986e8311a2066 | Python | Aasthaengg/IBMdataset | /Python_codes/p03546/s439181616.py | UTF-8 | 716 | 2.765625 | 3 | [] | no_license | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
H, W = map(int, readline().split())
C = [list(map(int, readline().split())) for _ in range(10)]
A = list(map(int, read().... | true |
aa165c4256c57fce85ec54bbf3b2723b88b8ef2a | Python | jimmy-guo/twitter-sentiment-analysis | /program.py | UTF-8 | 1,316 | 3.328125 | 3 | [
"MIT"
] | permissive | import pickle
from utilities import Tweet # necessary for loading tweet objects
from utilities import preprocess
from utilities import BayesSentimentClassifier
from utilities import accuracy_score
from sklearn.cross_validation import KFold
def main():
# load the tweet objects
tweets = pickle.load(open('tweet... | true |
1f71bc33495f14bdd546f3c51e82d06ce2d8187b | Python | Louis-Gabriel-TM/computer_science | /4_classic_puzzles/4_1_with_arrays/is_rotation.py | UTF-8 | 948 | 3.84375 | 4 | [] | no_license | """
Puzzle Wording
==============
Given two arrays with no duplicates, write a function that returns True if on array is a rotation of the other: same sequence in the same order but starting at a different index.
"""
def is_rotation_with_slices(array_1, array_2):
if set(array_1) == set(array_2):
for i, e... | true |
fdf60743e22c6c125e0af5717349d098fb639fc2 | Python | harshalms/python | /basics/bubble_sorting.py | UTF-8 | 1,207 | 4.40625 | 4 | [] | no_license | '''HackerRank
Day 20: Sorting
Objective
Today, we're discussing a simple sorting algorithm called Bubble Sort.
Check out the Tutorial tab for learning materials and an instructional video!
Task
Given an array,a, of size n distinct elements, sort the array in ascending order using the Bubble Sort algorithm above.
On... | true |
902fe01c9ba0b6688ee65bb1aa2648c9e18eaeaa | Python | AmarNathH/software | /deprecated/misc/mission_state_viewer_client.py | UTF-8 | 1,669 | 3.265625 | 3 | [
"BSD-3-Clause"
] | permissive | """
mission_state_viewer_client.py
Reads mission state from mission_state_viewer.py
so that it can draw the robot's 'thoughts' onto
the screen with a pygame window.
Run mission_state_viewer.py on the vehicle and
this on a local computer.
Modify HOST to be the proper host IP address."""
import socket
import time
impo... | true |
1ac252a9b98ace45645d774e43aebf56a5a28be2 | Python | roastedpork/luko | /projection_mapping/gui_opencv.py | UTF-8 | 3,968 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import time
import math
import random
import numpy as np
import pygame
import cv2
# dimension of the display
screen_cols = 624 #1920 #1182
screen_rows = 1182 #1080 #624
# initialise GUI environment
pygame.init()
flags = pygame.DOUBLEBUF | pygame.HWSURFACE | pygame.NOFRAME | pygame.FU... | true |
e3a428f7c0ba9f6392a86d364778b5cc8058c2ad | Python | ThreePointFive/aid1907_0814 | /mounth02/day08/demo02.py | UTF-8 | 2,325 | 3.65625 | 4 | [] | no_license | # def fu(a,b,c):
# print(a,b,c)
# t=(1,2,3)
# fu(*t)
''''''
'''函数参数传递
形参'''
def fun01(row,col,char='*'):
"""
打印矩形要求输入
打印的行数列数和填充字符
如果用户不传递填充字符 默认使用*
:param row:
:param col:
:param char:
"""
for i in range(row):
for c in range(col):
print(char,end=' ')
print()
fun... | true |
dce7d9233828392cf7e12699b1181e48e6e3efac | Python | xXViridianXx/CSE30 | /list.py | UTF-8 | 8,454 | 3.828125 | 4 | [] | no_license | #------------------------------------------------------------------------------
# Aniket Pratap
# 1825275
# CSE 30-02 Spring 2021
# pa5
# list.py
#------------------------------------------------------------------------------
class _Node(object):
"""Private _Node type."""
def __init__(self, x):
"... | true |
4d864f2f5fd845f25f441e90772ae0b4f4d1df36 | Python | DeXie0808/cmn | /util/loss.py | UTF-8 | 1,400 | 2.84375 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import, division, print_function
import tensorflow as tf
import numpy as np
def weighed_logistic_loss(scores, labels, pos_loss_mult=1.0, neg_loss_mult=1.0):
# Apply different weights to loss of positive samples and negative samples
# positive samples have label 1 while negative... | true |
31aa2e889ebbb3352c97974a6e892ed3d3f331fb | Python | lifesci/project-euler | /6/solution.py | UTF-8 | 246 | 3.578125 | 4 | [] | no_license | def main():
lim = int(input('Enter a positive integer: '))
square_sum = (lim*(lim+1)/2)**2
sum_square = sum(map(lambda x: x**2, range(lim + 1)))
diff = square_sum - sum_square
print(diff)
if __name__ == '__main__':
main() | true |
a508669abbcef0450931b61fcf651165028f979c | Python | yasirabd/udacity-ipnd | /stage_2/lesson_2.1_serious_programming/programming.py | UTF-8 | 1,546 | 4.25 | 4 | [] | no_license | # Lesson 2.1: Introduction to Serious Programming
# Programming is grounded in arithmetic, so it's important
# to know how programming languages do simple math.
# Thankfully, Python follows the same math rules people do.
# See if you can predict the output of this code.
# https://classroom.udacity.com/nanodegrees/nd0... | true |
7bdc4480a3be2cb51d71ffd6da938b276078b24a | Python | wmgeolab/schoolCNN | /Philippines/Subject5_AP/Ensemble/5_BinaryGridSearch.py | UTF-8 | 2,759 | 2.609375 | 3 | [] | no_license | from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import GridSearchCV
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
import matplotlib.colors as cm
import seaborn as sns
import pandas as pd
import numpy as... | true |
3e6b61c56f9891f2ec667d8488689b1d742729e8 | Python | dannyramasawmy/Data-Structures-and-Algorithms | /Sorting/mergeSort.py | UTF-8 | 1,137 | 4 | 4 | [] | no_license | # a nicer implementation
def mergeSort(array):
"""
mergesort
O(n log n) - time complexity
O(n) - space complexity
"""
# base case
if len(array) <= 1:
return array
# get midpoint
midpoint = len(array)//2
# split left and right half of array call recursively
left = me... | true |
14414750b4c40e8cbec01ea0c971b71ca5931338 | Python | kotsabo/processing_webdata_mapreduce | /Task8/reducer08.py | UTF-8 | 564 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 15 02:40:07 2017
@author: kotsabo
"""
import sys
average, next_average, student_id = None, None, None
students = list()
flag = False
for line in sys.stdin:
line = line.strip()
next_average, student_id = line.split('-')
if next_average !... | true |
ab45d362736dc99b851d579326cd29e040066145 | Python | bzdvdn/youscan-wrapper | /youscan/exceptions.py | UTF-8 | 311 | 3 | 3 | [] | no_license | class YouScanException(Exception):
def __init__(self, error_code: int, error_message: str, *args):
super().__init__(*args)
self.error_code = error_code
self.error_message = error_message
def __str__(self):
return f"Code: {self.error_code}, Detail: {self.error_message}"
| true |
07579430de8c02c9eafcba271f8838cb30de8386 | Python | 279673842/data_student | /2020-10-14/两数交换.py | UTF-8 | 175 | 3.359375 | 3 | [] | no_license | def reverse(nums):
start=0
end=len(nums)-1
while start < end:
nums[start],nums[end]=nums[end],nums[start]
start+=1
end+=1
return nums
| true |
a08c6180fbfb73576a6ac3dd4c027e5c9e81b0eb | Python | HarrshaVardhan/Python_Projects | /Notes/class10_dic.py | UTF-8 | 1,165 | 3.265625 | 3 | [] | no_license | d={'name':'venkat','number':[7777,9999]}
#print(type(d))
#dic()
#update
#d.update({'age':25})
#print(d)
#add
'''d['name']='kiran'
print(d)'''
'''d.pop()
print(d)'''
#del
'''del d['name']
print(d)'''
'''for x,y in d.items():
print(x,y)'''
'''l=[1,2,3,4]
d=l.copy()
l.extend([1])
print(l)
print(d... | true |
170a46b006ba6ef714591ed5dad4a65b156c915e | Python | amemasire/half-life | /Other/simp.py | UTF-8 | 762 | 3.234375 | 3 | [] | no_license | from tkinter import *
from math import *
root = Tk()
top = Frame(root); top.pack()
Label(top, text='Define f(x):').pack(side='left')
f_entry = Entry(top, width=12)
f_entry.pack(side='left')
f_entry.insert('end', 'x')
Label(top, text=' x =').pack(side='left')
x_entry = Entry(top, width=6)
x_entry.pack(side='left')
x... | true |
6a477dc4967d6da27b9e5083a840d38dbf805ff6 | Python | james97/MyPracticeCodes | /Python/Challenges/bulb_switcher.py | UTF-8 | 1,044 | 3.625 | 4 | [
"Apache-2.0"
] | permissive | #########################################################################
# File Name: bulb_switcher.py
# Author: Jun M
# mail: warrior97@gmail.com
# Created Time: Mon 21 Mar 14:06:23 2016
#Description: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On t... | true |
059891516657805b2eebb0fde0701152f3ab0079 | Python | otaviohenrique1/python-projetos | /MatematicaPython/Quadrado.py | UTF-8 | 433 | 4.25 | 4 | [] | no_license | import math;
class Quadrado(object):
def __init__(self, x):
self.x = x;
def calcula_area(self):
return 'Area do quadrado: ' + str(float(self.x) ** 2);
def calcula_perimetro(self):
return 'Perimetro do quadrado: ' + str(float(self.x) * 4);
# Teste da classe Quadrado
q... | true |
4c9c10750122dffc75cb6fd30256746261cd6cab | Python | Christopher-Caswell/holbertonschool-higher_level_programming | /0x0A-python-inheritance/4-inherits_from.py | UTF-8 | 303 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python3
"""
Write a function that returns True if
instance of a class that inherited
4r0/\/\ the specified class, else False
"""
def inherits_from(obj, a_class):
"""Doc line still tryna trick checker"""
return (issubclass(type(obj), a_class) and
(type(obj) != a_class))
| true |
3ade9db4898f50815734e1ea47a5b91ed7af47c9 | Python | zekearneodo/intan2kwik | /intan2kwik/core/h5/tables.py | UTF-8 | 1,547 | 3.015625 | 3 | [
"BSD-2-Clause"
] | permissive | import logging
import h5py
logger = logging.getLogger('intan2kwik.core.h5.tables')
def unlimited_rows_data(group, table_name, data):
"""
Create a table with no max shape, to append data forever
:param group: h5py Group object. parent group
:param table_name: str. name of the table
:param data: np... | true |
2f794d403266c3fa790c66707937d03c6b8c63c3 | Python | PdxCodeGuild/20170724-FullStack-Night | /Code/sam/python/Lab26_bogosort.py | UTF-8 | 834 | 4.03125 | 4 | [] | no_license | import random
# generates and returns a list of length n, with random values between 0 and 100
def random_list(n):
list = []
for i in range(n):
list.append(random.randint(1,100))
return list
# randomly re-arranges a list
nums = random_list(8)
print(nums)
def shuffle(nums):
for i in range(... | true |
3aad351ec9442309feecb0a862d9f75271eb38d0 | Python | hedayet13/practiceCoding | /hackerRank5.py | UTF-8 | 292 | 3.296875 | 3 | [] | no_license | # diagonal difference
a= [[1,2,3],
[4,5,6],
[7,8,9]]
b=len(a)
k=1
diag1= 0
diag2=0
# print(a[0][1])
for i in range(b):
diag1 = diag1+a[i][i]
for j in range(b):
diag2 = diag2+a[j][j-k]
k=k+2
print(abs(diag2-diag1))
# print(a[0][0-1])
# print(a[1][1-3])
# print(a[2][2-5]) | true |
b010f851ace9d560f4744da9777c12ef58ecc805 | Python | ITISFoundation/osparc-simcore | /packages/service-library/src/servicelib/docker_utils.py | UTF-8 | 532 | 2.828125 | 3 | [
"MIT"
] | permissive | from datetime import datetime
import arrow
def to_datetime(docker_timestamp: str) -> datetime:
# docker follows RFC3339Nano timestamp which is based on ISO 8601
# https://medium.easyread.co/understanding-about-rfc-3339-for-datetime-formatting-in-software-engineering-940aa5d5f68a
# This is acceptable in I... | true |
f36e3f041f7530b99d38784d4d6cc45d44aa53e9 | Python | fredrikarve/predict-it_v0.1 | /flask/app/models.py | UTF-8 | 1,056 | 2.9375 | 3 | [] | no_license | from app import db
"""
A user is someone who is a customer of the tv provider and has an account
a user has the following properties:
Attributes:
UserID: An integer number representing the user.
Gender: A character representing the users gender
Age: An Integer number representing the use... | true |
465cffda6305c7390100d2d7aa0a8bba800a024d | Python | praneethpeddi/Python-Assignments | /Oct7th/validate_function.py | UTF-8 | 784 | 4.4375 | 4 | [] | no_license | """Program to validate a function is_prime"""
def is_prime(num):
"""This function will return True if a number is Prime"""
if num > 1:
for i in range(2, num):
if (num % i) == 0:
return False
else:
return True
def main():
"""This is a function which... | true |
cc8070052718c1d7ca5435728f99c5ac87bd9916 | Python | PranavOnGit/Python-BootCamp | /tuples.py | UTF-8 | 175 | 3.484375 | 3 | [] | no_license |
# tupple values can't be modified/ changed
# tuple is same as list.
tuple = (123, 123, 123, 123)
print(tuple)
# tupple[1] = 10
tuple = ('123', 'asd', 'dfdf')
print(tuple) | true |
b0fe0e5661af0cae89c681c91f6b519285958bd9 | Python | kasinxc/Visualizing-Trend-of-Key-Roles-in-News-Articles | /SemanticRoleLabeling/Source/SRL/word2vec.py | UTF-8 | 2,192 | 2.59375 | 3 | [] | no_license | import os
import gensim
import json
from srl_config import *
def build_training_data_from_file(input_data_file_path):
training_data = list()
with open(input_data_file_path, 'r') as f:
lines = f.readlines()
for data_index in range(len(lines)):
line = lines[data_index]
... | true |
733c46d411fa7ab7da59f7205510b03b9dea07e7 | Python | ericliu859/StudyOfTextSolve | /textsolve/TextSolve.py | UTF-8 | 215 | 2.625 | 3 | [] | no_license | if __name__ == '__main__':
index = 1211
temp = "1121"
input = open('p.txt','r')
s = input.read()
input.close()
s = s[:index] + temp + s[index+4:]
output = open('p.txt','w')
output.write(s)
output.close()
| true |
a03c4d0990c78b76f72cb79cc92cc2bb6c12742e | Python | petigura/specmatch-syn | /smsyn/calibrate.py | UTF-8 | 7,521 | 2.828125 | 3 | [] | no_license | """Module contains class and functions to facilitate calibrating
specmatch results with touchstone stars.
"""
import numpy as np
import pandas as pd
import lmfit
from scipy.interpolate import LinearNDInterpolator
import smsyn.io.fits as smfits
class Calibrator(object):
"""
Calibration object
Args:
... | true |
874d1c403dc2e3f24acea8a1546ff455a2d66cc0 | Python | sachin175638/theame | /modules/password.py | UTF-8 | 1,359 | 2.625 | 3 | [] | no_license | #!/usr/bin/python2
import os
from getpass import getpass
def pss():
x = raw_input("Enter username :- ")
y = getpass('Enter password :- ')
z = getpass('re-type password :- ')
x1 ='"'+x+'"\n'
y1 ='"'+z+'"\n'
#print x1
if y != z:
print ''
print "password is not matching "
print ''
os.system("python2 pass... | true |
29f40578753eca3806673769f2e481e922c0da36 | Python | Third-World-Innovators/Assignment1_Search_Code-_BFS_-_DFS | /Q_3d_Depth_First_Search.py | UTF-8 | 1,009 | 3.71875 | 4 | [] | no_license | graph = {
'S' : set(['c','d','e']),
'b' : set(['i','j','q']),
'c' : set(['e','q']),
'd' : set(['b']),
'e' : set(['f','h']),
'f': set([]),
'G': set([]),
'h': set([]),
'i': set([]),
'j': set([]),
'p': set(['G']),
'q': set(['G','p'])
}
def dfs_paths(graph, start, goa... | true |
0003f83fa592d3023047dd13407a9a1598995619 | Python | bearchair/cbmf4761_project | /python_files/query_dbsnp.py | UTF-8 | 3,227 | 2.8125 | 3 | [] | no_license | #! /usr/bin/python
import sys
import csv
from collections import defaultdict
# query_dbsnp.py
#
# This function reads the dbSNP database into memory and then checks to see if the mutations
# recorded in VCF reads appear in the database. If so, the the mutations are written into one
# file. If not, they are written int... | true |
14d415fc1d0eaffeb89834d55b5e6e6f2ccbe016 | Python | gm-p/practice_demo | /python练习/tk23.py | UTF-8 | 164 | 2.671875 | 3 | [] | no_license | from tkinter import *
root = Tk()
text = Text(root, width=30, height=2)
text.pack()
text.insert(INSERT, "I love \n")
text.insert(END,"Fishc.com!")
mainloop()
| true |
a5bb49405d44355def1bed06c0ba9eb64b39135c | Python | YVass1/BrewApp | /backups/source/unit_test.py | UTF-8 | 1,343 | 2.75 | 3 | [] | no_license | import source.User.commands as com
def test_add_list_element():
#Arrange
test_list = ["John", "Jim", "Jack"]
test_element = "Julie"
expected_output = ["John", "Jim", "Jack", "Julie"]
#Act
actual_output = com.add_list_element(test_list, test_element)
#Assert
assert expected_output == act... | true |
0e5dce4fad065e6e23e79e707ff8ba809e5aa3ca | Python | namratadevbhankar/Python | /dictionarydemo.py | UTF-8 | 183 | 3.84375 | 4 | [] | no_license | adict = {"chapter1":10,"chapter2":20,"chapter3":30}
print("Elements are :",adict)
print(adict["chapter1"])
print(adict["chapter2"])
items = {10:20,30:40,50:60}
print(items.keys())
| true |
c66c6878abe85f8942d8addebbab12ed6d0269dc | Python | Trietptm-on-Awesome-Lists/crypto | /tp/asymetrique/correction/crypto_simple/rsa_simple.py | UTF-8 | 3,439 | 3.21875 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
import sys
from primeutils import is_prime, find_prime, bezout, get_generator_ZpZ, pgcd, egcd
import pdb
"""
Etant donné que l'on va chiffrer byte par byte, il faut qu le mininum des nombres
premiers possibles pour la clé privée soit supérieur à ceil(sqrt(255)).
Cela vient du fait que l'on... | true |
f73d632ec6d98a4f4b111a3a2007975a372a9d1f | Python | kazukgw/daylog | /bin/daylog | UTF-8 | 5,393 | 2.75 | 3 | [] | no_license | #!/usr/bin/python
# coding: utf-8
import sys
import re
import datetime
import os
import argparse
import glob
DEBUG = False
# DEBUG = True
def debug(*keys):
if DEBUG:
print keys
def check_and_mkdir(path):
if not os.path.exists(path):
os.mkdir(path)
elif not os.path.isdir(path):
pr... | true |
cb9101e09b7d78460b801afb1d8595cfd1f49f83 | Python | JlucasS777/Aprendendo-Python | /Aprendendo Python/cursopythonudamy/aula28funcao_03.py | UTF-8 | 464 | 4.0625 | 4 | [
"MIT"
] | permissive | #funções (def) em Python - *args(Uso quando eu não sei quantos argumentos serão necessários na minha função )*** Kwargs-
#Aula 16(Parte3)
'''def func (a1,a2,a3,a4,a5,nome = None,a6 = None):
print(a1,a2,a3,a4,a5,nome, a6)
return nome, a6
var=func (1,2,3,4,5,nome = 'Luiz',a6='5')
print(var[1],var[0])'''
def func... | true |