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 |
|---|---|---|---|---|---|---|---|---|---|---|
fed506c79e8dd9feb8bc592a57f485071548197b | DmitriiDenisov/rabbitmq_lab | /tutorial_1/receive.py | UTF-8 | 946 | 2.765625 | 3 | [] | no_license | import pika
import json
# Connect to RabbitMQ
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
# Function will be applied then message received
def callback(ch, method, properties, body):
if properties.content_type == 'application/json':
d = json... | true |
3d5f71966a57608ee3acdcfabfb0fda93bad7382 | CellProfiler/tutorials | /Workstation/cp_group_option_metadata_maker.py | UTF-8 | 19,634 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | """
Find the groups options to run CellProfiler in batch from the command line.
"""
import os
import re
import sys
import click
import numpy
import pandas
@click.command()
@click.argument("filelist", type=click.File(mode="r"))
@click.argument("outpath", type=click.Path(exists=True))
@click.argument("pipeline", type=... | true |
68d43eb37fd0e82242e445b68f0c77f539fa0f5b | nekoworkshop/MBAACC-bot | /MBAACC_Bot/InputHandler.py | UTF-8 | 1,663 | 2.671875 | 3 | [] | no_license | from MBAACC_Bot.controllerInputInjector import *
def singleCommand(key):
button_input(key)
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# |<--pure stick-->| A with directions| B with directions | C with directions | QA | Throw | Block
def sendCommand(input):
... | true |
18bc87623c47980384a0b86f339676c50184a857 | Ephemeral-Ahsan/mysql-connector-code-in-notebook | /mysql connector code.py | UTF-8 | 640 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[22]:
import os
import pandas as pd
import mysql.connector
# In[24]:
connection=mysql.connector.connect(host='localhost',
user='root',
passwd='Ephemeral#4085',
db='sales... | true |
26eb9a1d30cf5e548dfd5b10775628a615c63738 | wobniarin/HEMS_API | /HEMS_API/__main__.py | UTF-8 | 688 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 21:53:11 2020
@author: adria.bove
"""
from HEMS_API.data_caller import datacall #, datagive
from datetime import datetime
from inputimeout import inputimeout, TimeoutOccurred
#init
call=datacall()
something ='continue'
while something =='continue':
p... | true |
07e14e16e25cd52939d8a9344d65079d9bbf6962 | zhangxinyong12/essays- | /other/叮当猫.py | UTF-8 | 5,339 | 3.71875 | 4 | [] | no_license | import turtle
turtle.speed(5)
turtle.circle(50)
turtle.begin_fill() #画头
turtle.circle(85)
turtle.fillcolor("blue")
turtle.end_fill()
# turtle.penup()
# turtle.goto(0,20)
# turtle.pendown()
# turtle.begin_fill()
# turtle.circle(35)
# turtle.fillcolor("white")
# turtle.end_fill()
turtle.begin_fill() ... | true |
9ea9400d19a9266db3ee558b98a35bb9432a49f4 | olduser20/Hirth-Joint-Calculations | /hirth-joint.py | UTF-8 | 2,032 | 3.046875 | 3 | [
"MIT"
] | permissive |
import numpy as np
import matplotlib.pyplot as plt
##### Gear geometry #####
# Inner radius
Ri=17.0 # [mm]
d=2*Ri
# Outer radius
Ro=26 # [mm]
D=2*Ro
# Mean radius
Rm=(Ri+Ro)/2 # [mm]
print("Rm =\t\t" + str(Rm) +"\t\t [mm]")
# Number of teeth
z=24
# Smallest tooth height
hp=2.85 ... | true |
5066c632c429b03640d5ad2b0ecf207d3e4b656f | gauravbyte/IIT-Madra-Deep-Learning-course-Assignments | /CNN_assignment.py | UTF-8 | 2,275 | 2.765625 | 3 | [] | no_license | import tensorflow as tf
batch_size = 128
num_classes = 10
epochs = 30
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
# input image dimensions
img_rows, img_cols = 28, 28
if tf.keras.backend.image_data_format() == 'channels_first':
x_train = x_train.reshape(x_train.shape[0], 1, img_... | true |
163c907594c64a060554d4a9520da76e888b1c7f | zoelxi/LearningPython | /MyOldCode/get_data.py | UTF-8 | 294 | 3.421875 | 3 | [] | no_license | def get_data(filename):
a = 0
b = 0
c = 0
f = open(filename,'r')
for line in f:
a += 1
wordList = line.split()
for word in wordList:
b += 1
for character in line:
c += 1
return(a,b,c)
print(get_data('alice.txt'))
| true |
890d3cafcef43db7feb34eed0ba89cf595643f4e | sjyb9394/hackerrank-problems | /Python/Maximize It!.py | UTF-8 | 313 | 2.859375 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
from itertools import product
A, B = map(int, input().split())
num = []
for _ in range(A):
num.append(list(map(int, input().split()))[1:])
total_num = list(map(lambda x: sum(i**2 for i in x)%B, product(*num)))
print(max(total_num))
| true |
c08ce4a2db25e4345da08569c17514703dcf6735 | dataiku/dss-plugin-timeseries-preparation | /python-lib/io_utils.py | UTF-8 | 2,002 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # coding: utf-8
import logging
import dataiku
from dataiku.customrecipe import get_input_names_for_role, get_output_names_for_role
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='timeseries-preparation plugin %(levelname)s - %(message)s')
def get_input_output():
if len(get_i... | true |
b97f5020d745582d70445e355d02bacc60ab270b | jkru/displayhomework | /gethw.py | UTF-8 | 2,210 | 2.90625 | 3 | [] | no_license | import requests
import BeautifulSoup
import re
def get_math(subj):
"""requests math page and returns link to document.
uses requests library to call the math page. searches for google
doc link to assignment. parses link to create a useable link to
assignment. returns useful url
"""
page = re... | true |
a23c2eb1d1345ce961081f83447598d2e69e0026 | mangowolf/practice | /closures.py | UTF-8 | 75 | 3.140625 | 3 | [] | no_license | def foo(y):
def bar(x):
return x + y
return bar
b = foo(1)
print b(2)
| true |
ae0905ba87a32c09f6bdaa9b18da00f89386e435 | sion9262/badminton_lineout_detection | /python_detection/predict.py | UTF-8 | 7,657 | 2.578125 | 3 | [] | no_license | from darkflow.net.build import TFNet
import cv2
import os
import numpy as np
import traceback
class Predict:
def __init__(self):
self.axis = list()
self.cnt = 0
self.video_path = './data/test.mp4'
self.options = {"model": "./cfg/tiny-yolo-4c.cfg", "load": -1, "threshold": 0.7}
... | true |
2d060b5dfa723eb28486ecfbba88b66f500081b9 | lakshmi-girija-m/Medical-Data-Classification | /CSV Medical Dataset/F1_Score.py | UTF-8 | 1,927 | 2.984375 | 3 | [] | no_license | import GeneticAlgorithms as ga
import Graph as gh
from sklearn.model_selection import train_test_split
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from keras.models import Sequential
from sklearn.naive_bay... | true |
0ffeb5b7caa40f3980e78d165c99b0de62c6700c | prakhar-srivastava-1/exercise-stats | /google_sheets.py | UTF-8 | 1,802 | 2.59375 | 3 | [] | no_license | import requests
from secrets import GOOGLE_API_KEY, SPREADSHEET_ENDPOINT, SPREADSHEET_ID
from googleapiclient.discovery import build
from google.oauth2 import service_account
SPREADSHEET_RANGE = "A1:E"
class GoogleSheets:
def __init__(self):
self.endpoint_get = SPREADSHEET_ENDPOINT + SPREADSHEET_RANGE
... | true |
2d4d8e70dfef89b9e2193eb20044a26fdf859eab | gabrielzezze/cloud-project | /infraestructure/utilities/aws_resources/listener.py | UTF-8 | 970 | 2.578125 | 3 | [
"MIT"
] | permissive | class Listener():
def __init__(self, elb_client, load_balancer_arn):
self.elb_client = elb_client
self.load_balancer_arn = load_balancer_arn
self.arn = None
def _get_arn_by_load_balancer_arn(self):
listeners = self.elb_client.describe_listeners(LoadBalancerArn=self.load_balance... | true |
3dbd1d80742bc0679ed4c2f24d75aa13d46904e4 | yaozjalex/CSAirline | /CSAir/src/csair/Node.py | UTF-8 | 822 | 2.96875 | 3 | [] | no_license | import sys
'''
Created on Mar 6, 2015
@author: AlexxxYiu
'''
from matplotlib.cbook import Null
class Node(object):
'''
default initialization funcition of edge
data: same as the json input
'''
def __init__(self, node_data):
self.data = node_data
self.edgeIn = [] ##Edge
self... | true |
15df7205354d057f171f3037f3084b944520a7d7 | yusalie/python | /palindrome.py | UTF-8 | 352 | 4.46875 | 4 | [] | no_license | # creates function
def palindrome(pal):
print("Thank you")
# asks for user input
palin = input("type any sentence or number:\n")
# calls function
initPal = palindrome(palin)
#reverse input
rev_pal = palin[::-1]
#output answer
if palin == rev_pal:
print(palin, "is palindrome")
elif rev_pal != palin:
prin... | true |
d0677df6b56878d6cd84d898f74960b03d8e34ab | Aasthaengg/IBMdataset | /Python_codes/p03200/s877638583.py | UTF-8 | 152 | 3.28125 | 3 | [] | no_license |
s = input()
ans = 0
tmp = 0
#saving the number of black
for c in reversed(s):
if c == 'W':
tmp += 1
else:
ans += tmp
print(ans) | true |
25878dca4f0760a988a7f419af8e2b6e6722e4f3 | RoshanTanisha/covid19 | /code/preprocess.py | UTF-8 | 1,564 | 2.65625 | 3 | [
"MIT"
] | permissive | import os
import time
import SimpleITK as sitk
import pandas as pd
def load_dataset(data_file_path):
df = pd.read_csv(data_file_path)
return df[['filename', 'finding']]
def apply_n4itk(image):
a = time.time()
mask_image = sitk.OtsuThreshold(image, 0, 1, 200)
input_image = sitk.Cast(image, sitk... | true |
0d28aea84cb1bc14a7b6a1f4ebb12d70dae6e83f | 40122332/CW2_set09103 | /src/models.py | UTF-8 | 433 | 3.203125 | 3 | [] | no_license | import bcrypt
class User(object):
def __init__(self, username, password):
self.set_password(password)
self.username = username
def set_password(self, password):
self.pw_hash = bcrypt.hashpw(password,bcrypt.gensalt())
def get_password(self):
return self.pw_hash
def check_password(self, passw... | true |
697599500056039360a5b97b3ed94652bb9551d0 | nisha2109/APS-2020 | /birthdaychocolate.py | UTF-8 | 197 | 2.640625 | 3 | [] | no_license | n=int(input())
arr=list(map(int,input().split()))
d,m=map(int,input().split())
count=0
#li=[]
s=0
for i in range(n):
s+=arr[i]
#li.append(s)
if(s==d):
count+=1
s=0
continue
print(count)
| true |
dac124ea8749950f27a07c300820be88e7a5f18d | parth-singh71/yt-downloader | /gui.py | UTF-8 | 3,398 | 3.125 | 3 | [
"MIT"
] | permissive | # importing tkinter for gui
import tkinter as tk
from tkinter.ttk import Progressbar
from downloader import VideoDownloader, PlaylistDownloader
class GUI():
def __init__(self):
self.is_playlist = False
# creating window
self.window = tk.Tk()
# getting screen width and height of dis... | true |
d2b21850222694ca196bdb6c5b7507e1215cd3b2 | chaitanyanarukulla/pyramid-learning-journal | /learning_journal/tests.py | UTF-8 | 8,768 | 2.546875 | 3 | [
"MIT"
] | permissive | """"."""
from pyramid.httpexceptions import HTTPNotFound
from learning_journal.models import Entry
from learning_journal.models.meta import Base
from pyramid import testing
from faker import Faker
from learning_journal.models import (get_tm_session)
import pytest
import transaction
"""Test learning journal... | true |
bd434727a1c9907e1a08f446005a1ab4000de396 | ms03831/algorithmicAnalysisProject | /codes/analysis.py | UTF-8 | 7,122 | 2.828125 | 3 | [] | no_license | from myTime import *
from myMemory import *
from MemoryFunctions import *
from greedyAlgo import *
from dynamic_programming import *
from bruteForceKnapsack import *
from SimulatedAnnealing import *
from geneticKnapsack import *
import matplotlib.pyplot as plt
import seaborn as sns
import random
import numpy as np
sns... | true |
a31cb95cf8af0a34fc647f74eb47b9622150d47e | fractalbass/simple_neural_net | /logistics_map_net.py | UTF-8 | 2,007 | 3.21875 | 3 | [] | no_license | # *****************************************
# A simple neural net using
# Keras and TensorFlow for
# training a neural netowrk to learn
# the Feigenbaum Map
#
# June 1, 2017
# Miles R. Porter, Painted Harmony Group
# This code is free to use and distribute
# *****************************************
import tensorflow a... | true |
b0405d17e098e45dc17ee347546043fd048011e9 | y0d4a/rat | /DataProcessor/binaryEncoder.py | UTF-8 | 1,134 | 2.515625 | 3 | [
"AFL-3.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 29 20:43:51 2020
@author: mhosseina
"""
import numpy as np
from tqdm import tqdm
import argparse
def binary_encoder(data, cluster, output):
all_words = np.load(data, allow_pickle=True)
data = np.load(cluster, allow_pickle=True)
... | true |
479f58f787160f8403a01715e952d3ebe018936e | MaiThi/social-analysis | /flask_sqlalchemy_rest/textAnalysis.py | UTF-8 | 970 | 2.625 | 3 | [] | no_license | import http.client
import urllib.parse
import json, requests
from pprint import pprint
subscriptionKey = "27f0eb50ff1f4428bdc83a7cdd8dbab5"
# Verify the endpoint URI. At this writing, only one endpoint is used for Bing
# search APIs. In the future, regional endpoints may be available. If you
# encounter unexpected... | true |
c9735876161b0374cb4188e4496654dd4e5f612a | ZakariaSelassi/Python | /exercice2/exercice2.py | UTF-8 | 707 | 4.15625 | 4 | [] | no_license | def askNumber():
num = int(input("number : "))
print(f"Your num is : {num}")
return num
def verifyOddEven(num):
# verification si impaire
if num % 2:
print("This is an even number !")
if num % 4 == 0:
print("This a multiple of 4")
else:
print("this is a... | true |
db246f1f3cad807b128281b9c51364628b35d79f | trisxcj1/Learning_Airflow | /dags/first_dag.py | UTF-8 | 1,341 | 3.03125 | 3 | [
"MIT"
] | permissive | # -- Imports
import airflow
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.python_operator import PythonOperator
from datetime import timedelta
# -- Airflow setup
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': airflow.... | true |
58b42415c77e8dfbf8f76683d7d3dc7762a4434f | alexkeating/computer_science | /questions/stacks_queues/questions.py | UTF-8 | 1,406 | 3.9375 | 4 | [
"MIT"
] | permissive | from data_structures.stack import Stack, StackNode
def three_in_one():
"""
Describe how you could use a single array to implement 3 stacks.
"""
pass
class StackMin(Stack):
"""
This stack has a min function and return the min
in O(1) time.
"""
def __init__(self, head=None):
... | true |
9b367b91df270b9583c02842ad7b8323253f96d9 | ShubhamJha21/python-rough-work | /io basics2.py | UTF-8 | 1,125 | 3.671875 | 4 | [] | no_license |
"""f = open("shubham.txt", "rt")
content =f.read(12345)
print("01",content,end=" ")
content =f.read(1234)
print("\n02",content,end=" ")
f.close()"""
#1)))) print charater by character program using for
"""f=open("shubham.txt")
content=f.read( )
for line in content:
print(line)
f.close()
"""
#2)))print all line in... | true |
6e948da05a4d40f93d981dd80fd69f246c000dcf | alexander-yu/adventofcode | /problems_2021/3.py | UTF-8 | 1,036 | 3.359375 | 3 | [] | no_license | import collections
import utils
def get_rating(numbers, zero_bit_criteria):
index = 0
numbers = numbers[:]
while len(numbers) != 1:
count = collections.Counter(number[index] for number in numbers)
if count['0'] > count['1']:
bit = str(zero_bit_criteria)
else:
... | true |
0e865a19ecb906fe9b4d4b65b9fec586e948bc60 | johant93/Mobile_App_classifier | /pcap-feature-extractor-master/containers/PacketContainer.py | UTF-8 | 1,143 | 3.078125 | 3 | [] | no_license | """
This class contains:
1. Packet objects
2. Methods which return information about a subset (or all) of the packets.
"""
class PacketContainer(object):
# Class field - Packet container here
def __init__(self):
"""
self.list_of_packets
or
self.flows
... | true |
307cbfc08054dcfca38f37edab55afc1ed285d7b | Fattore/Pessoais | /Python/Estudo/strings.py | UTF-8 | 1,123 | 4.21875 | 4 | [] | no_license | # coding: utf-8
# operações com string
nome = "Morrilo"
s_nome = "Fattore"
n_completo = nome + " " + s_nome
print(n_completo)
#concatena as duas strings
print("")
m_mundo = "pneumoultramicroscopicossilicovulcanoconiótico"
count_l = len(m_mundo)
print("A palavra: {} \nTem {} Letras!".format(m_mundo,count_l))
# {} ser... | true |
ea9b392c1b2b083644c8f1c19d175aceea5008f3 | SahooManoj/Python-Code | /whileloop.py | UTF-8 | 300 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 16 19:21:39 2019
@author: Administrator
"""
x=0
while x<5:
print('x is', x)
x=x+1
i=0
while i<10:
i=i+1
if i<=4:
print("continue")
continue
print("i is",i)
if i>=8:
print("Break")
break | true |
60df668dcd7b2ddfdd6573327b362275bbb7eacf | EmlynQuan/Programming-Python | /Leetcode/leetcode139.py | UTF-8 | 806 | 3.5 | 4 | [] | no_license | # coding=utf-8
def wordBreak(s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
n = len(s)
# 动态规划 子串是否能够分割为单词 1代表可以
dp = [0 for _ in range(n+1)]
# 空前缀表示可以
dp[0] = 1
# dp[i] 表示 字符串s[0:i]是否能够被分割成单词组
for i in range(n):
for j in range(i+1, n+1... | true |
9e6ffabc652f8c3d6b9a6b9ce50983c9f82f495f | m-motawea/js-ng | /jumpscale/tools/syncer/__init__.py | UTF-8 | 8,584 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | """Module to help syncing multiple machines with specific directories you have.
used in the jsync tool.
```
JS-NG> xmonader = j.clients.sshkey.new("xmonader")
JS-NG> xmonader.private_key_path = "/home/xmonader/.ssh/id_rsa"
JS-NG> xmonader.load_from_file_system()
JS-NG> xmonader.save()
JS-NG> xmonader = j.clients.sshcli... | true |
6533f9d7d5c664b84ddee092be044b1d1c429dc0 | JaimeADalton/TFG | /join_data_files.py | UTF-8 | 3,124 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import subprocess
import os
import csv
'''
Algoritmo que devuelve el ratio 1 - (tamaño_final / tamaño_original) de todos los estudios
'''
f = open('./ratio_results.txt' , 'w')
results=[]
for estudio in range(1,9):
for test in range(1,71):
num_estudio = estudio
if num_estudio ... | true |
39e41b5299527ee7d1cf363308753746abf7da1a | ytbilly3636/amygdala | /wrs18.py | UTF-8 | 3,508 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from amygdala.layer import LateralNucleus as LA
from amygdala.layer import CentralNucleus as CE
import numpy as np
import cv2
import six
import os
class Amygdala(object):
def __init__(self):
self.la1 = LA(la_size=1, la_map_size=(8, 8), la_in_size=3*64*64) # for face
sel... | true |
1df72ae807495500ecfb8201fb81216320a969af | tom-mi/gr-binary_decoder | /python/binary_message_debug_sink.py | UTF-8 | 3,616 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 Thomas Reifenberger.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Thi... | true |
fc7a7ce5681c07a554ec9e0b30221731f48050a7 | colo1211/Algorithm_Python | /유형별문제집/구현/1. K번째 약수.py | UTF-8 | 335 | 3 | 3 | [] | no_license | import sys
# sys.stdin = open('input.txt','rt')
n , k = map(int,input().split())
count=0
for i in range(1,n+1):
if n % i == 0:
count += 1
if count == k:
print(i)
break
else :
print(-1)
# 파이썬은 for-else 구문이 존재
# 만약 for문을 다 돌고 나면 else에서 -1을 출력 | true |
c872566da339371d4cdc33f7a376833242dc11b5 | factor-hmc/numerical-scratch | /python/benchmark.py | UTF-8 | 2,453 | 3.4375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from timeit import timeit
def old_style():
print("Benchmarking NumPy")
print("Add two 100 element numpy arrays")
a = np.arange(100)
b = np.arange(100)
n = 1000000
print(timeit(lambda: a + b, number=n) / n * 10**9)
print("Add two 100000 element numpy arrays")
a = np... | true |
e9ca8d7f033b57bf9e20cb6eabb2540fe5a14a76 | lin-br/pythonando-do-lin | /studies/classes/aula008_estrutura_repeticao_for/challenge004.py | UTF-8 | 267 | 4.21875 | 4 | [] | no_license | """
Refaça o desafio da tabuada de um número
que o usuário digitar utilizando o laço for.
"""
inp = int(input('Digite um número para exibir a tabuada: '))
print('=-' * 20)
for number in range(1, 11):
print('{} x {} = {}'.format(inp, number, inp * number))
| true |
c170031125db22fe91c9b715414dc7343bd6497c | Wanyeki/lane-detection-deep-learning | /utils.py | UTF-8 | 1,177 | 2.671875 | 3 | [] | no_license | import tensorflow as tf
import os
import matplotlib.pyplot as plt
def read_images(img_names,dir):
all_images=[]
for img in img_names:
if("_L" not in img and ".png" in img):
path=os.path.join(dir,img)
image=tf.io.read_file(path)
image=tf.image.decode_png(image,channe... | true |
29d12780a2cff046a50c52c93a0e47815db0dd91 | Anant0810/CS50-Harvard | /pset6/sentimental/caesar.py | UTF-8 | 864 | 3.6875 | 4 | [] | no_license | import sys
key = int(sys.argv[1])
plaintext = str(input("Plaintext: "))
print("Ciphertext: ", end="")
len_plain = len(plaintext)
for var in range(len_plain):
if plaintext[var].isalpha() == True:
ascii_char = ord(plaintext[var])
if plaintext[var].islower() == True:
ascii_to_num = (ascii_... | true |
383c1d821f354ea968855026bb4787f6dc36cdc0 | LGL1992/phase_retrieval_experiment | /src/phre/optimizer/optimizer.py | UTF-8 | 3,672 | 3.203125 | 3 | [] | no_license | """
optimizer
~~~~~~~~~
"""
from typing import Union
import numpy as np
class Optimizer:
"""Optimizer parent class.
"""
def __init__(self,
obs_mat: np.ndarray,
obs: np.ndarray,
obj_type: str = 'soft'):
"""Construtor of Optimizer.
... | true |
818ba56380068d5e579512867d26cc613a0e94b3 | samzaberi/lancealot | /lance.py | UTF-8 | 1,735 | 2.6875 | 3 | [] | no_license | from operator import itemgetter
from flask import Flask, jsonify
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from geodist import haversine, get_dist_matrix
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///vehicles.sqlite3'
db = SQLAlchemy(app)
migrate = Migrate(ap... | true |
3ef86e0d1cf919ca5a9acb6eec53d30fcd9c47cb | smadala/IIIT-PG11 | /sce/slides/python/pra/Python_example_scripts/Control-Structures/nested_list.py | UTF-8 | 285 | 3.796875 | 4 | [] | no_license | #!/usr/bin/python
# demo of nested lists
L=[] # begin with empty list
for i in range(0,4):
row=[] # row is a single list
for j in range(0,4):
row.append(j) # populate the rows
L.append(row) # populate the list (L is list of lists)
print L
| true |
7b016b0b5cbe84e767340c648125c9439de2613e | summery91/baidu2sdk | /python_test/report_service_test.py | UTF-8 | 5,210 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #coding=utf-8
import traceback as tb
import random
import string
from ApiSDKJsonClient import printJsonResponse
from sms_service_ReportService import sms_service_ReportService
# performanceData参数 指定返回数据,取值范围在下面,根据不同的物料层级,其合法的取值范围不同
# impression(展现)--Y,必传
# click(点击)--Y,必传
# ctr(点击率)
# cost(花费)
# cp... | true |
3fb315b6dfaa29b79bcb75a9d5e6d085ef24e24d | Ge0dude/CodeFights | /intro/matrixElementSum | UTF-8 | 705 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 7 18:41:11 2017
@author: brendontucker
"""
matrix = [[0, 1, 1, 2],
[0, 5, 0, 0],
[2, 0, 3, 3]]
rowCount = len(matrix)
total = 0
current = 0
row = 0
col = 0
columnCount = len(matrix[0])
'''
while row < rowCoun... | true |
e8d8c310fcb8b8732fb3fc1c650e1331729e923e | jheddings/setgen | /setgen.py | UTF-8 | 3,759 | 3.3125 | 3 | [] | no_license | import random
import os
################################################################################
def parse_args():
import argparse
argp = argparse.ArgumentParser(description='setgen: random set generator')
argp.add_argument('--config', default='setgen.yaml',
help='configura... | true |
8862b9a3edec20268a73bf4f5ece20cdda9d9848 | Wolfant/EspePython | /Parte1/clases/airtravel6.py | UTF-8 | 2,221 | 3.203125 | 3 | [] | no_license | """ Modelo para vuelo de aviones"""
class Vuelo:
def __init__(self, numero, aeronave):
if not numero[:2].isalpha():
raise ValueError("No existe codigo de aerolinea \
en {}".format(numero))
if not numero[:2].isupper():
raise ValueError("El Codigo {} es invalid... | true |
72dc3ea563d860c6261619108c9db1964ce3323d | Kuebic/Thinkful | /03_Python/3.8_String_Drills/Poem_Formatter.py | UTF-8 | 88 | 2.890625 | 3 | [] | no_license | def format_poem(poem):
sentences = poem.split(". ")
return ".\n".join(sentences) | true |
c83e49cd8c3b8e9bb5b9c5cfd8653f1a19eaff49 | ChanatipSaetia/PatternProject | /preprocessing/ItemSelector.py | UTF-8 | 278 | 2.546875 | 3 | [] | no_license | from sklearn.base import BaseEstimator, TransformerMixin
class ItemSelector(BaseEstimator, TransformerMixin):
def __init__(self, index):
self.index = index
def fit(self, X, y):
return self
def transform(self, X):
return X[:, self.index]
| true |
266386d32f579ed7a9eddee3e28cf518edc41e85 | Zorking/wavelet | /wavlet_transform.py | UTF-8 | 3,096 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv
import pywt
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate
def main():
# file_name = str(raw_input('Please input file name:\n'))
# data_size = int(raw_input('Input data size:\n'))
# csv_file_name = str(raw_input('Please input csv file name:\... | true |
f21aa77ecd414a90fbbc343ca65d04a2828fabca | huygn/python-utils | /linked_list.py | UTF-8 | 2,371 | 4.15625 | 4 | [
"MIT"
] | permissive | class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
def print_list(head):
print head.data
if head.next:
print_list(head.next)
def Insert(head, data):
'''
Not working, see InsertNth
'''
if not isinstance(head,... | true |
2a32c95a9afa7a396abfa51efcf070c89a2c0cdd | rajkonkret/lekcja-python-k-i-k | /2.py | UTF-8 | 103 | 3.171875 | 3 | [] | no_license | x = "hello"
print(type(x))
if not type(x) is int:
raise TypeError("tylko liczby są akceptowane")
| true |
3c198e04f5c6ac558da80a8eb40b06cf8c99a033 | hughmcmillanv/rain_alert_public | /main.py | UTF-8 | 1,166 | 2.78125 | 3 | [] | no_license | import requests
from twilio.rest import Client
OWM_ENDPOINT = "owm_endpoint" # Enter the OpenWeatherMap API endpoint
API_KEY = "api_key" # Enter your OpenWeatherMap API key
ACCOUNT_SID = "account_sid" # Enter your Twilio account SID
AUTH_TOKEN = "auth_token" # Enter your Twilio account auth token
MY_LAT = 0 # En... | true |
423a64d587007c5af41ea2ce94bf4add3f21b5b4 | edwin95162/appTest7 | /TrabajoCorte1/checkSum.py | UTF-8 | 1,205 | 4.3125 | 4 | [] | no_license | # Ejercicio 4. Algoritmo que reciba por pantalla N números y deje de solicitar números hasta que la SUMA de los ya ingresados sea mayor a 100.
flag_3 = 0
flag_2 = 0
flag_consecutive = 0
num_consecutive = 2
addition = 0
while addition <100:
print("Por favor ingrese un número:")
n = int(input())
... | true |
7b1fda4cb10b7bcfc686a82de45c4ef681396c36 | hongsungheejin/Algo-Study | /songbae/Algo/DP/5904.py | UTF-8 | 403 | 2.96875 | 3 | [] | no_license | n=int(input())
s=[0]*1000
s[0]=3
cnt=1
while 1:
s[cnt]=s[cnt-1]+cnt+3+s[cnt-1]
if s[cnt]>n:
break
cnt+=1
answer=['-1','m','o','o']
def recur(now,cnt):
if cnt==0:
return answer[now]
if now<=s[cnt-1]:
return recur(now,cnt-1)
elif now>s[cnt-1]+cnt+3:
return recur(now-s[cnt-1]-cnt-3,cnt-1)
e... | true |
946eb36cedb39d1f9867ce41260259644f59908d | KyleLamoureux/AdventOfCode2020 | /Day 6/q1.py | UTF-8 | 261 | 2.953125 | 3 | [] | no_license | puzzle = open("input.txt").read().strip().split("\n\n")
total = 0
anwnser = set()
for line in puzzle:
for group in line.split("\n"):
for x in group:
anwnser.add(x)
total += len(anwnser)
anwnser = set()
print("total: ", total)
| true |
e50526aa630da231dd7d28aded9d2aef501de8a1 | jakob-ristner/snek-platformer | /main.py | UTF-8 | 5,314 | 2.859375 | 3 | [] | no_license | import pygame as pg
import random
import pytmx
from settings import *
from sprites import *
from tilemap import *
from gui import *
from items import *
from os import path
class Game:
def __init__(self):
# initialize game window, etc
pg.init()
pg.mixer.init()
self.screen = pg.disp... | true |
84c7eb1a91c2d8e6492cff64fdcc4dda9c4ae7df | junyi1997/non_local_train_code | /ops.py | UTF-8 | 3,706 | 2.890625 | 3 | [] | no_license | import tensorflow as tf
import tensorflow.contrib.slim as slim
def NonLocalBlock(input_x, out_channels, sub_sample=True, is_bn=True, scope='NonLocalBlock'):
batchsize, height, width, in_channels = input_x.get_shape().as_list()
with tf.variable_scope(scope) as sc:
with tf.variable_scope('g') as scope:
... | true |
5352325f1df97b87c9ec104d2659ed7e547a23de | Julianajjss/resilia-vamo-ai-qualified5 | /qualifiedpodio2.py | UTF-8 | 2,058 | 2.953125 | 3 | [] | no_license | def podio_olimpico(tempo_chegada1, tempo_chegada2, tempo_chegada3, nome_corredor1, nome_corredor2, nome_corredor3):
if tempo_chegada1 <= tempo_chegada2 and tempo_chegada2 <= tempo_chegada3:
primeiro_tempo = tempo_chegada1
segundo_tempo = tempo_chegada2
terceiro_tempo = tempo_chegada3
primeiro_... | true |
3981dd84e9f8d531a8855e56382e9dd3703f1c45 | LordAmit/automating-boring-tasks-using-python | /gplay_apk_download_multidex/analyze_log.py | UTF-8 | 3,270 | 3.234375 | 3 | [
"MIT"
] | permissive | from typing import List
class LogBody:
def str_to_bool(self, value: str) -> bool:
if value == "True":
return True
else:
return False
# def __init__(self, id,
# apk_id: str, processed: str,
# downloaded: str, multidex: str, sha1: str):
... | true |
7511b1c18f4deabf0e5ca212ad5795f23d50e62d | jtvkw2/6-Degrees-of-Kevin-Bacon | /Graph.py | UTF-8 | 2,570 | 3.640625 | 4 | [] | no_license | class Vertex:
'''
keep track of the vertices to which it is connected, and the weight of each edge
'''
def __init__(self, key):
'''
'''
self.ID = key
self.connected_to = {}
def add_neighbor(self, neighbor, weight=0):
'''
add a connection from this ve... | true |
52aae3fefee8ae8f0b8a41d0809f10b2f9240e5c | aalekseevx/DFAMinimizer | /app/automation.py | UTF-8 | 6,387 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | from collections import deque
from itertools import product
from types import SimpleNamespace
from typing import Dict, List
from loguru import logger
# Everything is actually a namespace,
# Named for convenience and type checks
Automation = SimpleNamespace
State = SimpleNamespace
Transmission = SimpleNamespace
DEATH_... | true |
1f980bd41d4bb8a166d6b9e27b1dead84cc412c5 | KrikorHerlopian1/CSCI-6651 | /tkinter/main.py | UTF-8 | 959 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# Created By : Krikor Herlopian
# Created Date: Wed Apr 14 2021
# Email Address: kherl1@unh.newhaven.edu
# =============================================================================
import ... | true |
98b1b71501eb8cf42482a94bf59b43fc59cdf6a1 | mhostetter/galois | /src/galois/_codes/_bch.py | UTF-8 | 44,691 | 2.703125 | 3 | [
"MIT"
] | permissive | """
A module containing general Bose-Chaudhuri-Hocquenghem (BCH) codes over GF(q).
"""
from __future__ import annotations
from typing import Type, overload
import numba
import numpy as np
from numba import int64
from typing_extensions import Literal
from .._domains._function import Function
from .._fields import GF2... | true |
8fa92d0a93925d9e4e4fda9b2e2b165cd60d73e5 | gabriellaec/desoft-analise-exercicios | /backup/user_371/ch119_2020_10_07_15_05_06_412030.py | UTF-8 | 362 | 2.984375 | 3 | [] | no_license | from math import factorial
def calcula_euler(x, n):
lista=[]
j=2
while j<n:
lista.append(j)
j+=1
i=0
lista_nova=[]
e=1+x
while i<len(lista):
lista_nova.append((x**lista[i])/factorial(lista[i]))
i+=1
i=0
while i<len(lista_nova):
e=e+lista_nova[i... | true |
d30ebeb1144b947bccb5b428e119896d83072b6b | ksyy/gepetto-viewer-corba | /pyplugins/gepetto/gui/matplotlibwidget.py | UTF-8 | 858 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | from matplotlib.figure import Figure
from pythonqt.matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, NavigationToolbar2QT
from PythonQt.QtGui import QWidget, QVBoxLayout
### Python QWidget that allows to draw matplotlib figures within the interface.
###
### Create an instance and populate member MatplotlibW... | true |
de4509bff7d160c17adb445830314aa820c39f5a | daoudclarke/ldacomposition | /ldacomp/restricted.py | UTF-8 | 2,453 | 2.703125 | 3 | [] | no_license | from gensim.corpora.wikicorpus import WikiCorpus, _extract_pages, process_article, ARTICLE_MIN_WORDS
from gensim import utils
from itertools import imap
import bz2
import multiprocessing
import logging
logger = logging.getLogger(__name__)
class RestrictedWikiCorpus(WikiCorpus):
def __init__(self, fname, terms, *... | true |
c1f1b33cf842cae0e1febae6f741b9c744e58a72 | mayank31398/deep-learning-bias-correction | /GAN/GAN.py | UTF-8 | 11,738 | 2.625 | 3 | [] | no_license | import os
import sys
import numpy as np
import scipy as sc
import tensorflow as tf
def OneHot(X, n=None, negative_class=0.):
X = np.asarray(X).flatten()
if n is None:
n = np.max(X) + 1
Xoh = np.ones((len(X), n)) * negative_class
Xoh[np.arange(len(X)), X] = 1.
return Xoh
def save_visualiz... | true |
39372a202bc69123ad62ca81921831e4b7d630fd | Dimitry-G/SF_decorator_timing | /decorator_timing.py | UTF-8 | 728 | 3.703125 | 4 | [] | no_license | import time
def time_this(func):
def wrapper(*args, **kwargs):
num_runs = 10
avg_time = 0
for i in range(num_runs):
start_time = time.time()
result = func(*args, **kwargs)
end_time = time.time()
avg_time += (end_time - start_time)
... | true |
6cc367f53f6997d3a79bc792050b81c13e1c8191 | Drust2/100Days | /Day 14 - Higher Lower/main.py | UTF-8 | 1,474 | 3.8125 | 4 | [] | no_license | import art
from game_data import data
import random
#Variables
famous_1 = random.choice(data)
famous_2 = random.choice(data)
#While loop to avoid both dictionaries being the same.
while famous_2 == famous_1:
famous_2 = random.choice(data)
#Info of both dictionaries
famous_1_name = famous_1["name"]
famous_1_follower... | true |
267add0f166d9d1666bdcb79dae9522a9f3252e4 | gireevash/giree | /3636L.PY | UTF-8 | 93 | 3.296875 | 3 | [] | no_license | E=int(input())
SS=list(map(int,input().split()))
SS.sort()
for H in SS:
print(H,end=" ")
| true |
fe1faf8628801246000895f680c36b5b0cfe98fa | yerbolaussat/text_classification | /NB.py | UTF-8 | 4,962 | 3.140625 | 3 | [] | no_license | # Author: Yerbol Aussat
import numpy as np
from sklearn.naive_bayes import BernoulliNB
from sklearn.metrics import accuracy_score
from math import log
import operator
# loading training data
def loadTrain():
global trn_labels
global trn_data
trn_labels = []
# total number of words in training examples
num_word... | true |
943fd32a8d27ee76db7ace31f64200b1dc93d63d | nasimulhasan/Context-sensitive-Bangla-spell-checker | /Others/helper/create_sentence.py | UTF-8 | 574 | 2.859375 | 3 | [] | no_license | import re, os
def create_sentences(text):
text = re.sub("\n", "", text)
if len(text) == 0:
return ""
pattern = r"[\।|\?|;]+"
sentences = re.split(pattern, text.rstrip(pattern))
sentences = "\n".join(sentence.strip() for sentence in sentences)
sentences += "\n"
return sentences
if __name__ == '__main__':
for... | true |
5139afbe19cd8e4448cd5f4ba8e8f2861b2051b6 | zou-Justin/workshop | /05_py/revisednames.py | UTF-8 | 1,641 | 3.671875 | 4 | [] | no_license | #Yoonah Chang, Josephine Lee, Josh Kloepfer
#SoftDev
#K05 -- REVISED Python Random Name Generator
#2021-09-26
#SUMMARY OF TRIO DISCUSSION
#good code is reusable code.
#DISCOVERIES
#randint > rand, adding "period 1/2: " makes output more readable
#QUESTIONS
#should the lists be a separate file? are mini lists better fo... | true |
37af8455b475b67ea1231207252a747223f04b39 | fdtroya/Horarios_espol | /Scrapper/basic_func.py | UTF-8 | 1,186 | 2.578125 | 3 | [] | no_license | import jellyfish
def time_convert(time):
horas,minutos,segundos=time.split(":")
tiempo=int(horas)+(int(minutos)/60)+(int(segundos)/3600)
return tiempo
def en_espacios(inicial,posicion,saltos):
return(posicion-inicial)/saltos - (posicion-inicial)//saltos == float(0)
def en_2(browser):
... | true |
78e55312cf3978693afab80b3a29211f9e89d0b9 | ztalloC/ProjectEuler | /proj_euler/problems/p113.py | UTF-8 | 2,635 | 3.796875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 9 14:15:04 2016
@author: mjcosta
"""
from collections import defaultdict
from proj_euler.utils.timing import timefunc
# Calculates the number of decreasing values with at most a number of digits.
def calculate_decreasing(digits):
stats = defaultdict(int)
# Ini... | true |
79d2bb9273bdccf782ec8f0442a99719ff095c00 | liuxu1005/Machine-Learning | /hw2/NaiveBayes.py | UTF-8 | 7,065 | 3.109375 | 3 | [] | no_license | # Project 2 comp 135
# Xu Liu
# Navie Bayes with cross validation
import sys
import numpy as np
import math
import argparse
#read index file, return instances space
def readIndex(filename) :
src = open(filename)
space = []
line = src.readline()
while line != '':
tmp = line.split('|')
... | true |
4ff70d7761b853ec2fab318e6764c6b77cd9d52e | Scott8440/490Project | /py/parser/PythonParser.py | UTF-8 | 14,316 | 2.578125 | 3 | [] | no_license | import re
from py.code_rep.CodeClass import CodeClass
from py.code_rep.CodeFunction import CodeFunction
from py.code_rep.CodeFile import CodeFile
from py.code_rep.CodeBlock import CodeBlock
from py.code_rep.CodeLine import CodeLine
from py.code_rep.LineTypes import LineTypes
from py.parser.CodeParser import CodeParser,... | true |
e6d2a070d30f9339780aac1a2c3ae4bb8ff9abde | cpiwong/analyze_ais | /mfile.py | UTF-8 | 476 | 3 | 3 | [
"Apache-2.0"
] | permissive | """Class for handling files."""
import csv
import logging
log = logging.getLogger(__name__)
class FileHandle():
"""Generic functions for reading files."""
def __init__(self):
"""Intial class."""
pass
def read_csv(self, file):
"""For all csv files extract data."""
log.inf... | true |
f0603365f9094780f944690bd456ecf5f8845056 | xianwenjian/interface_test-api_IHRM | /day04/pymysql/01_connect_mysql.py | UTF-8 | 454 | 2.984375 | 3 | [] | no_license | # 1.导包
import pymysql
# 2.创建数据库链接
conn = pymysql.connect(host="localhost", user="root", password="root", database="books", port=3306, charset="utf8")
# 3.获取游标
cursor = conn.cursor()
# 4.执行SQL语句
sql = "select version();"
result = cursor.execute(sql)
version = cursor.fetchone()
print("result = ", result)
print(version)
... | true |
8e18c33856b794afa4c09a924af29d39760ba5af | warrenkeil/Fourier | /PDE_2p5_plot.py | UTF-8 | 1,192 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 4 13:56:54 2018
@author: warrenkeil
"""
'''
======================
3D surface (color map)
======================
Demonstrates plotting a 3D surface colored with the coolwarm color map.
The surface is made opaque by using antialiased=False.
Also ... | true |
b67cfafc7a63a5f2aa162303c7d90a97ebec1981 | IsmailAlaouiAbdellaoui/Kalman-Filter-Localization | /map.py | UTF-8 | 9,622 | 2.921875 | 3 | [] | no_license | import numpy as np
import cv2
import math
import random
import time
from localization import Localization
from sklearn.metrics import mean_squared_error as mse
import matplotlib.pyplot as plt
class Robot:
def __init__(self, pos, radius=25, map_size=(500, 600, 3)):
self.pos = pos
self.prev_pos = pos... | true |
86b6f5f2c0182bb37771d363ec216c04996b73e3 | thsis/BADS19 | /models/knn.py | UTF-8 | 4,563 | 2.6875 | 3 | [] | no_license | """
Fit k-Nearest-Neighbor Classifier.
1. Create a logger.
2. Decorate the `models.tuning.minimizer`.
3. Read and clean the data.
4. Define model pipeline.
5. Define hyperparameter space.
6. Perform hyperparameter tuning with train data.
7. Fit pipeline with whole dataset and save predictions.
"""
import os
import lo... | true |
f5775c91184f2d7d46cef80bf4a007e570964834 | Exia01/Python | /Self-Learning/OOP/Part1/init.py | UTF-8 | 522 | 4 | 4 | [] | no_license | # A User class with 3 attributes but no methods (aside from __init__)
class User:
# init, equivalent of constructor
def __init__(self, first, last, age, is_admin=False): # self refers to the instance
self.first = first
self.last = last
self.age = age
self.is_admin = ... | true |
6a1d60340b8979a19c83b60eaefb32bbeec2fdd2 | zhangxiaozhe8023/Test_development | /zxztest/ke16/test_demo.py | UTF-8 | 437 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2021/8/1 09:45
# @Author : apple
# @Software: PyCharm
import pytest
@pytest.fixture(scope='function')
def demo_fix():
print('测试之前运行')
yield 'hello'
print('清理工作')
def test_01(demo_fix):
# 打印yield的返回值
print(demo_fix)
print('测试用例1')
def test_... | true |
ed563338a5a9e55bae57b315833993ac05dea89b | qmnguyenw/python_py4e | /geeksforgeeks/python/medium/4_5.py | UTF-8 | 7,197 | 3.5 | 4 | [] | no_license | How to build a URL Shortener with Django ?
Building a URL Shortener, Is one of the Best Beginner Project to Hone your
Skills. In this article, we have shared the steps to build a URL shortener
using Django Framework. To know more about Django visit – Django Tutorial
### Setup
We need some things setup be... | true |
05f332287ea272eeac6e7bb51d4f072fae626174 | kristofe/mlskeleton | /src/linear_mocap_regression.py | UTF-8 | 3,029 | 3.109375 | 3 | [
"MIT"
] | permissive | import sys
import numpy as np
#import matplotlib.pyplot as plt
#NOTES FROM ROSS - 9/9/15
#NOTE: W should be 42x7
#NOTE: Bias should be 1x7
#for linear regression -
#loss = 0.5*sum((scores-targets)^2)
#scores = Wx + b
#dL/dW = dL/dscores * dscores/dW
#dL/dscores = (score - y)
#dscores/dW = X
#so
#dL/dW = (score - y) ... | true |
dd3de9fabe61bfe06b499c7529b592345a2d8c88 | forbearing/mypython | /3.1_Advanced/4_深入类和对象/7.1.py | UTF-8 | 237 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
class Date:
def __init__(self, birth):
self.__birth = birth
self.name='hyb'
def get_birth(self):
return self.__birth
date = Date(1997)
#print(date.__birth)
print(date.get_birth())
| true |
7e4da876f7e739bc54135abacd820854e401cfc4 | yumening7/py_torch | /DQN_test.py | UTF-8 | 6,076 | 3.09375 | 3 | [] | no_license |
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
import torch
import gym
import torch.nn as nn
BATCH_SIZE = 32
LR = 0.01
EPSILON = 0.9 # Q Learning的策略值,代表90%的情况我们会按照Q表的最优值来选择行为,10%的情况是随机选择行为。
GAMMA = 0.9 # 奖励衰减值
TARGET_REPLACE_ITER = 100 ... | true |
ec117aeb65f0521b70224eec1769040c46e6fae3 | jvd33/ArenaHelper | /app/mongo/models.py | UTF-8 | 15,707 | 2.53125 | 3 | [] | no_license | import mongoengine as me
"""
Abstract class for all documents, makes object instantiation easy
"""
class Doc(me.Document):
def __init__(self, **kwargs):
super().__init__(**kwargs)
meta = {'allow_inheritance': True, 'abstract': True}
@staticmethod
def map_obj(json, mappings):
kwargs ... | true |
9f432e2e837d8c41cdc10ed0340632cb17badfae | kishoresuren/Telecommunications | /Source code/networkTrafficTimeSeries.py | UTF-8 | 1,336 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 3 19:16:47 2020
@author: Kishore
"""
#This code displays the plots of the time series traffic intensities over the first 14 day period
import pandas as pd
import matplotlib.pyplot as plt
#Plot a bar graph displaying the time series
def plotPDF(area):
plt... | true |
9b5daca12895ac619e8185bed20a9e1d001298de | jersson/mit-intro-cs-python | /week-03/99-problem-set-03/problem-03/program.py | UTF-8 | 675 | 4.03125 | 4 | [
"MIT"
] | permissive | import string
def getAvailableLetters(lettersGuessed):
'''
lettersGuessed: list, what letters have been guessed so far
returns: string, comprised of letters that represents what letters have not
yet been guessed.
'''
# FILL IN YOUR CODE HERE...
result = ''
alphabet = string.ascii_lowe... | true |
3c9b575fcb83dda47023ddbe39bbb9fa2e584742 | kunj17/PYTHON-GAME | /turtle-tictactoe.py | UTF-8 | 7,247 | 2.828125 | 3 | [] | no_license | import turtle,time,sys
wind=turtle.Screen()
plr=turtle.Turtle()
played={1:10,2:20,3:30,4:40,5:50,6:60,7:70,8:80,9:90}
mv=0
wincon=0
op=[0]
win=False
kg=True
def make_xo(ffcp,fx,fy):
if ffcp==1:
if p1=='X':
plr.penup();
plr.goto(fx,fy);
... | true |