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 |
|---|---|---|---|---|---|---|---|---|---|---|
dd9ab45c9f7bcb2e8da4b4115b865f62c12beaef | ZengyuanYu/Machine-Learning | /XGBoost/二噁英/groupby.py | UTF-8 | 431 | 2.828125 | 3 | [] | no_license | #-*- coding :utf-8-*-
import pandas as pd
ereying=pd.DataFrame(pd.read_excel('all2.xlsx'))
ereying=ereying.set_index(u'时间')
ereying2=ereying.resample('H').sum()
print(ereying2)
ereying2.to_csv('ereying2.csv',encoding='utf-8')
ereying=pd.DataFrame(pd.read_excel('all2_label.xlsx'))
ereying=ereying.set_index(u... | true |
b91aeabbe5b2e5a66a06d7bd9624df2520e07be1 | zeroam/TIL | /opencv_tutorial/opencv_python_tutorials/Image_Processing/hough_circle_transform.py | UTF-8 | 680 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 4 16:02:33 2019
@author: jone
"""
import cv2
import numpy as np
img = cv2.imread('img/logo.png')
img = cv2.medianBlur(img, 5)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
circles = cv2.HoughCircles(img_gray, cv2.HOUGH_GRADIENT, 1, 20,
pa... | true |
7be75c1f1c92378f378f023a56b1ea48ea0b2630 | AhmedKhalil777/courses | /data_structures_and_algorithms/Thebes-1st-2018-2019/Lectures/Lecture-06/Set.py | UTF-8 | 1,587 | 3.59375 | 4 | [] | no_license | # بسم الله الرحمن الرحيم
class Set:
def __init__(self):
self._list = []
self._counter = -1
def __len__(self):
return len(self._list)
def length(self):
return len(self._list)
def contains(self, element):
return element in self._list
def add(self, element... | true |
63b72c3c05c7dc26c054059bb8f9586dd69f6e6b | GAIPS/ILU-RL | /analysis/digitize.py | UTF-8 | 8,978 | 2.703125 | 3 | [
"MIT"
] | permissive | """This script helps setting sensible discretization bins
This script performs the digitalization from continous spaces to discrete bins.
* Splits results per network, tls and phase.
* It searches for both train_logs and train_config for each experiment.
* Aggregating MDPs when necessary fo... | true |
04e8cda41cb8bce4b97a4220782027757866b8aa | UYasher/mew2math | /mew2math_func.py | UTF-8 | 1,280 | 3.890625 | 4 | [] | no_license | import abc
import random
from problems import ArithmeticProblemGenerator
import time
class Pokemon:
def __init__(self, name, hp):
self.name = name
self.hp = hp
print('Mewtwo Gx, you need addition to win this battle!')
#pokemon_list = [Pokemon("Bulbasaur", 100), Pokemon("Charmander", 100), Pokemo... | true |
8fe94d0f22142ae7ccec9ad8e6c95b3870d43441 | kk0m4k/getgeoinfo | /getnavermap.py | UTF-8 | 5,098 | 2.515625 | 3 | [] | no_license | import ssl
import certifi
import argparse
import requests
import pandas as pd
import json
NAVERMAP_CLIENTID=""
NAVERMAP_SECRETKEY=""
class GeoNavermap():
"""
This Getgeoinfo class contains getting latitude/longitude
of specific addres from NaverMAP
"""
def __init__(self, address=None, timeout=Non... | true |
739bb899c9ca69eb2011f39eac5b2c0097411c1f | DramaCow/JASP-Processor | /examples/1_raw/plot.py | UTF-8 | 1,389 | 2.5625 | 3 | [] | no_license | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
#mpl.rcParams['agg.path.chunksize'] = 10000
y1 = np.loadtxt("epc_raw")
y2 = np.loadtxt("epc_uraw")
y3 = np.loadtxt("epc_u2raw")
y4 = np.loadtxt("epc_curaw")
z1 = np.loadtxt("epc_short_raw")
z2 = np.loadtxt("epc_short_uraw")
z3 = np.loadtxt(... | true |
440348b867957b648323a5c5e4b8af3dc94cb78c | PRkudupu/Algo-python | /array_strings/py/merge_sorted_array.py | UTF-8 | 7,940 | 4.5 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# #### Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
#
# Note:
# <p>
# The number of elements initialized in nums1 and nums2 are m and n respectively.
# <br>Note:
# You may assume that <i><b>nums1 has enough space (size that is g... | true |
d87024f812dabd5181a45312a88cc14873057695 | rzfeeser/pyapi20200203 | /pikachu02.py | UTF-8 | 191 | 2.890625 | 3 | [] | no_license |
import requests
userinput = input("What pokemon are we looking up?")
myresp = requests.get(f"https://pokeapi.co/api/v2/pokemon/{userinput.lower()}")
myresp = myresp.json()
print(myresp)
| true |
2891110728337f9b92fc1062449742038e009826 | nayanashettyft/pythonChallenges | /fibonacciseriessum/fibonacci_sum.py | UTF-8 | 740 | 3.4375 | 3 | [] | no_license |
import argparse
#from ...leapyearfinder.leapyear import Validator
class FibSum:
def __init__(self, args):
for name,value in args.items():
setattr(self, name, value)
print(self.number)
def fibR(n):
if n==0:
return 0
elif n==1:
return 1
else:
return fibR(n-1)+fibR(n-2)
def main():
parser ... | true |
8727fc95d3f021b11d5d90d1235023acc16e375c | feeroz123/LearningPython | /udemy/Account.py | UTF-8 | 1,144 | 4.4375 | 4 | [] | no_license | class Account:
def __init__(self, owner_name, initial_balance=0.0):
self.owner = owner_name
self.balance = initial_balance
def __str__(self):
return "Account owner = " + self.owner + "\n" + f"Account Balance = {self.balance}"
def deposit(self, amount):
self.balance = self.... | true |
f71d20feed3d23d1427f80aca147c2a1190e7af0 | saikiran-patro/Voice-controlled-Home-Automation | /voice controlled home automation.py | UTF-8 | 3,806 | 2.671875 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk,Image
import pyttsx3 ##used for speak engine
import speech_recognition as sr # used for voice to text conversion
import threading
import datetime
from boltiot import Bolt
class led_control:
def onled(self,x):
api_key = "YOUR API KEY"
devi... | true |
4d5b4d9568e9a5690abfe5369da33537a6fec030 | seanahmad/py-trader | /traveling_salesman.py | UTF-8 | 5,218 | 3.078125 | 3 | [] | no_license | import random
import math
import sys
#from ts_tools import City
#Member,setup
#pop_size = int(sys.argv[1])
cities = []
# for _ in range(int(sys.argv[1])):
# cities.append(City(rand=True))
class City:
def __init__(self,name=None,x=None,y=None,rand=True):
if rand == True:
self.name = rando... | true |
ca0e453cd8ba8100705ae0703ff1cd4131c7aada | nutty7t/tissue | /server/models/database.py | UTF-8 | 1,058 | 2.734375 | 3 | [] | no_license | import sqlite3
from flask import current_app, g
def init_database(app):
"""
Create SQLite tables in the database if they don't already exist. Intended
to be called from within the application factory.
:param app: Flask instance
"""
with app.open_resource("models/schema.sql") as f:
co... | true |
979235818b309b5e4d99e780ec3f4cf91bed48a0 | WangYizhang01/Wav2Letter-with-pytorch | /Wav2Letter/model.py | UTF-8 | 5,076 | 2.5625 | 3 | [] | no_license | from __future__ import print_function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from Wav2Letter.decoder import GreedyDecoder
import os
class Wav2Letter(nn.Module):
def __init__(self, num_features, num_classes):
super(Wav2Letter, self).__init__()
# Conv1d(in_c... | true |
e5562a6c5c7f8a0fd48bd4994bbf477a57cea7d4 | rafaelri/coding-challenge-solutions | /python/tree-max-delta-ancestor/tree_max_delta.py | UTF-8 | 529 | 3.4375 | 3 | [] | no_license | class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def max_tree(tree, mn=float("inf"), mx=float("-inf")):
mn = min(mn, tree.value)
mx = max(mx, tree.value)
if tree.left and tree.right:
return max(max_tree(... | true |
1c23ca85ea23cdb96ddfa23571be992b68a4acbc | IvanovicM/magic-square | /source/test/test_stats.py | UTF-8 | 1,157 | 2.703125 | 3 | [
"MIT"
] | permissive | from ..utils.magic import MagicSquare
from ..search import annealing, beam, genetic, greedy, randoms
from ..stats import calc
def print_stats(finder, iter_per_experiment=100):
print('============================================================\n'
'Search type: {}\n'.format(finder['type']))
it_mean, ... | true |
f4f682214f021b2a53f5bbe8102b1c2c9b9545b3 | yunyusha/xunxibiji | /month1/week2/class3/fun_style.py | UTF-8 | 2,868 | 4.3125 | 4 | [] | no_license | """
匿名函数: 函数名被隐藏
匿名函数定义语法
lambda 参数1,参数2,...:函数体
注意:匿名函数函数体只有一行代码,
并且该代码必须有运行结果
运行结果会被作为函数返回值自动返回
匿名函数没有函数名,因此通常是通过变量
接受该函数,之后通过变量名(参数列表)来
调用,同时匿名函数因为代码只有一句,
因此匿名函数值用来解决比较简单的数据计算问题
"""
# 匿名函数
# 第一种方案
# num = (lambda x:x**2)(10)
# print(num)
fun = lambda x: x**2
result = fun(12)
print(result)
# 定义一个匿名函数 返回任意两个数的大小... | true |
4d1c487d0e7e0e58a4a2950e4e9cdcbe749dcdc2 | LyunJ/algorithm | /BJ1010.py | UTF-8 | 374 | 3.203125 | 3 | [] | no_license | n = int(input())
R = []
for i in range(n):
up = 1
down = 1
a, b = input().split()
a = int(a)
b = int(b)
if(a > b):
R.append(0)
continue
for r in range(a):
up = (b-r) * up
down = (a - r) * down
if (down == 0):
R.append(0)
else:
R.appe... | true |
0c30cbf5dfa7dbce994145b6b09d8c5f80cc3201 | Maicius/AdvanceAlgorithm | /home_work_2/2.py | UTF-8 | 454 | 3.390625 | 3 | [] | no_license | import sys
def get_input():
file = open('2.txt', 'r')
sys.stdin = file
while True:
try:
line1 = input().strip().split(' ')
print(calculate(line1))
except EOFError:
exit()
def calculate(arr):
num = int(arr[0])
arr = arr[1:]
for i in range(num ... | true |
0eeb1633b2e75c350d0b2927ac0584fb949e9238 | dnesnipe/belajarpython | /ifelse.py | UTF-8 | 1,021 | 3.65625 | 4 | [] | no_license | nilai = 100
if 90 <= nilai <= 100:
print("maaf anda tidak lulus,saya dosen killer anda bisa apa")
else:
print("maaf anda tidak lulus mata kuliah ini")
#c++
# include <iostream>
# using namespace std;
# int main(){
# int a;
# cout << "masukan angka = ";
# cin >> a;
# if (a == 100){
# cout << "nilai 1... | true |
45ae935f34a2c8e2e645d999532181388e63b8c6 | penicillin0/atcoder | /ABC/129/a.py | UTF-8 | 72 | 2.59375 | 3 | [] | no_license | P, Q, R = map(int, input().split())
A = [P, Q, R]
print(sum(A) - max(A)) | true |
2070153143e4597e3bd12c81558ca47b4574f1c2 | neisoo/misc | /audiosplit/audiosplit.py | UTF-8 | 15,661 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#python3
import logging
from pydub import AudioSegment
from pydub.silence import split_on_silence
from pydub.silence import detect_nonsilent
import sys
import os
import time
import json
import speech_recognition as sr
from aip import AipSpeech #百度语音API
# 实现拆分,只要这一句代码就够了
#chunks = split_on_s... | true |
4e09d88dbd9e108ccb6d7b21a47e436040cfb10c | naveenORT/Connected_Devices | /apps/labs/module01/DeviceHandlerApp.py | UTF-8 | 522 | 2.5625 | 3 | [] | no_license | '''
Created on Jan 14, 2020
@author: Naveen Rajendran
'''
from labs.module01 import SystemPerformanceAdaptor
import logging
def main():
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',level=logging.INFO,datefmt='%Y-%m-%d %H:%M:%S')
logging.info(".started logging.")
obj = SystemPerform... | true |
d993d166fb19d73d5ba40f899894c65d7e13516d | tntterri615/Pdx-Code-Guild | /Python/lab13guessthenumber.py | UTF-8 | 509 | 4.25 | 4 | [] | no_license | '''
have the user guess a random number (1-10) chosen by the computer
'''
from random import randint
comp_choice = randint(1, 10)
#create a REPL to check the user input against the computer choice
i = 0
user_choice = 0
while i < 10 and user_choice != comp_choice:
user_choice = int(input('Guess what number from 1-... | true |
1c16f0c55f3ddce3e410bb9c4ca3f474405ca60a | nilearn/nilearn | /nilearn/_utils/niimg_conversions.py | UTF-8 | 18,749 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | """Conversion utilities."""
import glob
import itertools
import os.path
# Author: Gael Varoquaux, Alexandre Abraham, Philippe Gervais
import warnings
import numpy as np
from joblib import Memory
import nilearn as ni
from .cache_mixin import cache
from .exceptions import DimensionError
from .helpers import stringify... | true |
b4f3041d05aaa8abb3dfd13c58fadfbfb408b72d | ethanjoyce14/python-standard-library-ethanjoyce14 | /pythonstandardlibrary.py | UTF-8 | 1,975 | 4.28125 | 4 | [] | no_license | import random
def instructions():
print(r"""
How to play Dice:
- Roll the die.
- Your opponent then rolls their die.
- Whoever has the highest number wins.
- Rinse and repeat.
""")
def intro():
response = input("\nPress ENTER to continue...\n")
if response == "":
play(... | true |
6eaa684b04c8760cb1d78e16b72915380abc2167 | alexe1ka/CheckIoSolutions | /currency_style.py | UTF-8 | 1,269 | 3.703125 | 4 | [] | no_license | # Only currency amounts in dollars should be converted:
# $1.234,50 to $1,234.50, $1.000 to $1,000, and $4,57 to $4.57.
# But don't convert your router's IP address 192.168.1.1.
# Also leave currency in the US style unchanged.
# Input: A string containing dollar amounts to be converted.
# Output: A string with converte... | true |
dc98dd37dab03ebb8f667c593e40b5770e5c3629 | xiaokaixi/Coding_deal_py | /txt_handle.py | UTF-8 | 3,382 | 2.828125 | 3 | [] | no_license | import re
import os
# 定义文本操作类
class txt_handle():
# 定义文件path
def __init__(self, path):
self.path = path
self.filst_cs = []
self.filst_txt = []
self.filt_code_str_list = []
# 重命名函数
def rename(self,type):
if type == 'txt':
file_list = os.listdir(self.... | true |
06db9a75f17184b9166335ffece1fe595cd75a32 | mgaug/ctapipe | /ctapipe/image/extractor.py | UTF-8 | 12,907 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Charge extraction algorithms to reduce the image to one value per pixel
"""
__all__ = [
"ImageExtractor",
"FullWaveformSum",
"FixedWindowSum",
"GlobalPeakWindowSum",
"LocalPeakWindowSum",
"NeighborPeakWindowSum",
"BaselineSubtractedNeighborPeakWindowSum",
"extract_around_peak",
... | true |
40bcb39b87dc0f84f101ff85dd4427555c227726 | YasserDbeis/Refugee-Tracker | /mysite/data-parsing/parser.py | UTF-8 | 4,362 | 2.703125 | 3 | [] | no_license | import csv
import sys
import requests
import json
def main():
links = []
for i in range(0, 300, 100):
headers = { 'apikey': '52afcc10-91dc-11ea-8306-23ef3e34ef78' }
params = (
("q","Refugee Camp"),
("tbm","nws"),
("device","desktop"),
("locati... | true |
9c0681871ccd8b96ac58271de8c14c51349fc948 | divyanshu-95/python_codes | /if.py | UTF-8 | 136 | 3.421875 | 3 | [] | no_license | x=8
r=x%2
if r==0:
print("even")
if x>5:
print("great")
else:
print("not")
else:
print("odd")
| true |
b8708b06df472a8f8039f8ab052f8f67b332d427 | sameersaini/hackerank | /Strings/Bigger is Greater.py | UTF-8 | 1,502 | 3.84375 | 4 | [] | no_license | T=int(input())
for _ in range(T):
W=list(input()) #create a list of string recieved from the user.
FC_index=len(W)-2
temp=FC_index
while temp != -1: #find the rightmost character which is smaller than the next character.
if W[temp] < W[temp+... | true |
02fd926f0331a20634a2837bc4b501e5f7175588 | Mag1cPanda/MyPython | /InCommonUse.py | UTF-8 | 4,561 | 3.765625 | 4 | [] | no_license | # 获取当前日期和时间
from datetime import datetime, timedelta, timezone
now = datetime.now()
print(now)
print(type(now))
# 获取指定日期和时间
dt = datetime(2015, 4, 19, 12, 20)
print(dt)
# datetime转换为timestamp
print(dt.timestamp())
# timestamp是一个浮点数,它没有时区的概念,而datetime是有时区的
# timestamp也可以直接被转换到UTC标准时区的时间
t = 1429417200.0
# 本地时间
print(... | true |
7fea207f6e8fdf3aef8619e902183d842b275033 | manojkumarmc/python-examples | /iv-league/fizzbuzz.py | UTF-8 | 431 | 4.03125 | 4 | [] | no_license | '''
This is a simple program which prints
FizzBuzz = divisible by 3 and 5
Fizz = divisible by 3
Buzz = divisible by 5
else print the number
'''
def is_factor(num, factor):
return num % factor == 0
for x in range(1,50):
f3 = is_factor(x,3)
f5 = is_factor(x,5)
if f3 and f5:
print "FizzBuzz"
... | true |
035e3c1636d24a33b7b86c521bef2f92deb13452 | anushahaleema/Data-Integration | /statistical_analysis_(5).py | UTF-8 | 1,043 | 3.21875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy.stats import kurtosis, skew
from tabulate import tabulate
print('Reading the final file')
df=pd.read_csv('final.csv', sep=',',header=None)
file1 = df.values
file1 = np.array(file1)
file1=np.delete(file1,[0,1],0)
for i in range(len(file1)):
file1[i,1]... | true |
9c6177cef71af8962e01bc7af0f02ec69f5af757 | hikarivina/DeNo | /main.py | UTF-8 | 783 | 3.453125 | 3 | [] | no_license | import numpy as np
from Variable import Variable
from Function import Function
class Square(Function):
def forward(self, x):
return x ** 2
def backward(self, gy):
x = self.input.data
gx = 2 * x * gy
return gx
class Exp(Function):
def forward(self, x):
return np.exp... | true |
de842a1a105bc035743a5a0d6e038b2951d24981 | zhanggang807/learn-tkinter | /src/packGridPlace.py | UTF-8 | 634 | 3.078125 | 3 | [] | no_license | import tkinter as tk
window = tk.Tk()
window.title('my window')
window.geometry('200x300')
# 三种放置部件的方式,用于组件布局吧
# tk.Label(window, text='top').pack(side='top')
# tk.Label(window, text='right').pack(side='right')
# tk.Label(window, text='bottom').pack(side='bottom')
# tk.Label(window, text='left').pack(side='left')
#... | true |
886338d2169347163fdf5dc8785c961cb5d1f475 | liuhu0514/py1901_0114WORK | /午饭.py | UTF-8 | 161 | 3.078125 | 3 | [] | no_license | import random
list1 = ['沙县小吃', '擀面皮', '牛肉汤', '手擀面', '胡辣汤', '饺子', '热干面']
lunch = random.sample(list1, 1)
print(lunch)
| true |
9c4075506fd4b9a0b4e15844c9578c89b3498a9d | wannesm/pyGPs | /pyGPs/GraphExtensions/nodeKernels.py | UTF-8 | 3,303 | 2.890625 | 3 | [
"BSD-2-Clause-Views",
"BSD-2-Clause"
] | permissive | from __future__ import division
from past.utils import old_div
#================================================================================
# Marion Neumann [marion dot neumann at uni-bonn dot de]
# Daniel Marthaler [dan dot marthaler at gmail dot com]
# Shan Huang [shan dot huang at iais dot fraunhofer d... | true |
cb64c72758c2bc60a50cfbe8f5bcbdb108f0eff3 | jiahao-shen/SDN-SR-TE | /algorithm/bandwidth_efficient_branch_aware_segment_routing_tree.py | UTF-8 | 6,000 | 3.015625 | 3 | [] | no_license | """"
@project: RoutingAlgorithm
@author: sam
@file bandwidth_efficient_branch_aware_segment_routing_tree.py
@ide: PyCharm
@time: 2019-02-14 20:42:59
@blog: https://jiahaoplus.com
"""
import math
from itertools import islice
from collections import OrderedDict
from network import *
from algorithm.multicast_tree import *... | true |
6cb7883cddb87491e5bbc51fd7973fa3b0e2a408 | oyorooms/hue | /desktop/core/ext-py/kazoo-2.0/kazoo/handlers/utils.py | UTF-8 | 2,648 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | """Kazoo handler helpers"""
HAS_FNCTL = True
try:
import fcntl
except ImportError: # pragma: nocover
HAS_FNCTL = False
import functools
import os
def _set_fd_cloexec(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC)
def _set_default_tcpsock_option... | true |
0822858bc2c2681bbab1ebe248b435616741258a | bill-95/COMP551Project2 | /bill/decision_tree_final.py | UTF-8 | 9,298 | 3.171875 | 3 | [] | no_license | #! python3
# coding: utf-8
"""
Created on Tue Oct 11 18:07:19 2016
@author: Bill
"""
class TreeNodes():
def __init__(self, columnIndex=-1, value=None, results=None, trueBranch=None, falseBranch=None):
self.col = columnIndex
self.val = value
self.res = results #none except for leafnod... | true |
a0b1817b755ddaf965076886ae7fcd6cb48e6192 | iamrishap/PythonBits | /InterviewBits/backtracking/palindrome-partioning.py | UTF-8 | 1,638 | 4.21875 | 4 | [] | no_license | """
Given a string s, partition s such that every string of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
["a","a","b"]
["aa","b"],
]
Ordering the results in the answer : Entry i will come before Entry j if :
len(Entryi[0]) < len(Ent... | true |
43bd3c6d33c6933f2ab654e47207616e57988b3d | hayoungishere/Algorithm | /Python/clock.py | UTF-8 | 1,481 | 3.6875 | 4 | [] | no_license | # 4가지 숫자로 만들 수 있는 가장 큰 시간을 출력해라
# 시계에 표시된 시간은 24시간 기준이다.
# 4가지 숫자를 조합해서 시간을 출력할 수 없는 경우에는 -1을 출력해라
res = ""
time = input()
time = [int(x) for x in time.split()]
time.sort(reverse = True)
def clock(time):
res =""
#첫번째 자리 시간 후보 : 2,1,0
if min(time) >= 3:
return "-1"
myFilter = [x<3 for x in ... | true |
6e21788b4730af3b56b2abf27c2f3dcfcb4c6843 | MrAsimZahid/Automate-Boring-Stuff-with-Python | /string_manipulation.py | UTF-8 | 317 | 4.5 | 4 | [
"MIT"
] | permissive | #simple program to say hello and ask for name
print("Hello!") #Greetings
print("What is your name?") #name
name = input()
print("It is good to meet you, " + name)
print("The length of your name is:" + str(len(name)))
print("What is your age?")
age = input()
print('You will be '+ str(int(age) + 1) + ' in a year')
| true |
a08d9bda8068bc638a3ff139807087d4a6ea9117 | emericcolombe/led-table | /apps/music_test.py | UTF-8 | 1,053 | 3.25 | 3 | [] | no_license | # Print out realtime audio volume as ascii bars
import time
import numpy as np
import sounddevice as sd
from apps.app import LedApplication
from controllers.controller import TableController
from utils.primitives import Led, Color
duration = 100 # seconds
class MusicTest(LedApplication):
def __init__(self, co... | true |
5a6497ea92ef60bc43edaee95d68588b84e91960 | mh-rahman/Programming-Practice | /463. Island Perimeter.py | UTF-8 | 1,484 | 3.09375 | 3 | [] | no_license | class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
def getN(grid,x,y):
n = []
i = max(0,x-1)
if x > 0 and grid[x-1][y] != 0:
n.append([x-1,y])
if x < len(grid)-1 and grid[x+1][y] != 0:
n.append([x+1,y])
... | true |
042311c4f22346671b15618dd79867c88ca93d63 | hiro-ogawa/CozmoSock | /client.py | UTF-8 | 1,593 | 2.515625 | 3 | [] | no_license | import websocket
import _thread as thread
import time
import json
import cozmo
import sys
# wsserver = "ws://echo.websocket.org/"
# wsserver = "ws://192.168.100.157:3000/"
wsserver = "ws://localhost:3000/"
coz = None
def cozmo_action(message):
msg_dict = json.loads(message)
command = msg_dict["command"]
... | true |
cff8d71ffeb605ace2bfc54f29b362e45914226f | weiting1608/Leetcode | /200. Number of Islands.py | UTF-8 | 1,226 | 3.59375 | 4 | [] | no_license |
# Approach BFS and DFS(for using DFS, just change popleft() to pop())
# Time complexity: O(M * N)
# Space complexity: O(min(M,N)) because in worst case where the grid is filled with lands, the size of queue can grow up to min(M,N).
class Solution:
def numIslands(self, grid: List[List[str]]) -> int:
if not ... | true |
c63287e85abb58b1b1d800c4e1e68c197fba1937 | Chronographer/DampedAndDrivenSHM | /driven_damped.py | UTF-8 | 5,359 | 3.3125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
""" Models simple harmonic motion with the addition of a drag force and a driving force. """
yAxisList = []
xAxisList = []
periodTimer = 0.0 # stores the current elapsed time in the current drive period. Used for plotType 'poincare'.
def run(gravity, pendulumLengt... | true |
0c470673536fb420be4b9b0d1d28f3e744530e70 | knowlage-storage/rpg | /errors.py | UTF-8 | 469 | 2.953125 | 3 | [] | no_license | class EndGame(Exception):
pass
class EndGameDied(EndGame):
def __init__(self, message="You Died."):
self.message = message
class NotEnoughRoomsInZone(EndGame):
pass
class ZoneAlreadyExists(EndGame):
pass
class ZoneCreationError(EndGame):
pass
class RoomDoesNotExist(EndGame):
p... | true |
64d7a862ce6a5a73e932eee1a608109d1708e952 | JoZonneveld/Peercoach | /Python/Periode1/Oefeningen/Calculator.py | UTF-8 | 231 | 3.71875 | 4 | [] | no_license | #create a calculator
# i = input()
getal1 = int(input("Getal 1: "))
operator = input("Kies een operator + - / * ")
getal2 = int(input("Getal 2: "))
if operator == "+":
print(getal1 + getal2)
elif operator == "-":
pass | true |
27e6161b26bed05f7d47a403a97f230c9ee05a61 | sathish97625/Python-Course | /python_the_hard_way/ex13.2.py | UTF-8 | 509 | 3.515625 | 4 | [] | no_license | from sys import argv #argv is an argument variable from the sys module/library.
script, first, second, third, fourth = argv
first = raw_input("How old are you? ")
second = raw_input("What's your name? ")
first = raw_input("What country are you from? ")
second = raw_input("What colour eyes do you have? ")
print "Th... | true |
1cce9e1236040c7606c4ca95c74641164ee90c89 | vmware/alb-sdk | /python/avi/sdk/samples/validate_custom_ipam_script.py | UTF-8 | 13,596 | 2.828125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ############################################################################
# ========================================================================
# Copyright 2022 VMware, Inc. All rights reserved. VMware Confidential
# ========================================================================
###
import importlib... | true |
7d876bd3d1ccf2a31d9db9f1162b72c06017d13c | KyeongTaek/Anagram-Counter | /anagram_finder.py | UTF-8 | 3,700 | 4.21875 | 4 | [] | no_license | print('This program will check if the two lines typed in are anagrams!\n')
print('Type "help" if you need more information about anagrams,\n\nand "No, thanks" to start!\n')
answer=input()
if(answer=='help'):
print('\nOk, let me tell you about what anagram is.\n')
input()
print('If you say the two lines a... | true |
f1327e0d2a02c0314e0d56ea62a42b861ad40090 | AmiMunshi/Python-programs | /company_email | UTF-8 | 201 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 3 19:09:09 2019
@author: maulik
"""
import re
S= input("")
L= re.split("@",S)
name= re.split(".com",L[1])
print(name[0],end="")
| true |
e7a3377dee53353596df64611fee52b05609e0f6 | chinatsui/DimondDog | /algorithm/exercise/dp/range_sum_query.py | UTF-8 | 906 | 4.25 | 4 | [] | no_license | """
LeetCode-303
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.
Example:
Given nums = [-2, 0, 3, -5, 2, -1]
sumRange(0, 2) -> 1
sumRange(2, 5) -> -1
sumRange(0, 5) -> -3
Note:
You may assume that the array does not change.
There are many calls to sumRange functi... | true |
e99a3d544d8fe3b36c8217597e1beff28e87d4ca | Rushi21-kesh/30DayOfPython | /Day-29/Day_29_Rushikesh_Lavate.py | UTF-8 | 584 | 4.0625 | 4 | [] | no_license | """Given a set of strings, find the longest common prefix."""
def Lon_Com_Prefix(words):
print(words)
if not words:
return ''
prefix = words[0]
for word in words:
if len(prefix) > len(word):
prefix, word = word, prefix
while len(prefix) > 0:
if word[:len(... | true |
ffdaa10187240de3a27c595d21d5fd9b88b9e91d | FRCTeam1571/Robot2020 | /sample_code/commands/testcommand.py | UTF-8 | 1,614 | 2.859375 | 3 | [] | no_license | from wpilib.command import TimedCommand
class TestCommand(TimedCommand):
def __init__(self):
timeInSec = 5
TimedCommand.__init__(self, "TestCommand", timeInSec)
self.requires(self.getRobot().testSubsystem)
self.setInterruptible(True)
# This method sets up the command ... | true |
c60f51875f3c1c05a7454a9a208c5f055d6dec7c | NielsRisseeuw/PROG_Huiswerk | /Les 08/Oefening8_3.py | UTF-8 | 130 | 2.640625 | 3 | [] | no_license | breuk = 3/8
print('{:f}'.format(breuk))
print('{:.3f}'.format(breuk))
print('{:8.3f}'.format(breuk))
print('{}'.format(breuk)) | true |
7e985430df475fd733385f1c291b560c87b547df | YotamYang/learn-python | /pic2char.py | UTF-8 | 2,418 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@autour yyt
"""
import os
import imageio
from PIL import Image, ImageDraw, ImageFont
SOURCE_PATH = r'./webwxgetmsgimg.jpg'
OUTPUT_PATH = r'./imgs/'
FRAMES_PATH = r'./outimg/'
def create_dir():
if (os.path.exists(OUTPUT_PATH)):
for file in os.listdir(OUTPUT_PATH):
os... | true |
4a1b76bc13295b337293c571b2afd082d17681cb | yannickfunk/CCFD | /run.py | UTF-8 | 2,661 | 3.109375 | 3 | [] | no_license | # csv processing
import pandas as pd
import numpy as np
# keras
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
from keras.callbacks import TensorBoard, ModelCheckpoint
# other imports
from time import time
# method to create a dataset returning features x and l... | true |
b794365147af74e184ab871c56a85aa25d65eca1 | helloproclub/vanderlinde-discord | /vanderlinde.py | UTF-8 | 3,455 | 2.671875 | 3 | [] | no_license | import requests
from dotenv import load_dotenv
import os
#ENV
load_dotenv()
def url_get(path):
url = os.getenv("URL") + path
return requests.get(url)
def url_post(path,data):
headers = {'Authorization': os.getenv("AUTH")}
url = 'https://aqueous-reaches-39441.herokuapp.com' + path
return requests.... | true |
0482ee810eaf143518b628644cd54964e04d10c9 | vineetarath/dv.pset_old | /0034/isDivisible.py | UTF-8 | 234 | 3.609375 | 4 | [] | no_license | count = 0 #count of integers divisible by 7
n = int(input("Input:")) #get input
for i in range(1,n): #define range
if i%7 == 0: #check divisibility by 7
count = count+1 #update count
print ('Output:' + str(count)) #answer
| true |
d0f17fa9231d273f5db5019492ee50ccf9b0337f | man-group/pytest-plugins | /pytest-verbose-parametrize/tests/integration/parametrize_ids/tests/unit/test_long_ids.py | UTF-8 | 127 | 2.515625 | 3 | [
"MIT"
] | permissive | import pytest
@pytest.mark.parametrize(('x', 'y', ), [(list(range(100)), None), ])
def test_foo(x, y):
assert y not in x
| true |
e34db5874f4d855a90b2c9d2440d7d11eee644b8 | yxch1996/Image_Analyzer | /Pixel.py | UTF-8 | 3,422 | 2.796875 | 3 | [
"MIT"
] | permissive | import numpy
import cv2
import math
RGB_limit = 255;
Lum_limit = 255;
Hue_limit = 359;
Sat_limit = 255;
HUE_Threshold = 14; # put -1 to disable this feature
Sat_XYZ_Threshold = 5 / Sat_limit
no_Color = 0
#Section class variables
def sat_Calu(R, G, B):
r = R / RGB_limit;
g = G / RGB_limit;
... | true |
dca311c8b59835c7affb546944b04df0c3a66f52 | Spetastian/owtf-valhalla | /valhalla/dockerutils/owtfcontainer.py | UTF-8 | 11,475 | 2.625 | 3 | [] | no_license | """
This is iteration 2 of the OwtfContainer.
This one is the one that have been refactored and
the one we should build from
"""
import os
import pprint
import json
import logging
from .exceptions import DockerContainerException, DockerImageException
from . import dclient as dc
# List with ports that can be assigned ... | true |
b4cdc2a985fa9811d3f777f22c9c7005ad8a7868 | fsfrazao/DegDay | /tbase_GDD_analysis.py | UTF-8 | 3,841 | 3.40625 | 3 | [] | no_license | """ tbase_GDD_analysis
This program analyses the relationsip between GDD and base temperature
It reads .csv files containing daily min and max temperatures
and calculates the maximum cummulative degree days for each dataset in a range of base temperatures (0-29 C). It then fits a second order model to the data and pr... | true |
8d3160bd6d65987d73dcc3f8033543a808bb94c1 | noahlwest/leetcode | /python/easy/387_First_Unique_Character_in_a_String.py | UTF-8 | 388 | 3.3125 | 3 | [] | no_license | class Solution:
def firstUniqChar(self, s: str) -> int:
seen = {}
for char in s:
if char in seen:
seen[char] += 1
else:
seen[char] = 1
for i in range(0,len(s)):
if seen[s[i]] == 1:
return i
... | true |
60c739788818ca33ab5ee9d971cd77c24022e0b9 | statKim/TIL | /Python/basic/mymath.py | UTF-8 | 75 | 3.09375 | 3 | [
"MIT"
] | permissive |
mypi = 3.14
def add(a,b):
return a+b
def area(r):
return r*r*mypi | true |
7c2f5b5519c4b9769e2e7aff449fb7eb8fdd8ac1 | ShiFengZeng/ZeroJudge_py | /d056.py | UTF-8 | 581 | 2.84375 | 3 | [] | no_license | import sys
N = int(input())
for _ in range(N):
input()
M = int(input())
L = M
num = [[0 for a in range(2)] for b in range(M)]
res = [0] * M
for NUM in sys.stdin:
M -= 1
num[M][0], num[M][1] = [int(x) for x in NUM.split()]
if M == 0:
break
temp = num[0][... | true |
9655ce3ec678b55599b111ac5a198047ace38036 | SilverBuzzard/python_kurs | /02_struktury_danych/04_listy_wycinanie.py | UTF-8 | 375 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
@author: krakowiakpawel9@gmail.com
@site: e-smartdata.org
"""
# %%
index = [ 0, 1, 2, 3, 4, 5]
idx_n = [-6, -5, -4, -3, -2, -1]
lista = [34, 23, 56, 24, 23, 76]
# %%
# lista[start:stop]
# lista[index]
# lista[start:]
# lista[:stop]
# lista[::step]
lista[0]
lista[1]
lista[-1]
list... | true |
a7954f9dabaebd28998bc692a31ab3547806ee2c | fanto88/GeneticSnake | /manager/display_manager.py | UTF-8 | 2,201 | 3.453125 | 3 | [] | no_license | import pygame
from utils import config
class DisplayManager:
"""Class that manage the display."""
def __init__(self, snake, apple):
self.__display = pygame.display.set_mode((config.DISPLAY_WIDTH, config.DISPLAY_HEIGHT))
self.__side = config.RECT_SIZE
self.__snake = snake
self... | true |
239e4776bfd19ffdf90cf177af4b477bea292dde | skee-t/backend | /skee_t/db/__init__.py | UTF-8 | 4,273 | 2.546875 | 3 | [] | no_license | #! -*- coding: utf-8 -*-
import sqlalchemy
from sqlalchemy.engine.url import make_url
from sqlalchemy.orm import sessionmaker
from skee_t.conf import CONF
__author__ = 'pluto'
def create_engine(connection, idle_timeout=3600, max_pool_size=10, max_overflow=10,
pool_timeout=30, encoding='UTF-8', deb... | true |
6373dfc34811b20419db091ecb20d1c30357efc8 | fossabot/Quantum-Algorithms | /Random Number Generator/liveplot.py | UTF-8 | 644 | 2.78125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 01:39:31 2020
@author: amann
"""
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import style
style.use('fivethirtyeight')
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
def animate(i):
graph_data = open('log.txt', 'r').r... | true |
0ad88bb7cb14c4927355a815bc9a4a5b727762cf | gonozov0/ElasticsearchBTCReader | /btc-reader.py | UTF-8 | 1,649 | 2.890625 | 3 | [] | no_license | import requests, logging, time
from datetime import datetime
from elasticsearch import Elasticsearch
def connect_elasticsearch():
_es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
if _es.ping():
print('Yay Connect')
else:
print('Awww it could not connect!')
return _es
def cr... | true |
9a003ff9f7b29cca2a8fe9a42d02950534430fc2 | taro0079/Icpy | /file_regex.py | UTF-8 | 630 | 2.875 | 3 | [] | no_license | import glob
import re
import os
class FileRegex:
def __init__(self, folder_path):
self.folder_path = folder_path
self.file_path_list = glob.glob(self.folder_path + '*.dat')
self.file_name_list = [os.path.basename(
ff) for ff in self.file_path_list]
def extract_sample_numbe... | true |
adf35314212669aac4fa838965c6b6769512b6f7 | danheeks/HeeksCAM | /PyCAD/geom/Box3D.py | UTF-8 | 3,282 | 3.578125 | 4 | [
"BSD-2-Clause"
] | permissive | import math
class Box3D:
def __init__(self, xmin = None, ymin = None, zmin = None, xmax = None, ymax = None, zmax = None):
self.x = [0, 0, 0, 0, 0, 0]
if xmin != None: self.x[0] = xmin
if ymin != None: self.x[1] = ymin
if zmin != None: self.x[2] = zmin
if xmax != Non... | true |
2ee227a54645893eef79ffae511fc38718444adb | Comyn-Echo/leeCode | /比赛/1439. 有序矩阵中的第 k 个最小数组和.py | UTF-8 | 638 | 3.171875 | 3 | [] | no_license | class Solution(object):
def kthSmallest(self, mat, k):
"""
:type mat: List[List[int]]
:type k: int
:rtype: int
"""
last_row = [0]
for i in range(len(mat)):
new_row = []
for j in range(len(mat[0])):
for p in last_row:
... | true |
0783405c03c995671220b319de1e14b41f68289b | BaileyKindrick96/CSCI-220-and-220L-Python | /Lab2-loops.py | UTF-8 | 3,060 | 4.5 | 4 | [] | no_license | """
Lab2-loops.py for the 4 problems assigned in Lab 2
Name:
"""
def main():
coffee()
newton(2,1000)
newton(5,1000)
calc_pi(10)
calc_pi(100000)
piAlt(10)
piAlt(1000)
piAlt(100000)
def order(pounds):
"""
Write a function, order(pounds), to compute the cost of a coffee order
... | true |
80bad6ee4af94458a5764de46f331e40e95ec31e | mpc-bioinformatics/ProtGraph | /protgraph/read_embl.py | UTF-8 | 1,395 | 3.25 | 3 | [
"BSD-3-Clause"
] | permissive | import mmap
def rows(f, chunksize=4096):
"""
Split entry and add as bytearray into the queue
"""
curr_row = bytearray()
sep_array = bytearray(b"\n//\n")
# Alternative, which only uses read/find and tell
# This is slower but reads the file faster
# sep=b'\nID'
# while True:
# ... | true |
181fc9dcc63b99a13feba62e065271643050ef77 | alexReshetnyak/pure_python | /1_fundamentals/19_scope.py | UTF-8 | 2,132 | 4.1875 | 4 | [] | no_license | print('---------------------------SCOPE--------------------------------')
# * Scope - what variables do I have access to?
total = 100 # * creates variable in global scope
# ------------------------------------------------------
# * Python has function scope (every new function creates it own scope)
def do_something... | true |
edf7f14f5be7b93e06119a647f391d7a397e2088 | dev3225/Computer-Vision-Project- | /Optical Flow/util.py | UTF-8 | 740 | 2.859375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import numpy as np
def computeBilinerWeights(q):
q[0] = q[0] - np.floor(q[0])
q[1] = q[1] - np.floor(q[1])
weights = [(1-q[0])*(1-q[1]), q[0]*(1-q[1]), (1-q[0])*q[1], q[0]*q[1]]
return weights
def computeGaussianWeights(winsize, sigma):
x_c, y_c = ((winsize[0] - 1) / 2, (winsize[1] - 1) / 2)
... | true |
b57054f8e9d6e6197f35a131b312cbc9ba2614d5 | knipknap/exscript | /Exscript/stdlib/string.py | UTF-8 | 2,944 | 2.796875 | 3 | [
"MIT"
] | permissive | #
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# 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,... | true |
7c97ef54c14e7a21ee5ae085f12bb3d695240a9a | BrettMohr/marketplace-currency-api | /tests/currency_converter.tests.py | UTF-8 | 1,269 | 2.6875 | 3 | [] | no_license | import unittest
import app_config
from api_helpers.currency_converter import CurrencyConvertor
class CurrencyConvertorTestCase(unittest.TestCase):
def setUp(self):
self.data = data = {
"success": True,
"timestamp": 1519296206,
"base": "EUR",
"date": "2021-0... | true |
a96e8c0969f3394b41b90880c53219c2c00377b7 | Aasthaengg/IBMdataset | /Python_codes/p02883/s447158977.py | UTF-8 | 541 | 2.859375 | 3 | [] | no_license | def isok(arg):
if arg < 0:
return False
count = 0
for i in range(n):
count += max(0,-(-(a[i]*f[i]-arg)//f[i]))
if count <= k:
return True
else:
return False
def bisect(ng, ok):
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if isok(mid):
... | true |
971790a4ed8be09e902f77fe635822d19828cd9a | jramapuram/async_fid | /client.py | UTF-8 | 2,619 | 2.59375 | 3 | [
"MIT"
] | permissive | import rpyc
import numpy as np
class FIDClient(object):
def __init__(self, host, port, normalize_imgs=True, force_cpu=False):
""" A simple FID-client that talks to the FID server and posts fid calculation requests
:param host: the FID-server hostname or ip
:param port: the FID-server port
... | true |
925b6024661d25573714b9055e61b05abfdad0cb | fatiando/harmonica | /examples/equivalent_sources/block_averaged_sources.py | UTF-8 | 5,548 | 3.578125 | 4 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) 2018 The Harmonica Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
Gridding with block-averaged equivalent sources
=======================================... | true |
ffcb3946cfc968ab2395ddafdc40f61ba900aaa5 | ethansure/Leetcode | /M338-counting-bits.py | UTF-8 | 245 | 2.609375 | 3 | [] | no_license | class Solution(object):
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
bs = [0] * (num + 1)
for i in range(1, num + 1):
bs[i] = bs[i&(i-1)] + 1
return bs | true |
b3e462e6d42f017bc3f14dca3e6ffecaf1d92a33 | szmgithub/Machine_Learning | /linear_regression/ridge_regression.py | UTF-8 | 4,932 | 3.671875 | 4 | [] | no_license | # coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
def plot_data(x, y):
"""绘制给定数据x与y的图像"""
plt.figure()
# ====================== 你的代码 ==========================
# 绘制x与y的图像
# 使用 matplotlib.pyplt 的命令 plot, xlabel, ylabel 等。
# 提示:可以使用 'rx' 选项使数据点显示为红色的 "x",
# 使用 "marker... | true |
5d1eaa90fe5aeebd70016a25aada815c2c75c18a | devpunjabi/fb_reactions_crawler | /training/model.py | UTF-8 | 5,718 | 2.625 | 3 | [] | no_license | import logging
import json
from sklearn.externals import joblib
from sklearn.pipeline import FeatureUnion, Pipeline
from sklearn.model_selection import GridSearchCV
class Model:
reactions = {"joy": 0, "surprise": 1, "sadness": 2, "anger": 3}
reaction_ids = {0: "joy", 1: "surprise", 2: "sadness", 3: "anger"}
... | true |
8e83d2f199efcfbd9024b084bcf134a158fa4e77 | shihyu/tdd_python | /tdd_leds/tests/alltests.py | UTF-8 | 1,123 | 2.65625 | 3 | [] | no_license | import unittest,os
from ctypes import *
app_path = os.path.dirname(os.path.abspath(__file__))
libpathname = os.path.join(app_path, "./libleds.so")
leds = CDLL(libpathname);
verbose = 0
def boslog(msg):
global verbose
if verbose:
print msg
class BOSTest_leds(unittest.TestCase):
def test_turn_ono... | true |
a6b5d3220dcb995c14bbcc39837edc9331d86f78 | yusukemurayama/ppytrading | /ppyt/rules/exit_rules/__init__.py | UTF-8 | 4,466 | 2.953125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import logging
import abc
from ppyt import const
from ppyt.rules import RuleBase
from ppyt.decorators import handle_nodataerror
from ppyt.exceptions import OrderTypeError
logger = logging.getLogger(__name__)
class ExitBase(RuleBase, metaclass=abc.ABCMeta):
"""exit_ruleの親クラスです。"""
_rule_type ... | true |
c9745865385d8a82a34b50f841c0b2071273298d | yingshaoxo/ML | /19.sentence_rewrite/Fengshenbang-LM/fengshen/examples/unimc/example.py | UTF-8 | 2,309 | 2.75 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import argparse
from fengshen.pipelines.multiplechoice import UniMCPipelines
def main():
total_parser = argparse.ArgumentParser("TASK NAME")
total_parser = UniMCPipelines.pipelines_args(total_parser)
args = total_parser.parse_args()
pretrained_model_path = 'IDEA-CCNL/Erlangshen-UniMC-RoBERTa-110M-Ch... | true |
e3beca4c44ed8656532026d8b0eb66acfa01ba4f | toybox-rs/ToyboxAgents | /agents/amidar/junctionwalker.py | UTF-8 | 6,170 | 2.53125 | 3 | [] | no_license | import random
from . import *
from toybox import Input
from . utils import tilepoint_lookup, index_junctions, tile_to_route_id, index_segments
class JunctionWalker(AmidarAgent):
def __init__(self, *args, **kwargs):
self.seed = 1984 # party
super().__init__(seed=self.seed, *args, **kwargs)
self.heading_... | true |
438a9ce696b52f8313e15d4fe4df84fbf3ca2cf6 | jordvnkm/csci561HW3 | /version1.py | UTF-8 | 13,689 | 3.40625 | 3 | [] | no_license | # Jordan Minatogawa
# Algorithm will set expected cost to goal for each grid location. Reset these costs per car.
# Use expected costs to determine which way to go for each grid location.
# Run simulation for each car.
import numpy as np
import math
import copy
# classes
# Wrapper that just contains start and end lo... | true |
e2662be5fa2cb6d33c9ce8c20d4be90788ccf0ce | vorti7/study | /studyTogether/test01.py | UTF-8 | 1,465 | 3.890625 | 4 | [] | no_license | '''
트와이스 팬클럽 카페지기 "redvelvetForever"는 카페 신규가입자들에게 최소한의 테스트를 거치게 하려고 한다.
문제는 트와이스 전 멤버의 활동명을 맞추는 문제로, 순서에 상관없이 이름들을 공백문자(" ")로 연속적으로 입력받게 한다.
(입력된 이름들이 멤버수와 맞지 않으면 따로 표시한다.)
입력과 출력의 예로
input>>
나연 쯔위 정연 채영 다현 미나 사나 모모 지효
output>>
정답입니다! 트와이스 광팬이군요!
input>>
김정은 도날드트럼프 푸틴 아베
output>>
멤버수가 맞지 않아요
input>>
나연 쯔위 정연 수지 다혈 마나 사... | true |
826f0d9bc85a845cc57e0e3456cee98d78e44ba3 | awasylew/mine1 | /ships1/ships.py | UTF-8 | 4,502 | 2.75 | 3 | [] | no_license | from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
import random
import os
#from pip._vendor.distlib.compat import raw_input
class Field(object):
def __init__(self, width, height):
self.width = width
self.height = height
... | true |
9fdf323e7fe318588654f2bf29cfe33413b6f0ae | tmu-nlp/100knock2020 | /yamaguchi/chapter02/knock17.py | UTF-8 | 541 | 3.6875 | 4 | [] | no_license | # データ処理ライブラリ「Pandas」をインポート
import pandas as pd
# 区切り文字がタブ(sep='\t')なので「read_table()」を用いる
# headerがないので「None」を指定
data = pd.read_table('popular-names.txt', sep='\t', header=None)
# 「data[0]」で1列目を指定し,「unique」で異なる文字列の集合を重複を除いて求める.
print(data[0].unique())
# 確認
# sortコマンドで名前順に並べ替えて,uniqコマンドで連続する同じ行を削除する.
| true |