blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
d347f1266fbbee33862371158be4d9ef68dc940c | loujitao/PythonLearn | /function/08scope.py | UTF-8 | 621 | 3.59375 | 4 | [] | no_license | i= 1
j= 1
def fun1():
i= 2
global j #全局作用域修饰词 这里的j是引用外部的j
j= 2 #赋值会覆盖外部j的值
def fun2():
nonlocal i #临近作用域修饰词 这里的i是引用fun1里的i
i= 3 #赋值会覆盖fun1中i的值
j= 3
print("fun2中的i,j: "+str(i)+","+str(j))
print("fun1中的i,j: " + str(i) + "," + str(j))
fun2()
print... | true |
e09415ce71c72f509995f69f50465b42b334f659 | Erniess/Stepik | /Python - основы и применение/2 Cтандартные средства языка Python/2.5 Работа с функциями functool и лямбда функции/Workbook.py | UTF-8 | 1,561 | 3.65625 | 4 | [] | no_license | # Работа с функциями: functool и лямбда функции
n, k = 1, 5 #map(int, input().split())
print(n+k)
x = 10, 20, 31, 35, 16, 19, 18 # input().split()
xs = (int(i) for i in x)
def even(x):
return x % 2 == 0
evens = list(filter(even, xs))
print(evens)
x = 10, 20, 31, 35, 16, 19, 18 # input().split()
xs = (int(i) f... | true |
7c5ef84db9268172cb809f7dadde68b6a9f2f5f8 | Mrapplejuice43/2D_platformer_mario_style | /Overlay.py | UTF-8 | 5,136 | 2.828125 | 3 | [] | no_license | from Component import *
# Events ids used inside pygame events not to get limited
PLAY_ID = 1
OPTION_ID = 2
BACK_ID = 3
EDITOR_ID = 4
MAIN_MENU_ID = 5
SELECT_GROUND = 6
SELECT_BLOCK = 7
SELECT_PLAYER = 8
RESET_WORLD = 9
QUIT_ID = 10
SAVE_ID = 11
CHANGE_MODE = 12
class Overlay:
def __init__(self, width, height):
... | true |
c886caf97e87dbf712fcf786af141c2ba32e0e7d | marcovnyc/penguin-code | /Python_Talk/mpt-master/ch03/stand_by.py | UTF-8 | 600 | 3.078125 | 3 | [] | no_license | import speech_recognition as sr
speech = sr.Recognizer()
while True:
print('Python is listening...')
inp = ""
with sr.Microphone() as source:
speech.adjust_for_ambient_noise(source)
try:
audio = speech.listen(source)
inp = speech.recognize_google(audio)
... | true |
b2ae6849ecd130fa378b82b839948e0f7eb1ac9c | nickordoodle/pyapi | /sort01/sorted02.py | UTF-8 | 1,633 | 3.703125 | 4 | [] | no_license | #!/usr/bin/env python3
iplist = ['10.8.2.1', '1.1.1.1', '255.255.255.255', '10.1.2.1', '10.2.1.2', \
'10.2.3.2', '10.7.2.1', '192.168.23.1', '192.168.66.1', '10.42.2.1', \
'10.11.10.2', '10.25.32.2', '10.27.21.1', '192.168.55.1']
print('Currently iplist looks like this:', iplist)
print('\nThe results of sorted(iplist) ... | true |
26c2804841a4f218722588bdfb5698a44348c739 | wcferreira/Raspbel | /tests/keyboard.py | UTF-8 | 162 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import time
x = 1
while True:
try:
print(x)
time.sleep(.3)
x += 1
except KeyboardInterrupt:
print('Bye')
sys.exit()
| true |
181ea0ebe5cabe0843e4b824ac50f4ebe88c63d6 | HuaMuLanChina/Piano-Fingering-Generators | /LSTM Approach/Utils.py | UTF-8 | 679 | 2.984375 | 3 | [] | no_license | def elapsed(sec):
if sec<60:
return str(sec) + " sec"
elif sec<(60*60):
return str(sec/60) + " min"
else:
return str(sec/(60*60)) + " hr"
def generateNewState(old_state, finger_pred, new_interval, normalization=True):
if normalization:
return old_state[2:]+[finger_pred/5... | true |
97fda4322a84522657807125ffceb19586b99313 | isrmic/tests-challenges | /tests/python/render_2/inc/__init__.py | UTF-8 | 176 | 2.859375 | 3 | [] | no_license | def GenerateHtmlElement (element, Content, values = "") :
values = " " + values if values != "" else ""
return "<"+element + values+"> " + Content + " </"+element+">"
| true |
959476a6e62f9ac0da30175b4856cafffc0933ae | lipilian/RotationCode | /RealSense.py | UTF-8 | 1,790 | 2.578125 | 3 | [] | no_license | import numpy as np
import cv2
import pyrealsense2 as rs
import os
from os.path import dirname
from pathlib import Path
import argparse
#----------------------------------
#This function is for read the bag data of RealSense.py
def main():
try:
config = rs.config()
rs.config.enable_device_from_file(c... | true |
ce53f0436f9099bb6825b99a7e983c527c7edcd7 | jk990803/Python_Study_Plan | /Test100/Test1.py | UTF-8 | 284 | 3.546875 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# 题目:有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?:
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if i!=j!=k:
print (i*100+j*10+k) | true |
41facf3f3e17f7e50b213269c792028a2f0a096b | oracle614/buter | /buter/app/services.py | UTF-8 | 7,540 | 2.671875 | 3 | [
"MIT"
] | permissive | """
应用相关的 server 层
add on 2017年11月29日17:37:16
"""
import json
import os
import shutil
from buter import ServiceException, Application
from buter.logger import LOG
from buter.server import docker
from buter.util.Utils import unzip, formatDate, copyFileToDir
from config import BASE_DIR, IS_WINDOWS
ZIP = ".zip"
TAR = "... | true |
c1ef7b9f97dcbd9416e1a21ad5223fafe6f23eee | SrMouraSilva/rbm_notebooks | /tf_utils.py | UTF-8 | 597 | 2.96875 | 3 | [] | no_license | '''
* Add attributes
* `tensor.T` to transpose
* `variable.T` to transpose
* Add methods
* `tensor.reshape` as `tf.reshape(self, new_shape)`
* `tensor.cast` to `tf.cast(self, new_dtype)`
* `tensor.to_vector` to transfor the matrices as vectors
'''
import tensorflow as tf
tf.Tensor.T = property(lambda self:... | true |
ef474b2e3457b3ce4237485a2ecc262b75311c01 | Carolyn95/transformers-exprmt | /hf_t5_ner.py | UTF-8 | 6,281 | 2.875 | 3 | [] | no_license | import faulthandler
faulthandler.enable()
import pdb
task = 'ner' # ['ner', 'pos', 'chunk']
"""
- NER(Named Entity Recognition): classify the entities in the text(person, organisation, location...)
- POS(Part-of-speech tagging): grammatically classify the tokens(noun, verb, adjective...)
- Chunk (Chunking): grammatic... | true |
0b4a4b6f55ba789f212e18228ff7d0895b17607a | batfish/pybatfish | /pybatfish/datamodel/answer/table.py | UTF-8 | 5,117 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 The Batfish Open Source Project
#
# 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 applicab... | true |
423510560629578c20c9198be7337a9c53691043 | wagnerdelima/docker-handson | /health/run.py | UTF-8 | 577 | 2.5625 | 3 | [] | no_license | from threading import Lock
from collections import namedtuple
from os import getenv
from flask import Flask
app = Flask(__name__)
lock = Lock()
counter = 0
ApplicationStatus = namedtuple('ApplicationStatus', ['healthy'])
app_status = ApplicationStatus(healthy=bool(getenv('HEALTHY', False)),)
@app.route("/health... | true |
7466ae9723727ae961272787d37b28d5eca38e98 | zuzimira/Ukoly_Py | /Sibenice/pomocne_funkce.py | UTF-8 | 1,306 | 3.40625 | 3 | [] | no_license | import random
def tiskni_sibenici(cislo_obrazku):
"""Vrati prislusny obrazek sibenice dle poctu neuspesnych pokusu."""
obrazek = 'obrazky{}.txt'.format(cislo_obrazku)
with open(obrazek, encoding='utf-8') as soubor: #podle poctu chyb se otevre prislusny soubor
obrazek = soubor.read()
... | true |
2aefadc5daa192ad3d1fed71a1f9b14b83d7eeb5 | yeremiwesly/Python-Project-Chapter6 | /Latihan/Latihan 2 starFormation3.py | UTF-8 | 246 | 3.765625 | 4 | [] | no_license | #Latihan 2 starFormation3
def starFormation1(n):
i = 0
while (i < n):
i += 1
print('* ' * i)
starFormation1(4)
def starFormation2(n):
i = 4
while (i > n):
i -= 1
print('* ' * i)
starFormation2(1)
| true |
258f2946e7e903591c8a96f5d873351412c29dc6 | emiyacody/Stress-Prediction | /Dashboard/utils.py | UTF-8 | 1,231 | 3.265625 | 3 | [] | no_license | import pandas as pd
import streamlit as st
def load_data():
'''loads the data from the data subdirectory'''
train = pd.read_csv('../data/train.csv')
#remove missing values form last three coloms
train = train.dropna(subset=['Resource Allocation','Mental Fatigue Score',
'Burn... | true |
d7f5b6ea98b5652451e5d8822463cdb6c2e8514d | nileshhadalgi016/python3 | /PythonLambda.py | UTF-8 | 430 | 4.3125 | 4 | [] | no_license | """
Python Lambda
-Techie Programmer
A lambda function is a small anonymous function.
Syntax :
lambda arguments : expression
"""
# Example
x = lambda a: a + 20
print(x(5))
# Example 2
x = lambda a, b: a * b
print(x(5, 6))
# Another... | true |
67d9821476c0c3d19a420ac77353e8b08f0d6e63 | kgaswin93/Decision-Tree-using-ID3 | /utilities.py | UTF-8 | 5,035 | 2.90625 | 3 | [] | no_license | import math
import random
import tree
class Node:
def __init__(self, instances, instance_classes, attr, left, right, label):
self.instances = instances
self.instance_classes = instance_classes
self.attr = attr
self.left = left
self.right = right
self.label =... | true |
196aeee47e60e135132b5a32848522f40d874453 | st120721/BA-Code | /ml_algoritms_v1.py | UTF-8 | 13,923 | 2.640625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
import datetime as d
from sklearn import preprocessing
from sklearn.metrics import make_scorer, fbeta_score, recall_score
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from keras.models import Sequential
from keras.layers import ... | true |
82a04dec7c586c4bfedc0227034271bd3bfa8e3a | AmiraDowidar/relevance-task | /relevance.py | UTF-8 | 4,478 | 2.96875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import re
import matplotlib.pyplot as plt
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import sent_tokenize, word_tokenize
## ================ Define Criteria =======================##
# size > 50,000 sf
# large scale developments
# non residential
# 12 mont... | true |
ac345802ec8293aba50933b43d0f7bd4ed93a87f | nannanruguo/-_test | /numConv.py | UTF-8 | 256 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
def convert(func, seq):
'conv. sequence of numbers to same type'
return [func(eachNum) for eachNum in seq]
myseq = (123,45.67,-6.2e8,999999999L)
print convert(int,myseq)
print convert(long, myseq)
print convert(float, myseq)
| true |
84fcf0173e7bcd857566d2bace93d1b50b20c341 | yujiex9/toolbox | /data_structures/node.py | UTF-8 | 273 | 3.484375 | 3 | [] | no_license | class Node:
def __init__(self, value):
self.value = value
self.next = None
def __repr__(self):
return f'{self.__class__.__name__}({self.value})'
__str__ = __repr__
def __eq__(self, other):
return self.value == other.value
| true |
67ac56be2bc00c35d0cb1dba4b35944eb2b04993 | alexpujols/evalSearchingAlgorithms | /evalSearchingAlgorithms.py | UTF-8 | 7,038 | 3.859375 | 4 | [] | no_license | ##!/usr/bin/env python
'''
::::::
:+: :+:
+:+ +:+
+#++:++#++:::::::
+#+ +#+ :+:
#+# #+# +:+
### ###+:++#""
+#+
#+#
... | true |
399b42640309e3f9db9c0f648fb0c384096be3d1 | charles-debug/learning_record | /13-复合赋值运算符.py | UTF-8 | 224 | 3.484375 | 3 | [] | no_license | a = 10
a+=1 # a= a+1
print(a)
b = 10
b-=1 # b = b-1
print(b)
c=10
c+= 1 + 2
#先计算复合赋值运算符右边的算式,在计算运算符,然后再赋值
# c = c+3
print(c)
d *= 1+2
print(d) | true |
2f978e37517d4e47c90df49b2cc5e6dc93dcb8de | phandc/speech-recognition | /app.py | UTF-8 | 940 | 2.578125 | 3 | [] | no_license | from flask import Flask, render_template, request
from werkzeug.utils import secure_filename
import os, os.path
from utils import combine_predict
UPLOAD_FOLDER = 'upload'
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
@app.route('/', methods=['POST', 'GET'])
def hello_world():
if request.m... | true |
88ee9f60d9040f75e156997710a3629a6073dcbd | holonking/ts-findSecurities | /strategist.py | UTF-8 | 26,530 | 2.53125 | 3 | [] | no_license | import tushare as ts
import pandas as pd
import numpy as np
import datetime,calendar
import matplotlib.pyplot as plt
import math
from ts_util import *
from traders import *
BUY='constant buy'
SELL='constant sell'
class StrategistBase:
def __init__(self,df=None):
if df is not None:self.set_data(df... | true |
a2dcedfa82f3709563088489425c1910d0c18fdb | WoohyunSHIN/algo | /Shortest Path/book/correct_rank.py | UTF-8 | 760 | 3.0625 | 3 | [] | no_license | INF = int(1e9)
n,m = map(int, input().split())
graph = [[INF] * (n+1) for _ in range(n+1)]
for a in range(1,n+1):
for b in range(1,n+1):
if a == b:
graph[a][b] = 0
for _ in range(m):
a,b = map(int,input().split())
graph[a][b] = -1
graph[b][a] = 1
def main(n:int,m:int,graph:list)->... | true |
c2649771863a66fd9d53e34721fd1e1dcec75971 | moskytw/clime | /examples/pyramid.py | UTF-8 | 667 | 2.875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# file: pyramid.py
from __future__ import print_function
import sys
def draw(story, squash=1, verbose=False):
'''It draws a pyramid.
-s <int>, --squash=<int> make fat pyramid
-v, --verbose show the args from `squash` and `--squash`
'''
... | true |
4219becb488b892b82c89e6a615433ea59dc82c4 | Jonas231/awkward-1.0 | /src/awkward/_v2/contents/content.py | UTF-8 | 3,713 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
class Content(object):
... | true |
77209b29db3de80b2cd89ad7cb500039f99d3f32 | msfm-abe/Code-file | /multiprocessing_test.py | UTF-8 | 459 | 2.84375 | 3 | [] | no_license | from multiprocessing import Pool
import numpy as np
# def nijyou(x):
# print(np.power(x,2))
# return None
#
# if __name__ == "__main__":
# p = Pool(4)
# p.map(nijyou, range(1000))
def kakezan(a , b):
return a*b
def wrapper_kakezan(args):
return kakezan(*args)
if __name__ == ... | true |
5e4f79325cdaef9836617b902ff706d71bf92412 | Deepthi-Rao/CSC495 | /Project2/persistent/pile.py | UTF-8 | 571 | 3.734375 | 4 | [] | no_license | from utils.stack import Stack
# a Pile is a representation of the in-play pile of cards, with behaviour inherited from Stack
class Pile(Stack):
# initializes the pile
def __init__(self):
self.stack = []
# empties the pile and returns a list of the cards from it
def takeAllCards(self):
... | true |
9f9d106c3c55353a8a093002ecf70a84ba65f5fd | florentinolim/pythonestudos | /pythonCursoEmVideo/Cores/aulacores.py | UTF-8 | 402 | 3.734375 | 4 | [] | no_license | #\033[0;30;41m]
#\033[4;33;44m]
#\033[1;35;43m]
#\033[30;42m]
#\033[m]
#\033[7;30m]
print('\033[1;31;43mOlá mundo!\033[m')
print('\033[4;30;45mOlá mundo!\033[m')
print('\033[7;30mOlá mundo!\033[m')
a = 3
b = 5
print('Os valores são \033[32m{}\033[m e \033[31m{}\033[m!!!'.format(a, b))
nome = 'Reginaldo'
print('Olá! M... | true |
e73df1e2eeafcc755430fdb46f087f994a76fd1f | devinbhushan/rbs | /rbs/rbs/lib/reviewboard_scorer.py | UTF-8 | 2,482 | 3.125 | 3 | [] | no_license | from scorer import Scorer
from util import url_to_json
from math import log
class ReviewBoardScorer(Scorer):
"""Implements Scorer class with ReviewBoard specific scoring heuristics"""
def __init__(self, username, grace_period, review_length):
self.username = username
self.grace_period = int(g... | true |
b42bef7b4e06f6b7702602b5b2b566cba798eaa1 | zhiweiguo/my_leetcode | /offer/68_II.py | UTF-8 | 1,194 | 3.90625 | 4 | [] | no_license | '''
二叉树的最近公共祖先
'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
ans = None
def lowestCommonAncestor(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode:
def recu... | true |
905ad5edcb3fb4410eb24d90ef3e939f5aff2b23 | heuristicwave/TrainingGround | /acmicpc/Greedy/2014_소수의곱.py | UTF-8 | 379 | 2.828125 | 3 | [] | no_license | import heapq
import copy
K, N = map(int, input().split())
A = list(map(int, input().split()))
lst, ck = copy.deepcopy(A), set()
heapq.heapify(lst) # heap으로 바꿈
ith = 0
while ith < N:
mn = heapq.heappop(lst)
if mn in ck:
continue
ith += 1
ck.add(mn)
for i in A:
if mn * i < 2 ** 32... | true |
8587abe516f3cbb52986210f505d37514525081a | kkikori/Asking | /src/preparation/declare_class.py | UTF-8 | 1,367 | 2.65625 | 3 | [] | no_license | class THREAD():
def __init__(self):
self.title = "" # 親投稿のタイトル
self.posts = [] # ポストのidリスト
self.parent = None # 親投稿ポストのid
self.parent_words = [] # 親投稿の単語リスト(名詞,形容詞,動詞,形容動詞)
self.previous_qs = []
# 投稿のクラス
class POST():
def __init__(self):
self.sentences = [] ... | true |
9bb674c7012e9ddca8b4fff000602c05dd487f85 | kfigon/RandomCode | /SztucznaInteligencja/neurony/Perceptron.py | UTF-8 | 1,227 | 3.125 | 3 | [] | no_license | __author__ = 'kamil'
from Funkcje import *
class Perceptron:
def __init__(self, ileWejsc=2, funkcjaAktywacji = Signum()):
self.__wagi = [1]*ileWejsc
self.__stala = 1 #bias
self.__funkcjaAktywacji = funkcjaAktywacji
def zgaduj(self, inputData):
suma = self.__stala
for... | true |
45a2335da76cb5ea09db5a7af02c6df66c34a9df | DanielJPuratich/danielpuratich-python | /turtleIntro/turtleIntro.py | UTF-8 | 2,108 | 3.734375 | 4 | [] | no_license | import turtle as t
def mainDrawing () :
t.hideturtle ()
t.speed(0)
t.setup(width=800 , height=800)
p = 6
c = '#268dd6'
t.title("Turtle Graphics - turtleIntro")
#p.pencolor(c)
drawing1 (p)
drawing2 (p)
drawing3 (p)
drawing4 (p)
drawing5 (p)
drawing6 (p)
drawing7 (... | true |
850149cfd4b0935a58ac09b6c74da4a9a91ff15e | Jellikitty/testing | /test_mysoftware.py | UTF-8 | 294 | 3.09375 | 3 | [] | no_license | from mysoftware import *
def test_square_integers():
assert square(2) == 4
assert square(0) == 0
assert square(-1) == 1
assert square(3) == 9
def test_coulomb():
assert coulomb(1.0) == 1.0
assert coulomb(2.0) == 0.5
assert coulomb(-2.0) == 0.5
assert coulomb(0.0)
| true |
4f6e9a081b687c1bcee71cc942537eb4a1896ee6 | njtwomey/har_datasets | /src/utils/label_helpers.py | UTF-8 | 440 | 2.625 | 3 | [
"MIT"
] | permissive | __all__ = ["normalise_labels"]
def normalise_labels(ll):
"""
Args:
ll:
Returns:
"""
if "walk" in ll:
return "walk"
elif "elevator" in ll:
return "stand"
elif ll in {"lie", "sleep"}:
return "lie"
elif ll in {"vacuum", "iron", "laundry", "clean"}:
... | true |
238880276208091ceaa7a3fe796af841b92a05a8 | omusaev/adventofcode_2019 | /day1/part2.py | UTF-8 | 612 | 3.34375 | 3 | [] | no_license | input_file = './input'
def fuel_for_mass(mass, parts):
fuel = mass // 3 - 2
if fuel > 0:
parts.append(fuel)
fuel_for_mass(fuel, parts)
return parts
def main():
with open(input_file, 'r') as f:
modules = f.readlines()
modules = [int(mass) for mass in modules]
fuel_... | true |
29c0a9100712d38530a615725c71449a84542502 | codebubb/python_course | /Semester 1/Project submissions/Lee Eldridge/Excercise Weeks 1-9 - Lee Eldridge/Week 9/user_class_methods (Test).py | UTF-8 | 882 | 3.640625 | 4 | [] | no_license | import hashlib
class user():
def __init__(self, username, password):
self.username = username
self.password = password
def authenticate(self):
authentication = self.password == "password"
if authentication == True:
print ""
print "User Creat... | true |
4911af811a12fe5ef3cc85271e1dcac78d6b0b56 | laurakah/EasyEscape | /door.py | UTF-8 | 297 | 2.90625 | 3 | [] | no_license | from item import Item
class Door(Item):
def __init__(self, name):
super(Door, self).__init__(name, "door")
self.name = name
def examine_item(self, game_state, map):
if game_state.check_for_key(self):
return True
else:
return None
| true |
ec139e46fee321e38249425b0b77fbd8784c3e94 | imtiantian/Python_Awesome_Interview | /rabbit-python/python/chapter-4/rpc_server.py | UTF-8 | 1,514 | 2.671875 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | ###############################################
# RabbitMQ in Action
# Chapter 4.3.3 - RPC Server
#
# Requires: pika >= 0.9.5
#
# Author: Jason J. W. Williams
# (C)2011
###############################################
import pika, json
#/(apiserver.0) Establish connection to broker
creds_broker = pika.PlainCredentia... | true |
7c467d066c3934704035fbd7e88b0cbc14758d42 | HellRoads/python-2 | /Python_File/Back_math.py | UTF-8 | 323 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def huishu():
i = int(input(">>> "))
s = list(filter(lambda n:int(str(n)[::-1])==n,range(1,i+100)))
if i in s:
f = str(i)
if len(f) <= 3:
print(f[:-1],"+",f[len(f)//2:])
else:
print(f[:len(f)//2],"+",f[len(f)//2:])
print(i,"是回数")
else:
print(i,"不是回数")
huishu() | true |
2d9ef65cf75a30d6db559c3289190c10d082bd4f | MANOJPATRA1991/Data-Structures-and-Algorithms-in-Python | /Linked List/circularly_linked_list.py | UTF-8 | 2,654 | 4.03125 | 4 | [] | no_license | class Element(object):
def __init__(self, value):
self.value = value
self.next = None
class CircularlyLinkedList(object):
def __init__(self, head=None):
self.head = head
def append(self, new_element):
current = self.head
if self.head:
while current.next... | true |
9a37dca1b4f75c6955d008f9f9e42b18e82d8694 | BonHyuck/Python | /SWEA/D4/10966.py | UTF-8 | 1,720 | 3.0625 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt', 'r')
# 상하좌우를 위한 배열
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
def find_plz(N, M):
queue = [(0, 0)] * (N * M)
front = -1
rear = -1
visited = [[0] * M for _ in range(N)]
for i in range(N):
for j in range(M):
if box[i][j] == 'W':
... | true |
2880bd1646edd3a2d98f588a76f3fabdb090091b | Sai-nook73/TheAlgorithms | /SortingAlgorithms/QuickSort.py | UTF-8 | 1,154 | 3.78125 | 4 | [
"MIT"
] | permissive | def partition(collection, left, right):
pivot = collection[right]
j = left
for i in range(left, right):
if collection[i] <= pivot:
temp = collection[i]
collection[i] = collection[j]
collection[j] = temp
j += 1
temp = collection[right]
collection[right] = collection[j]
collection[j] = temp
return j... | true |
93dd16572116e852a7b400dd56e5138d5b80bab9 | alex/llvmpy | /test/passes.py | UTF-8 | 4,419 | 2.546875 | 3 | [
"BSD-3-Clause",
"NCSA"
] | permissive | #!/usr/bin/env python
from llvm.core import *
from llvm.passes import *
from llvm.ee import *
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import logging, unittest
# A helper class.
#class strstream(object):
# def __init__(self, s):
# self.s = s
# def read(self... | true |
e4fed302014cd5509dddecee1885d363352204e4 | Vladislp/Python-Tartu | /Все возможные txt документы/kodu0test.py | UTF-8 | 664 | 2.703125 | 3 | [] | no_license | import os.path
def kuva_failid(kaust):
for nimi in os.listdir(kaust):
täisnimi = os.path.join(kaust, nimi)
for dirpath, dirnames, filenames in os.walk('C:\\Users\\Ximaks\\Desktop\\Всякие приложения'):
print('Current path: ', dirpath)
print('Directories: ', dirnames)
print('F... | true |
4a25eb84a55eb68d5fd51597d351c599b534476b | Aasthaengg/IBMdataset | /Python_codes/p02597/s841974500.py | UTF-8 | 910 | 3.265625 | 3 | [] | no_license | #atcoder template
def main():
import sys
imput = sys.stdin.readline
#文字列入力の時は上記はerrorとなる。
#ここにコード
#input
n = int(input())
c = str(input())
#output
#Rがr個、Wがw個あるとする。
#最終的にはRRRR...WWWW...の状態にすれば良い。
#もとの状態と比べた時、RとWが一致していないものを考える。
#WRの個数とRWの個数をそれぞれx, yとすると、求める操作の回数はmax(x, y)と... | true |
bc5bfed4a64e8582903f8d08dfffbb7552920ea0 | elpeart/chicken_id | /keras/transfer learning/transfer_learn2.py | UTF-8 | 1,533 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri May 1 21:58:22 2020
@author: elpea
"""
from keras.applications.vgg16 import VGG16
from keras.callbacks import ModelCheckpoint
from keras.layers import Dense, Flatten
import keras
from keras.models import Model
import matplotlib.pyplot as plt
model = VGG16(inc... | true |
46a171becc977148d6a11534cdc56bdd624cd344 | Droppledev/FPKK | /fix/PSO.py | UTF-8 | 4,797 | 2.96875 | 3 | [] | no_license | import csv
import random
import math
import operator
from sklearn.model_selection import StratifiedKFold
from knn import KNN
def loadDataset(filename, split, dataset=[], trainingIdx=[], testIdx=[]):
with open(filename, 'r') as csvfile:
lines = csv.reader(csvfile)
dataset[:] = list(lines)
X ... | true |
7b413f26c0284e57ce75fddbaf4b33c0bc01f797 | EngeloperChen/Python_Classwork | /329_classwork_calculator.py | UTF-8 | 358 | 4.25 | 4 | [] | no_license | num1 = float(input("Please enter the 1st number: "))
op = input("Please enter the operator: ")
num2 = float(input("Please enter the 2nd number: "))
if op == "+":
print(num1 + num2)
elif op == "-":
print(num1 - num2)
elif op == "*":
print(num1 * num2)
elif op == "/":
print(num1 / num2)
else:
print("... | true |
b49f3593cf13b3967fba77bea0287f50a60a1ac2 | ecly/adventofcode2020 | /day13/day13.py | UTF-8 | 1,376 | 3.28125 | 3 | [
"MIT"
] | permissive | import functools
import math
def get_wait(earliest, schedule):
min_t = schedule * math.ceil(earliest / schedule)
return min_t - earliest
def part1(earliest, ids):
ns = [int(t) for t in ids if t != "x"]
waits = [(get_wait(earliest, t), t) for t in ns]
min_wait, min_t = min(waits)
return min_w... | true |
458a0b50547c79f333bd861b3c65b15f73dbc2e0 | patrick473/TCIT-V1PROG-15 | /practice exercise 2_3_2_4.py | UTF-8 | 257 | 3.65625 | 4 | [] | no_license | leeftijd = input('Geef je leeftijd: ')
paspoort = input('Heb je een nederlands paspoort: ')
if (paspoort == 'ja')and (int(leeftijd) == 18 or int(leeftijd) > 18) :
print('Gefeliciteerd, je mag stemmen!')
else :
print('Jammer, je mag niet stemmen!')
| true |
e770b5b2ecf7ff7feb8ba0ab2475be3cd3fc222d | AliMurtaza096/alilab2 | /ver003.py | UTF-8 | 54 | 3.28125 | 3 | [] | no_license | #calculator
def mul(x,y):
return x*y
print(mul(5,3)) | true |
df4777ef7ef3c28139a2240b91edbdfec0ef2987 | aryan-upa/CompetitiveCodes | /MashmokhandLights.py | UTF-8 | 422 | 2.96875 | 3 | [] | no_license | # Round 240, Div 2, Problem A
# https://codeforces.com/contest/415/problem/A
n, s = map(int,input().split())
ps = list(map(int, input().split()))
ls = [0 for i in range(n)]
for q in ps:
if q == 1:
for j in range(len(ls)):
if ls[j]==0:
ls[j]=1
break
else:
... | true |
7a04a1cddb479bdc2730a4b07f72e04205fc55c5 | Kimuksung/bigdata | /tensorflow/C06_Keras/lecture01_keras_DNN/step02_keras_mnit_DNN.py | UTF-8 | 2,508 | 3.296875 | 3 | [] | no_license | '''
Tensorflow 2.0 Keras + MNIST( 0 ~ 9 ) + flatten layer
first case : one dimesion (28 x 28 ) -> 768
second case : 28 x 28 -> Flatten
'''
import tensorflow as tf
from tensorflow.keras.utils import to_categorical # Y 변수 전처리
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense , Fl... | true |
352506a54a24008a8a60dcae8bdfca2165ba478c | MengSunS/daily-leetcode | /fb高频/29.py | UTF-8 | 553 | 2.71875 | 3 | [] | no_license | class Solution:
def divide(self, a: int, b: int) -> int:
sign = 1
if a < 0: sign *= -1
if b < 0: sign *= -1
a, b = abs(a), abs(b)
res = 0
while a >= b:
tmp = b
times = 1
while (tmp << 1) <= a:
tmp = (tmp << 1)
... | true |
07b0d3d40b350bf4bd6ddc803c0cef5f9f142698 | szczor/Project_DAV | /scripts/survey_leadership_interactive.py | UTF-8 | 954 | 2.59375 | 3 | [] | no_license | import plotly.express as px
import pandas as pd
import numpy as np
df = pd.read_csv('survey_leadership.csv')[['label', 'val']]
df.columns = ['', 'Share of respondents']
fig = px.bar(df, x='', y='Share of respondents')
fig.update_layout(
title = 'How strong is your trust in the political leadership\nin terms of C... | true |
2257904a4ffa782b0cadf17fb9379943b103c430 | seangrogan-archive/trade_war_game | /player.py | UTF-8 | 3,788 | 3.765625 | 4 | [] | no_license | import random
class Player:
def __init__(self, friendliness, imitation, vindictiveness, horizon=100):
"""
Initializer function for the Player class.
:param friendliness: As a baseline, how often (as a percentage of all rounds) will you cooperate, allowing free
... | true |
6db2296cf7661c16b8e8865259ce351d9f535de3 | 142296/- | /Python代码/用/用 密码强度检测.py | UTF-8 | 1,698 | 3.71875 | 4 | [] | no_license | # 密码安全性检查代码
#
# 低级密码要求:
# 1. 密码由单纯的数字或字母组成
# 2. 密码长度小于等于8位
#
# 中级密码要求:
# 1. 密码必须由数字、字母或特殊字符(仅限:~!@#$%^&*()_=-/,.?<>;:[]{}|\)任意两种组合
# 2. 密码长度不能低于8位
#
# 高级密码要求:
# 1. 密码必须由数字、字母及特殊字符(仅限:~!@#$%^&*()_=-/,.?<>;:[]{}|\)三种组合
# 2. 密码只能由字母开头
# 3. 密码长度不能低于16位
while True:
def safegrade():
print('您的密码安全级别评... | true |
ad42f44451ca0762570a47e30e9f5ea992f20174 | mrFahrenhiet/Python-Web-Maps | /map1.py | UTF-8 | 590 | 2.59375 | 3 | [] | no_license | import folium
import pandas
d=pandas.read_csv("ECD.txt")
la=list(d["lat"])
lo=list(d["lon"])
el=list(d["Name"])
m1=folium.Map(location=[28.7041,77.1025],zoom_start=9)
f=folium.FeatureGroup(name="Colleges")
for i,j,k in zip(la,lo,el):
f.add_child(folium.Marker(location=[i,j],popup=str(k),icon=folium.Icon(color='red'... | true |
7fc4e6a856613736b0e9e730b581b8f44d4ef673 | AlexeyDenezhkin/diplom_2.0 | /User/class_User.py | UTF-8 | 8,395 | 2.546875 | 3 | [] | no_license | import requests
import string
from datetime import datetime
import time
from pprint import pprint
from settings.token import TOKEN
class User:
sex = None
bdate = None
age = None
city = None
interests = set()
friends_ = set()
groups_ = set()
books = set()
music = set()
def __in... | true |
d4062dced1cca44fc90496a474fdcc282e02723b | jgrt/programming-problems | /programs/string/problem1/solution.py | UTF-8 | 503 | 3.984375 | 4 | [] | no_license | """
https://practice.geeksforgeeks.org/problems/sort-the-string-in-descending-order/0
Given a string S containing only lower case alphabets, the task is to sort it in lexigraphically-descending order.
Constraints:
1 <= |S| <= 10^5
Input: S = geeks
Output: skgee
"""
def transform_str_char_desc_order(s: str) -> str... | true |
e8d63bfd0496b9b6a0d78b8906a079f12d36b433 | Maopos/Basic_Python | /016_Programacion_Objetos/encapsulamiento/encap2.py | UTF-8 | 606 | 4.15625 | 4 | [] | no_license | print('======================\n')
class Persona:
def __init__(self, codigo, nombre, edad):
self.codigo = codigo # Publico
self._nombre = nombre # Protegido solo acceden su clase y subclases
self.__edad = edad # Privado solo accede su clase
def __saludar(self):
print('Hola', s... | true |
ba6ee5d7ed0ecfadeda746d889ffcc92cbe5efca | swapnil2me/Sonal_FTP_Git | /dublicate_application.py | UTF-8 | 3,101 | 2.546875 | 3 | [] | no_license | import os
import tarfile
import csv
import io
from flask import Flask, render_template, send_file
from operator import itemgetter
from zipfile import ZipFile
def count_Result(file_name):
count1 = 0
count0 = 0
if not file_name.endswith('tar'):
file_name += '.tar'
#print(file... | true |
7620a4edc36326583e317efedc1b95e35b621709 | Einstellung/AlgorithmByPython | /AwesomeAlgorithms/manacher算法.py | UTF-8 | 1,952 | 3.453125 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
'''
神之算法-Manacher算法
求最长回文子串
'''
def manacher(s):
if s == None or len(s) == 0:
return
# 预处理字符串, 把字符串中间和首尾都添加#号, 时的字符串长度变为奇数
# 预处理后的字符串每个位置对应的最长回文串的半径 减去1 等于原始字符串该处对应的最长回文串的长度
s = "#" + "#".join(s) + "#"
curLongest = [0] * len(s) # 使用curLongest存储每个位置最长回文串半径
m... | true |
a4fa2f5a1b9f5252402ece88acb93e115e969238 | ermk006/simple-reversi-python | /player.py | UTF-8 | 2,258 | 3.328125 | 3 | [] | no_license | import time
from board import Board
from evaluator import MiddleEvaluator, FinalEvaluator
from minimax import Minimax
from minimax_thread import Minimax_Threaded
class Player:
def __init__(self, my_stone):
self.my_stone = my_stone
def get_my_stone(self):
return self.my_stone
conv_col2int =... | true |
8743c432afb7188aa4de930d560ef337761dc6e5 | Aasthaengg/IBMdataset | /Python_codes/p03657/s539907472.py | UTF-8 | 200 | 3.4375 | 3 | [] | no_license | sheet = input().split()
sheet_i = [int(s) for s in sheet]
a, b = sheet_i
if(a % 3 == 0 or b % 3 == 0):
print('Possible')
elif((a+b) % 3 == 0):
print('Possible')
else:
print('Impossible')
| true |
def610dd6e981b660a7ebe8be52879364cc58ab3 | Rinkikumari19/codechef_questions | /code_que2.py | UTF-8 | 424 | 3.015625 | 3 | [] | no_license | T = int(input("enter you test cases number"))
for i in range(T):
N = int(input("enter your number of students"))
A = input()
A = A.split()
print(A)
count = 0
# if len(A)==N:
index = 0
while index < len(A):
p = index+1
while p<=(N-1):
if A[index]== A[p]:
... | true |
4c2a615b9e89d17e830a07f8a10c2cb1791b4998 | jespinozallanos/Digital_Transformation | /03_flask/Pybo/models.py | UTF-8 | 1,247 | 2.671875 | 3 | [] | no_license | from Pybo import db
# 클래스 형태로 데이터베이스 질문 테이블 생성
class Question(db.Model):
id = db.Column(db.Integer, primary_key=True) # primary_key는 중복되지 않는 값임
subject = db.Column(db.String(200), nullable=False)
content = db.Column(db.Text(), nullable=False)
create_date = db.Column(db.DateTime(), nullable=False)
cla... | true |
5d01b65c2bc99e919e61d21a04ef4487ef1ef77e | jippylong12/TAMU_FGD | /pdf_analyzer.py | UTF-8 | 6,815 | 2.78125 | 3 | [] | no_license | from pypdf import PdfReader
import re
from transformTextFiles import getCoursesWithProfessorsTransformed
PROF_NAME_REGEX = r"[A-Z\- \,\.\']{2,}$"
class PdfAnalyzer:
def __init__(self, pdf_file):
self.pdf_file = pdf_file
# from Spring 2012 - Summer 2016
def transform_v1(self):
reader = Pd... | true |
57a21ca3f8e8a1dd8b08e69115bf957ffcea3bce | parulsharma-121/CodingQuestions | /day_141_MakeTwoArraysEqualbyReversingSub-arrays.py | UTF-8 | 1,154 | 4 | 4 | [] | no_license | '''
Given two integer arrays of equal length target and arr.
In one step, you can select any non-empty sub-array of arr and reverse it. You are allowed to make any number of steps.
Return True if you can make arr equal to target, or False otherwise.
Example 1:
Input: target = [1,2,3,4], arr = [2,4,1,3]
Output: t... | true |
d315cc9b21a96a1cb43cec4715f31e346922ccaf | CoDyPhin/FEUP-MNUM | /tp8.py | UTF-8 | 1,575 | 3.40625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 14 10:47:34 2019
@author: Carlos Lousada
"""
import math
def f(x,y):
return math.exp(y-x)
def f1(x,y):
return pow(x,2)+pow(y,2)
def int_dupla_trapezio(f, a0, af, b0, bf, n):
hx = (af-a0)/n
hy = (bf-b0)/n
result = f(a0, b0) + f(a0, b... | true |
799fe702bfab6ad8a74d8b7c347cf1ce0953885d | CRomanIA/Python_Undemy | /Seccion23_Librerias_Seaborn_Matplotlib/Secc23_cap101_Grafico_de_Cajas.py | UTF-8 | 276 | 3 | 3 | [] | no_license | #Diagrama de Cajas
#Sirve para representar graficamente una serie de datos númericos a traves de sus cuartiles
#%%
import pandas as pd
import numpy as np
import matplotlib as mpl
import seaborn as sns
# %%
datos = np.random.randn(100)
datos
# %%
sns.boxplot(datos)
# %%
| true |
29bbbb6bc8fc04c2794e890e1b396eb074ca489b | jayant23/LearnPython | /.vscode/app.py | UTF-8 | 3,121 | 2.609375 | 3 | [] | no_license | import os
import xml.etree.ElementTree as ET
import glob
import csv
xml_files = glob.glob("C:/Users/TechFerry/AllPublicXML/NCT0000xxxx/*.xml")
# xml_data = open('C:/Users/TechFerry/xmldata.csv', 'w')
# csvwriter = csv.writer(xml_data)
# xmldata_head = []
# count = 0
# for xml_file in xml_files:
# tree= et.parse(... | true |
bec5939fffd0228c19c24564b39e9ca8ac48c060 | nunch/IT-5202E | /src/main.py | UTF-8 | 526 | 2.734375 | 3 | [] | no_license | '''
Created on 26 nov. 2015
@author: yo
'''
from RSA import RSA
import time
if __name__ == '__main__':
rsa = RSA()
#truc=rsa.primeFactorsDecomposition(1234567890123456789)
a={1:2,3:9}
a=5
truc=0
start_time = time.time()
#truc=rsa.pollard(26915353)
elapsed_time = time.time() - start_tim... | true |
c09171c95897509b21b239e087f141c8b4506c69 | Sanardi/bored | /backdoor/backdoor.py | UTF-8 | 1,932 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# Import the required librarys for the job
import subprocess
import socket
import os
# Set variables used in the script
HOST = '10.0.0.98' # IP for remote connection
PORT = 4444 # Port for remote connection
PASS = 'Te$t!2#456' # For making the script secure
# Create the socket that will be used
s =... | true |
9828aba43bb7d9ee1fdde94fb4414595c6d90527 | bach-hardie/rdkit | /rdkit/Logger/demo.py | UTF-8 | 1,373 | 2.953125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # $Id$
#
# Copyright (c) 2001-2006, Greg Landrum and Rational Discovery LLC,
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
# Demo code fo... | true |
463084be6006b9703fecc7815dc85f41541bba40 | kaitlynwright/Data-Structures | /Project 2/Collage.py | UTF-8 | 583 | 3.296875 | 3 | [] | no_license | import sys
def collage(file):
magazine = {}
outcome = "YES"
with open(file, "r") as f:
magCt, noteCt = f.readline().strip().split(" ")
magWords = f.readline().strip().split(" ")
noteWords = f.readline().strip().split(" ")
if noteCt > magCt:
outcome = "NO"
return outcome
for word in magWords:
if wor... | true |
e284f91292d2f67ac2327f74d265d7b2475a9027 | osama-salman99/PythonProject | /src/helper.py | UTF-8 | 5,534 | 2.71875 | 3 | [] | no_license | import re
import pandas as pd
isoCodesFile = open(r'../res/iso_codes.txt', encoding='utf8')
isoCodes = {}
def init():
for line in isoCodesFile.readlines():
line = line.strip().split('\t')
code = line[0]
language = line[1]
isoCodes[code] = language
init()
def get_language(code):
try:
return isoCodes[c... | true |
c866c829f1eb6fe15a8c7c45f229d95bacac4031 | mitma98/SDGP-main-test | /FlaskBackend/.ipynb_checkpoints/company-checkpoint.py | UTF-8 | 648 | 3.078125 | 3 | [] | no_license | from database import Database
from account import Account
class Company:
__accounts = [] #Holds a list of accounts that belong to the company
def __init__(self):
self.__database = Database()
def createAccount(self, accountId, firstName, lastName, accountType, email , password):
#The Acc... | true |
058955029105a761a59dae98e35f43855a504834 | kernel-panic96/Dungeons-Pythons | /src/war_unit.py | UTF-8 | 3,208 | 3.375 | 3 | [] | no_license | from src.game_object import GameObject
from src.weapon import Weapon
from src.spell import Spell
class WarUnit(GameObject):
def __init__(self, row, col, health, mana, damage=0):
super().__init__(row, col)
self.health = health
self.mana = mana
self._max_mana = self.mana
sel... | true |
a96c531f43420330eeff94258f519d00b0b17370 | gabe1314/aws_python_scripts | /listing_some_of_the_ec2_services.py | UTF-8 | 737 | 2.703125 | 3 | [] | no_license | import boto3
from pprint import pprint
aws_mag_con=boto3.session.Session(profile_name='default')
ec2_con_cli=aws_mag_con.client(service_name="ec2",region_name="us-east-1")
response=ec2_con_cli.describe_volumes()['Volumes']
for each_item in response:
print("The Volume Id is: {}\nThe Volume State is:{}".format(eac... | true |
a7ec0238e7a413f45f078c10dc55dfe2768b3fef | fank-cd/anjuke_spider | /anjuke/tools/item_tools.py | UTF-8 | 281 | 2.796875 | 3 | [] | no_license | # coding:utf-8
import re
def get_nums(value):
match_re = re.match(r".*?(\d+).*", value)
if match_re:
nums = match_re.groups(1)
else:
nums = 0
return nums
def remove_n(value):
value = value.strip().replace("\n", "").strip()
return value
| true |
01cc58290b5197c6ebe8a51491cc29788be784b9 | zhdcirno/Pythonstudy2 | /12-多线程/01.py | UTF-8 | 377 | 3.265625 | 3 | [] | no_license | '''
利用time函数,生成两个函数
顺序调用
计算总运行时间
'''
import time
def loopl():
print(time.ctime())
time.sleep(4)
print(time.ctime())
def loop2():
print(time.ctime())
time.sleep(2)
print(time.ctime())
def main():
print(time.ctime())
loopl()
loop2()
print(time.ctime())
if __name__ == '__main__... | true |
3b7a948ce68262217b4a9c59d76d761d4b234d47 | gyz0807-ai/facial_keypoints_detection | /src/utils/preprocess.py | UTF-8 | 3,479 | 2.859375 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
def get_keypoints(df, img_size=[96, 96]):
results_dict = {}
for idx, row in df.iterrows():
template = {
'image':{},
'left_eye':{},
'right_eye':{},
'left_eyebrow':{},
'right_eyebrow':{},
'... | true |
8dcf07a8840b5ceaea2be573bd5c8b8209d4b251 | erdc/proteus-mprans | /benchmarks/sacramentoLevee/waveModules_Matt.py | UTF-8 | 12,459 | 2.90625 | 3 | [] | no_license | import numpy as np
from math import pi
import JONSWAP_p as JS
""" Set of wave modules for initializing and
driving the wavemaker field, that will be
fed in and constrasted with wave flume
experimental data."""
class Linear2D:
"""
A class for linearized solutions of 2D flow (1D + surface) for
t... | true |
3f555f1948180e42390b2bb140ce15ca3cf6fea2 | adafruit/Adafruit_Learning_System_Guides | /QT_Py_Cube/code.py | UTF-8 | 3,881 | 2.640625 | 3 | [
"MIT"
] | permissive | # SPDX-FileCopyrightText: 2022 Charlyn Gonda for Adafruit Industries
#
# SPDX-License-Identifier: MIT
from secrets import secrets
import ssl
import busio
import board
import adafruit_lis3dh
import wifi
import socketpool
import adafruit_requests
from adafruit_led_animation.color import (
PURPLE, AMBER, JADE, CYAN, ... | true |
cb65dfbd730c58863199a734534b0825b924c4d2 | daniel-kanchev/fincabank | /fincabank/spiders/fincabank.py | UTF-8 | 1,583 | 2.59375 | 3 | [] | no_license | import scrapy
from scrapy.loader import ItemLoader
from itemloaders.processors import TakeFirst
from datetime import datetime
from fincabank.items import Article
class fincabankSpider(scrapy.Spider):
name = 'fincabank'
start_urls = ['https://www.fincabank.kg/category/%d0%bd%d0%be%d0%b2%d0%be%d1%81%d1%82%d0%b8... | true |
575107b1165b4629187264ed53c645d1846d7aae | Laila1400/Sentiment-Analysis | /ml_and_rule_based/ml_based_sentiment_analysis.py | UTF-8 | 4,480 | 3.171875 | 3 | [] | no_license | import nltk
# Splitting the corpus into 2 parts one for training by ml classifier and another to test the model
file_path_pos = "/Users/gpande2/nltk_data/cornell_movie_review_data/rt-polaritydata/rt-polaritydata/rt-polarity-pos.txt"
file_path_neg = "/Users/gpande2/nltk_data/cornell_movie_review_data/rt-polaritydata/rt-... | true |
6b5441788823accc2e3518ae4e884b089da42e91 | SujanMaga/Python-prac-for-ref. | /test/Lists_tuples/11_list_prac.py | UTF-8 | 209 | 3.53125 | 4 | [] | no_license | # t = (3,2,1,32)
# t[3] = 33
# print(t)
# to test tuple cannot be changed
# to count the number of items in tuple
a = [7,0,8,0,0,9]
print(a.count(0))
# sum method using
a = (314,3242,23,132,4)
print(sum(a)) | true |
28dc68c4bc57ceea89cd3eabfc99b203e3a208f1 | acboyty/NN_for_tabular | /baseline/cat.py | UTF-8 | 736 | 2.8125 | 3 | [] | no_license | from base import BaseModel
class CATModel(BaseModel):
def __init__(self, dataset, dataset_path, sample=False, sample_num=None, split_method='6-2-2', use_category=True):
BaseModel.__init__(self, dataset, dataset_path, sample, sample_num, split_method, use_category)
self.model_name = 'cat'
def ... | true |
7f082758ad1279ab70d4bfd054ce5a1801d55ab2 | bwinton/weblog.latte.ca | /convert.py | UTF-8 | 1,931 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
from datetime import datetime
import os
from optparse import OptionParser
from collections import OrderedDict
import pwd
import sys
def getStats(source):
stat = os.stat(source)
date = datetime.fromtimestamp(stat.st_mtime).isoformat(" ")
author = pwd.getpwuid(stat.st_uid).pw_gecos
retur... | true |
bf25ee6643c3beb7f1ac7f09afb3c8af34046691 | asiopueo/pygletMaze | /perspective_correction.py | UTF-8 | 1,625 | 2.890625 | 3 | [] | no_license |
# Demonstration of perspective projection
#
import sys, time
from pyglet.gl import *
window = pyglet.window.Window()
keys = pyglet.window.key.KeyStateHandler()
window.push_handlers(keys)
glLineWidth(5.0)
glEnable(GL_DEPTH_TEST)
text = pyglet.text.Label('',x=5,y=5,font_name='Times New Roman', font_size=20)
fovy = 6... | true |
ec38a501802548f6d150e87aa50881b1b0388406 | queer1/FTPredator | /src/ftpredator.py | UTF-8 | 9,769 | 3.109375 | 3 | [] | no_license | ###
### FTPredator
###
### Authors: Christopher Wood (christopherwood07@gmail.com)
### Robert Wood (robertwood50@gmail.com)
###
### Purpose: FTPredator is a tool for FTP security auditing, it will first check IP addresses for open
### or poorly protected FTP services. It will then map out the directory structr... | true |