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 |
|---|---|---|---|---|---|---|---|---|---|---|
c7aa8a8bd0cfbda59dcfaaa611eb8e7ad0a8ced0 | achanhon/AdversarialModel | /proportion/CIFAR/selective/density.py | UTF-8 | 1,513 | 2.796875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import torch
def logitTOdensity(logit):
softmaxdensity = torch.nn.functional.softmax(logit, dim=1)
tmp = torch.nn.functional.relu(logit) + softmaxdensity
total = tmp.sum(dim=1)
total = torch.stack([total] * logit.shape[1], dim=1)
estimatedensity = tmp / total
return estimatedensity.sum(dim=0)... | true |
1327ed97243ab282656caf1b038b0329371e47a6 | aleisa07/Silvia | /src/algorithm_backtracking.py | UTF-8 | 1,986 | 3.3125 | 3 | [] | no_license | class Backtracking():
def __init__(self):
self.sudoku_matrix = None
def solve(self, matrix):
self.sudoku_matrix = matrix
self.solveInline(0, 0)
def solveInline(self, row, col):
if (col >= 9):
col = 0
row = row +1;
... | true |
9f7a64d590ec5e145b5e9f1b671c292edcf20814 | ibuilder/real-estate-investment-guru | /project_real_estate/models/preprocessor.py | UTF-8 | 5,152 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from scipy import stats
from sklearn.preprocessing import LabelEncoder
from project_real_estate.constants import ALLOWED_PROPERTY_TYPES
class PropertyPreprocessor:
def __init__(self, price_lower_bound=100000):
self._price_lower_bound = price_lower_bound
self... | true |
da6518c20ffa6a3cd0531436de3a75a039e74681 | DavidPesta/AdventOfCode | /python3/2018/01-Chronal-Calibration/part1.py | UTF-8 | 196 | 3.296875 | 3 | [
"MIT"
] | permissive | import pathlib
input: str = pathlib.Path("input.txt").read_text()
values = input.split("\n")
current = 0
for value in values:
integer = int(value)
current = current + integer
print(current) | true |
c0f4ea4152e4afb28c88af0a7462c1aa94d0ff36 | chivaughn/COMP3608 | /Assignment 1/astar.py | UTF-8 | 1,908 | 3.484375 | 3 | [] | no_license | '''
Full Name: Chivaughn Charles
Student ID: 815007458
Email: chivaughncharles@gmail.com
Course Code: COMP 3608
'''
from collections import defaultdict
from queue import PriorityQueue
INPUT_FILE = 'maze.txt'
G = defaultdict(lambda: defaultdict(dict))
h = {}
fp = open(INPUT_FILE, 'r')
data = fp.read()
fp.close()
d... | true |
533226d4946a3efbe6ce26b4b1911c5b2d99962c | P-Madhulatha/become-coder | /original list.py | UTF-8 | 375 | 3.234375 | 3 | [] | no_license | #original numbers
def ori(n,data):
k=[]
for i in data:
if i not in k:
k.append(i)
return k
n=int(input())
data=list(map(int,input().split()))
print(*ori(n,data))
#sorting method
def ori(n,data):
data=list(set(data))
data.sort()
return data
n=int(input())
dat... | true |
e75e60e882409683de300e77e48533d0a33c8447 | kevinmershon/alexa-bitstamp-portfolio-balance | /crypto_balance.py | UTF-8 | 3,415 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
# CONFIGURE THESE AS DESIRED
client_id = "CLIENT_ID"
pairs = [
{"name": "Bitcoin", "ticker": "btcusd"},
{"name": "Ethereum", "ticker": "ethusd"},
{"name": "Bitcoin Cash", "ticker": "bchusd"},
{"name": "Ripple", "ticker": "xrpusd"}
]
api_keys = {
"btcusd": {"api_key": ... | true |
ca242abdcdc14a4a153b791ae7961eafe7d27efc | dkekre21/hackerrank | /Python/Strings/merge_the_tools.py | UTF-8 | 299 | 2.8125 | 3 | [] | no_license | from textwrap import wrap
def merge_the_tools(string, k):
# your code goes here
n=len(string)
for x in range(0, n, k):
substring = string[x : x+k]
l=[]
for s in substring:
if s not in l:
l.append(s)
print ("".join(l)) | true |
2b19bbe1523b089c3b18aa70c1017e9c42b2e61c | DrGrue/PythonFS-SF | /Tar 5.6.1/xo.py | UTF-8 | 6,124 | 3.59375 | 4 | [] | no_license | #Исходное игровое поле
field = [" ",0,1,2,0,"-","-","-",1,"-","-","-",2,"-","-","-"]
#Список строк, стобцов и диагоналей нашего поля
strikes = [(5,6,7),(9,10,11),(13,14,15),(5,9,13),(6,10,14),(7,11,15),(5,10,15),(7,10,13)]
#Выбор уровня сложности
def choose_diff():
n = input('''Привет!
Поддаваться тебе или хоч... | true |
e9aa78c2fa0ee5658ec8ccca5bc6da53444a2ab2 | anthonychl/automate-the-boring-stuff-with-python | /regular-expressions/phoneAndEmailExtractor.py | UTF-8 | 1,558 | 3.71875 | 4 | [] | no_license | '''
finds phone numbers and emails in the clipboard
'''
import re
import pyperclip # pyperclip allows to copy/paste from/to the clipboard
phoneRegex = re.compile(r'''(
(\d{3}|\(\d{3}\))? # area code
(\s|-|\.)? # separator
(\d{3}) # first 3 digits
(\s|-|\.) ... | true |
a01388bb7bb15b5ae4b50efa6b8ba426f41f97ad | H-S-20/CapstoneS20-63 | /imutest.py | UTF-8 | 2,768 | 2.796875 | 3 | [] | no_license | import time
import board
import busio
from adafruit_lsm6ds import LSM6DSOX
import paho.mqtt.publish as publish
i2c = busio.I2C(board.SCL, board.SDA)
sensor = LSM6DSOX(i2c)
MQTT_SERVER = "192.168.1.11" #Needs to be changed based on network
MQTT_PATH = "test_channel"
publish.single(MQTT_PATH, "Hello World!", hostnam... | true |
606af81120b494e8681e3654783a76b19d3d741a | Jcollier722/PSS | /write_results.py | UTF-8 | 2,547 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | from docx import Document
from docx.shared import Inches
from datetime import datetime
def export(path,sjn,fcfs,srt,rr):
#create and title new document
document = Document()
document.add_heading('CPU Scheduling Simulation Results', 0)
#add timestamp of generation
sub_title = document.a... | true |
dfd07c4898501f69e8448ceeb8460e9e205e784f | sa-sumanth/Web-Scrapers | /IMDbScraper.py | UTF-8 | 2,145 | 3.6875 | 4 | [] | no_license | #Web scraping script to get the top 10 movies from IMDb
import requests
import bs4
#scrape the information
def getContents(soup):
contents = dict()
#loop through top 10 movies' content
for heading in soup.findAll("div","lister-item-content")[:10]:
#get the movie title
... | true |
0a6dbae7ad617ea12c9fc34c95aa187f77ddb57b | eltnas/ExerciciosPythonBrasil | /02 - EstruturaDeDecisao/16.py | UTF-8 | 540 | 4.1875 | 4 | [] | no_license | import math
a = int(input("Coeficiente de a: "))
if a == 0:
print("Se a é igual a ZERO, não é uma equação de segundo grau! Até logo!")
else:
b = int(input("Coeficiente de b: "))
c = int(input("Coeficiente de c: "))
delta = b*b - (4-a*c)
if delta < 0:
print("Delta menor que 0. Raizes imaginarias. Até logo!")... | true |
9fe537ac7371f59124274a04977aaaf9ace0869e | Mathesh099/Coffee-Machine | /Coffee Machine/stage_3.py | UTF-8 | 847 | 4.4375 | 4 | [] | no_license | print("Write how many ml of water the coffee machine has:")
machine_water = int(input())
print("Write how many ml of milk the coffee machine has:")
machine_milk = int(input())
print("Write how many grams of coffee beans the coffee machine has:")
machine_coffee = int(input())
print("Write how many cups of coffee you wil... | true |
42a7ef569996ba2cba21e9f648106f2ca558ecf5 | yaoshi1218/API_Automation | /common/public/do_excel.py | UTF-8 | 4,879 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/3/12 9:07
# @File : do_excel.py
from openpyxl import load_workbook, workbook
from common.public.my_log import MyLog
from common.public.my_config import ReadConfig
from common.public.project_path import *
log = MyLog() # 实例化MyLog类
class DoExcel:
def __init__(self,file... | true |
f1a5c9afd4d998891aa664e8216b0fec39d39d76 | zerover0/HelloPython | /timestamp.py | UTF-8 | 1,334 | 2.609375 | 3 | [] | no_license | from datetime import datetime
print datetime.fromtimestamp(1346236702.123456)
print datetime.fromtimestamp(1346236702)
print datetime.fromtimestamp(1346236703)
print datetime.fromtimestamp(1346236712)
print datetime.fromtimestamp(1346236802)
print datetime.fromtimestamp(1346237702)
print datetime.fromtimestamp(1346246... | true |
3b75b8ac1daf55f579da0b276ecd3267860bc80c | Ingram7/DoubanBookSpider | /DoubanBookSpider/spiders/bookspd.py | UTF-8 | 2,186 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
import string
import random
import re
from ..items import DoubanbookspiderItem
class BookspdSpider(CrawlSpider):
name = 'bookspd'
allowed_domains = ['douban.com']
start_urls = ['https://boo... | true |
6b78b2928e4dbd119ec6cc94b4097c0a28140dcc | eperez96/EjercicioScript | /ItemsSeller.py | UTF-8 | 2,420 | 2.796875 | 3 | [] | no_license | import sys
import requests
import prettytable
# api-endpoint
UrlBase = "https://api.mercadolibre.com"
UrlItemsSeller = UrlBase + "/sites/MLA/search"
UrlCategories = UrlBase + "/categories/"
def get_CategoryName_Result(category_id):
# Obtencion de categoria por id
responseCategories = requests.ge... | true |
77eee5141d0daefe2be87d44482b461b50b225ea | dahallgren/adventOfCode2018 | /main.py | UTF-8 | 245 | 2.78125 | 3 | [] | no_license | import re
import sys
def main():
if len(sys.argv) > 1:
with open(sys.argv[1], 'r') as s:
values = s.readlines()
else:
values = sys.stdin.readlines()
print(values)
if __name__ == '__main__':
main()
| true |
efd2ed556cb0e0e27304a6ee40c2e53343401389 | rafacab1/1daw-python-prog | /Primer Trimestre/03 Bucles/5.py | UTF-8 | 2,538 | 4.6875 | 5 | [] | no_license | # 5. Escribe un programa que pida el limite inferior y superior de un intervalo.
# Si el límite inferior es mayor que el superior lo tiene que volver a pedir.
# A continuación se van introduciendo números hasta que introduzcamos el 0. Cuando termine el programa dará las siguientes informaciones:
# La suma de los n... | true |
ddb21de8426760cd76606498f0ea9b9e138c305a | Shildon25/Tg-diary-bot | /SQL_file.py | UTF-8 | 5,830 | 2.875 | 3 | [] | no_license | import sqlite3
class SQLighter:
def __init__(self, database):
self.connection = sqlite3.connect(
database,
check_same_thread=False
)
self.cursor = self.connection.cursor()
def select_all_events(self, user_id, date):
"""Получаем все события в указанный д... | true |
8a8c63da809d507641939f11ee75e9e041870303 | lucascantos/challenge-backend | /stratus.py | UTF-8 | 1,601 | 2.84375 | 3 | [] | no_license | from flask import Flask, request
from core import core_table
from stations import stations_available
import pandas as pd
stratus_app = Flask(__name__)
@stratus_app.route('/stations')
def stations():
'''
Consultar quais as estações disponíveis para consulta.
É um diferencial realizar consultas utilizando... | true |
bde9c936801ef17b44ac3168bec23cda70c741c4 | Lightraine2/cryptopals | /set1level1.py | UTF-8 | 141 | 2.625 | 3 | [] | no_license | import binascii
import base64
string = binascii.unhexlify("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d")
print(string)
encoded = base64.b64encode(string)
print(encoded)
| true |
d9f2525bf97497777349f00f386de83b42198c64 | ZSRoach/Maze-Game-Text-Adventure | /Entities.py | UTF-8 | 7,108 | 3.171875 | 3 | [] | no_license | import random
import math
xpPerLevel = ["100","100","150","200","300","400","500","600","700","800","900","1000","1150","1300","1550","1750","1900","2000","2600"]
xpAtLevel = ["0","100","200","350","550","850","1250","2350","3050","3850","4750","5750","6900","8200","9750","11500","13400","15400","18000"]
class Entity()... | true |
c40a4623234ab9a85b0786c7ff71ccf08fbd3a06 | mjbella/SLAC_NWA8753C | /test/src/first_pack/testing.py | UTF-8 | 348 | 3.203125 | 3 | [] | no_license | '''
Created on Mar 13, 2013
@author: charliex
'''
# File: bind1.py
from Tkinter import *
root = Tk()
def callback(event):
print "clicked at", event.x, event.y
frame = Frame(root, width=100, height=100)
frame.pack()
button = Button(root, text="Hello")
button.bind("<Button-1>", callback)
butt... | true |
2c0df31ec6b1d1b1ad1f84f5acdbb404719b5a7b | nuclth/python_SGP4 | /atmospheric_variables.py | UTF-8 | 3,321 | 2.96875 | 3 | [] | no_license | import math
from constants import k2, q0, rEarth, A30
def get_s_altitude_parameter(perigee_height):
if (perigee_height < 98):
s = 20 + rEarth
elif (perigee_height >= 98) and (perigee_height < 156):
s = (perigee_height - 78) + rEarth
else:
s = 78 + rEarth
s_norm = s / rEarth
... | true |
82a26b76c63937508a4362e81a0824be418a813f | ishantk/PythonEdurekaDec14 | /venv/Session8.py | UTF-8 | 867 | 3.296875 | 3 | [] | no_license | import os
"""
path = os.getcwd()
print("Path of CWD:", path)
os.chdir("/Users/ishantkumar/Downloads")
path = os.getcwd()
print("Path of CWD Now is:", path)
os.mkdir("/Users/ishantkumar/Downloads/MyPython")
print("==Directory Created==")
# Use this command carefully
# os.rmdir()
"""
"""
print(os.name)
print(os.get... | true |
a741c4e0c2ec17f5a4f5a24d4635088d59ecc75d | JustNicosh/Historische-Tennis-Daten | /code/profiles_and_competitions_synchronizer.py | UTF-8 | 2,223 | 3.09375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: iso-8859-1 -*-
import csv_handler
class ProfilesAndCompetitionsSynchronizer():
"""Synchronizes all different player profiles and competitions.
"""
def __init__(self):
self.profilesPath = '../data/competitions/tour-data/atp-500-data/allProfiles.csv'
self.matchesPath = '../data/... | true |
a194c58ad9e0386004303a451160c458e184855e | yuehuanjue/PythonParadiseLost | /装饰器/show_8.py | UTF-8 | 4,113 | 4.75 | 5 | [] | no_license | # @dese: 这是总结 python 装饰器用法的地方 -- 可自定义属性的装饰器
# @date: 2021/04/05
# @author:小十二
"""
可自定义属性的装饰器
问题:
写了一个装饰器来包装一个函数,并且允许用户提供参数在运行时控制装饰器行为。
解决方案:
引入一个访问函数,使用 nonlocal 来修改内部变量。 然后这个访问函数被作为一个属性赋值给包装函数。
"""
"""
一、 什么是 nonlocal
global 表示将变量声明为全局变量
nonlocal 表示将变量声明为外层变量(外层函数的局部变量,而且不能是全局变量)
python引用变量的顺序如下:
1、当前作... | true |
100f2fdadffb28e285052dcef12b1e55200fd2ed | ai-kmu/etc | /algorithm/2022/0517_149_Max Points on a Line/Joohye.py | UTF-8 | 1,299 | 3.34375 | 3 | [] | no_license | class Solution:
def maxPoints(self, points: List[List[int]]) -> int:
D = dict()
# points가 하나일 경우 기본값 1 처리
if len(points) == 1:
return 1
for i in range(len(points)):
d = dict()
for j in range(len(points)):
if i =... | true |
5262f0d258efb87f94aa7ab07499e37086376233 | dagrons/CEC-CVPR2021 | /dataloader/miniimagenet/miniimagenet.py | UTF-8 | 4,616 | 2.53125 | 3 | [
"MIT"
] | permissive | import os
import os.path as osp
import numpy as np
import torch
from PIL import Image
from torch.utils.data import Dataset
from torchvision import transforms
class MiniImageNet(Dataset):
def __init__(self, root='./data', train=True,
transform=None,
index_path=None, index=None, ... | true |
7e58a534835cf7747c6f28cacfe3a9ec9af21c09 | daniel-reich/ubiquitous-fiesta | /3eEjDZtxDtaiZccf9_16.py | UTF-8 | 182 | 2.875 | 3 | [] | no_license |
def can_play(hand, face):
face = face.split()
hand = list(x.split() for x in hand)
for x in hand:
if x[0] == face[0] or x[1] == face[1]:
return True
return False
| true |
7305d71a80abc01a0b4d63066290a14218ee46c6 | antonio00/blue-vscode | /MODULO 01/EXERCICIOS PARA ENTREGA 1º MODOLO/EX02.PY | UTF-8 | 909 | 4.34375 | 4 | [] | no_license | #02 - Utilizando estruturas de repetição com variável de controle,
# faça um programa que receba uma string com uma frase informada pelo usuário e
# conte quantas vezes aparece as vogais a,e,i,o,u e mostre na tela,
# depois mostre na tela essa mesma frase sem nenhuma vogal.
frase = input('Digite uma frase: ')
print... | true |
51f0df933577e85318c4ef8a7e3bd08858ae1dfc | markzxx/gobang_platform | /user_code/11610634.py | UTF-8 | 5,637 | 2.921875 | 3 | [] | no_license | # -*- coding:utf-8 -*
import numpy as np
import random
import logging
COLOR_BLACK = -1
COLOR_WHITE = 1
COLOR_NONE = 0
class AI(object):
def __init__(self, chessboard_size, color, time_out):
logging
self.chessboard_size = chessboard_size
self.color = color
self.time_out = time_out... | true |
ffa87a8fe38daeb4c76484706998adbe0159d424 | ra5ika27/Algorithmic-Problem-Solving | /word_ladder2.py | UTF-8 | 1,730 | 3.046875 | 3 | [] | no_license | import collections
class Solution(object):
def findLadders(self, beginWord, endWord, wordList):
"""
:type beginWord: str
:type endWord: str
:type wordList: List[str]
:rtype: List[List[str]]
"""
def dfs(word,temp,res):
temp.append(word)
... | true |
c1d9c5b3faf73eac5e47b9f62405e3f5cfb24f5e | Engineering-Capstone-TTE-Communications/TTE_Communications | /References/Timing Reliability Study/python_sampler_benchmark_v2.sh | UTF-8 | 199 | 2.546875 | 3 | [] | no_license | #!/usr/local/bin/python3
import time
filepath= 'py_log_test.csv'
try:
f = open(filepath,'a')
except:
f = open(filepath,'w+')
while(1):
f.write(str(time.monotonic()) + ',\n')
f.close()
| true |
25edaa0bee86e8accd90545fcfa87e94ab997a1d | Bharanij27/bharanirep | /PyhuntS98.py | UTF-8 | 174 | 2.734375 | 3 | [] | no_license | n,k=map(int,input().split())
q=[]
for i in range(0,k):
f,g=input().split(" ")
q.append(f)
q.append(g)
if len(set(q))%2!=0 or n==1: print("YES")
else: print("NO")
| true |
8b22d42d36dbad052ecf25bb762b996ae28d8400 | AK-1121/code_extraction | /python/python_9792.py | UTF-8 | 111 | 2.640625 | 3 | [] | no_license | # How can I increase the size of a sprite inpygame?
biggrasstile = pygame.transform.scale(grasstile, (16, 16))
| true |
2f41bef290185e455aa02dedbb45731b6e5caaf2 | aixp/rops | /rops/cocodrivers/Umbriel/Scanner.py | UTF-8 | 15,836 | 2.890625 | 3 | [] | no_license |
import sys
class Token( object ):
def __init__( self ):
self.kind = 0 # token kind
self.pos = 0 # token position in the source text (starting at 0)
self.col = 0 # token column (starting at 0)
self.line = 0 # token line (starting at 1)
self.val = u'' # to... | true |
69b1a3f01ab64375eb660282cc3bb882172ad4bb | alastairrmcneill/Flappy-Bird-AI | /FlappyBird/Game.py | UTF-8 | 2,597 | 3.5 | 4 | [] | no_license | """
The main game class for the flappy bird game. Stores all the game logic and functionality
"""
import pygame
from FlappyBird.Constants import bg_img
from FlappyBird.Base import Base
from FlappyBird.Pipe import Pipe
from FlappyBird.Constants import WIN_WIDTH, WIN_HEIGHT, FPS, BLACK, mediumFont, largeFont, file_path
... | true |
be34cc41a925172d740b7ef834c31e9ab821155d | milevy1/Coders-Workshop | /Coding-Challenges/checkPermutation/disemvowel.py | UTF-8 | 157 | 3.1875 | 3 | [
"MIT"
] | permissive | def disemvowel(str):
print(disemvowel('CodeSmith')); # => 'CdSmth'
print(disemvowel('BANANA')); # => 'BNN'
print(disemvowel('hello world')); # => 'hll wrld' | true |
1adc07d8424b33dfc6f8c4ecc37c815e697f6c48 | sanidhyamangal/machine_learning_models | /Classification/naive_bayes.py | UTF-8 | 2,974 | 3.71875 | 4 | [] | no_license | """
A ML model built on the top of Naive Bayes in order to predict wether a person will buy or not a product from Social Network Ads
"""
# base import
import numpy as np # matrix maths
import pandas as pd # data handeling
# viz imports
import matplotlib.pyplot as plt # plotting
from matplotlib.colors import Lis... | true |
e0ac7ddce227a0049db8449b89a5e8ca1a0f6215 | ghyhoiu/learn-python | /python-operation/第三章/天天向上续2..py | UTF-8 | 151 | 3.09375 | 3 | [] | no_license | i=0
a=1
while i<365:
i=i+1
if i%10<=6:
a=a
elif i%10>6:
a=a+a*0.01
print("最后你的能力值是{0}".format(a))
| true |
58493a75f85e1a0ba86dcc308dd0c1e485580a5f | radhikapc/foundation-homework | /homework10/Homework10-Radhika-Reddit.py | UTF-8 | 4,378 | 2.796875 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# In[4]:
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response = requests.get("https://www.reddit.com/", headers=headers)
doc = BeautifulSoup(response.... | true |
fb353d87a57bc6e89ef802c4e0e9f17f932a6bb0 | meataur/cryptofeed | /tests/integration/rest/test_ftx.py | UTF-8 | 1,632 | 2.515625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Python-2.0"
] | permissive | from cryptofeed.defines import ASK, BID, BUY
from decimal import Decimal
from cryptofeed.exchanges.ftx import FTX
f = FTX(config='config.yaml')
def test_funding():
expected = {'timestamp': 1607691600.0,
'symbol': 'BTC-USD-PERP',
'feed': 'FTX',
'rate': Decimal('0.... | true |
0c7f32f935712b7802ff3322af03a2438cfa83b2 | witte-de-with/advent-of-code-2017 | /09/01-02.py | UTF-8 | 1,125 | 3.296875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10000)
def remove_garbage(s, removed=0):
head, tail = s[0], s[1:]
if head == "!":
return remove_garbage(tail[1:], removed)
elif head == ">":
return (tail, removed)
else:
return remove_garbage(tail, removed + 1)
def parse(s, depth=1, score=0,... | true |
d04c2ffd894502301162ea2aa9419cc9b9244b93 | pll513/leetcode-solutions-python | /7_reverse_integer.py | UTF-8 | 495 | 2.96875 | 3 | [] | no_license | class Solution:
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
negtive = False
if x < 0:
negtive = True
x = -x
result = 0
while x > 0:
remainder = x % 10
result = result * 10 + remainder
... | true |
96972e167c79e2e413cbb405494295d8d5ef46cd | mdprewitt/sigmund_droid | /directory_app/app/models.py | UTF-8 | 1,924 | 2.6875 | 3 | [
"MIT"
] | permissive | from app import db
class Location(db.Model):
__tablename__ = 'location'
id = db.Column(db.Integer, primary_key=True)
alias = db.Column(db.String(8), unique=True)
street_address = db.Column(db.String(120))
city = db.Column(db.String(120))
state = db.Column(db.String(120))
country = db.Colum... | true |
49ed54916a19de46e49e1796904671b1ec9d916b | hsccorp/reviewboard | /reviewboard/accounts/trophies.py | UTF-8 | 4,973 | 2.828125 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import logging
import re
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.utils.translation import ugettext_lazy as _
_trophy_types = {}
class TrophyType(object):
"""An abstract trophy.
Represents a type of trophy, with logic to se... | true |
c35fbc836112c9a5a5eaf845ea59c916e5bfc536 | christopheroates/probnum | /src/probnum/statespace/sde_utils.py | UTF-8 | 565 | 2.8125 | 3 | [
"MIT"
] | permissive | """Continuous-time transition utility functions."""
import numpy as np
import scipy.linalg
def matrix_fraction_decomposition(driftmat, dispmat, dt):
"""Matrix fraction decomposition (assuming no force)."""
dim = len(driftmat)
if dispmat.ndim == 1:
dispmat = dispmat.reshape((-1, 1))
Phi = n... | true |
58cfb734b936fa63dee013e3eadbf2e54557503d | MrZiemni0k/Learning | /Done/100DaysChallenge/#016-OOP_Coffee_Machine/main.py | UTF-8 | 875 | 3.359375 | 3 | [] | no_license | from menu import Menu, MenuItem
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
_menu = Menu()
my_machine = CoffeeMaker()
my_money = MoneyMachine()
while True:
order = input(f"What would you like? {_menu.get_items()} ").lower()
if order == 'report':
my_machine.report()... | true |
8c879be01f48c68a67833ee563a0579179c7044d | sripadaraj/pro_programs | /python/starters/helloworld.py | UTF-8 | 266 | 3.734375 | 4 | [] | no_license | #program for swapping two numbers
print "program for swapping of two numbers"
a=12.0
print "before swap"
print "a=",a
b=22.0
print "b=",b
a,b=b,a
print "after swap"
print "a=",a
print "b=",b
a=10
print "a=",a
b=20.56
print "b=",b
c=a/b
print "divided value"
print c
| true |
c68e4d0e392e2a74c09423a1ffc01d2234b91d50 | butoon/testpro1 | /testing/conftest.py | UTF-8 | 2,342 | 2.671875 | 3 | [] | no_license | import os
from typing import List
import pytest
import yaml
from python_code.calc import Calculator
@pytest.fixture(scope='session')
def connectDB():
print('连接数据库操作')
yield
print('断开数据库连接')
@pytest.fixture(scope='class')
def get_calc():
print('获取计算机实例')
calc = Calculator()
return calc
wit... | true |
15c692f2c2be729c83a616eb02def4a72b7c7839 | octopus833/test | /project/app.py | UTF-8 | 456 | 2.78125 | 3 | [] | no_license | from flask import Flask
from flask import render_template
app = Flask(__name__) # create an instance of the Flask class for our web app
@app.route("/")
def index():
#The method "render_template" will generate a jinja2 template object
#out of that HTML and return it to the browser when the user visits
#... | true |
7c6c534d5562ed65ce8ec553aa7ea33e8e4a47e6 | takecian/ProgrammingStudyLog | /LeetCode/mock_interview/google_online_3/b.py | UTF-8 | 420 | 2.875 | 3 | [] | no_license | class Solution:
def maxDistToClosest(self, seats: List[int]) -> int:
left_distance = None
right_distance = None
space = 0
max_space = 0
for s in seats:
if s == 1:
max_space = max(max_space, space)
space = 0
else:
... | true |
ec657b641e9b0f33481fedd389fc7af4be536931 | DavidYKay/python-fundamentals | /lesson1/snippets/if.py | UTF-8 | 403 | 3.234375 | 3 | [] | no_license | defcon = 5
print("Current DEFCON is:", defcon, "and I had beans for breakfast today!")
if defcon > 3:
print("Declare war on Russia")
elif defcon == 2:
print("Maintain PRISM Program")
else:
print("Cut defense budget")
defcon = 2
if defcon > 3:
print("Declare war on Russia")
else:
if defcon == 2:
... | true |
c864cfa7e7b40749fe65b95e2818d9c4219dc5df | ont/cbox | /liba/reper2dots.py | UTF-8 | 418 | 2.640625 | 3 | [] | no_license |
def to_dots( self, nx, ny, nz ):
"""Produce set of dots multiply each vector in
interval (-nx,nx),...
"""
ps = []
for a,b,c in ( (i,j,k) for i in xrange( -nx,nx+1 )\
for j in xrange( -ny,ny+1 )\
for k in xrange( -nz,nz+1 ) ):
ps.appen... | true |
2ccdbc5579e91c83f42bb133cd82eb5dc9ec3717 | sabari-saravanan-m/USB_TO_GPIO | /usb_to_gpio/usb_to_gpio.py | UTF-8 | 6,312 | 3.3125 | 3 | [
"MIT"
] | permissive | """
Author : SABARI SARAVANAN M
Developed Tool and Version : Python 3.9
Description : General functions for HPA172 USB interface adapter
Module Name : USB-TO-GPIO
Module Version : 0.0.1
Created : April 2... | true |
f48bd26d5997e8d937e3641fad771b729e3b796d | salmanbirajdarwork/Python_Codes | /Section_04/Assignment_09.py | UTF-8 | 2,920 | 4.28125 | 4 | [] | no_license | # Assignment 9
"""
We have 2 variables. fr and d. fr is a list of strings and d is a dictionary with email
addresses as keys and numbers as values (numbers in string format).
Write code to replace the email address in each of the strings in the fr list with
the associated value of that email looked up from the diction... | true |
0e41bb1fc8dff8127694a84293160d56559b8db1 | PhysicsNAS/PhysicsNAS | /collision/operations_retrain.py | UTF-8 | 2,111 | 2.875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
# Basic operations
class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
class FCReLU(nn.Module):
def __init__(self, in_dim, out_dim):
super(FCReLU, self).__init__()
self.operat... | true |
f568299f782f2e0aedc9df3f6c3e0a4369693225 | kwiatolini/zadanie | /zad1.py | UTF-8 | 321 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
Komentarz
"""
def nowa(a,b):
return a-b
def counter(b,e):
while b < e:
yield b
b += 1
def main():
n = int(input())
for i in counter(0, n):
b, e = eval(input())
print(sum(counter(b, e)))
if __name__ == '__main__':
main()... | true |
6430b01de1279746e88e70c35a5447272614f825 | katryo/leetcode | /332-coin-change/solution.py | UTF-8 | 1,420 | 3.21875 | 3 | [] | no_license | class Solution:
def coinChange2(self, coins, amount):
if amount == 0:
return 0
if not coins:
return -1
coins.sort(reverse=True)
table = [-2] * (amount + 1)
table[0] = 0
def helper(money):
if money < 0:
return -1
... | true |
dace82b247408824467da7c78fbb42994651acf8 | kuceravyjura/Programming | /Practice/27/Python/main.py | UTF-8 | 468 | 3.40625 | 3 | [] | no_license | n = int(input("Введите кол-во элементов n: ").strip())
signals = map(int, input("Введите n элементов:\n> ").strip().split(" "))
a = []
for k in signals:
for i in range(6):
if i >= len(a) or i == 5:
break
if k > a[i]:
a.insert(i, k)
break
if i == 5 or i == len(... | true |
bd77817a6e8a0f9864bfdb42e86969d8833a2050 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/matrix/64b85d29be4b4614ac8c04798b35ea33.py | UTF-8 | 506 | 3.140625 | 3 | [] | no_license | class Matrix:
car=staticmethod(lambda x:x[0])
cdr=staticmethod(lambda x:x[1:])
def __init__(self, s):
self.rows=Matrix._parseMatrix(s)
self.columns=Matrix._transpose(self.rows)
@staticmethod
def _parseMatrix(s):
return map(lambda x: map(int, filter(len, x.split(" "))), s.spli... | true |
cc499ff5fd3f0309f17d7e6e96556815686c8e60 | GurbanSeyidhasanov/python | /TahminOyunu.py | UTF-8 | 2,878 | 3.890625 | 4 | [] | no_license | import time
import random as rastgele
class TahminOyunu():
___aciklama = """
Kullanıcı pozitif bir tamsayı girer.
Girdiği sayının rakamlarından kaç tanesinin yerleri ve rakamların değerleri doğruysa o kadar + işareti koyulur.
Girdiği sayının rakamlarından kaç tanesinin yerleri farklı ancak rakamların değerleri... | true |
5295d0f65eb888dd452df76902b8fd42a3dafca5 | rupeshjaiswar/ekLakshya-Assignments | /Python Codes/Day 4 Assignments/6_code.py | UTF-8 | 201 | 3.640625 | 4 | [] | no_license | s1 = ["India", "USA", "Australia", "Netherlands", "England"]
print("The list is:", s1)
s2 = "Australia"
if s2 in s1:
for i in s2:
print(i)
else:
print("No matches found")
| true |
ddc6caba71e4ec00e8015a98e4b31f9fd12e60e3 | sevboa/updateOriginatorRegistration | /modules/Commons.py | UTF-8 | 5,643 | 2.53125 | 3 | [] | no_license | import codecs
import csv
import io
from time import sleep
from modules.Counter import counter
from modules.dbPostgre import dbPostgre
def sortingByFieldNames(innerList, fieldNames):
params = fieldNames.copy()
Counter = counter(len(params), 5.0)
params.reverse()
innerList = dedublicateListDict(innerLis... | true |
d70240a24146a1c2979bf2b839bf1e2f28b83726 | VictorMany/FundamentosPython | /7-Entradas.py | UTF-8 | 393 | 4.375 | 4 | [] | no_license | #ENTRADAS
#El input guarda datos de tipo cadena
"""STRINGS"""
nombre = input("Ingresa tu nombre: ")
print(nombre)
"""INT"""
numero = int(input("Ingresa tu numero: "))
print(numero)
"""FLOAT"""
numeroFloat = float(input("Ingresa tu numero: "))
print(f"tu numero es:{numeroFloat}")
"""BOOLEAN"""
myboolean = bool(input... | true |
3ef317ff83ec92494deb716ea2e99a4bb7b6c4a6 | jayit2000/Crop-Recommendation | /CropRecommendation.py | UTF-8 | 9,131 | 3.03125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeClassifier
clf=DecisionTreeClassifier()
data=pd.read_csv(r'C:\Users\admin\AppData\Local\Programs\Python\Python36\Techie\Crop recommendation system\Crop_dataset.csv',index_col=False)
da=np.array(data)
crop=da[:,0:... | true |
69ff49cad12b9936696b0ff80bcf3fda4bb4ff54 | gunny26/webstorageS3 | /tools/wsverify.py | UTF-8 | 1,894 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
import os
import gzip
import json
import sys
import argparse
# own modules
import webstorageS3
parser = argparse.ArgumentParser("verifying wstar archives, checking if stored files are in FileStorage")
parser.add_argument("filename", help="wstar filename to verify")
parser.add_argument("-v", "--verb... | true |
6187c59c5a279e26391dfb5ed7467c4269dae51c | dan-ski/Roman_to_Arabic-KATA | /roman_to_arabic_test.py | UTF-8 | 471 | 3.09375 | 3 | [
"MIT"
] | permissive | import pytest
from roman_to_arabic import Roman_to_Arabic
@pytest.fixture()
def roman_to_arabic():
roman_to_arabic= Roman_to_Arabic()
return roman_to_arabic
@pytest.mark.parametrize("roman_input, arabic_output", (
("I", 1),
("II", 2),
("XIV", 14),
("XVII", 17),
("XXIV", 24)
))
def test_ch... | true |
3e5c3f58f25359cb6e55e3710e763f8cf65ea237 | cacciella/PythonProEstudos | /Aula_Pro_14.py | UTF-8 | 612 | 3.890625 | 4 | [] | no_license | # Parâmetros Variáveis
def soma(*args):
print(args)
print(type(args))
print(soma(10,4))
print('-'*20)
def soma(*args):
aux = 0
for valor in args:
aux += valor
return aux
print(soma(2,4))
print('-'*20)
def f(**kwargs):
print(kwargs)
print(type(kwargs))
print(f(nome = 'Kleverson', ... | true |
0e6c0872d861d844e025e6376ede43e8f3833c39 | Zerl1990/python_essentials | /solutions/module_8/01_dog.py | UTF-8 | 1,123 | 4.1875 | 4 | [] | no_license | class Dog:
def __init__(self, name, age, height, weight):
self.name = name
self.age = age
self.height = height
self.weight = weight
self.__energy = 100
def play(self, time_sec):
print(f'{self.name} - play')
self.__energy = self.__energy - time_sec * ((sel... | true |
6726b96a965b08c0be929f0cf19b6326a6fe2f35 | anhyonchul/python | /ch02/computer.py | UTF-8 | 118 | 3.34375 | 3 | [] | no_license | #10 진수, 2진수, 16진수 표기하기
num = 10
b_num = 0b1010
h_num = 0xa
print(num)
print(b_num)
print(h_num)
| true |
e5b5ed6806530c6f3ac548555675159b1718d7cc | 15Chano/NEA_connect4 | /MainGamepycharm.py | UTF-8 | 1,081 | 3.875 | 4 | [] | no_license | #import random
#f strings
def board(row):
board1=[]
for i in range(0,row):
board1.append([0,0,0,0,0,0,0])
return board1
#print(board[5]) # 6 lists but when put in [], [0] counts as the first list
#print(board[1][2]) # adding another [] here can output which place of the second list
... | true |
a2f1080d7707a1f128bacfe0efaed9243d99bc84 | Melly-chan/fake_news_1511 | /ssilka.py | UTF-8 | 889 | 2.734375 | 3 | [] | no_license |
import requests
import json
from bs4 import BeautifulSoup
import requests
from urllib.parse import urlparse
enterurl = link
domain = urlparse(enterurl).netloc
if (int(domain.find("www."))!=-1):
domain = domain[4:]
url = enterurl.split("//")[-1].split("/")[0].split('?')[0]
show = "https://input.payap... | true |
4d5cc0e26133fb6ead888e1584e4eab6c1b77b1e | mizm/TIL | /python/swexpert/bj17136_색종이붙이기/bj17136.py | UTF-8 | 1,496 | 2.875 | 3 | [] | no_license | import sys
sys.stdin = open("bj17136.txt", 'r')
my_map = [list(map(int,input().split())) for i in range(10)]
total = 0
for m in my_map :
total += sum(m)
paper = [5,5,5,5,5]
def check(x,y) :
return x >= 0 and x < 10 and y >= 0 and y < 10 and my_map[y][x] == 1
def check_draw(x,y,n) :
for i in range(y, y+n) :... | true |
816702366473d6cd336f9291e58c9d5266436021 | noahxl10/commodities-trader | /src/examples/xom_trader (1%)/subtrader.py | UTF-8 | 8,410 | 2.765625 | 3 | [] | no_license | import requests
import time
import os
import alpaca_trade_api as tradeapi
from iexfinance.stocks import Stock
import logging
global dir_path
dir_path = os.path.dirname(__file__)
## Read in credentials from credentials file
global alpacaKey
global alpacaSecretKey
global iexkey
try:
with open(dir_path+'/credential... | true |
d8cad8d6d1dba669159cf85353b79de1e30cc624 | PhantomShift/pygame-platformer | /src/game_objects.py | UTF-8 | 5,272 | 2.984375 | 3 | [] | no_license | import geometry
import pygame
from vector2 import Vector2, UP, DOWN, LEFT, RIGHT
from vector2 import ZERO as ZERO_VECTOR
from bindable_event import BindableEvent
from input_handler import InputHandler
from geometry import Ray_Result
GRAVITY = Vector2(0, 100)
class InteractiveRectangle(geometry.Rectangle):
def __i... | true |
294b755f1ae5ab84ed23715af50a214fee874c46 | ybdesire/machinelearning | /image_process/opencv/connected_component/connectedComponents.py | UTF-8 | 254 | 2.5625 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
img = cv2.imread('connectedComponents.png', cv2.IMREAD_GRAYSCALE)# IMREAD_GRAYSCALE, IMREAD_COLOR
labels,result = cv2.connectedComponents(img)
print(labels)
# 5 component
# 4 white, 1 black
# label int in result
| true |
b28ff376fda951124398fc640b376d13ba07045a | uaboss/alien_invaders | /settings.py | UTF-8 | 421 | 2.78125 | 3 | [] | no_license | class Settings():
"""Class for """
def __init__(self):
"""Constructor for Settings"""
self.screen_width = 1200
self.screen_height = 700
self.bg_color = (230, 230, 230)
self.ship_speed_factor = 9.5
self.bullet_speed_factor = 9
self.bullet_width = 3
... | true |
bd796c5a6145f55301ce1725b5a50a335f83f72d | traffic-lights/simple-traffic-lights | /tools/routes/generate_route_file.py | UTF-8 | 2,528 | 2.6875 | 3 | [] | no_license | from collections import namedtuple
MAX_DISTANCE = 1333333333337
Edge = namedtuple('Edge', 'u v name')
class Node:
def __init__(self, id, is_dead_end):
self.id = id
self.is_dead_end = is_dead_end
self.distance = MAX_DISTANCE
self.parent_edges = []
self.edges = []
def a... | true |
3d8d0841edca88ab95963a9a67026dba8a8fa47c | rustylampshade/advent-of-code | /2021/6.py | UTF-8 | 625 | 3.265625 | 3 | [] | no_license | #! /usr/bin/env python3
from collections import Counter
with open('6.txt', 'r') as infile:
start = Counter(map(int, infile.read().strip().split(',')))
def nextday(current_counts):
upcoming_counts = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0}
for timer, count in current_counts.items():
i... | true |
a35d6b8d98a45a011010c1513fbf1b46e8ed709f | SmallJimbo/Textgame | /commands/Command.py | UTF-8 | 244 | 2.734375 | 3 | [] | no_license | from abc import abstractmethod
class Command:
commandName: str
def __init__(self, name):
self.commandName = name
def getName(self) -> str:
return self.commandName
@abstractmethod
def execute(self): pass
| true |
7635651ee700ce191d22db6c946bf0034a52d602 | Rajk-Network-Science/network_2021_spring | /HAZIK/MMárk/Mark_hazi3.py | UTF-8 | 1,429 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[27]:
import matplotlib
import networkx as nx
import urllib
import csv
import matplotlib.pyplot as plt
import statistics
import numpy as np
# In[68]:
def generate_hazi3():
g = nx.read_edgelist("CA-GrQc.txt",create_using=nx.DiGraph(), nodetype = int)
prin... | true |
949ec2df670e6bb3f6ed6b2f2c770c2e3505bb81 | Awawdi/pyCampus | /capital.py | UTF-8 | 233 | 3.296875 | 3 | [] | no_license | with open(r"capitals.txt") as file:
single_line_gen = (line for line in file)
capitals_and_cities = (i.replace("\n", "").split(",") for i in single_line_gen)
capitals_dict = dict(capitals_and_cities)
print(capitals_dict) | true |
4b2296b19be52e13745274f1821c3696b926488b | ravenusmc/examining_suicide | /server/data.py | UTF-8 | 3,579 | 3.375 | 3 | [] | no_license | #This file will handle a lot of the data process for the fact page.
#Bringing in the outside libraries for use in this pageimport csv
from csv import writer
import numpy as np
import pandas as pd
class Data():
def __init__(self):
self.data = pd.read_csv('./data/who_suicide_statistics.csv')
#This meth... | true |
4378d9ab3f299e1b31b5698d64f8d30d867351f9 | reggiemccoy/python_code | /Lambdas/Lambdas.py | UTF-8 | 93 | 3.234375 | 3 | [] | no_license | def square(x):
return x**2
print(square(4))
results =(lambda x: x**2)(30)
print(results) | true |
0ddd0891674558d00b68920f1282d2c790516af8 | Falonie/Notes | /slots.py | UTF-8 | 138 | 3.859375 | 4 | [] | no_license | class Employee(object):
def set_salary(self, salary):
self.salary = salary
n = Employee()
n.set_salary(15000)
print(n.salary) | true |
e745ddb2de258d1dd915f356af5f340abef0a1f2 | flamedart/hcsolver | /readquest.py | UTF-8 | 774 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python3.4
def parseHeader(fileName, nameList):
with open(fileName, "r") as f:
s = f.readline().split()
vals = [int(x) for x in s]
# print(s, len(vals), len(nameList))
assert len(vals) == len(nameList)
return dict(zip(nameList, vals))
def parseFile(fileName, skipNumOfHead... | true |
cc794d17da784197f3e7dc159edd25ca7fd3494e | VGTx/FaradayFuture_Assignment | /Q6/View.py | UTF-8 | 1,963 | 3.1875 | 3 | [] | no_license | import wx
"""
Defines the GUI elements for the program using wxPython
"""
class View(wx.Frame):
def __init__(self):
# Class Initialiser
frame = wx.Frame.__init__(self, None, -1,"City Information", pos = (700,300), size = (500,500), name = "frame")
panel = self.panel = w... | true |
e85fd7b20634b52640a2659f773a79980792a74e | amittal007/Training | /Chapter4.py | UTF-8 | 869 | 4.34375 | 4 | [] | no_license | #Exercise 4.1.1
print('\n ***Exercise 4.1.1**')
import math
import turtle
def square(t):
bob=turtle.Turtle()
for i in range(4):
bob.fd(100)
bob.lt(90)
square('bob')
#Exercise 4.1.2
print('\n ***Exercise 4.1.2**')
def square(t,length):
bob=turtle.Turtle()
for i in ra... | true |
2d69b25c19c0bafe7f235051655f489b7d449167 | Miminor/Weatherbot | /main_weather_tg_bot.py | UTF-8 | 6,226 | 2.578125 | 3 | [] | no_license | import asyncio
import json
from config import tg_bot_token
from config import open_weather_token
import requests
import logging
from datetime import datetime
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
bot = Bot(token=tg_bot_token)
dp = Di... | true |
002b8077b997b80fa58ef5ab5e41308ea0e0bfef | YasinMahdizadeh/hello-world | /Min_List.py | UTF-8 | 236 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[15]:
def sum_list(i, mylist = []):
n = len(mylist)
if(i == n-1 ):
return mylist[i]
return mylist[i]+sum_list(i+1,mylist)
# In[17]:
sum_list(0,[4,5,6])
# In[ ]:
| true |
08523eecba6d040a3e48bb2ec055e2cec4fd6ff1 | joorgej/tytus | /parser/fase2/team25/analizer/statement/functions/extract.py | UTF-8 | 7,621 | 2.625 | 3 | [
"MIT"
] | permissive | from analizer.abstract.expression import Expression, TYPE
from analizer.abstract import expression
from analizer.reports import Nodo
from datetime import datetime
from analizer.statement.expressions.primitive import Primitive
import pandas as pd
class ExtractDate(Expression):
def __init__(self, opt, type, str, ro... | true |
c0d4ef98ccde043882dfbd54942508f02098930e | NiveditJain/ProgrammingQuestionsIITJodhpur | /question7/question9.py | UTF-8 | 325 | 2.953125 | 3 | [] | no_license | import matplotlib.pyplot as graph
import numpy as array
import math
g=9.8
w=2*math.pi/(24*3600)
r=6371000
p=w*w*r
prem=p*(p - 2*g)
o=array.arange(0,90,1)
a=[]
for O in o:
a.append(math.sqrt(g*g+(math.cos(math.radians(O))*math.cos(math.radians(O)))*prem))
graph.xlabel("degree")
graph.ylabel("g")
graph.plot(o,a)
graph.s... | true |
f0235b720deb2bbb8faa5babb65891d8e2f0801b | AdamZhouSE/pythonHomework | /Code/CodeRecords/2318/60703/280973.py | UTF-8 | 1,379 | 2.859375 | 3 | [] | no_license | def maxValue(root):
while tree[root][1] != 0 and root != 0:
root = tree[root][1]
return root
def minValue(root):
while tree[root][0] != 0:
root = tree[root][0]
return root
pre = -1
def isBST(fa):
if fa==0:
return True
if fa in tree and not isBST(tree[fa][0]):
re... | true |
6edf77bb59ac43176856833ca8a2b87903742ccd | enimateK/algo-bts | /DUTRIAUX Benjamin Devoir 4 (18).py | UTF-8 | 1,397 | 3.921875 | 4 | [] | no_license | #################
## Devoir 4 ##
#################
#Très bien mais il falait utiliser le tableau Cx pour faire un bilan
#Voir code complémentaire ci-dessous
#18/20
from random import randint
Tx = []
Cx = []
for i in range (0, 1000):
Tx.append (randint(0,1))
print ("")
print ("Suite de 1000 0 ou 1 générés al... | true |
a9cd776dcbfa6046841fc81ffb6bec37b340812c | rrosajp/flowgen | /flowgen/core.py | UTF-8 | 1,070 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import print_function
from flowgen.graph import Graph
from flowgen.language import Code
from flowgen.options import parser
from pypeg2 import parse
from pypeg2.xmlast import thing2xml
class FlowGen(object):
def __init__(self, args):
self.args = parser.parse_args(ar... | true |