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 |
|---|---|---|---|---|---|---|---|---|---|---|
f7a8d55d7bd39ff527d4689745b48336ab4b68a1 | MathisDeronzier/mod-lisation-Little_Washita- | /py_codes/codes_utiles/optimisation_tool | UTF-8 | 2,138 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 26 18:59:48 2021
@author: mathis
"""
import numpy as np
########## Les fonctions utiles ############
def dist(u,v,x):
#La distance d'un point à la droite définie par le couple (u,v) voir rapport
y=(x-v)
return y.dot(y)-(y.dot(u))**2/(u.... | true |
ab6e4638b392f32b7f565a8f35de069181b74d4c | dejavvu/webdriver-start | /wdstart/drivers.py | UTF-8 | 3,883 | 2.78125 | 3 | [
"MIT"
] | permissive | from . import helper
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
class BaseDriver:
"""Wrapper class around Selenium webdriver
Starts a Selenium webdriver according to the parameters provided.
Parameters
----------
headless : bool
Whether to ... | true |
9e252a69ec1c5cf06a9ef21f77ccb22854f45f23 | Crysple/grocery | /leetcode/503.py | UTF-8 | 424 | 2.984375 | 3 | [] | no_license | class Solution:
def nextGreaterElements(self, nums: List[int]) -> List[int]:
ans = [-1] * len(nums)
stack = []
for i, n in enumerate(nums):
while stack and n > stack[-1][0]:
ans[stack.pop()[1]] = n
stack.append([n, i])
for n in nums:
... | true |
a47dd8ecdd37cf299312fdc1de3b627d258c4ed7 | cacampbell/pythonmisc | /UnzipAll.py | UTF-8 | 1,479 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
from ParallelCommand import ParallelCommand
class UnzipAll(ParallelCommand):
def __init__(self, *args, **kwargs):
super(UnzipAll, self).__init__(*args, **kwargs)
self.input_regex = ".*\.zip$|.*\.gz$|.*\.bz2$"
self.extension = ".*"
self.set_default('cluster_op... | true |
497e63dd50ef21281a1e188a66769d84a191d699 | bigzhao/Algorithm | /0-1package.py | UTF-8 | 5,399 | 2.984375 | 3 | [] | no_license | # coding=utf-8
import sys
import random
import numpy as np
import matplotlib.pyplot as plt
reload(sys)
sys.setdefaultencoding('utf-8')
WEIGHT = [220,208,198,192,180,180,165,162,160,158,
155,130,125,122,120,118,115,110,105,101,
100,100,98,96,95,90,88,82,80,77,
75,73,70,69,66,65,63,60,58,56,
... | true |
bf7fce83c57cd3346551654001c1cd3d4133d51d | estraube/SF_DAT_17_WORK | /Yelp Lab.py | UTF-8 | 1,115 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 5 21:09:07 2015
@author: estraube
"""
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.cross_validation import train_test_split
from sklearn import metrics
import statsmodels.formula.api as smf
# visualization
import ... | true |
a9cd2ada4913638d1ba1e9f8a4ce7206d2991c72 | harshkumarkhatri/Hackerrank-Solutions | /Hackerrank-30-days-solutions/Day 1.py | UTF-8 | 463 | 3.671875 | 4 | [] | no_license | i = 4
d = 4.0
s = 'HackerRank '
m=input()
z=int(m)
n=input()
y=float(n)
o=input()
print(i+z)
print(d+y)
print(s+o)
# Declare second integer, double, and String variables.
# Read and save an integer, double, and String to your variables.
# Print the sum of both integer variables on a new line.
# Print the sum of the ... | true |
b5b07f3ed2683f8eb2cb71b593e12bd118a96fb7 | colorfulComeMonochrome/data_analysis | /matplotlib/matplotlib004.py | UTF-8 | 1,138 | 3.375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
### 3D
fig = plt.figure()
# 用matplotlib.pyplot 自带的3d功能, projection='3d'
ax = fig.add_subplot(111, projection='3d')
# 画点
# ax.scatter([1, 2], [2, 3], [3, 4], marker='x')
# 画直线
# ax.plot([1,2,3], [2,3,4], [3... | true |
e15ea3001c411b03d950e85dc4f78cb8609d1d55 | claoidek/Project_Euler | /018_maximum_path_sum_i.py | UTF-8 | 2,091 | 3.421875 | 3 | [] | no_license | # Calculates the maximum value path from the top to the bottom of the following triangle
# 75
# 95 64
# 17 47 82
# 18 35 87 10
# 20 04 82 47 65
# 19 01 23 75 03 34
# ... | true |
d2b0aa4ee81e875839d43cef832057653a0b0a6c | anawatbk/consha | /code/test_app.py | UTF-8 | 2,240 | 2.5625 | 3 | [] | no_license | from app import application
import pickle
from backend.lr_base_model import get_score
def test_application():
'''
test if application is available
'''
assert application is not None
def UserFromDB(username):
user = classes.User.query.filter_by(username=username).first()
return user
def tes... | true |
9f9a4c43238a229fde20e1e18aec42ce4563b4bf | kilirobbs/python-fiddle | /TDD/unittest/test_init.py | UTF-8 | 915 | 3.6875 | 4 | [] | no_license | # http://stackoverflow.com/questions/88325/how-do-i-unit-test-an-init-method-of-a-python-class-with-assertraises
import unittest
class MyClass:
def __init__(self, foo):
if foo != 1:
raise ValueError("foo is not equal to 1!")
class TestFoo(unittest.TestCase):
def failUnlessRaises(self, excClass, callableObj,... | true |
7f682ab4076430787b8f7c53a94cfe402a4d350f | santoshernandezr/MatrixCalculator | /MatrixGUI.py | UTF-8 | 15,814 | 2.78125 | 3 | [] | no_license | from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button, ButtonBehavior
from kivy.uix.boxlayout impo... | true |
b423f95346cdc25038a062e60a5ea214d19b3ec8 | break11/AutoStorage | /App/PowerUtils/netPowerStation.py | UTF-8 | 1,323 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3.7
import socket
host = "127.0.0.1"
port = 5025
backlog = 5
size = 1024
voltage = 0.0
current = 0.0
state = "NONE"
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind( (host,port) )
server.listen(backlog)
while True:
client, address = server.accept()
while Tr... | true |
7996f558638ac51ba0c4c5cc7f8da54bf1948ebf | AryanGitHuB653/otp | /mian.py | UTF-8 | 574 | 2.90625 | 3 | [] | no_license | import smtplib
import random
print('*'*15)
k = input('enter email ')
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login('python.bot75@gmail.com','adyaesziprmhepwg')
otp = random.randint(100000,999999)
msg = 'Hi , thank you for creating your account , here is your otp-->'+str(otp)
se... | true |
969d463fb30fa627b169b3dc7dec0cf5a2e3e9ef | Chekoo/Core-Python-Programming | /7/7-7.py | UTF-8 | 289 | 3.296875 | 3 | [] | no_license | def swap(dct):
change = {}
for key in dct:
change[dct[key]] = key
return change
if __name__ == '__main__':
while True:
dict1 = input('Please input a dict(-1 to quit): ')
if dict1 == -1:
break
else:
print swap(dict1)
| true |
93c9bbdc6181627a470dbaecb7768c242ae6955d | ipcoo43/algoOne | /lesson113.py | UTF-8 | 741 | 3.546875 | 4 | [] | no_license | # 분수 수열의 합계 (스위치 변수)
# 분수 수열 문제의 해법
# 분자, 분모의 상호 연관성 확인
# 연과성이 없을 때는 분자, 분모의 반복 규칙을 따로 찾자
# 분자, 분모의 변수 중 어느것으로 종료 할 것인가
# 1/2+2/3+3/4+4/5 ... i/i+1
# 분자 : i = i + 1
# 분모 : i/(i+1)
# sum = sum + i/(i+1)
# i < 4
from fractions import Fraction
i = 0 # 1
sum = 0 # 1/2
while i < 4:
i = i + 1
n = Fraction(i,i+... | true |
b4d1d381ca78daf5ae75bb0759b63ca6ba403b7e | Istiak-004/linked-lists | /delete_list.py | UTF-8 | 2,688 | 3.671875 | 4 | [] | no_license | class Node(object):
def __init__(self,data = None,next = None):
self.data = data
self.next = next
class LinkList:
def __init__(self):
self.head = None
def append_first(self,data):
node = Node(data,next = None)
node.next = self.head
self.head = node
def app... | true |
990f66872529eeeccd4bf1f0d027eabdd50215b5 | touruscy/chatterbot_wxpy | /chatterbot_wxpy.py | UTF-8 | 2,019 | 2.515625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
from chatterbot import preprocessors
from wxpy import *
import configparser
def load_path():
# 读取配置文件
config = configparser.ConfigParser()
config.read("config.cfg")
my_friend = config.get("friends", "my_... | true |
269fae48ae0a5044fcaa195cc54e4e390c61460b | mmm311/kaggle | /Leaf/FeatureExtract3.py | UTF-8 | 6,819 | 2.578125 | 3 | [] | no_license | '''
Created on 2016年12月10日
@author: liu
'''
import numpy as np
import scipy as sp
import scipy.ndimage as ndi
import pandas as pd
from skimage import measure
from sklearn import metrics
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from pylab... | true |
6b9a2726691ebef9b51e7e19aab1225749b8c289 | kagxin/recipe | /django_study-master/querysetapi/views.py | UTF-8 | 494 | 2.65625 | 3 | [] | no_license | from django.shortcuts import render
from .models import *
from django.http import HttpResponse
from datetime import *
# Create your views here.
"""
过滤出满足下面条件的Blog
1、发布时间是2016年之前
2、authors是xiaoming
3、rating 大于等于60
"""
def example1(request):
blog_set = Blog.objects.filter(entry__pub_date__lt='2016-01-01', entry__... | true |
d0d611e64995c8fe6b2280f8b3e4fe81586728b3 | getChan/algorithm | /dp/10844_쉬운계단수.py | UTF-8 | 290 | 2.71875 | 3 | [] | no_license | # 12345678 9
# dp[i] : i자리수인 수의 계단수의 개수
# dp[1] = 9
# dp[2] = 17
# dp[3] = (dp[2]-2)*2 + 2
# dp[i] = (dp[i-1]-2i)*2 + 2i
n = int(input())
num = 17
for i in range(n-2):
num = (num-2*(i+1))*2 + 2*(i+1) % 1000000000
if n == 1:
print(1)
else:
print(num) | true |
751a38955c9f5835dc4a44cdd97f2b46cf0b4abf | scikit-image/scikit-image | /skimage/transform/tests/test_finite_radon_transform.py | UTF-8 | 316 | 2.828125 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
from skimage.transform import frt2, ifrt2
def test_frt():
SIZE = 59 # must be prime to ensure that f inverse is unique
# Generate a test image
L = np.tri(SIZE, dtype=np.int32) + np.tri(SIZE, dtype=np.int32)[::-1]
f = frt2(L)
fi = ifrt2(f)
assert np.array_equal(L, fi)
| true |
a1e42695ac15a8706147c85e0e7c5bc1816925be | mulinfro/nautilus | /sh/text_process.py | UTF-8 | 2,370 | 2.75 | 3 | [] | no_license |
import re
from itertools import chain
from sh.os_cmd import is_dir, replace_if_star_dir
def pipe_itertool(func):
def wrapper(*args, **kw):
assert(len(args) > 0)
if type(args[0]) == str:
return func(*args, **kw)
for line in args[0]:
new_args = (line,) + args[1:]
... | true |
32cee4d1627d2dc2e5ccb8604b42cc85ad48996f | WarrenGreen/InfiniteDropPlusApps | /PythonFacebookFaceRecognition/face_recognizer.py | UTF-8 | 3,717 | 2.6875 | 3 | [] | no_license | import cv2
import os
import psycopg2
import numpy as np
import pickle
class FaceRecognizer:
def train(self, training_data_directory):
models = {}
faces = {}
dataset = {}
try:
conn = psycopg2.connect("dbname='InfiniteDrop' user='postgres' host='127.0.0.1' password='@Po... | true |
f184e53ee91cf31856d3c44b859f2652a9d92382 | AndyLiamano/Aprendendo-Python | /1 - elif (comando Caso).py | UTF-8 | 671 | 4.46875 | 4 | [] | no_license | # elif é semelhante ao comando escolha/caso
print('Segunda-Feira (1)')
print('Terça-Feira (2)')
print('Quarta-Feira(3)')
print('Quinta-Feira(4)')
print('Sexta-Feira(5)')
print('Sábado(6)')
print('Domingo(7)')
semana = int(input('Digite um numero: '))
if semana == 1:
print('Hoje é Segunda-Feira')
elif... | true |
a84cb3035097e9ddb0a29e4ad297f1eb661999dd | stellar-echo/exoechopy | /exoechopy/io/loaders.py | UTF-8 | 22,275 | 2.65625 | 3 | [] | no_license |
"""
This module provides tools for importing .exo files and generating systems
"""
import os
import json
import copy
from pathlib import Path, PurePath
from exoechopy.utils import astropyio, is_nested
from exoechopy.utils.pdf_parser import *
from exoechopy.simulate import *
__all__ = ["generate_system_from_file", ... | true |
20aa0914bde3ecfc91641098fa0e1b4f2c1cab0c | MOHAMMAD-FATHA/Python_Programs | /Data Structures/Basic Python/SortFiles.py | UTF-8 | 310 | 2.65625 | 3 | [] | no_license | """
* @Author: Mohammad Fatha
* @Date: 2021-09-24 15:50
* @Last Modified by: Mohammad Fatha
* @Last Modified time: 2021-09-15 01:52
* @Title: :Python program to sort files by date
"""
import os
os.chdir('F:')
result = sorted(filter(os.path.isfile, os.listdir('.')), key=os.path.getmtime)
print('\n'.join(map(str, res... | true |
d569ca60b777950ec58977bdd488bcbbc6ce92e9 | xxffhv/PythonDemo | /demo_list.py | UTF-8 | 267 | 3.34375 | 3 | [] | no_license | b=[]
b.append("test")
b.append("apple")
b.append("banana")
for a in b:
print(a)
def fact(n):
if n == 1:
return n
else:
return n * fact(n-1)
print("阶乘:", fact(3))
print('__name__是模块名字(文件名),值为:'+__name__) | true |
9ad871c5c3836e05be1cfea25503e786d91980c7 | wyljpn/LeetCodeTest | /Math/69. x 的平方根.py | UTF-8 | 939 | 3.890625 | 4 | [] | no_license | # 69. x 的平方根
#
# 实现 int sqrt(int x) 函数。
#
# 计算并返回 x 的平方根,其中 x 是非负整数。
#
# 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。
#
# 示例 1:
#
# 输入: 4
# 输出: 2
class Solution(object):
# 自己写的,在leetcode提交会内存错误
def mySqrt(self, x):
if x <= 1:
return x
for i in range(1, int(x/2)+1):
if pow(i, 2) <= ... | true |
f792d5aa513936c42a709dfa0d2592d12161f1a5 | ioannistsanaktsidis/python-further | /color_test.py | UTF-8 | 1,364 | 3.34375 | 3 | [] | no_license | from Colour import Color, Colour
from pytest import mark
parametrize = mark.parametrize
@parametrize('Colour', (Colour, Color))
@parametrize('r,g,b', ((0, 0, 0), (0.2, 0.3, 0.7), (1, 1, 1)))
def test_rgb_01_should_be_retreivable(Colour, r, g, b):
c = Colour.from_rgb_01(r, g, b)
assert c.as_rgb_01() == (r, g, ... | true |
d06c699afeb9a69f687ca9c2c8d2965160af058b | blastmaster/sysmap | /python/smap.py | UTF-8 | 5,558 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | import click
import json
import pprint
from sysmap.database import SystemMapDatabase
from sysmap.graph import NetworkGraph
__author__ = "Sebastian Oeste"
__email__ = "sebastian.oeste@tu-dresden.de"
'''
This script inserts the collected data from the `sysmap` tool into arangodb.
A HPC-System is a Database in... | true |
c3a9b42c5e0afb735b437a0fc1331b38d60cebfd | p3i0t/TreeLSTM | /tree.py | UTF-8 | 1,585 | 4 | 4 | [] | no_license | class Tree(object):
def __init__(self):
self.parent = None
self.num_children = 0
self.children = list()
def add_child(self, child):
"""
:param child: a Tree object represent the child
:return:
"""
child.parent = self
self.num_children += ... | true |
2c9ddcbcc6de084b89197aa5dd996ff1eb02f6f8 | 1021ky/nlp100_2020 | /chapter2/2_18.py | UTF-8 | 701 | 3.3125 | 3 | [
"MIT"
] | permissive | # 各行を3コラム目の数値の逆順で整列せよ
# (注意: 各行の内容は変更せずに並び替えよ).
# 確認にはsortコマンドを用いよ(この問題はコマンドで実行した時の結果と合わなくてもよい)
# 確認コマンド
# * sort -r -k 3 popular-names.txt
# * diff <(sort -r -k 3 popular-names.txt) <(python 2_18.py) ※ bashで
columns_tuple_list = []
with open('popular-names.txt') as f:
for line in f.readlines():
columns =... | true |
0a8f0ad35afbfb603e139de969f76d76a44e2efb | gssgch/gssgML | /com.ch/spider/crawlerDouban.py | UTF-8 | 5,342 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
# coding=utf-8
import os, requests, sys, urllib2, sys, re
from bs4 import BeautifulSoup
import csv
'''
豆瓣电视剧名称 主演
'''
reload(sys)
# 写中文
sys.setdefaultencoding('utf-8')
def write_file(file_name, writer_name, agree, comment, postings):
f = open(dictionary + file_name + '.txt', mode='w')
f.... | true |
5fe4360a2d7fac75db81044219cdb8df3b08313d | minnujimmy/remider | /minnu.py | UTF-8 | 1,799 | 3.21875 | 3 | [] | no_license | #WINDOW Creation(Root Window)
from tkinter import *
import pymysql
root=Tk()
root.title("Welcome Page")
root.geometry('1366x768')
root.configure(background='grey')
def insert():
db = pymysql.connect("localhost","root","admin","MYDATABASE")
cursor = db.cursor()
sqlinsert2 = "INSERT INTO BIRTHDAY (ID, NAM... | true |
20a3fcc005656ad32fe1806b81028a1328bb2a07 | mattmartinez/crypto | /skiddie.py | UTF-8 | 1,143 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python
# References
# md5 in python: https://mkyong.com/python/python-md5-hashing-example/
# md5 differences unix vs python: https://superuser.com/questions/1192917/why-does-my-md5sum-hash-not-match-other-md5s
import sys
import os
import hashlib
# Variables
OP_OBFUSCATED = '6a46446f206e6f74206265206f766572... | true |
92dd766541e8bd74456a9b82d721f23ddc13a36f | SachinHg/python-exercises | /bits.py | UTF-8 | 343 | 3.21875 | 3 | [] | no_license | def totalbits_each(x):
print(":::::",x)
if x<=0:
return 0
else:
if x%2 == 0:
return 1+totalbits_each(x//2)
else:
return totalbits_each(x//2)
def totalbits(b):
cnt = 0
for i in range(1,b+1):
i = int(bin(i)[2:])
cnt+=totalbits_each(i)
return cnt
t = int(input())
for i in range(t):
n = int(input()... | true |
6a24c781f86998adef2f26f691cff23cc25c05d9 | CNJackyYe/PractiseDayByDay | /16.isPalindrome.py | UTF-8 | 954 | 3.765625 | 4 | [] | no_license | # 验证回文串
# 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写。
# 说明:本题中,我们将空字符串定义为有效的回文串。
# 示例 1:
# 输入: "A man, a plan, a canal: Panama"
# 输出: true
# 示例 2:
# 输入: "race a car"
# 输出: false
# 相关标签
# 双指针
# 字符串
# 作者:力扣 (LeetCode)
# 链接:https://leetcode-cn.com/leetbook/read/top-interview-questions-easy/xne8id/
# 来源:力扣(LeetCode)
# 著作... | true |
41fac04068cd4745c7cd309975497856eaeb3f15 | Rubenkl/thesis-beam | /trainer/graphing/newKNNDTW-cv-multiprocess.py | UTF-8 | 4,948 | 2.65625 | 3 | [] | no_license | import docopt
from sklearn.neighbors import KNeighborsClassifier
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
import itertools
import os #filesystem reads
from helpers import DataAnalyzer
#Crossvalidation:
from sklearn.model_selection import train_test_split
#multiprocessing
import multiproces... | true |
f0c781b795bf30b45b51c71e68bf01b23eed6cdf | hansrobothans/shell | /ros/py_catkin_ws/src/my_awesomme_code/script/cv_bridge_test.py | UTF-8 | 1,258 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
import rospy
import cv2
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import Image
class image_converter:
def __init__(self):
#创建cv_bridge,声明图像的发布者和订阅者
self.image_pub = rospy.Publisher("cv_bridge_image",Image,queue_size=1)
self.bridg... | true |
49f7f8375341d77b2d991e8dfee82e61412f94d1 | iliketomatoes/python-cli-playground | /main.py | UTF-8 | 2,937 | 3.5 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
Entry module of the app
"""
import argparse
import importlib
import inspect
from colorama import init, Fore, Style
__author__ = 'Giancarlo Soverini'
__version__ = '0.1.0'
__license__ = 'MIT'
# Init colorama
init(autoreset=True)
def main():
""" Main entry point of the app """
# I... | true |
8ed72544c72fd332bf6f8d7c54063192ed938dbe | RichCerone/Interview-Problems | /FirstNonRepeatedChar.py | UTF-8 | 489 | 4.4375 | 4 | [] | no_license | """
Find the first non-repeated character in a String
@author Richard Cerone
"""
word = "aaaa baaa" #Example word.
#Every string is an array of characters if you think about it.
array = list(word)
count = 0
for letter in word:
if array[count+1] != letter:
#We'll check for spaces for better clarification... | true |
5305fbc0f8901d31961685a5061ead5ebb14e789 | aamishbaloch/StringFinder | /tests.py | UTF-8 | 2,291 | 3.21875 | 3 | [] | no_license | import time
import unittest
from string_finder import Finder
class TestStringFinder(unittest.TestCase):
def test_valid_str(self):
finder = Finder(['python', 'django', 'flask', 'unit', 'test'])
response = finder.find('thonpy')
self.assertEqual(['python'], response)
def test_invalid_s... | true |
9732e68d0778850236e44a666571e9e7b6eae363 | gustavojra/Methods | /Aux/cc_wfn.py | UTF-8 | 1,207 | 2.8125 | 3 | [] | no_license | import numpy as np
from fock import *
class cc_wfn:
def __init__(self, ref, ci_coef, ci_dets):
# Read in inputs
self.ref = ref
# Get C0 based on the given reference
C0 = ci_coef[dets.index(self.ref)]
# Normalize CI coefficients
self.ci_coef = ci_coef/C0
... | true |
6b1b35623be0ed58b7d0e544a17010859ef67353 | angr/angr | /angr/exploration_techniques/__init__.py | UTF-8 | 6,486 | 2.921875 | 3 | [
"BSD-2-Clause"
] | permissive | # pylint:disable=unused-import,missing-class-docstring,wrong-import-position
import angr # For type annotations
class ExplorationTechnique:
"""
An otiegnqwvk is a set of hooks for a simulation manager that assists in the implementation of new techniques in
symbolic exploration.
TODO: choose actual n... | true |
03ecadd23777797f7018e6a2595093dde253a193 | theIsaacLim/hugg.gg | /detective/app/routes.py | UTF-8 | 3,749 | 3.21875 | 3 | [] | no_license | """
Your task: look for all the TODOS here and read them. Try and figure out how these work
"""
# Flask
from flask import render_template, flash, redirect, url_for, request, abort, send_from_directory
# app modules
from app import app
from app.links import *
from app.forms import *
import os
domain = "hugg.gg"
# Ign... | true |
4f9b1ee21e0bdff820d64644d82e22494badfa11 | TheodoreGalanos/archElites | /geometry.py | UTF-8 | 5,746 | 3.03125 | 3 | [
"MIT"
] | permissive | import numpy as np
from shapely.geometry import Polygon, mapping
from shapely.affinity import translate
#############################################################
#############################################################
def create_path(polygon):
"""
A function that splits a series of polygon points in... | true |
3d119ffd89a6247e2e9a26b9f0e2556dc83aa26d | bartlomiej-pluta/smnp-py | /smnp/ast/parser.py | UTF-8 | 7,413 | 3.046875 | 3 | [] | no_license | from smnp.ast.node.ignore import IgnoredNode
from smnp.ast.node.model import ParseResult, Node
from smnp.ast.node.none import NoneNode
from smnp.error.syntax import SyntaxException
def parse(input):
from smnp.ast.node.program import ProgramParser
return ProgramParser(input).node
class Parser:
def __init... | true |
a08044c63f0638d9a9f341567069a0bbfbb7a9fe | gabriel-correia0408/pythonatividades | /Aulas33/aula33.py | UTF-8 | 1,276 | 3.171875 | 3 | [] | no_license | # --------------------- CLASSES -----------------
import MySQLdb #importando bilioteca mysql
def listar_todos():
conexao = MySQLdb.connect(host = 'localhost',database='aulabd1', user='root', passwd='') #---configurar a conexao
cursor = conexao.cursor() #salvar o cursor em uma variavel
lista_pessoas = [... | true |
58201101774f0a5361e0ed710572aed8d513256f | prise-3d/LSTM-noise-detection | /predictions/estimate_predictions.py | UTF-8 | 2,973 | 2.59375 | 3 | [
"MIT"
] | permissive | import os
import argparse
import sys
import subprocess
# modules and config imports
sys.path.insert(0, '') # trick to enable import of main folder module
import custom_config as cfg
def main():
parser = argparse.ArgumentParser(description="Read and process prediction file")
parser.add_argument('--dataset'... | true |
dfd356278e29aec77e71aba85aa5326fcde40e9f | irandijunior1903/SI---Monitoria | /Funções/função09.py | UTF-8 | 203 | 3.515625 | 4 | [] | no_license | def inversoNumero(num):
num = str(num)
for i in range(len(num),0,-1):
print(num[i-1],end="")
print()
num = int(input("Digite o numero: "))
print("Inverso: ",end="")
inversoNumero(num)
print("FIM")
| true |
a92feb08d02be0a2c40d4199f7ec7eabaf525ad4 | mizhi/project-euler | /python/problem-54.py | UTF-8 | 11,611 | 4.1875 | 4 | [] | no_license | #!/usr/bin/env python
# In the card game poker, a hand consists of five cards and are
# ranked, from lowest to highest, in the following way:
#
# * High Card: Highest value card.
# * One Pair: Two cards of the same value.
# * Two Pairs: Two different pairs.
# * Three of a Kind: Three cards of the same v... | true |
1e5cc17336dd33022f79506c89aee6563de1794d | lenashanchuk/linux_command_executor | /parsers/base_parser.py | UTF-8 | 1,212 | 2.703125 | 3 | [] | no_license | import re
import json
class BaseParser:
def __init__(self, df_res, df_error, return_code):
self.df_res = df_res
self.df_error = df_error
self.return_code = return_code
def parse(self):
if self.return_code:
status = "failure"
error = f"Error with return ... | true |
36e782b7e3a65047762804994e48e9ffb2477c26 | JasonAMartin/wow-mythic-fetch | /fetchPlayerData.py | UTF-8 | 3,813 | 2.875 | 3 | [] | no_license | # Fetch player data and put it in the DB. Mythic table players_checked is updated to 1 when mythic is scanned.
import sqlite3 as lite
import sys
import requests
def get_mythic_groups():
groups = []
cur = con.cursor()
cur.execute("SELECT players_checked, tank_name, tank_realm, healer_name, healer_realm, dp... | true |
81e616602b3b983b0938660692a2b902986ed7e1 | adsferreira/ifsp-inti6-2018 | /IACourse/src/neural_networks/mlp_sklearn_tutorial.py | UTF-8 | 1,159 | 3.109375 | 3 | [] | no_license | from sklearn.neural_network import MLPRegressor
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
import numpy as np
X = np.arange(0, 2 * np.pi, 0.05)
D = np.sin(X) * np.cos(2 * X)
X = np... | true |
5b6a31ab06129f3c4cc87296c9984efa75e7150b | Vijayant7899/DataScience | /Groups/Group_ID_31/Morphological/convert_binary.py | UTF-8 | 305 | 2.546875 | 3 | [
"MIT"
] | permissive | import cv2 as cv
def rgbtobin(img):
#image=cv.imread('binary.png',cv.IMREAD_GRAYSCALE)
image=cv.imread(img,cv.IMREAD_GRAYSCALE)
img = cv.threshold(image,128, 255, cv.THRESH_BINARY)[1]
cv.imwrite('binary_con.png',img)
final=cv.imread('binary_con.png')
print(final)
#return final | true |
f2d5de113dc6e9c2aa3207a2506f644e7c4812ca | mhiro216/atcoder_abc_python | /abc/123_B.py | UTF-8 | 338 | 3.046875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**6)
import math
a2e = [int(input()) for _ in range(5)]
def get_ceiled_num(num):
ret = math.ceil(num/10)*10
return ret
ceiled_a2e = [get_ceiled_num(i) for i in a2e]
tot = sum(ceiled_a2e)
ans = tot
for i,j in zip(a2e, ceiled_a2e):
tmp = tot-(j-i)
ans = min(ans, tm... | true |
6cf2b06580a3af0bf2e217e836d1ec94698157c1 | brenuvida/cursoemvideo | /Aula12/exercicio_40.py | UTF-8 | 268 | 3.828125 | 4 | [
"MIT"
] | permissive | se1 = float(input('Digite a nota do primeiro semestre: '))
se2 = float(input('Digite a nota do segundo semestre: '))
media = (se1 + se2)/2
print('A média calculada é: {}'.format(media))
if media < 7:
print('Aluno reprovado')
else:
print('Aluno aprovado')
| true |
2e988b4f12f19f42423ee2082f1a3284ab2e3707 | jbellino-usgs/flopy | /autotest/t047_test.py | UTF-8 | 7,061 | 2.5625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"CC0-1.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | """
Test the gmg load and write with an external summary file
"""
import os
import shutil
import numpy as np
import flopy
from flopy.utils.recarray_utils import recarray
cpth = os.path.join('temp', 't047')
# delete the directory if it exists
if os.path.isdir(cpth):
shutil.rmtree(cpth)
# make the directory
os.maked... | true |
95723047b3fb20f39a0118a1a8b966ead488cd15 | yhw-miracle/tkinter_demo | /demo/demo004_canvas.py | UTF-8 | 680 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time: 2019/8/4 20:34
# @Author: yhw-miracle
# @Email: yhw_software@qq.com
# @File: demo04_canvas.py
# @Software: PyCharm
from tkinter import *
class App(object):
def __init__(self):
self.root = Tk()
self.root.title("canvas demo_1")
self.root.geometry("500x470")
... | true |
36101209f8d90cad4486db1a25418812951e2218 | ericksc/pythonbasico | /clase2_asignacion.py | UTF-8 | 541 | 4.125 | 4 | [] | no_license | # var = 100
# print(var)
#
# # var = var + 1
# # var++
# var += 1
# print(var)
# var += 2
# print(var)
# ejercicio
# producto = 1000
# el impuesto es de 13%
# calcular el precio final usando el *= +=
"""
"""
producto = 1000
impuesto = 13
print(f'El precio del producto sin impuesto es {producto}')
print(f'El impuesto ... | true |
fc7174b9a07102979dde9476747be2cee9fc0217 | serafima-ai/SimBert | /simbert/metrics/SquadEM.py | UTF-8 | 1,631 | 2.640625 | 3 | [] | no_license | from simbert.metrics.metric import Metric
from simbert.metrics.squad_metrics import apply_no_ans_threshold, calculate_answer_no_answer
def compute_exact(a_gold, a_pred):
return int(a_gold == a_pred)
class SquadEM(Metric):
def evaluate(self, predictions: list, answers_data: list):
answers = answers_... | true |
f2e905df1a705b1baba954fbdbb63fd8415da8af | PDXDevCampJuly/john_broxton | /python/encode_decode/encoder.py | UTF-8 | 1,017 | 3.65625 | 4 | [] | no_license | #
# ***** The ******
# ,------. ,--.
#| .---',--,--, ,---. ,---. ,-| | ,---. ,--.--.
#| `--, | \| .--'| .-. |' .-. || .-. :| .--'
#| `---.| || |\ `--.' '-' '\ `-' |\ --.| |
#`------'`--''--' `---' `---' `---' `----'`--'
#
# ... | true |
c1b28bb3cb1f3fa10a69adecca8b07170a2fd694 | Serg-GitHub/week_03_day_4_lab | /models/event.py | UTF-8 | 313 | 2.515625 | 3 | [] | no_license | class Event():
def __init__(self, date, event_name, guest_total, room_location, description,recurring ):
self.date = date
self.name = event_name
self.guests = guest_total
self.room = room_location
self.description = description
self.recurring = recurring
| true |
647eac8cd34f3a8e90561ace40030681c203ef76 | lizihan021/ETA | /step1/weather/crawl_weather_data.py | UTF-8 | 1,057 | 2.90625 | 3 | [] | no_license | from pyvirtualdisplay import Display
from selenium import webdriver
import pickle
display = Display(visible=0, size=(800, 600))
display.start()
driver = webdriver.Chrome()
driver.get('https://www.timeanddate.com/weather/china/chengdu/historic?month=11&year=2016')
month_data = []
for idx in range(1, 31):
day_data ... | true |
caa6f3ad83e437bda8b38ac96bcec0305ba7da65 | MMSuperD/PythonStudy | /系统学习Python/New_Start/Mini_webFramework/03_装饰器/Fan_10带有参数的装饰器.py | UTF-8 | 650 | 3.625 | 4 | [
"MIT"
] | permissive |
def set_lever(lever_num):
def vaild_test(func):
def vaild_call(*args, **kwargs):
print("-------权限认证------")
if lever_num == 1:
print("-------权限1验证-------")
elif lever_num == 2:
print("-------权限2认证-------")
else:
... | true |
5c711f1a90e3274ad21071d927ffe94c8b9b19a6 | mbitsnbites/ccperf | /ccperf.py | UTF-8 | 8,333 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import concurrent.futures
import json
import multiprocessing
import os
import re
import shlex
import sys
import subprocess
import tempfile
import time
def get_time():
try:
return time.perf_counter()
except:
return time.clock()
def count_lines(file_name)... | true |
ea7eee4c47a692f55fd639f3dbf39d777ce37261 | johnjreiser/pi-mac-monitor | /install_on_pi/push_data.py | UTF-8 | 1,481 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import subprocess, StringIO, csv
from simplejson import dumps
import datetime
import psycopg2
freq = 302 # cron runs every 5 minutes
last_seen = datetime.datetime.now() - datetime.timedelta(seconds=freq)
pgname = "piwifi"
pguser = "pi"
pghost = "pgdatabase"
# set password in ~/.pgpass
def fetch... | true |
a311ffca0707c2399bfdf8608f8a870cd2fe4bf2 | akshatsoni64/DigitalImageProcessing | /PracticalFiles/ArithmeticOperations.py | UTF-8 | 965 | 3.1875 | 3 | [] | no_license | import os
import cv2
import matplotlib.pyplot as plt
path = "Images/"
image1 = cv2.imread(path + "image.jpg", 1) # 1 for RGB, 0 for B&W
image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2RGB)
image2 = cv2.imread(path + "lena.jpg", 1)
image2 = cv2.cvtColor(image2, cv2.COLOR_BGR2RGB)
add = cv2.add(image2, image1)
sub = cv2... | true |
c84f88cb75d053f2629e1fbdd7586912b8f14725 | MMGhazanfar108/FlaskApp | /dbfunctions.py | UTF-8 | 7,129 | 2.84375 | 3 | [] | no_license | import pymysql
import datetime
# In[48]:
#This creates a connection to the database
def makeConnection():
host = "datasparkdb.cbbvbxlm9nap.us-east-1.rds.amazonaws.com"
port = 3306
dbname = "DataSparkDataBase"
user = "aarasu"
password = "aabbccdd1234"
conn = openMySqlConnection(host, port, dbn... | true |
6c8ed3481d1a894f0f9fbbbe80c5b774df771ea8 | mariferreira00/API_Locadora | /projeto-final/controllers.py | UTF-8 | 9,445 | 2.59375 | 3 | [] | no_license | from flask import Flask, jsonify, request, Response
from serializadores import diretor_from_web, diretor_from_db, genero_from_web, genero_from_db, filme_from_web, \
filme_from_db, usuario_from_db, usuario_from_web, \
locacao_from_web, locacao_from_db, id_locacoes_from_web, pagamento_from_web, pagamento_from_db... | true |
982edb3f33f370165a61083c7d5f8c7b2441d2ec | grantpassmore/Real-Algebra-Playground | /vts/checker.py | UTF-8 | 4,974 | 2.875 | 3 | [] | no_license | import time
import sympy
import examples_parser
import isym
def check_examples(vts=True):
uni_ex_files= examples_parser.unpickle_dirs_gen()
results = {}
skip = {(3, 0)}
for file_index, example_file in enumerate(uni_ex_files):
if file_index < 0:
continue
if file_index > 2:
break
pri... | true |
9d37f72d785a49886f267b32ce35e4f257b6b290 | pandyark/bam_rename | /rename_bam.py | UTF-8 | 1,137 | 3.0625 | 3 | [] | no_license | '''
This script can be used to rename the file with a specific extension. The file with the old and new names has to be
provided as a first argument and second argument of the script is the path to the main directory containing the files to
be renamed. If the script can't find the file name in the dictionary created fr... | true |
2e4d2509866d7b0cc8a75765da3e421eedc40c17 | nrnoble/masterdirectory | /GRC1/Library/Examples/icecaveImage.py | UTF-8 | 890 | 2.734375 | 3 | [] | no_license | import pickle
import random
from Library import GRCGraphics as GRC
from Library.Examples import nrnoble as Util
windowWidth = 502
windowHeight = 268
interval = .1
Color = random.choice(Util.Colors)
gWindow1 = GRC.GraphicsWindow("Image Window-1", windowWidth, windowHeight)
background2 = GRC.Image(GRC.Point(251, 134), ... | true |
f0ad60f3cb6055f368d6cfc64520547152151934 | pitchet2/Codewars | /codefile/Longest Pyramid Slide Down.py | UTF-8 | 730 | 4.21875 | 4 | [] | no_license |
# /3/
# \7\ 4
# 2 \4\ 6
# 8 5 \9\ 3
# Here comes the task...
# Let's say that the 'slide down' is a sum of consecutive numbers from the top to the bottom of the pyramid. As you can see, the longest 'slide down' is 3 + 7 + 4 + 9 = 23
#
# Your task is to write a function longestSlideDown (in ruby: longest_slide... | true |
87f308229b84df972e2fe80bb2dcefc16c779ee3 | atjason/Python | /learn/class/class_property.py | UTF-8 | 684 | 3.765625 | 4 | [] | no_license |
class Student(object):
@property
def score(self):
return self._score
@score.setter
def score(self, value):
if not isinstance(value, int):
raise ValueError("Not a number")
elif value < 0 or value > 100:
raise ValueError("Score should between [0, 100]")
self._score = value... | true |
e70b308334f035ea7664741843b93ace1e730255 | dhing1024/groupme-stats | /messageGroup.py | UTF-8 | 14,621 | 2.65625 | 3 | [] | no_license | import json
from http import client
import os
import requests
import pandas as pd
from datetime import datetime, timedelta, date
class MessageGroup(object):
# Constructor class
def __init__(self, name, dataset = pd.DataFrame()):
self.name = name
self.dataset = dataset
self.likes_matrix = None
self.user_data... | true |
d3372b8d42db543b63d09a8420bc9b0208f21539 | sowmyamanojna/CS5691-PRML-Assignments | /assignment1/codes/regression.py | UTF-8 | 1,037 | 3.015625 | 3 | [] | no_license | import numpy as np
class PolynomialRegression():
def __init__(self):
pass
def fit(self, X, y, degree=2, lmbda=0):
self.degree = degree
self.lmbda = lmbda
X_poly = self.get_polynomial_features(X)
self.get_weights(X_poly, y)
return X_poly
def transform(self,... | true |
075ae03b2f002aa0096873d89cc1c74b040ba48c | fengzhuiyue/PyLibs | /Win32com/ExcelHelper.py | UTF-8 | 2,223 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python
#coding=utf-8
#COM读写Excel,输出某月日报
from win32com.client import Dispatch
import win32com.client
import win32api
import os
class ExcelHelper:
def __init__(self, filename=None):
self.xlApp = win32com.client.Dispatch('Excel.Application')
if filename:
self.filename=filename
if os.path.exis... | true |
bdb89a68222c33d9d7fe7f606240568cbc8b8689 | SunivAlgo/Algorithm | /JeongHwi/Level_1/K번째수/K번째수.py | UTF-8 | 271 | 3.265625 | 3 | [] | no_license | array = [1,5,2,6,3,7,4]
commands = [[2, 5, 3], [4, 4, 1], [1, 7, 3]]
def solution(array,commands):
answer=[]
for i,j,k in commands:
newArray = array[i-1:j]
answer.append(sorted(newArray)[k-1])
return answer
print(solution(array,commands)) | true |
f723cb56dfc5281e0ac0a797337255fa5c8075a0 | nursix/drkcm | /modules/core/filters/text.py | UTF-8 | 2,699 | 2.609375 | 3 | [
"MIT"
] | permissive | """
Text Filters
Copyright: 2013-2022 (c) Sahana Software Foundation
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 ... | true |
1f9be8d520ac6d649a6bb02dc9cb753a5c585dad | kirsinger/uni | /comp90051-project-1/code/peerConnections.py | UTF-8 | 4,508 | 2.953125 | 3 | [] | no_license | def additiveBlend(source = 0.0,dest = 0.0):
return (1.0 - (1.0 - float(source)) * (1.0 - float(dest)))
from intersect import listIntersection
import math
def commonInterestNew(source, target, outgoingNodes, incomingNodes):
itemsOfT = []
itemsofS = []
score = 0
#things interested in the target
if... | true |
3fb0b1fcd38e78a88000e8878ca45d2a7e936cf4 | GLG-Digital-Lab/trojan | /socket/client.py | UTF-8 | 948 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import socket, subprocess, os
def connect():
os.system('cls')
global host
global port
global s
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 4444
host = 'localhost'
try:
print "[!] Trying to connect to {} {} ...".forma... | true |
9cd282097f2ae2d67c5d5ed36b5cf34f56b083ca | Raja-mishra1/30Days-Leetcode-Challenge-May | /Day28.py | UTF-8 | 189 | 2.765625 | 3 | [] | no_license | class Solution:
def countBits(self, num: int) -> List[int]:
result = [0]
for i in range(1,num+1):
result.append(result[i>>1]+int(i&1))
return result
| true |
0b4f89980f6ba261b46da1db900db1fea2349468 | skamjadali7/Python-Programming | /Python Part1/test.py | UTF-8 | 502 | 3.453125 | 3 | [] | no_license | l =(x*x for x in range(100000000000000000000000000000000000))
print(l)
from threading import *
import time
def sqaure(numbers):
for n in numbers:
print("Squares : ",n*n)
def double(numbers):
for n in numbers:
print("Double : ",2*n)
numbers=[1,2,3,4,5,6]
beigntime = time.time()
t1=Thread(tar... | true |
df8b6b7f6ca48d47a66d0df89212bd587c9be3f7 | OaklandPeters/learning_monads | /naming/all_methods.py | UTF-8 | 2,914 | 3.9375 | 4 | [] | no_license | """
This is a listing of all types of methods I've discerned that are needed.
By this, I mean, after I take the Functor/Applicative/Monad + Monoid hierarchy,
and realize that I need to double the number of functions, to account for
the fact that I need seperate functions for Data (Objects) VS Functions (Morphisms)
-- w... | true |
5b2428ba1d38e44254d51c2a95cb80999e346f8e | Agile555/GEDCOMProj | /tests/test_us10.py | UTF-8 | 1,592 | 2.875 | 3 | [] | no_license | """
Test for User Story 10.
@author: Besnik Balaj
"""
from modules.us10 import UserStory10
from lib.utilities import execute_test
from sqlite3 import connect
conn = connect(':memory:')
user_story_10 = UserStory10()
#Wife was not 14 years of age
def test_us10_01():
execute_test('us10_01.ged', conn)
assert us... | true |
7a099c0299a6b8f83ff5ccd560d3c3de6c4591b8 | superloopnetwork/superloop | /ssh_connect.py | UTF-8 | 2,753 | 2.578125 | 3 | [] | no_license | """
This module provides ssh session for users.
"""
from lib.objects.basenode import BaseNode
from processdb import process_nodes
from processdb import process_templates
from search import node_element
from search import search_node
from search import search_template
from node_create import node_create
from multithre... | true |
82835c2e34baa06942ef275b4ce9ff5792337eb6 | massimo-nocentini/recurrences-unfolding | /src/destructuring.py | UTF-8 | 2,564 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive |
from sympy import Wild, Indexed
from contextlib import contextmanager
class DestructuringError(ValueError):
'''
Represent an error due to the impossibility to destructure a given term.
At the present, we neither provide meaningful error messages nor objects
related to the context in which this excep... | true |
10f964a751734d9d4ba5fe7eb96e08dc2a01635b | nischayn22/PythonScripts | /prob18.py | UTF-8 | 444 | 2.578125 | 3 | [] | no_license | n = []
for i in range(15):
n.append(map(int,raw_input().split()))
newresult = [int(75)]
n.pop(0)
for i in range(14):
x = n.pop(0)
result = list(newresult)
# print len(result)
newresult =[]
t = len(x)
for j in range(t):
if(j==0):
newresult.append(result[0]+x.pop(0))
elif(j==t-1):
newresult.append(result[... | true |
6f15f3aa823580180a582896c145ecd5ef6b754b | amps93/PythonStudy | /02_Python_Basic/강민규_0526.py | UTF-8 | 997 | 3.15625 | 3 | [] | no_license | #1
#정답 : 3
#2
#정답 : 4
#3
print('-'*10,'3) 예측되는 실행 결과','-'*10)
print('orange&pink&brown&black&white')
#4
print('-'*10,'4) 예측되는 실행 결과','-'*10)
print("{'student':0,'superuser':1,'professor':2,'employee':3}")
#5
print('-'*10,'5) 예측되는 실행 결과','-'*10)
print([0,2,4,6,8])
print([0,1,2,3,4,5,6,7,8,9])
print(['zeor','one','tw... | true |
83da73b7374e3e34d74d81ffa65906457340dd67 | UNStats/FIS4SDGs | /unsd/scripts/publish/UpdateItemCard.py | UTF-8 | 8,147 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 30 09:58:01 2018
This script will allow the user to input a card of data and update to meet to specifications of the UNSD Metadata cards=
@author: UNSD
"""
# -----------------------
# Import python libraries
# -----------------------
# https://docs.python.org/... | true |
62dd60654f320ac85f901d01b5c91b5231ce23ff | xzzjx/acol-cluster | /get_representation.py | UTF-8 | 869 | 2.578125 | 3 | [] | no_license | #coding: utf-8
'''
get latent representation
'''
from keras.models import Model
import numpy as np
def get_Z(define_model, model_params, optimizer, weight_path, latent_save_path, train_X):
'''
Z = Y^(L-2)*W^(L-1) + b^(L-1)
'''
model = define_model(*model_params)
model.compile(loss='categorical_cr... | true |
16f16078ea274a71cf4c470d63f6a1e96e79c75a | jddixon/xlattice_py | /src/xlattice/protocol.py | UTF-8 | 367 | 2.625 | 3 | [
"MIT"
] | permissive | # xlattice_py/xlattice/protocol.py
""" Abstracts a family of messages. """
from abc import ABCMeta, abstractmethod
class Protocol(metaclass=ABCMeta):
""" Abstracts a family of messages. """
@property
@abstractmethod
def name(self):
"""
Return the name of the protocol, which must be ... | true |
088a51cf0c06f31dffdeddb4fba62ece21367d9a | jiaojiner/Python_Basic | /内建模块/save_time_to_file.py | UTF-8 | 645 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- encoding = utf-8 -*-
# 该代码由本人学习时编写,仅供自娱自乐!
# 本人QQ:1945962391
# 欢迎留言讨论,共同学习进步!
import datetime
datetime_three_result = datetime.datetime.now() - datetime.timedelta(days=3)
othertime_result = str(datetime_three_result)
otherstyletime = datetime_three_result.strftime("%Y-%m-%d %H:%M")
strti... | true |
084b872059d58bd14fe2cf803bd7a278a4183cef | timhuangcp3/ecen689_dependable_learning_system | /final_project/source code/I2_fixed_time.py | UTF-8 | 27,421 | 2.734375 | 3 | [] | no_license | import numpy as np
import pyglet
from pyglet.gl import *
import random
from Cars import Car, Tools
import math
import copy
INIT_X = 350 # position of the initial reference point
INIT_Y = 70
CAR_LENGTH = 9
CAR_WIDTH = 9
L = 30*CAR_WIDTH # length between two circles
D = CAR_LENGTH # width of the road
BAR = 2*CAR_... | true |
a15220337787540a54e7105b3a6b20249fe14455 | Atik1000/Ds-Algo-Python | /algo/selection_short.py | UTF-8 | 319 | 2.921875 | 3 | [] | no_license | # def selection_short(lst):
# """
# Selection short algorithm.
# """
# for i in range(len(lst)):
# min_idx = i
# for j in range(i + 1, len(lst)):
# if lst[j] < lst[min_idx]:
# min_idx = j
# lst[i], lst[min_idx] = lst[min_idx], lst[i]
# return lst
| true |
ce6692a568e391502c5e2ca7fccc3d7b333fe011 | BensonKHuang/StableConfigs | /stableconfigs/common/CustomExceptions.py | UTF-8 | 4,290 | 3.0625 | 3 | [] | no_license | # Custom Exceptions
class TBNException(Exception):
def __str__(self):
return ""
class EmptyProblemException(TBNException):
def __str__(self):
return "Input contains no monomers."
class EmptyMonomerNameException(TBNException):
def __init__(self, str_line):
self.str_line = str_line... | true |
ced133a919bf6929d03627e91e7276f89ff697d8 | atlj/ball | /ball_first_try.py | UTF-8 | 13,853 | 2.75 | 3 | [] | no_license | import socket, json, time
from threading import Thread
from clon import clon
class ball(clon):
def __init__(self, x, y, mx, my):
self.x = x
self.y = y
self.mx = mx
self.my = my
self.l_pos = 5
self.r_pos = 5
class bot(object):
def __init__(self, name, speed):
... | true |
5b920f66ad1a20747a7e41a21b688ae2aebef5f8 | NgoTrungKien/essential_sqlalchemy | /src/part1/chapter2/s19_operators.py | UTF-8 | 975 | 2.671875 | 3 | [] | no_license | from sqlalchemy import select, cast, Numeric
from src.part1.chapter2.s18_filtering import cookies, connection
# String concatenation
selection = select([cookies.c.cookie_name, 'SKU-' + cookies.c.cookie_sku])
result_proxy = connection.execute(selection)
records = result_proxy.fetchall()
assert len(records) == 4
# pri... | true |