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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
52a589761198189f03780d12f75631e64f211df1 | Python | RootChenLQ/myHTM | /test.py | UTF-8 | 71 | 2.53125 | 3 | [] | no_license | import simplehtm
a = [[[1,2,3]]]
print a[0][0][0]
#创建三维数组
| true |
dfe9d7ec4309f4f23c8d9057d4f1c660a12e9c6e | Python | Aasthaengg/IBMdataset | /Python_codes/p03241/s834465594.py | UTF-8 | 259 | 2.6875 | 3 | [] | no_license | from math import sqrt
n, m = map(int, input().split())
ans = 1
for i in range(1, int(sqrt(m) + 2)):
if m % i == 0:
if i <= m / n:
ans = max(ans, i)
if m // i <= m / n:
ans = max(ans, m // i)
print(ans)
| true |
179de4a94393c01e6b5080b6d204a9d38d339328 | Python | ADSNL/ADSNL_MACOS_Updated | /data/DataMigrationScripts/7_Misc.py | UTF-8 | 1,704 | 2.5625 | 3 | [] | no_license | import pyodbc
import connections as conn
cursor_new = conn.conn_new.cursor()
cursor_old = conn.conn_old.cursor()
oldChartData = cursor_old.execute('SELECT year, order_count FROM Chart_Data')
count = 0
for row in oldChartData:
cursor_new.execute('Insert Into ChartData (Year, Order_Count) values(?,?)', row[0], row... | true |
6c80a766ed896938a1099b9cdb4fa7ba179e496e | Python | Tinghao724/ox | /ox/grammar.py | UTF-8 | 862 | 2.59375 | 3 | [
"MIT"
] | permissive | from typing import Union
from lark import Lark, Tree, Token
from pathlib import Path
from functools import lru_cache
OPTIONS = {"lark-expansions": {"start": "expansions"}}
DEFAULTS = {"parser": "lalr"}
SOURCE = {"lark-expansions": "lark"}
PATH = Path(__file__).parent / "grammars"
@lru_cache(8)
def load_grammar(name... | true |
fc266a0d009c775bd8e681ab0095052f1459ed29 | Python | 31062/algerhythms | /stack_in_python.py | UTF-8 | 1,150 | 4.21875 | 4 | [] | no_license | class Stack:
"""a stack create as a class"""
#constructor
def __init__(self,max_size):
# set attributes starting values
self._items = 0
self._max_size = max_size
self._stack_pointer = 0
self._stack_list = []
def is_empty(self):
#find out it t... | true |
1ae5b8098251d7d6c7a9bea7007dd6dc1a871b7f | Python | muyawei/DataAnalytics | /Python_T1/12306/ontime/png.py | UTF-8 | 180 | 2.5625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from PIL import Image
import pytesseract
image = Image.open("1.png")
image.load()
imgry = image.convert('L')
print pytesseract.image_to_string(imgry)
| true |
19d4cdc9acd41a4e7c6b01c49862868844a23bb3 | Python | EKarpovets/Python_Crash_Course | /Chapter_11/city_functions.py | UTF-8 | 119 | 3.421875 | 3 | [] | no_license | def get_formatted_city(city, country):
city_and_country = city + ", " + country
return city_and_country.title() | true |
496f0721ddb94a0469193c4f50b494d5c5d43090 | Python | giraffesyo/School-Assignments | /Programming Intelligent Robots - HONR 1000/Assignment 3/detector.py | UTF-8 | 3,037 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
import roslib
roslib.load_manifest('assignment3')
import rospy
import cv2
import math
from sensor_msgs.msg import Image, LaserScan
from assignment3.msg import BallLocation
from cv_bridge import CvBridge, CvBridgeError
class Detector:
def __init__(self):
# The image publisher is for debugging... | true |
19f118adc851ff237a5c6779712eb38f92da3117 | Python | thuzarwin/UA-AID | /gda94towgs84.py | UTF-8 | 986 | 2.703125 | 3 | [] | no_license | from ctypes import *
from ctypes import WINFUNCTYPE
class Coordinate(Structure):
_fields_=[('dNum1', c_double),
('dNum2', c_double),
('dNum3', c_double),
('dLatacc', c_double),
('dLongacc', c_double),
('iNum4', c_long),
... | true |
a818bbc5e7b86e127679b17d618ece24e2857798 | Python | LiXiaoli921/FOTS.PyTorch | /data_loader/data_loaders.py | UTF-8 | 4,401 | 2.625 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
import torch.utils.data as torchdata
from torchvision import datasets, transforms
from base import BaseDataLoader
from .dataset import SynthTextDataset
class MnistDataLoader(BaseDataLoader):
"""
MNIST data loading demo using BaseDataLoader
"""
def __init__(self, config... | true |
7519cd1a19b63ca49eae8d2ddde82cc06991a76d | Python | pedronadaes/CursoEmVideoPython | /Mundo 02 - Estruturas Condicionais/evenOddMatchGame.py | UTF-8 | 725 | 4.125 | 4 | [] | no_license | from random import randint
contador = 0
while True:
jogador = int(input('Diga um número: '))
pc = randint(0, 10)
total = jogador + pc
par = ' '
while par not in 'PI':
par = str(input('Par ou Ímpar? [P/I]: ')).strip().upper()[0]
print(f'Você jogou {jogador} e o computador {pc}. Total = {t... | true |
392cd9fdb6651de923cd67b9f8a732fccabe73f0 | Python | kudos09/python_study | /basic_network/sd_2.py | UTF-8 | 784 | 3.09375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
# 使用 NumPy 生成假数据(phony data), 总共 100 个点.
x_data = np.float32(np.random.rand(1, 100)) # 随机输入
y_data = np.dot([10], x_data) + 0
# 构造一个线性模型
b = tf.Variable(tf.zeros([1])) + 0.1
W = tf.Variable(tf.random_uniform([1, 1], -1.0, 1.0))
y = tf.matmul(W, x_data) + b
# 最小... | true |
31f0b8ab62035ab78775b9a6353906d7e0306824 | Python | JacoKritzinger/matplotlib | /bar.py | UTF-8 | 282 | 3.453125 | 3 | [] | no_license | import matplotlib.pyplot as plt
x1 = [1,2,3,4,5]
y1 = [1,2,4,8,16]
colors = ['blue', 'green', 'red', 'orange', 'maroon']
plt.bar(x1,y1,edgecolor="green",color=colors, linewidth=3)
plt.title('Your title')
plt.xlabel('horizontal label')
plt.ylabel('vertical label')
plt.show()
| true |
0fd0fe19ff5ebd17a8b31f0e02ff76f661c778e9 | Python | cybertraining-dsc/fa19-516-159 | /cloudmesh-exercises/e-cloudmesh-shell-3.py | UTF-8 | 1,091 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
from cloudmesh.shell.command import command
from cloudmesh.shell.command import PluginCommand
from cloudmesh.docopts_example.api.manager import Manager
from cloudmesh.common.console import Console
from cloudmesh.common.util import path_expand
from pprint import pprint
from cloudmes... | true |
4d5bcf629749d3668f9f23d8f1111d8622b5690f | Python | dylan-slack/TalkToModel | /explain/conversation.py | UTF-8 | 6,498 | 3.046875 | 3 | [
"MIT"
] | permissive | """Contains a representation of the conversation.
The file contains a representation of the conversation. The conversation
class contains routines to write variable to the conversation, read those
variables and print a representation of them.
"""
import copy
from typing import Union
import gin
import pandas as pd
fro... | true |
69acc8f3516355592b3e8d7566635a4a7ad828d6 | Python | jamheald/aoc | /aoc2.py | UTF-8 | 605 | 3.375 | 3 | [] | no_license | input = open("/Users/james.heald/Documents/aoc/aoc2input.txt","r")
passwords = input.read().split('\n')
n = 0
m = 0
for i in range(len(passwords)):
passArray = passwords[i].split(' ')
numberString = passArray[0].split('-')
numbers = [int(string) for string in numberString]
char = passArray[1][0]
... | true |
68968481793943fc2d619a7f9c4849fe586f8e02 | Python | dillon-ward/PythonStuff | /email validation 3.py | UTF-8 | 3,576 | 3.703125 | 4 | [] | no_license | import string # Using 'import string' will import the constants that aren't built in
import csv
def validateEmail(email): # Using a function can use the code for later purposes
emailok = False
message = ''
# Count the number of '@' characters in the email address. It should only contain 1
atcount = 0... | true |
8b7ea8d112846dccacc68e1228be4c49d71df803 | Python | Danielotuo/spam-detector | /model.py | UTF-8 | 2,027 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 2 12:57:15 2020
ML model to detect spam messages
@author: danid
"""
import re
from nltk.stem import PorterStemmer
# from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
import pandas as pd
import pickle
df = pd.read_csv('spam_ham_dataset.csv')
# ... | true |
359918cef3921daacae8ad710fb0d02994c0579c | Python | ajmazurie/biofabric | /lib/biofabric/layout.py | UTF-8 | 2,872 | 3.1875 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | # calculate the layout of a biofabric representation of a given graph, based
# on the details of http://www.biomedcentral.com/1471-2105/13/275/
# TODO: implement shadow links
# TODO: implement link groups
import networkx
NEG_INF, POS_INF = float("-inf"), float("+inf")
def _key_with_max_value (d, ignore = None):
""... | true |
4946da40f88721ff471f4509b2be8b5abe8b411b | Python | alsofro/gu-ai-1-python | /lesson_4/1.py | UTF-8 | 708 | 3.453125 | 3 | [] | no_license | """Реализовать скрипт, в котором должна быть предусмотрена функция расчета заработной платы сотрудника.
В расчете необходимо использовать формулу: (выработка в часах*ставка в час) + премия.
Для выполнения расчета для конкретных значений необходимо запускать скрипт с параметрами."""
from sys import argv
def calculate... | true |
74f028215a2efc3019a7fd02515dd3432148a1c0 | Python | palomagmz3/TFM | /match_kfolds_and_all.py | UTF-8 | 3,919 | 2.59375 | 3 | [] | no_license | import os
import pandas as pd
import numpy as np
import csv
programa = 'L6N_20151205' #un programa de L6N
enfoque = '/aglomerativo/' #distintivo
n = '1' #un número del 1 al 5 (listas kfold)
t = 'TEST' #TRAIN o TEST
def name_file(enfoque):
if enfoque == '/aglomerativo/':
return '_AGLO'
elif enfoque == '... | true |
0d71a9e9aec82dc0ce2ed09f8ecdebea09b29b6e | Python | HumanAcademy-AI-Cource/12PythonSample | /sensor_sample1.py | UTF-8 | 705 | 3.84375 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 説明を表示する
print("--------------------------------------------------------------")
print("○ センサデータを入力すると目の前に障害物があるか検出します。")
print("--------------------------------------------------------------")
# センサデータを入力する
sensor_data = int(raw_input("センサデータ入力(mm) > "))
print("-------... | true |
62c842f0d51ab9b27a1426e1c587112a61b206af | Python | LiHaoyu1994/global_bibliography | /crawlers/pymarc_tools.py | UTF-8 | 33,317 | 3 | 3 | [] | no_license | """
@encoding:utf-8
@author:Tommy
@time:2020/9/25 17:30
@note:
@备注:
"""
import pandas as pd
from pymarc import MARCReader, Record, Field, MARCWriter
from pymarc.exceptions import NoFieldsFound, RecordLengthInvalid
import os
NON_CHARACTERS_IN_UTF_8 = ["©"]
"""
@模块1:从csv文件生成ISO文件.注意,这里csv文件的列名不一定是按顺序的
"""
def output_i... | true |
671c86e7f697c29d08ec95a81a76b4aaadde417d | Python | hntrjndx/Tebakkata | /tebakkata.py | UTF-8 | 21,189 | 2.734375 | 3 | [] | no_license | import time, sys, os
#color
HEADER = '\033[95m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
CYAN = '\033[96m'
RESET = '\033[0m'
#tebakan EASY
level1 = "kasih mudah ni, pemain bola yang berat nya 3kg siapa?"
jawaban1 = "bambang tabung gas"
level2 = "penyanyi luar negri yang suka bersepeda?"
jawaban2 = ... | true |
8c3e8e80204caed913e74ef4288241e8febb73c3 | Python | hc-2018-chameleons/sudden-dev | /chat/consumers.py | UTF-8 | 5,023 | 2.625 | 3 | [] | no_license | import re
import json
import logging
import time
import calendar
from channels import Group
from channels.sessions import channel_session
from .models import Room, Player, Question
log = logging.getLogger(__name__)
@channel_session
def ws_connect(message):
# Extract the room from the message. This expects message... | true |
64fa2c17e8c87e87e24191e17bf03bde4584f14f | Python | gkgktmd/gui | /스크롤바.py | UTF-8 | 615 | 3.265625 | 3 | [] | no_license | from tkinter import *
root=Tk()
root.title('실시간 키워드 순위') # 창 타이틀 제목
root.geometry('640x480+100+100')
frame=Frame(root)
frame.pack()
# 스크롤바는 프레임에 넣어서 한번에 관리하는 것이 편함
scrollbar=Scrollbar(frame)
scrollbar.pack(side='right', fill='y')
listbox=Listbox(frame, selectmode='extended', height=5, yscrollcommand= scr... | true |
857f742f09b6a3fe63405003c5a67ca0e18eda6e | Python | msuwala/Advent-of-Code-2017 | /solutions/day1.py | UTF-8 | 894 | 2.96875 | 3 | [] | no_license | test_p1_1 = "1122"
test_p1_2 = "1111"
test_p1_3 = "1234"
test_p1_4 = "91212129"
test_p2_1 = "1212"
test_p2_2 = "1221"
test_p2_3 = "123425"
test_p2_4 = "123123"
test_p2_5 = "12131415"
def solve(input_, delta=1):
s = 0
for x in range(len(input_)):
if input_[x] == input_[(x + delta) % len(input_)]:
... | true |
bae01a6ea0725834ffb843dee4936343021c508a | Python | edward0829/blog | /wide_and_deep_learning_example/src/wide_and_deep_learning.py | UTF-8 | 9,584 | 2.5625 | 3 | [] | no_license | import os
import pandas as pd
import numpy as np
from time import time
from datetime import datetime, timedelta
from sklearn.preprocessing import OneHotEncoder, LabelEncoder, MinMaxScaler
from sklearn.model_selection import train_test_split
from keras.layers import Input, Embedding, concatenate, Flatten, Dense, Dropout... | true |
465882d5ed6fa3bebcadd9658e313c90ad948053 | Python | PingVK/reading_notes | /scripts/info_record.py | UTF-8 | 2,374 | 2.921875 | 3 | [] | no_license | """
监控软件内存、CPU、磁盘占用的情况
需使用管理员权限打开
"""
import os
import time
import logging
from logging import handlers
import psutil
from pywinauto import application
# 获取当前pid的CPU和内存,以及磁盘占用情况
def get_info(pid):
rss = psutil.Process(pid).memory_full_info().rss / (1024 * 1024)
cpu_percent = psutil.Process(pid)... | true |
7d2c6e1d4ed3a45102da99f1394b39745962efac | Python | ste-carlesso/si-cu-convert | /old/conversion.py | UTF-8 | 225 | 3.09375 | 3 | [] | no_license | import pandas as pd
my_string = "2020-03-04"
my_timestamp = pd.to_datetime(arg = my_string, format = "%Y-%m-%d")
my_date = my_timestamp.date()
print(my_timestamp)
print(type(my_timestamp))
print(my_date)
print(type(my_date))
| true |
699934a6e373af090c536f98341cd327ce8af716 | Python | dongqi-wu/PyProD---A-AI-Friendly-Power-Distribution-System-Protection-Platform | /code/PyProD/utils.py | UTF-8 | 2,395 | 3.1875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from datetime import datetime
# convert Cartesian to Polar for complex numbers
def cart_to_pol(arr):
# the format of input array is:
# [Re1, Im1, Re2, Im2, ...]
dim = int(len(arr) / 2)
mag = np.zeros(dim)
angle = np.zeros(dim)
for i in range(dim):
... | true |
f9fdc7dcd99b7879530605557b2aae1789fc62ee | Python | zerynth/core-zerynth-toolchain | /zdevicemanager/client/models/device.py | UTF-8 | 3,201 | 2.59375 | 3 | [] | no_license | from .base import Model, Collection
class DeviceModel(Model):
@property
def fleet_id(self):
return self.attrs.get("fleet_id")
@property
def workspace_id(self):
return self.attrs.get("workspace_id")
@property
def workspace_name(self):
return self.attrs.get("workspace_n... | true |
7debebbe4fcbb965bbb8f1bba65678801eed1d42 | Python | djsilenceboy/LearnTest | /Python_Test/PySample1/com/djs/learn/chart/TestMatplotlibLine.py | UTF-8 | 1,299 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on Jun 18, 2017
@author: dj
'''
from os import path
from matplotlib import pyplot as plot
from numpy.random import randn
output_file_path = "../../../../Temp"
output_file = "SampleChart_Line.png"
plot.style.use("ggplot")
plot_data1 = randn(50).cumsum()
plot_data2 = randn(50).cumsum()
plot_data3 = randn... | true |
71a83c05360b16ba012a1cc2f0a3f222e6430c7f | Python | willabelkane1906/lekhanhlinh-labs-c4e21 | /lab3/Homework/ex2.py | UTF-8 | 56 | 3.46875 | 3 | [] | no_license | def sum(x, y):
print(x,"+", y, "=", x+y)
sum(8,11) | true |
e556d7c79c000f0f3b01d21053f3193dff64a506 | Python | TheNickDeveloper/AutoRegistScript | /Services/ExceptionHelper.py | UTF-8 | 224 | 3.109375 | 3 | [] | no_license | class BlankDataException(Exception):
def __init__(self, col_name):
self.message = f'{col_name} cannot be balnk.'
super().__init__(self.message)
def __str__(self):
return repr(self.message) | true |
4aa88f955455c18d5ce7e265bfc4f9bb6053fbd9 | Python | coruus/pythonlabtools | /labtools/analysis/fitting_toolkit.py | UTF-8 | 45,459 | 3.71875 | 4 | [] | no_license | """Hessian and Levenberg-Marquardt Curve Fitting Package with resampling capability.
This is loosely derived from the information in 'Numerical Recipes'
2nd Ed. by Press, Flannery, Teukolsky and Vetterling.
Implementation by Marcus H. Mendenhall,
Vanderbilt University Free Electron Laser Center, Nashville, TN, USA
I... | true |
7d072418cecaec97927fe6af0ad4ea2fd2a197f8 | Python | rjoshi47/DSmax | /cookOff/DSIMP/AMZ_REPEATING_PAT_IN_STRING.py | UTF-8 | 947 | 3.546875 | 4 | [] | no_license | '''
Created on Apr 30, 2018
@author: rjoshi
for nchars: abcabceabcabce
rep = [0, 0, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7]
patLen = 7
For string to be valid the last value of rep array must be a multiple of pattern length.
E.g.
nchars: abcabceabcabceabcabce
rep = [0, 0, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,... | true |
228565b8969d44fcec2c3789bd30f90505c295b3 | Python | jonathankohen/flask_practice | /flask_app/models/friend.py | UTF-8 | 1,490 | 2.921875 | 3 | [] | no_license | # import the function that will return an instance of a connection
from flask_app.config.mysqlconnection import connectToMySQL
class Friend:
def __init__(self, data):
self.id = data["id"]
self.nickname = data["nickname"]
self.created_at = data["created_at"]
self.updated_at = data["... | true |
0f54b8cf253a226dcf3c3fac06fc3c805d89a4d9 | Python | CoderQingli/MyLeetCode | /21. Merge Two Sorted Lists.py | UTF-8 | 588 | 2.96875 | 3 | [] | no_license | def mergeTwoLists(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if not l1 and l2: return l2
if not l2 and l1: return l1
if not l1 and not l2: return None
c1 = l1
c2 = l2
temp = ListNode(None)
res = ListNode(None)
res.next = temp
whi... | true |
0a884a9a126e38d8e0e65af22c1b550e1c167ffe | Python | tetrismegistus/minutia | /processing_sketchbooks/packed_circles/packed_circles.pyde | UTF-8 | 1,904 | 3.734375 | 4 | [] | no_license | SIZE = 500
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
@staticmethod
def distance(point1, point2):
xd = point1.x - point2.x
yd = point1.y - point2.y
return sqrt(xd ** 2 + yd ** 2)
@staticmethod
def random():
... | true |
62ce4657a79a9754bd091ae9d2c8d69fe006cc2a | Python | DawidWIld/SEMIII | /MMI/fft2D.py | UTF-8 | 2,474 | 3.046875 | 3 | [] | no_license | import cmath
import math
import matplotlib.pyplot as plot
import matplotlib.image as image
def load_image(dir):
return image.imread(dir)
def fft(x):
n = len(x)
if n <= 1:
return x
even = fft(x[0::2])
odd = fft(x[1::2])
T = [cmath.exp(-2j*cmath.pi*k/n)*odd[k] for k in range(n//2)]
r... | true |
1e75362e649067ffc29e079e545ea95ab62afc76 | Python | pandeysaurabhofficial/LetsUpgradeDsaAssignment | /Day1(DSA Assmt).py | UTF-8 | 313 | 3.25 | 3 | [] | no_license | 1.
{
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
printf("hello")
ans: it's time complexity is O(n square) as it's quadratic time complexity
2.
{
for(i=1;i<=n;i*3)
for(j=1;j<=n;j++)
{
printf("hello")
ans: it's time complexity is O(n square) as the value of n is unknown and its quadratic as well
| true |
c2fd628eb90d4378b450cdb13488f5c5d46282bb | Python | erkkke/Python2020 | /informatics/Integer arithmetics/R.py | UTF-8 | 290 | 3.171875 | 3 | [] | no_license | a = int(input())
time = (45 * a)
even = 0
odd = 0
for i in range (1, a, 2):
if(i < a):
odd = odd + 1
for i in range (2, a, 2):
if(i < a):
even = even + 1
time = time + (odd * 5) + (even * 15)
hour = (time // 60) + 9
min = time % 60
print (hour, min)
| true |
d1d95581340af2980b01ff7f5f8a5fbdb13cd5ed | Python | liruileay/data_structure_in_python | /data_structure_python/question/chapter4_dynamic/question1.py | UTF-8 | 735 | 4.03125 | 4 | [] | no_license | """
题目:给定整数N,返回斐波那契数列的第N项
补充题目1:
给定整数N,代表台阶数,一次可以跨2个或者1个台阶,返回还有多少种走法。
补充题目2:
假设农场中成熟的母牛每年只会生1头小母牛,并且永远不会死。第一年农场有1只成熟的母牛,从第二年开始,母牛开始生小牛
。每只小母牛3年之后成熟又可以生小母牛。给定整数N,求出N年后牛的数量。
"""
def f1(n):
if n < 1:
return 0
if n == 1 or n == 2:
return 1
return f1(n - 1) + f1(n - 2)
def f2(n):
if n < 1:
return 0
... | true |
3279b8249bea8658fd13064185e4474e643198c5 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_143/432.py | UTF-8 | 342 | 3.125 | 3 | [] | no_license |
if __name__=='__main__':
T = int(input())
for i in range(1,T+1):
[A,B,K] = [int(x) for x in input().rstrip().split(' ')]
ans = 0
for x in range(A):
for y in range(B):
if x&y < K:
ans+=1
tp = 'Case #'+str(i)+': '+str(ans)
... | true |
867641a7f74daede9d5f4552477d704c6f1cd696 | Python | SilentStorm-1986/botw-re-notes | /tools/show_skipped_actors_for_ganon.py | UTF-8 | 2,969 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import pprint
import typing
import yaml
import argparse
import byml
import byml.yaml_util
from pathlib import Path
import wszst_yaz0
import zlib
from _map_utils import Map
actorinfodata = byml.Byml((Path(__file__).parent.parent/'game_files'/'ActorInfo.product.byml').open('rb').read()).parse()
d... | true |
975fa3bf184ca6699864bc4235289b74bde22966 | Python | yuanhawk/Digital-World | /Python Project/Wk 5 In Class Activities + Homework/Craps.py | UTF-8 | 1,167 | 4 | 4 | [] | no_license | import random
craps = set([2,3,12])
naturals = set([7,11])
sum = [4,5,6,8,9,10]
def roll_two_dices():
d1 = random.randrange(1,7)
d2 = random.randrange(1,7)
return d1,d2
def print_lose():
return print('You lose')
def print_win():
return print('You win')
def print_point(p):
string = 'Your poi... | true |
61410b3a9b4ae6abed10e4609ac277d13ecd2dbf | Python | DDoubleDee/netflix-film-filter | /searchengine.py | UTF-8 | 992 | 3.09375 | 3 | [] | no_license | def search(sortedlist, usersearch, usersearchtitleon, usersearchcountryon, usersearchgenreon, usersearchactoron, usersearchdescon):
searchlist = []
if usersearchtitleon == 'on':
for movie in sortedlist:
if usersearch.lower() in movie[3].lower():
searchlist.append(movie)
i... | true |
65465f923ee597854689d159d8f6c694d7df96eb | Python | SourceressEngineering/pyahocorasick | /regression/issue_56.py | UTF-8 | 617 | 3.125 | 3 | [
"GPL-1.0-or-later",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain"
] | permissive | import ahocorasick
def iter_results(s):
r = []
for x in A.iter(teststr):
r.append(x)
return r
def find_all_results(s):
r = []
def append(x, s):
r.append((x, s))
A.find_all(s, append)
return r
A = ahocorasick.Automaton()
for word in ("poke", "go", "pokegois",... | true |
76ec47e4038b90dc92706217cdd534551977567c | Python | avihad/BGP_research | /idc/bgpparser/main.py | UTF-8 | 8,210 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
from RibParser import RibDump
from optparse import OptionParser
from pybgpdump import BGPDump
from os import listdir
from os.path import isfile, join
import pygal
import tarfile
from operator import itemgetter
import math
resourcesPath="../../resources/"
bgpUpdatesPath = resourcesPath + "updat... | true |
bd7d2305b65158ed55728b403fe13e4fe2e201ad | Python | VoidArray/test_job | /simple_counter/problem1.py | UTF-8 | 248 | 3.328125 | 3 | [] | no_license | import re
from collections import Counter
# filename = input('Enter file name')
filename = 'book.txt'
with open(filename) as filehandler:
words = re.findall('\w{3,}', filehandler.read().lower())
c = Counter(words)
print('Частоты: ', c)
| true |
589996de16e88927ee595b2d0bae4454a07cf6d1 | Python | jjmaldonis/model_analysis | /icosahedron.py | UTF-8 | 6,062 | 3 | 3 | [] | no_license | """ This file generates a perfect <0,0,12,0> icosahedron.
It is actually called a dodecahedron (platonic solid).
You can specify the bond length between nearest neighbor atoms in the code """
import sys, random, copy
from math import sqrt
from fractions import Fraction
from model import Model
from atom import A... | true |
d15815b4a5c5505590b6bb63692ac4df8d7a28c4 | Python | Aishwarya-Sarkar/Customer-Segmentation | /K-Means Clustering.py | UTF-8 | 5,077 | 3.234375 | 3 | [] | no_license | # ### 3. K-Means Clustering:
#
# Now, we will be approaching the segmentation using K-Means Clustering, a popular unsupervised learning algorithm. But before we start, we need to process the data to adhere to the following assumptions of K-Means Clustering with the techiques mentioned below:
#
# 1. K-Means assumes th... | true |
a9f7ff8cb71956486e1735f9763f6380ed0257ba | Python | raywo/raspi-plays | /classes/ShiftRegister595.py | UTF-8 | 1,580 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import RPi.GPIO as GPIO
class ShiftRegister595:
def __init__(self, sd_pin, st_cp_pin, sh_cp_pin):
self.__sd_pin = sd_pin
self.__st_cp_pin = st_cp_pin
self.__sh_cp_pin = sh_cp_pin
# set pin numbering
GPIO.setmode(G... | true |
37e83d0d3d6ba67bd41004c94cbd67dc09a3c244 | Python | LYN088286/MDVRP_MHA | /Torch/Nets/model.py | UTF-8 | 1,768 | 2.546875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
# import sys
# sys.path.append('../')
# from dataset import generate_data
# from encoder import GraphAttentionEncoder
# from decoder import DecoderCell
from .encoder import GraphAttentionEncoder
from .decoder import DecoderCell
class AttentionModel(nn.Module):
def __init__(self... | true |
b86f62c7865c806f0eba501b6e5936fecf839a7a | Python | kiir07/test_python | /week_4/w4_Untitled-1_Минимальный делитель числа=.py | UTF-8 | 1,001 | 4.09375 | 4 | [] | no_license | # Дано натуральное число n>1. Выведите его наименьший делитель,
# отличный от 1. Решение оформите в виде функции MinDivisor(n).
# Алгоритм должен иметь сложность порядка корня квадратного из n.
# Указание. Если у числа n нет делителя не превосходящего корня из n,
# то число n — простое и ответом будет само число n.
# ... | true |
34de4b9b0770efbab1a99f203dc59274495a5e5d | Python | spellworks/httppy | /socketserver.py | UTF-8 | 5,845 | 2.90625 | 3 | [] | no_license | # coding=utf-8
import socket
import threading
import logging
import os
import traceback
class BaseTCPServer(object):
"""
基于TCP套接字的单线程服务器类
用于完成套接字层面的网络操作
工作流程:
bind()
↓
listen()
|
| loop ←------- ←
↓ ↑
get_r... | true |
a01e479975eddc3dd387e3f4fe0e35e109f9d08d | Python | gbosdet/Cartpole | /Cartpole DQN.py | UTF-8 | 5,130 | 2.6875 | 3 | [] | no_license | import gym
import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
class Layer:
def __init__(self, inputs, outputs, f=tf.nn.tanh):
self.weights = tf.Variable(tf.random_normal(shape=(inputs, outputs)))
self.params = [self.weights]
self.b = tf.Variable(np.zeros(outputs... | true |
43783ca1956876b18dc97eef91b9f3df07d7190a | Python | fitzk/TravelingSalesmanProblem | /submit/TSP_greedy.py | UTF-8 | 1,311 | 3.6875 | 4 | [] | no_license | import sys
import re
import math
# Rounds number to the nearest integer
def nearest_int(num):
if (num > 0):
return int(num + .5)
else:
return int(num - .5)
# Calculates distance between city 1 and city 2
def calculate_distance(c1, c2):
return nearest_int(math.sqrt((c1[1] - c2[1])**2 + (c1[... | true |
f6353dda02473f3ed8e36164343ebbf42e743c91 | Python | ViridianaVM/ADA-Precourse_SnowmanProject | /snowman_game.py | UTF-8 | 4,719 | 3.8125 | 4 | [] | no_license | import random
from wonderwords import RandomWord
SNOWMAN_MIN_WORD_LENGTH = 5
SNOWMAN_MAX_WORD_LENGTH = 8
SNOWMAN_MAX_WRONG_GUESSES = 7
SNOWMAN_1 = '* * * '
SNOWMAN_2 = ' * _ * '
SNOWMAN_3 = ' _[_]_ * '
SNOWMAN_4 = ' * (") '
SNOWMAN_5 = ' \( : )/ *'
SNOWMAN_6 = '* (_ : _) '
SNOWMAN_7 = '-----------'
... | true |
c3188b38ca36195d0aa6b4c82df659157c68a620 | Python | hhcs9527/Deep-learning-Implementation | /CNN_Mobile_Net/CPU_version/main.py | UTF-8 | 3,067 | 2.734375 | 3 | [] | no_license | import Process as Proc
import plot
import os
import matplotlib.pyplot as plt
import torch
from EEGNet import EEGNet
from DeepConvNet import DeepConvNet
cur_path = os.getcwd()
if __name__ == '__main__':
print('Training or Testing?')
choice = input()
if (choice == 'Training'):
##. Hyper Parame... | true |
e43ea6939e6f486dd9fafa8f7be8d4ff7a446aa3 | Python | DFrye333/DynamicMaze | /main.py | UTF-8 | 399 | 2.828125 | 3 | [
"MIT"
] | permissive | '''
Module: main
Author: David Frye
Description: Generates a dynamically-mutating maze. A prototype for Labyrinthine.
'''
import test
def run():
return
def main():
user_input_prompt = "Main menu: "
user_input = str(input(user_input_prompt))
while user_input != "":
if user_input == "0":
test.test_harness()
... | true |
3852855b62f20cda16033215a0bf12b622a2eeca | Python | ghuyng/ai-assignment | /ass1/PathFinding/pathfinding.py | UTF-8 | 2,747 | 3.734375 | 4 | [] | no_license | # Start state:
# - Start point with position
# - End point with position
# - Barriers with position
# Rules to move: suppose that we move value 0
# - Start point can move up (x, y+1)
# - Start point can move down (x, y-1)
# - Start point can move left (x-1, y)
# - Start point can move right (x+1,y)
# Heuristic funct... | true |
205222754aef5667d1a870db7636df679296eaaf | Python | claire0809/sparta | /homework/week3_genie_prac_alone.py | UTF-8 | 2,568 | 2.96875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from pymongo import MongoClient # pymongo를 임포트 하기(패키지 인스톨 먼저 해야겠죠?)
client = MongoClient('localhost', 27017) # mongoDB는 27017 포트로 돌아갑니다.
db = client.dbsparta # 'dbsparta'라는 이름의 db를 만듭니다.
# 타겟 URL을 읽어서 HTML를 받아오고,
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 1... | true |
970904a356432f634da83e308dab788e0e13bcf8 | Python | nishankjain/cs-546-applied-information-retrieval | /docs/RetrievalModels.py | UTF-8 | 2,489 | 2.90625 | 3 | [] | no_license | class RetrievalModels():
"""
Class which exposes APIs to query an inverted index using various modes and scoring models
"""
def __init__(self,
query_terms,
inverted_index,
retrieval_model='dirichlet',
k1=1.2,
k2=100,
... | true |
1fa5279356e469ffb4855b14ec6a5e17ba90926b | Python | Ashleshk/Python-For-Everybody-Coursera | /Course-1-Programming-for-Everybody-Getting-Started-with-Python/Codes/overtime_pay_try_except.py | UTF-8 | 647 | 4.0625 | 4 | [
"MIT"
] | permissive | # Employees get 1.5x the hourly rate for hours work above 40 hours.
# Error message for non-number input.
# One prompt then quit. No loop for this!
# Concepts: if, elif, else, try, except, input and print
hrs = raw_input("Enter Hours: ")
hrs_int = float(hrs)
hourly_rate = raw_input("Hourly Rate: ")
hourly_rate_int ... | true |
412f942971831ae3532994b2eceae41d2f2a1d42 | Python | DevJ5/Automate_The_Boring_Stuff | /phoneScraper.py | UTF-8 | 630 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import re
import pyperclip
text = pyperclip.paste()
extractedPhonenumbers = re.findall(r"""
(
(\d{3}|\(\d{3}\))? # Optional area code
(\s|-) # First seperator
(\d{3}) # first 3 digits
- # Second seperator
(\d{4}) ... | true |
0cf9ee1110e274c3ff5a9bfd51a62c4be2a01161 | Python | AlexPol5/Data_Visualization | /dice_visual_2D6.py | UTF-8 | 993 | 3.28125 | 3 | [] | no_license | import pygal
from cube import Cube
# Создание двух кубиков D6.
cube_1 = Cube()
cube_2 = Cube()
# Моделирование серии бросков с сохранением результатов в списке.
results = []
for roll_num in range(1000):
result = cube_1.roll() * cube_2.roll()
results.append(result)
# Анализ результатов.
frequencies = []
max_r... | true |
c14377998974d7b2c84a8c7924b63dcbc239efb5 | Python | cms-sw/cmssw | /Validation/Tools/scripts/simpleEdmComparison.py | UTF-8 | 6,623 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/env python3
from __future__ import print_function
from builtins import range
import inspect
import itertools
import logging
import optparse
import pprint
import random
import sys
import ROOT
from DataFormats.FWLite import Events, Handle
typeMap = { 'double' : ['double', 'vector<double>'],
'in... | true |
74e2b7b591826e2fb28fe54ed5e2c3c7f12b1edd | Python | tamojeetK/Python | /9Strings.py | UTF-8 | 868 | 5.15625 | 5 | [] | no_license | #Strings in python
text = "\nHello World"
print(text)
# *****************
# Single or Double Quotes
text1 = 'He said "I love Python"'
print(text1)
# *****************
text2 = "Let's have fun learning Python!"
print(text2)
# *****************
# Multi Line Strings
text3 = '''Python
is fun to learn
for s... | true |
eb3d38554896ad8dac45169c9ab7e8575cef6b19 | Python | facebookresearch/CompilerGym | /compiler_gym/spaces/commandline.py | UTF-8 | 2,840 | 3.515625 | 4 | [
"MIT"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Iterable, List, NamedTuple
from compiler_gym.spaces.named_discrete import NamedDiscrete
class CommandlineFlag(NamedTuple)... | true |
944a9dc1e1f0b10033dbbbf68629fab633a95d6a | Python | cekicbaris/DeepLearningForObjectDetection | /webapp.py | UTF-8 | 1,600 | 2.53125 | 3 | [
"MIT"
] | permissive | import streamlit as st
import numpy as np
from config import *
from experiment import *
from PIL import Image
from torchvision import transforms as transforms
@st.cache
def process_image(uploaded_img, algorithm):
transform = transforms.Compose([
transforms.ToTensor(),
... | true |
888771e3d7b39e8beed81cdc7408a07f7375a8c7 | Python | nagireddy96666/Djagno-dashboard | /usrauth/app/views.py | UTF-8 | 3,946 | 2.640625 | 3 | [] | no_license | import json
from datetime import datetime
from flask import Flask, jsonify, request, make_response
from werkzeug.security import generate_password_hash, check_password_hash
from bson import ObjectId
from usrauth.app.mongo import db
from usrauth.app.utils import serial
from usrauth.app.auth import requires_auth
app = F... | true |
b6a63419c2043bd742653d38af77466a18668cec | Python | haoqianglyu/NewPython_Learning | /ood/multi_inherit.py | UTF-8 | 504 | 3.921875 | 4 | [] | no_license | # 多继承
class Ma(object):
def run(self):
print("马在奔跑")
def eat(self):
print("马在吃草")
class Lv(object):
def lamo(self):
print("驴在拉磨")
def eat(self):
print("驴在吃麦秆")
class Luozi(Ma, Lv):
pass
def eat(self):
# 如果不想按照mro的顺序执行,可以通过以下方式执行
Lv.eat(self)... | true |
c4b4e4a73755cbb0b0e77bc5ceee152260c47a39 | Python | StBogdan/PythonWork | /Leetcode/1776.py | UTF-8 | 1,659 | 3.5 | 4 | [] | no_license | from collections import deque
from typing import List
# Name: Car Fleet II
# Link: https://leetcode.com/problems/car-fleet-ii/
# Method: Grafical intuition, monotonic queue building from the end with cars to futher crash into
# Time: O(n)
# Space: O(n)
# Difficulty: Hard
class Solution:
def getCollisionTimes(se... | true |
22b1415b403099bbe9ebd039fce0fe1918008b14 | Python | anotherLostKitten/the-incident | /this.py | UTF-8 | 1,429 | 2.8125 | 3 | [] | no_license | class Img:
def __init__(self,r,c):
self.c=c
self.r=r
self.img=[0 for i in range(r*c)]
def s(self,r,c,v):
self.img[c+r*self.c]=v
def ln(self,rs,cs,rf,cf,v):
dr=abs(rf-rs)
dc=abs(cf-cs)
if rs>rf if dr<dc else cs>cf:
self.ln(rf,cf,rs,cs,v)
... | true |
21b00b4559d8f6f5fc0a5003d87800353a2b7689 | Python | Dandresfsoto/agape-django | /agape-core/agape/signals.py | UTF-8 | 610 | 2.875 | 3 | [
"MIT"
] | permissive |
observers = {}
class Observer():
context = None
method = None
data = None
def __init__(self, context, method, data=None):
self.context = context
self.method = method
self.data = data
def destroy(self):
observers[self.context].remove(self)
def react(self,*args):
self.method(self,*args)
de... | true |
4384cdeaf235cc973aa13aee0aabdc3e38ad5d83 | Python | Abhinav2903/foobarandleetccode | /foobarcodechallenge/complementnolc.py | UTF-8 | 734 | 3.46875 | 3 | [] | no_license | def findComplement(num: int) -> int:
rc=[]
N=k=0
while(num):
R=num%2
if(R==1):
rc.append(0)
else:
rc.append(1)
num=num//2
for j in rc:
N=N+j*pow(2,k)
k=k+1
re... | true |
9b5aaa26cb7ad036d5696961dc3e1f07e8373d1a | Python | DavidDexterCharles/GBK-Topic-Modeler | /iDocumentation/experiment0/generator2.py | UTF-8 | 1,498 | 3.046875 | 3 | [] | no_license | from gbc.gbc import GBC as Model
model = Model()
topics = {}
topictags = {}
topics['model'] = ['sport','notsport']
topictags['sport'] = ['sp']
topictags['notsport'] = ['np']
model.init(topics,topictags)
model.tojson("model_Initial")
document1 = 'A great game sports occur sp '
document2 = 'The elect... | true |
f3ace18df3791267d6c5521278405de7d26404f9 | Python | ee19acmtech11009/EE5609 | /Assignment1/assignment1.py | UTF-8 | 817 | 3.765625 | 4 | [] | no_license | #EE5609:Matrix Theory
#Assignment 1
#Lines and Planes(Prob.39)
#Code by Sneha Konduru
#Roll no: ee19acmtech11009
#Libraries
from sympy import *
from sympy.abc import x, h
from sympy import Point, solve, Eq
from sympy.geometry import Line
from sympy import Derivative
from fractions import Fraction
#Given points ... | true |
46ae1fe6c7817b7cb3616fac2b45506397b0308f | Python | aidatorajiro/crypto | /kusa2.py | UTF-8 | 5,232 | 2.984375 | 3 | [] | no_license | # Statistics (and a little cryptography) over a finite field
# composite multiple base keys to a single masterkey using polynomial fitting
# the masterkey cannot be computed without having at least k base keys
# the masterkey can ganerate base keys
# use numpy to run this script
def tomod(obj, p):
if type(obj) == ... | true |
3580ec2e3a4d365ee3ac79f4aae26c51acbc405b | Python | coreyabshire/color-names | /Scripts/hulltest.py | UTF-8 | 440 | 3.140625 | 3 | [
"MIT"
] | permissive | from scipy.spatial import ConvexHull
points = np.random.rand(30, 3) # 30 random points in 2-D
hull = ConvexHull(points)
import matplotlib.pyplot as plt
plt.plot(points[:,0], points[:,1], 'o')
for simplex in hull.simplices:
plt.plot(points[simplex, 0], points[simplex, 1], 'k-')
plt.plot(points[hull.vertices,0], ... | true |
55a2019f134ef0b0771481c624ef534ac6cae81f | Python | hariprocessor/ABEEK | /test.py | UTF-8 | 1,406 | 3.046875 | 3 | [] | no_license | import random
import sys
freshman = 200
desire = 5
department = 30
freshman_data = []
department_data = []
final_match = []
arranged = []
# input data
for i in range(department) :
final_match.append([])
for i in range(freshman) :
input = raw_input("Enter input : ")
freshman_data.append(map(int, input.spl... | true |
64cedec000d7479d10458e8331bc3f9c0065c846 | Python | liuzuxin/multi_agent_path_planning | /generate_map/generate_grid.py | UTF-8 | 839 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 16 07:57:35 2020
@author: lance
"""
from PIL import Image
import numpy as np
import yaml
import matplotlib.pyplot as plt
img = Image.open('map.png').convert('L')
np_img = np.array(img)
np_img = ~np_img # invert B&W
np_img = np_img/255
np_img[np... | true |
e5bf00e04a447cd47592dc9caf8d931a0be9069a | Python | narayana1043/course_works | /Machine-Learning/pratice/ANN/ann_perceptron_learning_alogirthm.py | UTF-8 | 2,159 | 3.140625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import random
from math import sqrt
def compute_predicted_output(weighted_vector, each_training_example,
len_df_cols, theta, bias):
output = sum(weighted_vector[i] * each_training_example[1][i] for i in
range(len_df_cols)) + bias... | true |
494f0f719ef4c2fd63d1ce5a3e5a6af5b9a57a42 | Python | Abdilaziz/Collections-And-Algorithms-Notes | /Example Problems/Project Euler Problems/46. Goldbach's Other Conjecture/problem.py | UTF-8 | 2,703 | 4.03125 | 4 | [] | no_license | # coding=utf-8
# It was proposed by Christian Goldbach that every odd composite number can be written
# as the sum of a prime and twice a square.
# 9 = 7 + 2×1^2
# 15 = 7 + 2×2^2
# 21 = 3 + 2×3^2
# 25 = 7 + 2×3^2
# 27 = 19 + 2×2^2
# 33 = 31 + 2×1^2
# It turns out that the conjecture was false.
# What is the small... | true |
6cc2869953081ff8be649d9c1b694c20bbdc1ee0 | Python | jzxr/TraceTogether | /DataStructuresandAlgorithms/stack.py | UTF-8 | 655 | 3.5 | 4 | [] | no_license | class Stack:
def __init__(self):
self.top = -1
self.data = []
def push(self, value):
self.data.append(0)
self.top += 1
self.data[self.top] = value
def pop(self):
try:
value = self.data[self.top]
del self.data[self.top]
... | true |
a756f5b8ed6f1c1f917b217862a09c538a82dab3 | Python | trojek/elections-models | /election_control_algorithm.py | UTF-8 | 2,614 | 2.515625 | 3 | [] | no_license | from voting_system import VotingSystem
import random
class PluralityControl:
def __init__(self, voters_preferences):
self.vs = VotingSystem(voters_preferences)
self.method = "plurality"
def ccac(self):
pass
def dcac(self):
pass
def ccdc(self):
return ccdc_uni... | true |
2d017ceb761bab86cd426d9663fe7bfde7647a67 | Python | TavoGLC/DataAnalysisByExample | /Visualization/LollipopPlot.py | UTF-8 | 15,319 | 3.140625 | 3 | [
"MIT"
] | permissive | """
MIT License
Copyright (c) 2021 Octavio Gonzalez-Lugo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | true |
cefa73568b7cbdf449c2e0c930b51ebd1cbb8e6e | Python | abobakryousre/Crowd-Funding-consol | /library/validator.py | UTF-8 | 988 | 3.28125 | 3 | [] | no_license | import re
class Validator:
def check_username(self, username):
if username is None or username.isdigit():
return False
else:
return True
def confirm_password(self, first_password, second_password):
if first_password == second_password:
return True
... | true |
cf165d8cad4294ac859ae067ad718cc1ba6bf265 | Python | myumoon/deep_larning_tutorial | /1_python/1-0_numpy_tutorial.py | UTF-8 | 598 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
def testNumPy():
x = np.array([[1, 2], [3, 4]])
y = np.array([10, 20])
print(x * y)
def testMatplotLib():
x = np.arange(0, 6, 0.1) # 0.1刻み
y1 = np.sin(x)
y2 = np.cos(x)
plt.plot(x, y1, label = "si... | true |
2a53d94492d684526070827ff8967c67657c9d97 | Python | seancheng33/somethink_for_myself | /matplotlib_study/plt_demo01.py | UTF-8 | 315 | 3.125 | 3 | [] | no_license | '''
@Author : sean cheng
@Email : aya234@163.com
@CreateTime : 2018/8/8
@Program :
'''
import matplotlib.pyplot as plt
import numpy as np
# plt.plot([3, 1, 4, 5, 2])
# plt.ylabel("grade")
# plt.show()
a = np.arange(10)
plt.plot(a, a*1.5, 'go-', a, a*2.5, 'rx', a, a*3.5, '*', a, a*4.5, 'b-.')
plt.... | true |
fd653c24e0ce0c8bcba705db6f2675d9cb94bf5a | Python | ZhongTing/code_challenge | /#1 sentiment classification/sentiment_classification.py | UTF-8 | 1,660 | 2.890625 | 3 | [] | no_license | import jieba
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegressionCV
from sklearn.model_selection import cross_val_score
from sklearn.svm import LinearSVC
def load_data_from_file(file_name):
data = []
with open(file_name, "r", encoding="utf-8") as file... | true |
07a4e4b1f3e1c37f96e50a9ca3eb69d9e1f731e5 | Python | anisayari/pywikibot | /scripts/followlive.py | UTF-8 | 20,046 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Periodically grab list of new articles and analyze to blank or flag them.
Script to follow new articles on a wikipedia and flag them
with a template or eventually blank them.
There must be A LOT of bugs ! Use with caution and verify what
it is doing !
The following para... | true |
6ed1f6585a6ce4521809c94fa74e3d671a980edd | Python | jedzej/tietopythontraining-basic | /students/Glogowska_Joanna/lesson_03_functions/The_Collatz_Sequence.py | UTF-8 | 136 | 3.234375 | 3 | [] | no_license | def collatz(number):
if number % 2 == 0:
print(number // 2)
else:
print(3 * number + 1)
collatz(int(input()))
| true |
da17893b06c576f26c45844d641cb92062dec1c9 | Python | Lazy12316/Python3-Simple-Tips-and-Tricks | /Python_tips_n_tricks.py | UTF-8 | 11,308 | 4.125 | 4 | [] | no_license | # Date:19-Nov-2019
# [🐍PyTricks]:Trick - 1
"""
# Different ways to test multiple flags at once in python
x,y,z = 0,1,0
# Method-1
if x==1 or y==1 or z==1:
print("Passed-Method1")
# Method-2
if 1 in (x,y,z):
print("Passed-Method2")
# Method-3
if any((x,y,z)):
print("passed-Method3")
"""
# [🐍PyTricks]:Trick-2 ... | true |
d3a63f939f61bbf702d7ddc2ebe90c94f591a891 | Python | teddyrugged/calc | /simple calculator.py | UTF-8 | 502 | 4.28125 | 4 | [] | no_license | #creating a simple calculator
first_number = float(input("please enter the first_number: "))
operator = input("enter the operator or sign: ")
second_number = float(input("please enter the second_number: "))
if operator =="+":
print (first_number + second_number)
elif operator == "-":
print (first_number - sec... | true |
b2ff01fea76af4dffbcc0da41f198993b8e6d86b | Python | algorithm2020/Algorithm_CEK | /14_20200321과제물/10026_적록색약.py | UTF-8 | 2,822 | 3.375 | 3 | [] | no_license | import sys
from collections import deque
input= sys.stdin.readline
q=deque()
#입력#
N= int(input())
MAP=[ [*input().strip()] for _ in range(N)]
NORMAL_AREA={'R':0, 'G':0, 'B':0} #정상인
NOT_GREEN={'R': 0, 'B':0}#적록색약
visited=[ [False]*N for _ in range(N) ]
#상/하/좌/우
dy=(-1,1,0,0)
dx=(0,0,-1,1)
def isRange(y,x):
if (y... | true |
834c48dbb29eef3d36763a53eae28ec51206af87 | Python | harisankarkr/luminarpython | /pythoncollections/pattern3.py | UTF-8 | 133 | 3.078125 | 3 | [] | no_license | lst=[5,4,3,2] #[9,10,11,12]
#lst=[5,6,3,4] [13,12,15,14]
out=[]
total=sum(lst)
for num in lst:
out.append((total-num))
print(out) | true |
f95ea4556a3ebd79deeb0ee201f32131ca2b11bb | Python | nilpoona/redisclient | /redis_data_panel.py | UTF-8 | 4,189 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#import re
import wx
class RedisDataGrid(wx.grid.Grid):
KEY_COL = 0
DATA_TYPE_COL = 1
VALUE_COL = 2
def __init__(self, parent, id):
wx.grid.Grid.__init__(self, parent, id, size=(1000, 500))
self._redis = None
self._data = None
self._last_line = 1... | true |