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 |
|---|---|---|---|---|---|---|---|---|---|---|
bef026afc5f12273341f74d12d694dd5895939a8 | Huib0513/AoC2019 | /day1.py | UTF-8 | 140 | 2.953125 | 3 | [] | no_license | #!python3
lines = open('day1.input').read().splitlines()
mass = 0
for line in lines:
mass = mass + (int(line)//3 - 2)
print(mass)
| true |
5caae210d19011dad39246d454c5c61153965d24 | LinLeng/xiaoxiyouran_all | /python2/20180718零基础学习python/Python-From-Zero-to-One/unmd/课时037 类和对象 面向对象编程/review_game.py | UTF-8 | 3,111 | 4.46875 | 4 | [] | no_license | # Summary: 游戏编程: 按以下要求定义一个乌龟类和鱼类并尝试编写游戏
# Author: Fangjie Chen
# Date: 2017-11-14
import random as r
legal_x = [0, 10]
legal_y = [0, 10]
class Turtle:
def __init__(self):
# 初始体力
self.power = 100
# 初始位置随机
self.x = r.randint(legal_x[0], legal_y[1])
self.y = r.randint(leg... | true |
deddee2f4e2bb90a05d8e158ae8949ec855ccaf4 | miguel-rita/remote-three | /code/semisupervised.py | UTF-8 | 2,495 | 3.046875 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.semi_supervised import LabelSpreading
from utils import prepare_datasets
def augment_train_set(train, labels, test, fraction):
'''Applies semisupervised learning to augment existing train set with
pseudo labelled test set samples.
:param train: Pandas Da... | true |
41ba56d42a86b39a343cf30bd1c496d8f11e7da6 | KAA-sign/stepik | /python_1/2_task.py | UTF-8 | 149 | 3.625 | 4 | [] | no_license | summ = 0
result = 0
while True:
i = int(input())
summ += i
result += i ** 2
if summ == 0:
print(result)
break
print() | true |
9cdc27883824f77ae716309305b0a89bfbd020a7 | harlanhong/txad20 | /cosupload.py | UTF-8 | 2,668 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding=utf-8
import logging
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
from qcloud_cos.cos_auth import CosS3Auth
from qcloud_cos.cos_comm import check_object_content_length, mapped, get_content_md5
secret_id = '' # 替换为用户的secret_id
secret_key = '' # 替换为用户的secret_key
... | true |
8a3a6ef3a746e967249705cb20b4d80caeef23dc | parthshrotri/AE202 | /AE202HW1PY.py | UTF-8 | 2,835 | 2.84375 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
N2PER = 98.4
CH4PER = 1.4
H2PER = .2
SurfStdTemp = 93.7
LapseRate040 = -.0005
ChangeRate4060 = .0004
ChangeRate6080 = .0025
SurfStdPress = 146700
SpecificHeatRat = 1.45
g = 1.352
N2MOLMASS = 28.02
CH4MOLMASS = 16.042
H2MOLMASS = 2.016
AMolMass = N2PER / 100 * ... | true |
d9101ab3baf547ec8d290c39b36678216e7748b9 | huiba7i/Mycode | /python/class code/code4.24/异常/异常和错误.py | UTF-8 | 451 | 3.9375 | 4 | [] | no_license | # 1. 错误: 通常指的是语法错误,它会导致程序一行代码都不会执行
# print("hello world")
# if True:
# print("真的?")
# else:
# print("假的")
# 2. 异常 在程序运行过程中出现的错误 导致程序中断 出现异常之前的程序可以正常执行,出现异常之后的程序将不再执行
b = True
if b:
print("真的")
a = 10
else:
c = 20
print("a", a)
print("c", c) # 异常 NameError
| true |
7b5fd604c13921255aefe6772a6e2834e10378f4 | gil9red/SimplePyScripts | /psutil_example/print_process_memory/print_process_by_memory__simple__only_firefox_total.py | UTF-8 | 454 | 2.6875 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
# pip install psutil
import psutil
total = 0
for p in psutil.process_iter():
name = p.name()
if name.lower() != "firefox.exe":
continue
memory = p.memory_info().rss
total += memory
print(name, memory)
print(
... | true |
5d91465ee0e3cf6b5433ec65edf84b6865099843 | vegito11/Data_Structure | /Data-Structure-Algorithm-Python3/09-Binary-Tree/06-Sum-&-SumTree/18-Check-BTree-Sumtree.py | UTF-8 | 5,200 | 4.03125 | 4 | [] | no_license | from Queue import Queue
class Node:
# constructor take name and age as argument and create new Node
def __init__(self,data):
self.key=data
self.left=None
self.right=None
def __str__(self):
return f'{self.key}'
class Tree:
# it will initiallize root variable which point to ROOT of Tree
def ... | true |
4ed389b028940734cfda261355af408d91c63a6d | Shion-Ito/Waveform-Generator | /Lab2.py | UTF-8 | 2,236 | 3.28125 | 3 | [] | no_license | import RPi.GPIO as GPIO
import math
import numpy as np
from time import sleep
import Adafruit_MCP4725
dac = Adafruit_MCP4725.MCP4725()
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
def sin_wave(frequency, volts):
t = 0.0
tStep = 0.0001
while True:
... | true |
446acaf82b0008480bd91a0d9689a8697e6af60e | MarcondesOliveira/python-learning | /listas-repeticao.py | UTF-8 | 29 | 2.671875 | 3 | [] | no_license | l = [1,2]
r = l * 4
print(r) | true |
f280eaa7a4cbe51a9f3bec1164d259307b339326 | vault-the/pendulum | /tests/pendulum_tests/test_create_from_format.py | UTF-8 | 3,225 | 3 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import pytest
import pendulum
from pendulum import Pendulum, timezone
from .. import AbstractTestCase
class CreateFromFormatTest(AbstractTestCase):
def test_create_from_format_returns_pendulum(self):
d = Pendulum.create_from_format('1975-05-21 22:32:11', '%Y-%m-%d %H:%M:%S')
... | true |
eff91cbd6c12ee8656dc0363e1e1547709f9b073 | RishavRajendra/TheUglyDuckling | /misc.py | UTF-8 | 6,424 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = "Rishav Rajendra, Benji Lee"
__license__ = "MIT"
__status__ = "Development"
from get_stats_from_image import get_data
from constants import LEDPIN, BUTTONPIN, CONTACT_PIN, fwd, rev
from targetApproach import approach, approach_obstacle
import time
def wait_for... | true |
2a64d6ad9c7bb3cb0d246a99fe9cef7f433b9837 | itzme-jp/Building-Lattices | /writeLattice.py | UTF-8 | 1,310 | 2.75 | 3 | [] | no_license | ### writeLattice.py
### Morgan Henderson, September 23, 2020
### Functions for writing several types of lattice configuration files
# Write a LAMMPS (.dat) configuration file
def writeDat(fName,m,r,R):
# Get information directly from inputs
na = len(r)
mset = list(dict.fromkeys(m))
t = [mset.index(mi)... | true |
f3cda693c3ec4c469a49f4a80a9919619c7c06c1 | vividyellow/oldboyeduPython14qi | /第1部分-python基础(颜涛老师)/day07/day07-code/02 作业讲解.py | UTF-8 | 1,339 | 3.59375 | 4 | [] | no_license | # 1.
# i = 1
# while i < 11:
# fen = input("请%d评委打分:" % i)
# if int(fen) > 5 and int(fen) < 10:
# print("OK的分数")
# else:
# print("不在有效范围")
# continue
# i = i + 1
# lst = ['金瓶梅', '解救吾先生', '美国往事', '西西里的美丽传说']
# dic = {}
# for el in lst:
# fen = input("请给%s电影进行打分:" % el)
# ... | true |
456fad9f99b15c0a587b509bdc52ae99aeb287b1 | HateStar/pythonProject | /learn py/genshin.py | UTF-8 | 2,123 | 3.28125 | 3 | [] | no_license | # 开发时间2021/3/13 23:48
# 加油啊测试!
#使用随机数,做的原神抽卡模拟器
import random
class genshin():
pass
def chouka(gacha_a=10):
"""
:return:
"""
#a = int(input("输入抽卡次数:")) #想要抽卡的次数
a = gacha_a
number = 0 #当前抽的是第几次
count_90 = 0 #90保底计数
count_10 = 0 #10次保底计数
ssr = 0
sr = 0
r = 0
while... | true |
a1b1b20d633e409463ab1b746cc9c5985c7163a8 | Sapunov/qua | /search/legacy/misc.py | UTF-8 | 2,112 | 2.71875 | 3 | [] | no_license | from datetime import datetime
from hashlib import sha1
from importlib import import_module
from urllib.parse import urlparse
import os
import tempfile
import time
def url_part(url, part_name):
parsed = urlparse(url)
if hasattr(parsed, part_name):
return getattr(parsed, part_name)
def extract_domai... | true |
19b2df6a35d1adc52c6ffdf3c4e2d90f52484098 | oliphantee/adventOfCode2020 | /src/day18/day18.py | UTF-8 | 1,675 | 3.59375 | 4 | [] | no_license | homeworkFile=open("homework.txt","r")
# I looked at https://www.tutorialspoint.com/Convert-Infix-to-Postfix-Expression for part 2 and modified it to suit the problem
def preced(ch):
if ch=="+" or ch=="-":
return 2
elif ch=="/" or ch=="x" or ch=="*": # for part 1, modify this to return 2
return... | true |
4c2a650c40126b752ed216086242f642b17d8243 | samueljmcameron/ABPs_coarse_graining | /experiments/scripts/effectivepotentials.py | UTF-8 | 2,800 | 2.609375 | 3 | [] | no_license | import numpy as np
import scipy.integrate as integrate
import scipy.interpolate as interpolate
import scipy.special as spec
import matplotlib.pyplot as plt
from softsphere import SoftSphere
class W2potential(SoftSphere):
def __init__(self,Omega=None,l0=1,epsilon=1,Pi=1):
super().__init__(Omega=Omega,l0... | true |
fd5320f6b9ac0938507b30b7fccb583d0fe2242d | eliask89/water-flow | /main.py | UTF-8 | 3,482 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd, datetime as dt
import os
#Fetch a css template
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_styles... | true |
b5c4223e3411f8a324f0cb7c0e6d95567c9b8ea4 | c567wang/On-The-Go | /game_functions.py | UTF-8 | 2,226 | 3.4375 | 3 | [] | no_license | # functions in alphabetical order
import pygame
from stone import Stone
# global variables
turn_marker = 0
occupied = False
cleared = False
def clear_stone(stones, mouse_pos):
"""clear stone chosen"""
global cleared
if (315 <= mouse_pos[0] < 885) and (15 <= mouse_pos[1] < 585):
posx = determi... | true |
c101a122494868a8a3159d2f99b8367cb9a26e00 | Egiob/DIAYN | /neural_network.py | UTF-8 | 1,013 | 2.953125 | 3 | [] | no_license | import torch
import torch.nn as nn
class NeuralNetwork(nn.Sequential):
"""Fully-connected neural network."""
def __init__(self, in_size, out_size, hidden_sizes,
activation=nn.Tanh):
layers = []
for size in hidden_sizes:
layers.append(nn.Linear(in_size, size))
... | true |
e354efeaa3aa129b1bdc63fc54a06c7b0024fc37 | hritik5102/Haar-Cascade | /Haar_Cascade.py | UTF-8 | 1,512 | 2.984375 | 3 | [
"Unlicense"
] | permissive | import cv2
import numpy as np
#-----haar Cascade----#
#approach -> First Find the face and then inside part of it i.e eyes ,nose etc
front_face = cv2.CascadeClassifier('frontface.xml')
eye = cv2.CascadeClassifier('eye.xml')
cap = cv2.VideoCapture(0)
cap.set(3,720)
cap.set(4,480)
while True:
ret ,img... | true |
d06aebe04a2c96b1d620ee641a0753560d6dd3f9 | ssolssolham/ssolssolham | /backjoon/array5.py | UTF-8 | 204 | 3.3125 | 3 | [] | no_license | import sys
# set을 사용해서 다른내용들을 저장
s = set()
# 10개의 데이터 받기
for item in range(0,10):
target = int(sys.stdin.readline())
s.add(target % 42)
print(s.__len__())
| true |
767aa210e58b6611d980b2d3beccf7296c4409a9 | vnosinov/ITEA_homeWorks | /Lesson08/hw08_01.py | UTF-8 | 863 | 3.546875 | 4 | [] | no_license | """
1. Напишите декоратор для класса, который бы при создании экземпляра этого класса осуществлял бы запись информации об
этом в текстовый файл. Пример записи: 2012-01-01 15:04 Создан экземпляр класса TestClass по адресу памяти x01223342
"""
from datetime import datetime
def deco_class_info(cls):
def inner():... | true |
10b4a6dd59de8361a3d5c822f0366f8bafdb4a6f | rizalghod/NumericalMethodsAssistance2021 | /Regresi Linear Tanpa input user.py | UTF-8 | 803 | 3.390625 | 3 | [] | no_license | #Regresi Linear y = ax + b
from numpy import*
x = [1, 2, 3, 4, 5]
y = [4., 3.1, 2.6, 2.4, 2.4 ]
A = array([[0,0,0],
[0,0,0]])
y2 = 0
i = 0
while i < len(x):
A[0,0] = A[0,0] + (x[i])**2
A[0,1] = A[0,1] + x[i]
A[1,0] = A[1,0] + x[i]
A[1,1] = i + 1
A[0,2] = A[0,2] + x[i]*y[... | true |
2c94bd62c7989eefb43f4d5eac0f79749218e78c | neduchal/ecs | /ecs/src/ecs/robot_behavior_adaptation_node.py | UTF-8 | 2,793 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import rospy
from std_msgs.msg import String
from std_msgs.msg import Int8
import switcher_api
class RBANode:
"""
Robot Behaviour Adaptation Node Class
It is supposed to react on the deecision of the Image Based Classification Node
by runni... | true |
849489a3a619dfa162dfc143a016f98cdd03e26f | richamousam/python-task | /question2.py | UTF-8 | 254 | 3.15625 | 3 | [] | no_license | n=int(input())
t=int(input())
chocolate=list(map(int,input.split()))
x={ }
for i in range(n-1):
for j in range(i+1,n):
if (chocolate[i]!=chocolate[j]) and (chocolate[i]+chocolate[j])==t:
x.append([i+1,j+1])
print(x[0][0],x[0][1])
| true |
99ead4c8c0f0daaac4ad84da6f865f5fec5d7fd1 | JinseongHwang/pyqt5-lecture | /layout/03-GridLayout.py | UTF-8 | 1,071 | 2.859375 | 3 | [
"MIT"
] | permissive | import sys
from PyQt5.QtWidgets import (
QApplication, QWidget, QGridLayout, QLabel, QLineEdit, QTextEdit, QComboBox
)
class MyApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
grid = QGridLayout()
self.setLayout(grid)
comboBox ... | true |
d756d042a7b81e891d76177af250db51ef02a18e | alexbaltman/c-h-e-c-k-i-o | /Incinerator/bird-language/script.py | UTF-8 | 188 | 2.828125 | 3 | [] | no_license | import re
def translate(phrase):
for v in "aeiouy":
phrase = re.sub(v+v+v, v, phrase)
phrase = re.sub(r"([bcdfghjklmnpqrstvwxz])[aeiouy]", r'\1', phrase)
return phrase
| true |
c3acb4ad36e978329e9a69155b668945713a2e22 | ronnathaniel/techwithron | /snake/window.py | UTF-8 | 5,019 | 3.015625 | 3 | [] | no_license |
import pygame
import random
from util import (
CELL_W, CELL_H, WINDOW_W, WINDOW_H, Vector, Movable
)
class Window:
def __init__(self):
self.setup_pygame()
self.setup()
self.main()
def setup_pygame(self):
self.surface = pygame.display.set_mode((WINDOW_W, WINDOW_H))
... | true |
f2bd7a25f266e722992b122a589fadff29cc6fb8 | yogesh1234567890/insight_python_assignment | /completed/Data31.py | UTF-8 | 205 | 3.875 | 4 | [] | no_license | #31. Write a Python program to iterate over dictionaries using for loops.
d = {'name':'ram', 'age': 12, 'sex':'male','job':'study'}
for key, value in d.items():
print(key, 'related to ', d[key]) | true |
7ac5811c1f36fc41a5c1d464f8569df8a1ef1035 | topol-3000/XMLParser | /Models/Product.py | UTF-8 | 1,149 | 2.71875 | 3 | [] | no_license | import random
from datetime import datetime
class Product:
def __init__(self, id, name = None, category = None, price = None, image = None,
manufacturer = None, description = None, quantity = None):
self.id = id
self.name = name
self.category = category
self.price =... | true |
a41f5587a404b73ec3971cadc0af2674bdc5bffc | LucasGood/pi-servo | /inputoutput.py | UTF-8 | 230 | 2.96875 | 3 | [] | no_license | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
while True:
input = GPIO.input(4)
if (input == True):
print("input true")
else:
print("input false")
| true |
e7ec4534a9f490991cdcfef03882243f202444e4 | nguyenvanhaivn/gcp-av | /functions/clamscan/clamscan.py | UTF-8 | 4,826 | 2.609375 | 3 | [
"MIT"
] | permissive | import base64
import binascii
import errno
import hashlib
import os
from subprocess import PIPE, STDOUT, Popen
import requests
from google.api_core.exceptions import NotFound
from google.auth.exceptions import DefaultCredentialsError
from google.cloud import storage
DEF_FILES = ["main.cvd", "daily.cvd", "bytecode.cvd... | true |
48c4b1bab664f706c4529c975566b5fb366e0e30 | alshayefaziz/comp110-21f-workspace | /projects/cyoa.py | UTF-8 | 9,287 | 3.890625 | 4 | [] | no_license | """Choose Your Own Adventure Experience."""
__author__ = "730397680"
SNAKE: str = '\U0001F40D'
TIGER: str = '\U0001F405'
DRAGON: str = '\U0001F409'
player: str
points: int
monster: str
moster_name: str
def main() -> None:
"""Programs Entrypoint."""
global points
global monster_name
points = 0
... | true |
1abf4c6906192eaf16057fe27739001ce3df7eff | gentnerlab/pyoperant | /pyoperant/behavior/shape.py | UTF-8 | 31,444 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import random
import datetime as dt
from pyoperant import panels
from pyoperant import utils
class Shaper(object):
"""
Run a shaping routine in the operant chamber that will teach an
to peck the center key to hear a stimulus, then peck one of the side keys for reward.
training sequence:
Block 1: H... | true |
e950422de54744018cc18e4a5af8c60e1d2ad85d | Xls1994/JData | /gen_feat.py | UTF-8 | 21,645 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
from datetime import datetime
from datetime import timedelta
from datetime import date
import pandas as pd
import pickle
import os
import math
import numpy as np
action_1_path = "./data/JData_Action_201602.csv"
action_2_path = "./data/JData_Action_201603.csv"
a... | true |
cfe6a2f8a011394855d0cd4c693d40fedf723018 | SebDub/SubProducts | /code/DownloadData.py | UTF-8 | 1,405 | 3.375 | 3 | [
"MIT"
] | permissive | # 1) create a data folder
# 2) batch download the data from kaggle there
# 3) unzip them there
import os
import zipfile
def DownloadData(dirName: str = 'data') -> None:
"""Dowload the data from instacart on Kaggle
Input dirname: str with the directory
(existing or to be created)
to store... | true |
ecd1fc6d1d9deee1395171e19ed2805e80f7461b | LauraGwilliams/MorphComp | /stimuli_creation/make_stim_perm.py | UTF-8 | 3,013 | 2.515625 | 3 | [] | no_license | # make stimuli permutations
import numpy as np
import glob
import wave
# paths
root_dir = '/Users/lauragwilliams/Documents/experiments/brothelo'
file_dir = '%s/exp_design/stim_create/chunked' % (root_dir)
out_dir = '%s/exp_design/stim_create/combined' % (root_dir)
# define root path
f0 = '%s/%s.wav' % (file_dir, 'r... | true |
1385fd50c3a3663d656e969663de258da30be50c | jmegner/MazeSolver | /graph.py | UTF-8 | 3,916 | 3.09375 | 3 | [] | no_license | # author: Jacob Egner
# date: 2015-07-05
import collections
import copy
import itertools
import functools
@functools.total_ordering
class VeryBig:
def __eq__(self, other): return isinstance(other, VeryBig)
def __lt__(self, other): return False
def __add__(self, other): return self
def __radd__(self,... | true |
7f011bb3cef646962967188cf0e4d7f48eff8096 | cyber-kirby/Python-Art | /Triangles/triangle_magic.py | UTF-8 | 3,293 | 4.03125 | 4 | [] | no_license | # Using mathematics and probability, this programs creates a cool visualisation.
# The sequnece is as follows:
# There are three corners in a triangle. Each triangle with be assigned a number
# 1,2, or 3. Then the program will randomly generate a dot in the middle between
# the randomly genereated number and the previo... | true |
c7eb544688dd74d3bd9501e52aad30028eeec65b | sooriravindra/2nd_black_ace | /compare.py | UTF-8 | 1,689 | 3.390625 | 3 | [] | no_license | import random
import sys
BLACK_ACE1 = random.randint(1,52)
BLACK_ACE2 = random.randint(1,52)
NUM_OF_SIM = 100000
STEPS = NUM_OF_SIM/20
DECK = range(1,53)
while(BLACK_ACE1 == BLACK_ACE2):
BLACK_ACE2 = random.randint(1,52)
#-----------------------------------------------------------------------------------
print "B... | true |
9babdf38f10579610c800b96633596572b05c4b5 | Aasthaengg/IBMdataset | /Python_codes/p04034/s847741277.py | UTF-8 | 428 | 2.8125 | 3 | [] | no_license | n,m = map(int,input().split())
xy = [[int(i) for i in input().split()] for _ in range(m)]
num = [1]*n
red = [False]*n
red[0] = True
flag = True
for i in range(m):
p = xy[i][0]
q = xy[i][1]
num[p-1] -= 1
num[q-1] += 1
if red[p-1]==True:
red[q-1] = True
if num[p-1]==0:
red[p-1... | true |
8b98ffb8702c30722c86f721b21a72c206ec08ae | ct-chook/mom | /src/components/board/board.py | UTF-8 | 20,199 | 3.015625 | 3 | [] | no_license | import logging
import random
import re
from math import floor
from src.components.board.players import Player, PlayerList
from src.components.board import players
from src.components.board.monster import Monster
from src.components.board.tile import Tile, TileModifier
from src.helper.Misc.constants import ROOT, Terrai... | true |
70af6b993eb14a44a806e08a33915a105b966f66 | GeeklifeWang/gitworkspace | /my python note/正则匹配re模块应用.py | UTF-8 | 3,357 | 2.984375 | 3 | [] | no_license | # -*- coding:utf8 -*-
import re
#match
str1 = 'www-123 asd asdaqwe'
m = re.match('^(\w{3})-(\d{3})',str1)
print m.group()
print m.groups()
print m.group(1)
print m.group(2)
#search
str2 = 'www-123 thu.1 asdaqwe'
n = re.search('(\w{3})\.(\d)?',str2)
print n.group()
print n.groups()
print n.group(1)
print n.group(2)
... | true |
8405df0876a66b1d8a102d4e7d9c40f82f10c2fa | alu0100530964/Equipo_3_E | /src/ej_graf.py | UTF-8 | 786 | 3.3125 | 3 | [] | no_license | #!usr/bin/python
#!encoding:UTF-8
import pylab as dibujo
x = [1,2,3,4]
y = [10,20,30,40]
y2 = [5,15,25,35]
y3 = [7,12,22,33]
y4 = [12,25,33,39]
p1 = dibujo.subplot(211)
dibujo.title ('Porcentajes de error')
dibujo.plot (x, y, marker='o', linestyle=':',color='r', label='Linea 1') #':' '--' '_' . Los colores son 'r'... | true |
de31c8e3818c168ae5d359b57152bc66b98049bd | haomingdouranggouqil/mlcu | /mlcu/ml/KNN.py | UTF-8 | 1,963 | 3.109375 | 3 | [
"MIT"
] | permissive | import cupy as cp
class KNN:
'''
KNN模型,支持分类与回归,
'''
def __init__(self, task_type='classification'):
self.train_data = None
self.train_label = None
self.label_set = None
self.task_type = task_type
def fit(self, train_data, train_label):
self.train_data = cp.a... | true |
329582d676c9c3c8aa5f1150138b66871381ada5 | PacktPublishing/Apache-Spark-in-7-Days | /Section 3/3.4_code_DataFrameColumnOperations.py | UTF-8 | 2,196 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# start the Spark Context
import findspark
findspark.init()
# In[2]:
import pyspark # only run after findspark.init()
# In[3]:
from pyspark.sql import SparkSession
sc = pyspark.SparkContext(appName="col")
# In[4]:
spark = SparkSession.builder.getOrCreate()
... | true |
1a240b17e09c06472deaedfdc18b51660330a6ec | kimmyoo/python_leetcode | /7.BINARY TREE and BST/894_all_possible_BTs_MED/solution.py | UTF-8 | 957 | 3.640625 | 4 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def allPossibleFBT(self, N):
"""
:type N: int
:rtype: List[TreeNode]
"""
#base ca... | true |
ac4cd99a96d35269f3a5591b515ade5ef418fc75 | ianahernandez/master-python | /03-funciones/funciones-recursivas.py | UTF-8 | 724 | 4.125 | 4 | [] | no_license | #=======================================================
#=================== RECURSIVIDAD ======================
#=======================================================
#Es una tecnica muy utilizada que se basa en dividir un problema en partes mas pequeñas
# para poder solucionarlo de forma mas simple. Una funcion r... | true |
572d2bbb77da5ab6878b9cf1242af9f125ae0f91 | wmillar/ProjectEuler | /026.py | UTF-8 | 2,039 | 3.75 | 4 | [] | no_license | """
A unit fraction contains 1 in the numerator. The decimal representation of
the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. ... | true |
34670656d61d7c1bca093c5990ef7e59da769e03 | pankaj-cloud/python_basics-pirple | /Homework _6_Advanced_Loops.py | UTF-8 | 1,006 | 4.625 | 5 | [] | no_license | """
Homework Assignment #6: Advanced Loops
Create a function that takes in two parameters: rows, and columns, both of which are integers.
The function should then proceed to draw a playing board (as in the examples from the lectures)
the same number of rows and columns as specified. After drawing the board, your fu... | true |
65e880c28cf5086eb3f12ae9fda315bd54b762b1 | EvanJamesMG/Point-to-the-offer | /python/旋转数组的最小数字.py | UTF-8 | 2,401 | 4.34375 | 4 | [] | no_license | # coding=utf-8
__author__ = 'EvanJames'
'''
题目描述:
把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。
输入一个非递减序列的一个旋转,输出旋转数组的最小元素。例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。
'''
'''
解题思路:
和 《leetcode》033.Search in Rotated Sorted Array.py and 081.Search in Rotated Sorted Array类似
但是不同的是,这道题不是寻找某个特定的target,而是寻找最小的元素。而且此题需要把包含重复元素和起始未旋转状态的情... | true |
fa33b21c404e6aad5bb05b26e9e8b8d62fe17afb | spielzeugland/kodi-control-panel | /script.service.jogwheel/lib/generic/worker.py | UTF-8 | 1,365 | 2.640625 | 3 | [] | no_license | import sys
import threading
import configuredLogging as logging
try:
import queue
except ImportError:
import Queue as queue
def createQueue():
return queue.Queue()
def run(workload):
worker = _Worker(workload)
worker.start()
return worker
def runAsLoop(workload):
worker = _Worker(work... | true |
d66314067b3702af7cdd277815755400208a7fb2 | Norik123/AAA | /lesson 3/Dz2.py | UTF-8 | 561 | 3.125 | 3 | [] | no_license | store=95
base=store*1000
instrument=900
nail=80
new_instruments=base//instrument
stuff1=base%instrument
new_nails=stuff1//nail
stuff2=stuff1%nail
stuff3=stuff2/1000
print("На инструменты уходит",instrument/1000,"кг железа")
print("На гвозди уходит",nail/1000,"кг железа")
print("У вас было",store,"кг железа")
print("Сд... | true |
522e0c1adfaa9b5cdf2864fd30fe8c3b3e8f21f7 | The-Daily-Texan/copytext | /tests/test_copytext.py | UTF-8 | 8,943 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import unittest2 as unittest
from markupsafe import Markup
import copytext
class CopyTestCase(unittest.TestCase):
"""
Test the Copy object.
"""
def setUp(self):
self.copy = copytext.Copy('examples/test_copy.xlsx')
def test_sheet_... | true |
5faca6c363ce877d76d5c8cbfa6138d4102c7fff | Niklas2501/MasterThesisPublic | /analytic_tools/TestResultAggregation.py | UTF-8 | 1,964 | 2.75 | 3 | [] | no_license | from pathlib import Path
import pandas as pd
def main():
cols = ['F1', 'F2', 'Recall', 'Precision']
test = ['main', 'snn', 'ablation_study']
mode = test[2]
sort_by = 'F1' # cols[0]
print_latex = True
diff_to_first = True
if mode == 'main':
file_path = Path('../logs_archive/_res... | true |
a5b0b58e2629e1066b1a149a44e980ba67c9333b | valeriuo/rosalind | /src/_6_GC.py | UTF-8 | 995 | 2.921875 | 3 | [] | no_license | # GC proportion
import sys
def gc(input):
output = 0
for c in input:
if c == 'G' or c == 'C':
output += 1
return output
def main():
gc_v = 0
max_read = ""
cur_read = ""
all_v = 0
max_value = 0
with open('../data/rosalind_gc.txt', 'r') as fp:
... | true |
e4d51cebe30ca0fa1ea9724fa12eec10fcb5633b | crystalarnspiger/scripts | /test/palindrome.py | UTF-8 | 182 | 3.484375 | 3 | [] | no_license | import copy
def palindrome(word):
new_word = ''
x = len(word) - 1
while x >= 0:
new_word += word[x]
x -= 1
if word == new_word:
return True
| true |
d1a283a8555472d45480abae9b02ba0c97b86b2a | karmise/python_training | /fixture/contact.py | UTF-8 | 8,904 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from selenium.webdriver.support.ui import Select
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def create_new_contact(self, new_contact):
self.add_new_contact_page()
self.fill_contact_page(new_contact)
self.submit_con... | true |
215df4c17babe70fdb33422193e853904580fa33 | voxie-viewer/voxie | /lib/python/reikna-0.7.5/reikna/cbrng/__init__.py | UTF-8 | 2,559 | 2.84375 | 3 | [
"MIT"
] | permissive | """
This module is based on the paper by Salmon et al.,
`P. Int. C. High. Perform. 16 (2011) <http://dx.doi.org/doi:10.1145/2063384.2063405>`_.
and the source code of `Random123 library <http://www.thesalmons.org/john/random123/>`_.
A counter-based random-number generator (CBRNG) is a parametrized function :math:`f_k(... | true |
e7882a3d34cc8e421d573dd48ac97c17adeef306 | irisyupingren/jams | /tests/test_ns.py | UTF-8 | 30,869 | 2.703125 | 3 | [
"ISC"
] | permissive | #!/usr/bin/env python
# CREATED:2015-05-26 12:47:35 by Brian McFee <brian.mcfee@nyu.edu>
"""Namespace schema tests"""
import six
import numpy as np
import pytest
from jams import SchemaError
from jams import Annotation, Observation
from test_util import srand
xfail = pytest.mark.xfail
parametrize = pytest.mark.p... | true |
6b77d6e467b05378ac2c07f347b5edfaee5cc7ef | noorye4/maze | /mymazeclass.py | UTF-8 | 7,335 | 3.6875 | 4 | [] | no_license | #=============================================================================#
# Name : mymazeclass.py #
# Autor : Adrian Antonana #
# Date : July, 20 2012 #
... | true |
be67722d742a2ec621655feaa9232f3fe6a84b53 | 0xJeremy/me134 | /hw6/video.py | UTF-8 | 528 | 2.890625 | 3 | [] | no_license | import cv2
from display import Display
import time
class Video:
def __init__(self, path="videos/test.mp4"):
self.cam = cv2.VideoCapture(path)
def play(self, display):
while self.cam.isOpened():
ret, frame = self.cam.read()
frame = cv2.resize(frame, (20, 15))
... | true |
1579c8e918253640ba15b5a694a00a49e7e92867 | reeshogue/Experiments | /Python/treelang.py | UTF-8 | 895 | 3.421875 | 3 | [
"MIT"
] | permissive | class TREE:
def __init__(self):
self.tree = {}
self.pointer = 0, 0
def step_fore(self):
self.pointer[0] = not(self.pointer[0])
self.pointer[1] += 1
def step_back(self):
self.pointer[0] = not(self.pointer[0])
self.pointer[1] -= 1
def tele_oppo(self):
self.pointer[0] = not(self.pointer[0])
def add_... | true |
08e9ffa8535175c204fd78c9efba9468bbf7741e | danbikle/py4us | /public/class06/ch23.py | UTF-8 | 444 | 2.796875 | 3 | [] | no_license | # ch23.py
# ref:
# http://bokeh.pydata.org/en/latest/docs/user_guide/charts.html#markers
# The marker used for displaying outliers is controlled by the marker parameter:
from bokeh.charts import BoxPlot, output_file, show
from bokeh.sampledata.autompg import autompg as df
p = BoxPlot(df, values='mpg', label='cyl', ... | true |
219bb2d41b8109eb90c32e178ff98ad0d2ec4c82 | srikanthpragada/WEBDEMO_10_OCT_2019 | /hr/views.py | UTF-8 | 1,219 | 2.734375 | 3 | [] | no_license | from django.shortcuts import render
from django.http import HttpResponse
from datetime import datetime
import requests
# Create your views here.
def welcome(request):
return HttpResponse("<h1 style='color:red'>Welcome!</h1>")
def greet(request):
now = datetime.now().strftime("%d-%m-%y %H:%M:%S")
return... | true |
33685d6b4a2eff5fc0f557defdfb511b267281f0 | MrBitBucket/reportlab-mirror | /docs/userguide/ch5_paragraphs.py | UTF-8 | 23,044 | 2.78125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #Copyright ReportLab Europe Ltd. 2000-2017
#see license.txt for license details
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/docs/userguide/ch5_paragraphs.py
from tools.docco.rl_doc_utils import *
#begin chapter oon paragraphs
heading1("Paragraphs")
disc("""
The $reportlab.platypus.Paragraph$ class is... | true |
fd7d73f2daf11cf379fb306f9191db93aa7beec8 | dphang/sage | /dota/camera/controller.py | UTF-8 | 1,580 | 3.234375 | 3 | [
"MIT"
] | permissive | """
Programmatically controls the Dota 2 camera given a JSON-encoded list of timestamps and coordinates.
Note that since Dota 2 has no official API for controlling the replay camera, we use a hacky approach:
controlling the camera using a series of mouse events.
Input: JSON-encoded list of timestamps and coordinates
"... | true |
eec2f8e4d7a6973a6eae2a007fa0d413d8a14618 | Aasthaengg/IBMdataset | /Python_codes/p02398/s076527140.py | UTF-8 | 303 | 3.109375 | 3 | [] | no_license | while True:
a, b, c = map(int, input().split())
if a >= 1 and a <= 10000:
if b >= 1 and b <= 10000:
if c >= 1 and c <= 10000:
if a <= b:
break
i = 0
for num in range(a, b+1):
if c%num == 0:
i += 1
print(i)
| true |
ef7fed361de4bd52ec53c45107b5585deae785e6 | subsid/sandbox | /algos/two_pointers/remove_duplicates.py | UTF-8 | 942 | 4.21875 | 4 | [] | no_license | # Given an array of sorted numbers, remove all duplicates from it.
# You should not use any extra space; after removing the duplicates
# in-place return the length of the subarray that has no duplicate in it.
#
def remove_duplicates(arr):
i = 0
j = i + 1
if (len(arr) < 2):
return len(arr)
wh... | true |
c21f14a0b15fe138c960337c872b8dbe630d8dbe | ashu0074uall/Dataquest-A-Quest-2-Data-Science | /Machine Learning/Linear Algebra for Machine Learning/Linear Systems.py | UTF-8 | 935 | 4.25 | 4 | [] | no_license | ## In this course, we'll focus on understanding linear functions
## Overview Of Linear Algebra
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,50,1000)
y1 = 30*x + 1000
y2 = 50*x + 100
plt.plot(x, y1, color = 'orange')
plt.plot(x, y2, color = 'blue')
plt.show()
## Solving Linear Systems By E... | true |
fff90da52161be577e0331ca6ca07141327f27e3 | BramKasteel/PythonBasics | /parser/parse_known_args.py | UTF-8 | 1,472 | 3.75 | 4 | [] | no_license | #From https://docs.python.org/2/library/argparse.html#example
#A small extension, now able to handle more arguments.
#Could be useful in case of multiple scripts.
import argparse
#First step in using argparse is creating an ArgumentParser object
parser = argparse.ArgumentParser(description='Process some integers.')
#... | true |
5aa28f918a7cc3a3c3f29787ea934c27e158af56 | Thomassjaastad/INF-4490 | /HybridGA_HillClimbing.py | UTF-8 | 5,769 | 3.25 | 3 | [] | no_license | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import itertools
import csv
from datetime import datetime
import time
import random
#Solving Traveling Salesman Problem (TSP) with GeneticAlgorithm
with open("european_cities.csv", "r") as f:
data = list(csv.reader(f, delimiter=';'))
... | true |
29de7b17b2e854245bd75206f43200a6a5c6824a | syafhuan/webinfo | /webinfo.py | UTF-8 | 4,084 | 3.125 | 3 | [] | no_license | #!/usr/bin/python
import requests
import ssl
import datetime
import socket
class Clr:
#Text colors
RST = '\033[39m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
class sslchecker():
def __init__(self, host, port):
self.host = host
self.port = por... | true |
4a71bc46ecbb8cb524fec01891a1f681be2cf717 | jasonwu0908/tibame | /python_lesson/homework/hw1/leapYear.py | UTF-8 | 492 | 4.3125 | 4 | [] | no_license | # 輸入一西元年,如2015。判斷此年份是否為任年。
# 提示:每四年一閏,每百年不閏,每四百年一閏,每四千年不閏。
year = eval(input("請輸入西元年:"))
def leapyear(year):
if (year % 4000) == 0:
return False
elif (year % 400) == 0:
return True
elif (year % 100) == 0:
return False
elif (year % 4) == 0:
return True
else:
... | true |
f3c569b402abec511048c9b717ecfe17cc3605c8 | sebastianceloch/wd_io | /lab3/zadanie4.py | UTF-8 | 170 | 3.21875 | 3 | [] | no_license | def monot(a,b):
if(a<0):
return "funkcja malejaca"
elif(a==0):
return "funkcja stala"
else:
return "funkcja rosnaca"
print(monot(4,4)) | true |
77a2ce422100b6a57c5a28beddfc6afb6473aa99 | flownait/stmodels | /stmodels/stmodels.py | UTF-8 | 249 | 2.59375 | 3 | [
"MIT"
] | permissive | # For one testing class
class fbnc(object):
def __init__(self):
#self._n = n
pass
def fib(self,n):
a, b = 0, 1
while a < n:
a, b = b, a + b
return a
if __name__ == "__main__":
pass
| true |
7b282301dfcbe15d6b78c80e8ec08994f9537e50 | PythonOleg/python2020 | /DZ4_6.py | UTF-8 | 204 | 3.984375 | 4 | [] | no_license | str1 = input('Input string:')
if str1.isdigit() == True:
print('String consist from digits')
elif str1.isalpha() == True:
print('String consist from letters')
else:
print(type(str1))
| true |
aca22321835ca363486de4e8ee5d3eed2cb62e6d | davidbradlycurtis/big-data-project | /rongey/3reducer.py | UTF-8 | 471 | 2.609375 | 3 | [] | no_license | s = open("02.txt", "r")
r = open("03.txt", "w")
thisKey = ""
thisValue = 0
for line in s:
data = line.strip().split(",")
pitcher_id, event = data
if event == "Strikeout":
if pitcher_id != thisKey:
if thisKey:
r.write("PLAYER_ID: " + thisKey + "\t" + "Strikeouts: " + str(thisValue) + "\n")
thisKey = pi... | true |
c4360c5302a5f7056f39ce2b6bfbf3cf75ceede7 | elisa-aleman/ctrip-tripadvisor-satisfaction-public | /python/04-1_Chinese_comments_only_Ctrip_db.py | UTF-8 | 1,614 | 2.75 | 3 | [] | no_license | #-*- coding: utf-8 -*-
from Paper3_Methods import *
from Ctrip_Methods import *
import langdetect
def detect_languages_ctrip_db():
data_path = make_data_path("ctrip/ctrip_db/comments.csv")
comments_df = pandas.read_csv(data_path)
langs = []
for row in comments_df.itertuples():
text = row.Comme... | true |
87bf0dad7317530221ed0f6d3bf299e6cd0c2842 | salman-codes/distance_calculator | /app.py | UTF-8 | 1,027 | 3.15625 | 3 | [] | no_license | import configparser
from util import fetch_customers, calculate_distance, sort_customers, create_new_file
from test import test_distance_calculator
if __name__ == '__main__':
""" Reading the source coordinates from config file """
config = configparser.ConfigParser()
config.read('config.ini')
""" To ... | true |
b0382f640fdd421bb5858dddf1fd62062f28a8d3 | kjcoursera/Machine_Learning | /Regression/DecisionTreeRegression/DecisionTreeRegression_fbmetrics_V1.py | UTF-8 | 7,450 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 05:56:17 2019
@author: kanchana
"""
import pandas as pd
import numpy as np
import seaborn as sns; sns.set(color_codes=True)
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.svm import SVR
from skle... | true |
e1f4cdbf33fb002033aef79837e16499e1a02e53 | karlmueller/sweFinalRepo | /quaternionRotation.py | UTF-8 | 3,388 | 3.78125 | 4 | [] | no_license | #from here as a replacemnt for scipy https://automaticaddison.com/how-to-convert-a-quaternion-to-a-rotation-matrix/
import numpy as np
import math
from numpy.core.numeric import outer
def quaternion_rotation_matrix(Q):
"""
Covert a quaternion into a full three-dimensional rotation matrix.
Input
:pa... | true |
4c4dbdcde7166658fc5a4923ae3564ff18e1fc00 | sreeaurovindh/code_sprint | /trees/inorder.py | UTF-8 | 419 | 2.875 | 3 | [
"MIT"
] | permissive | from collections import deque
def inorderTraversal(self, root):
if root is None:
return None
stack = deque([root])
current = None
result = []
while len(stack) != 0 or current is not None:
while current is not None:
stack.append(current)
current = current.le... | true |
8f6578e5b2fc443c10aa76b8cb84d052c110d209 | chenyang1999/lanqiaocup_marcus | /base/base_T6.py | UTF-8 | 281 | 3.578125 | 4 | [] | no_license | '''
问题描述
对于长度为5位的一个01串,每一位都可能是0或1,一共有32种可能。它们的前几个是:
00000
00001
00010
00011
00100
请按从小到大的顺序输出这32种01串。
'''
for i in range(2**5):
print("0"*(5-len(bin(i)[2:]))+bin(i)[2:]) | true |
b947149b3c4819be6e12e7e75db6ff2f2607186d | marjia11/COVID-QA | /covid_nlp/language/detect_language.py | UTF-8 | 2,259 | 3.171875 | 3 | [
"Apache-2.0"
] | permissive | import sys
import os
import pycld2 as cld2
import hmac
from hashlib import sha1
from time import time
import requests
class LanguageDetector():
def __init__(self, model = 'sil'):
self.model = model
def detect_lang_cld2(self, text):
pred = cld2.detect(text)[2][0]
return pred[1], float(p... | true |
43af69d645d07e8e74796fedd16df4f9f26b8c46 | bigdatasciencegroup/wsb-stonks | /backend/app/background_job/statistics_calculator.py | UTF-8 | 1,151 | 3.21875 | 3 | [
"MIT"
] | permissive | def calculate_statistics(db_client, new_posts, new_comments, start_date, end_date):
print('Start calculating statistics')
# Statistics to track
total_posts = len(new_posts)
total_comments = len(new_comments)
post_authors = {}
comment_authors = {}
posts_activity = []
comments_activit... | true |
83a29c4e0c009f6eb2b3d187b04da56128efd801 | DaniloTeo/Box_Office_Rating | /ensemble.py | UTF-8 | 6,341 | 3.296875 | 3 | [] | no_license | import pandas as pd
import numpy as np
# Classe para definir as funcoes do ensemble de Naive-Bayes
class Ensemble:
def __init__(self, X, y, test_size = 0.1, n_classifiers=5, type= "sum"):
self.X = X
self.y = y
self.type = type
self.n_classifiers = n_classifiers
self.test_size = test_size
self.X_train = No... | true |
aec93a705d275c6eac842f41353535dbd59fa6f6 | praXin/Speech_based_Chatbot | /FINAL.py | UTF-8 | 1,866 | 2.546875 | 3 | [] | no_license | from watson_developer_cloud import SpeechToTextV1
from Tkinter import *
from PIL import Image
import json
import StringIO
import pyaudio
import wave
import os
import re
import pyttsx
import random
import stt
import remain
import TextToInteger
import text_to_speech
import Eliza_Algo
def working1(event):
while(True)... | true |
6455df8657b9c3011e79765f425f355ab653077b | Najibit/cs50x | /14. sentiments/analyzer.py | UTF-8 | 1,754 | 4.03125 | 4 | [] | no_license | ############################################################################
# analyzer.py
#
# Minor Programming
# Programming II
# Problem Set 6: Sentimental
# Najib el Moussaoui
#
# Loads positive and negative words in arrays, and analyses
# Twitter messages on their positivity/negativity/neutrality.
################... | true |
fd78b4331d904c1533b8c61e37acac25355a2aad | sfczzzj/FGOHelper | /FGO_Battle-master/FGO_Battle-master/anti.py | UTF-8 | 1,020 | 2.546875 | 3 | [] | no_license | # avoid the ID being banned
from lib.ats import *
from lib.cvs import *
import random
def long_tap(x, y): # random length tap
delay = random.randrange(5, 200)
swipe(x, y, x, y, delay)
def tap_card(x, y): # tap on random location of the card
x0 = x + random.uniform(0, 100)
y0 = y + random.uniform(-... | true |
f35eb295b2e1a71b544a61edeed7168fb6b74940 | eltonpeniche/cg-2018 | /preenchimento.py | UTF-8 | 744 | 3.1875 | 3 | [] | no_license | from bresenham import *
from ponto import *
def drawPolygon(coordinates):
coord = []
info = []
for i in range(0,len(coordinates)+1):
if i == (len(coordinates)):
break
p = coordinates[i-1]
np = coordinates[i]
coord.extend(Bresenham(Point(p[0], p[1]), ... | true |
4dc82e4942371add7715e60bf9d1e871b200ddae | tammojan/facet-calibration | /selfcalv20.py | UTF-8 | 54,280 | 2.625 | 3 | [] | no_license | import matplotlib
matplotlib.use('GTK')
import numpy
import os
import sys
from scipy import interpolate
import time
from subprocess import Popen, PIPE
import pyrap.tables as pt
import pyrap.images as pi
import uuid
pi = numpy.pi
import pwd
username = pwd.getpwuid(os.getuid())[0]
from facet_utilities import run, bg, ang... | true |
c5694f70dd2f7ca160cc289738b0550e9ec10ffa | luoshanya/crawl_project | /面向对象高级编程/agrs与kwargs的作用.py | UTF-8 | 732 | 3.390625 | 3 | [] | no_license | __author__ = 'zhukelin'
__date__ = '2019/4/17 0017 下午 3:21'
# 传入多个参数的时候 使用*args 不然会报错
# def test_args(first,*args):
# print(first)
# for v in args:
# print("args %s"%v)
# args = (2,3,4,5,6)
# 在你不知道有多少个参数传参的时候可以使用*args
# test_args(1,2,3,4,5,6,7)
#**kwargs
def test_kwagrs(fisrt,*args,**kwargs):
pri... | true |
e00bb7878f1e4d84155acff9450232e3064a9586 | allexx505/demos | /scripts/test_for_file_handle.py | UTF-8 | 1,439 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Create Time : 2018/11/4 17:16
# @Author : Alex-tan
# @FileName: test_for_file_handle.py
'''文件以及异常处理的练习代码'''
def read_file():
'''
写文件操作
:return:
'''
file_name = 'pi_digits.txt'
with open(file_name) as file_object:
# contents = file_object.read()
# pr... | true |
2a3f8eb847e19c89ac901a0df4b6daaff46c462d | korolmi/wikitools | /proc.py | UTF-8 | 1,785 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
import cgi, sys
"""
Скрипт обработки запроса на согласование
Фактически он нужен для записи данных о согласовании в базу данных
Это делается в функции (которая здесь не реализована)
"""
def addSignDate( id, login ):
""" добавляет информацию о согласовании страницы по ее имени """
return Non... | true |
86cdffad3925e3a9e31b6de81edd58eed1fadb92 | htl1126/leetcode | /288.py | UTF-8 | 819 | 3.6875 | 4 | [] | no_license | class ValidWordAbbr(object):
def __init__(self, dictionary):
"""
initialize your data structure here.
:type dictionary: List[str]
"""
self.lookup = collections.defaultdict(set)
for word in dictionary:
if len(word) > 2:
new_word = '{0}{1}{2}... | true |
71d2bc2de8345f0842a877b9add05fc3dc5442ba | ramamca90/ATG_scheduled_emails | /email_schedule.py | UTF-8 | 4,972 | 3.375 | 3 | [] | no_license | '''
Prototype service for scheduling and tracking transaction-based email
-- email_schedule.py
'''
import csv
import os
import traceback
from datetime import datetime
class EmailSchedule:
def __init__(self):
'''
constructor to intialize below things
self.products -> ... | true |