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 |
|---|---|---|---|---|---|---|---|---|---|---|
faf08de44ed8fa8a20dbf0cedba5b1bcea66aa2e | aboghossian/MST | /PrimTest.py | UTF-8 | 602 | 2.765625 | 3 | [] | no_license | from PrimsAlgoLL import *
from RandomGraph import *
import random
out_file = open("results.txt", "w")
trials = 5
num_points = [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144]
dims = [0, 2, 3, 4]
for n in num_points:
for d in dims:
res = 0
for t in range(trials):
... | true |
9e86b77fbe54c63b985da209e4ec41ddc39e2c46 | octopusengine/octopuslab | /esp32-micropython/components/i2c_expander/__init__.py | UTF-8 | 2,817 | 2.5625 | 3 | [] | no_license | # basic library for 8bit expander
# octopusLAB 2019 / FIRSTboard with PCF8574
# from components.expander8 import Expander8
# e8 = Expander8(addr) addr default 000 > 0x20
# e8.test()
__version__ = "1.1.0"
from time import sleep_ms
from micropython import const
from utils.bits import neg, reverse, set_bit, get_bit
DEF... | true |
325c3fafc75860beea93a3f8c8cd668536cd359b | Pongsaky/Attendance_faceRecognition | /service/mqsql/database.py | UTF-8 | 496 | 2.734375 | 3 | [] | no_license | import mysql.connector
mydb = mysql.connector.connect(
host= "localhost",
user = "test",
password = 'Test_123',
database = 'learn_sql'
)
mycursor = mydb.cursor()
if 1 < 2:
sql = "INSERT INTO albums (artist, album, released, genre, sales_in_millions) VALUES (%s,%s,%s,%s,%s)"
val = ("Krit","เพลง... | true |
f7f42043ec37f0f05c1c25e43f2d868ce3d80819 | basakrajarshi/HackerRankChallenges-Python | /Algorithms/time_conversion.py | UTF-8 | 944 | 3.21875 | 3 | [] | no_license | import os
import sys
def timeConversion(s):
res = ""
h = s.split(':')[0]
hour = int(h)
minute = s.split(':')[1].split(':')[0]
sec = s.split(':')[2].split(':')[0]
if ("AM" in s):
second = sec.replace("AM", "")
if (hour == 12):
res = str(0) + str(0) + ":" + minu... | true |
8207aff6499f149298c184ae6832df62d9905266 | haggbart/IN1900 | /Øve/Exercise 4.6 (objects_qa).py | UTF-8 | 126 | 3.625 | 4 | [] | no_license | # Excersise 4.6
from math import log
var = input("Give some input: ")
print(type(var),var)
x = eval(var)
print(type(x), x) | true |
b29e190b0488518651aecaf48c655703715bab3a | vladimirjukic/advent_of_code_2017 | /day4/day4.py | UTF-8 | 855 | 3.765625 | 4 | [] | no_license | def isAnagram(word1, word2):
word1 = ''.join(sorted(word1))
word2 = ''.join(sorted(word2))
return word1 == word2
def isMatch(word1, word2):
return word1 == word2
def calculateValidPassphrases(data, validFunction, part):
result = 0
for row in data:
words = row.split(" ")
i = 0
... | true |
3fb80111d8912b8255557a6928077b46112841b5 | rahulc810/actionable-state-machine | /renamethis.py | UTF-8 | 1,688 | 2.765625 | 3 | [] | no_license | import json
import logging
import string
import re
logger = logging.getLogger(__name__)
class Properties:
PATTERN_EXISTS = re.compile(".*$[^$].*")
def __init__(self,properties_file):
self.filename = properties_file
self.props = {}
self.load_properties()
def load_properties(self):
logger.debug("[Loadi... | true |
af35abd93c808a05eeb57964304a17c2832993f0 | dKosarevsky/algo | /remove_extra_spaces_v2.py | UTF-8 | 471 | 3.453125 | 3 | [] | no_license | import time
# text = input("Enter your text:")
text = " On my home world "
std = "On my home world"
exp_num = 1000000
start = time.process_time()
for i in range(exp_num - 1):
text = text.strip()
while " " in text:
text = text.replace(" ", " ")
elapsed = (time.process_time() - start)
print(f"Exec... | true |
6741d530f516a736102b03e61d74c4f835033cef | RobinFrancq/learn_python | /functions/evenoroddfilter.py | UTF-8 | 264 | 3.59375 | 4 | [] | no_license | lst = [10, 2, 33, 45, 89, 2]
# De filter-functie verwacht een lambda functie met de logica voor de filtering
# De tweede parameter is een sequence (dus bijvoorbeeld een list)
result = list(filter(lambda x:x%2==0, lst))
print(result)
for i in result:
print(i) | true |
d3e0c251dfe71eb95639d61b501dc036c6351f15 | Kenn3Th/Physics_at_UiO | /MEK1100/Oblig_2/oblig2c.py | UTF-8 | 719 | 2.859375 | 3 | [] | no_license | from oblig2 import*
from seaborn import*
#arrow-plot
n=11
quiver(
x[::n, ::n],
y[::n, ::n],
u[::n, ::n],
v[::n, ::n],
units='width', width = 0.0015)
#Rectangles
def rektangel(xi,yi,xj,yj):
x1 = x[yi][xi]; x2 = x[yj][xj]
y1 = y[yi][xi]; y2 = y[yj][xj]
plot([x1,x2],[y1,y1], color='red')
... | true |
636aebd77e829881ed12172b4050e2bdd39de6df | hortont424/email-stats | /src/personalTotalPerMonth.py | UTF-8 | 1,742 | 2.5625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
import os
from tempfile import NamedTemporaryFile
from operator import itemgetter
from collections import defaultdict
from statistics import Statistics
from util import *
plot = """
data = Drop[Sort[Import["$TEMPORARY_FILE_NAME"]], -1];
tp = Transpose[data];
dates = First[tp];... | true |
57ff446642a860e884c354f67273d5dcbfaba5f0 | 287mdsahil/SAMOSA | /samosa/mutate.py | UTF-8 | 1,393 | 3.203125 | 3 | [] | no_license | from point import Point
from math import *
import numpy as np
import random
import copy
def laplacian(input, max_input, min_input, b=0.5):
"""Function to perform mutation on individual input vector"""
i_rand = random.randint(0, input.size - 1)
y = input[i_rand]
y = laplacian_mutate(y, b)
i_count ... | true |
ce31f7e614281b1a7f9870e50f71b168d0b8c3ad | okayama-abelab/ONMT_translation | /client.py | UTF-8 | 935 | 3.046875 | 3 | [] | no_license | import socket
addr = '192.168.12.218'
port = 50000
size = 1024
def check_quit(text):
text = text.lower()
if text == "quit":
print(">> Exit the program.")
print(">> bye.")
exit()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((addr, port))
data = s.recv(... | true |
caea5df04069f0a98bd581ea2040af76fd067e89 | daniel-reich/ubiquitous-fiesta | /ZsCu4cAeZ2b9n59AH_5.py | UTF-8 | 229 | 3.109375 | 3 | [] | no_license |
def lost_dog(*houses):
dogs = {}
for i,e in enumerate(houses):
if 0 in e:
dogs['Dog{}'.format(len(dogs)+1)] = 'House ({}) and Room ({})'.format(i+1,e.index(0)+1)
return dogs if len(dogs)>0 else 'Dog not found!'
| true |
8ce52301018872a8d09e7241b7fb365ab27a92b0 | taggedzi/learning_python | /src/theory/patterns/factories/factory_pattern.py | UTF-8 | 1,320 | 3.9375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file contains a very simple example of a factory pattern.
You require at least:
1. Interface that defines the methods to be shared by all the created objects
2. At lease 1 object which implements the interface and will be constructed
3. A Factory class that genera... | true |
30327403960037b0237d2908e669ecc468f8f576 | lunaticfoxy/TIL | /Algorithm/leetcode/SingleNumber.py | UTF-8 | 953 | 3.796875 | 4 | [] | no_license | """
주소: https://leetcode.com/problems/single-number/
난이도: Easy
문제 내용
- 정수가 들어있는 리스트가 주어지는데 이 안에는 한개의 숫자만 빼고 동일한 숫자가 2개씩 들어있다.
- 이 한개의 숫자를 찾아라
- O(n) time complexity & O(1) space complexity
샘플
Input: [2,2,1]
Output: 1
Input: [4,1,2,1,2]
Output: 4
풀이 설명
- 한 숫자에 xor 연산을 두번하면 0이 된다.
- 모든 값에 xor 연산을 하면 된다.
어떤 경우... | true |
19f57cbf9693e4690ae31d85ee700718dd9d7d62 | gsfordham/python-system-info | /soundmonitor.py | UTF-8 | 1,714 | 2.90625 | 3 | [
"MIT"
] | permissive | #! /usr/env python3
#main.py
#Imports
import alsaaudio
#END imports
#Volume functions
#Reset volume
def reset_volume(mx, rv):
#Mixer, Reset Volume
cond1 = isinstance(rv, int) and rv != None
cond2 = isinstance(mx, alsaaudio.Mixer) and mx != None
if cond1 and cond2:
#Configuration is too high
if rv > 100:
mx... | true |
1f96de228db3bed905a43f15b01c9d15e9ea7e04 | AIFFEL-coma-team01/Kyeongmin | /week6/771_Jewels_and_Stones.py | UTF-8 | 459 | 3.671875 | 4 | [] | no_license | # 771 Jewels and Stones
class Solution(object):
def numJewelsInStones(self, jewels, stones):
"""
:type jewels: str
:type stones: str
:rtype: int
"""
jewel = list(jewels) # 문자열을 list화 하면 한글짜씩 쪼개서 들어감
# print(jewel)
count = 0
for char i... | true |
cf0d8dfbbf51b1758e34ce237a154d84cec8fd1e | cseveriano/solarenergyforecasting | /pyFTS/partitioners/Huarng.py | UTF-8 | 1,001 | 2.578125 | 3 | [] | no_license | import numpy as np
import math
import random as rnd
import functools, operator
from pyFTS.common import FuzzySet, Membership, Transformations
# K. H. Huarng, “Effective lengths of intervals to improve forecasting in fuzzy time series,”
# Fuzzy Sets Syst., vol. 123, no. 3, pp. 387–394, Nov. 2001.
def GridPartitionerT... | true |
d0adead5ac879875c111ef8c4cba2cd4ecd01367 | Tyler-Jon-Wong/VirtualAssistantShion | /main.py | UTF-8 | 3,627 | 2.609375 | 3 | [] | no_license | import datetime
import scheduling as sc
import gmail_management as gm
import threading
import time
gmail_service = gm.service
cal_service = sc.service
def main():
desiredFilters = [
{
"criteria": {
"subject": "add event",
},
"action": ... | true |
8205fd42490f3e926c033ddfe8062480a7caa127 | Caarlossouza/AulaDeDataScience | /graficoLinha.py | UTF-8 | 238 | 3.359375 | 3 | [] | no_license | import matplotlib.pyplot as plt
x = [1,2,3,6]
y = [5,6,7,10]
eixox = "Eixo X"
eixoy = "Eixo Y"
titulo = "Gráfico de Linha"
plt.title(titulo)
plt.xlabel(eixox)
plt.ylabel(eixoy)
#plt.plot(x,y)
plt.plot(x,y)
plt.show()
| true |
72669d3bef3fa200b8dbeea59ee300209040360c | fptudelft/IN4355 | /teapot/teapot.py | UTF-8 | 6,738 | 3.421875 | 3 | [] | no_license | import sys
import pygame
import math
import classes
from random import randrange
TEST_FILE = 'tests/teapot.txt'
WINDOW_WIDTH = 1300
WINDOW_HEIGHT = 800
#used to compare floats for equality
DELTA = 0.000001
#After all segments of the triangles reach this size, we stop splitting it
BOUND = 5
def read_file(file):
... | true |
e6a4e09b7d086a0397fa8ee2b875ed81db7346ad | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_201/1866.py | UTF-8 | 1,539 | 3.03125 | 3 | [] | no_license | # from Stall import *
class Case:
def __init__(self, n, k, case_num):
self.n = int(n)
self.k = int(k)
self.case_num = case_num
# self.stalls = []
# for i in xrange(n + 2):
# self.stalls.append(Stall())
# self.stalls[-1].occupied = True
... | true |
6a547ac6ea808be79cd8af2d98803d989ebdd233 | Jaspreetjas/scrappers | /tests/test_buzzfeed_com.py | UTF-8 | 2,555 | 2.953125 | 3 | [] | no_license | import unittest
import requests
from scrappers.buzzfeed_com import find_titles_from_category_page, find_timestamp_for_post, add_timestamp_to_posts
from tests.helpers import trim, load_fixture
from unittest.mock import MagicMock
from collections import namedtuple
import pandas as pd
import os
def scrape_mocked(fixtur... | true |
1dff3e1af8c2c35efb04a86d256aafe7590fcfee | rolfstruikmans/neural-network | /MNIST_read.py | UTF-8 | 5,710 | 2.578125 | 3 | [] | no_license | from PIL import Image
import sys, os
import ANN
import numpy as np
import random
import json
def read_file(file_name):
data = []
try:
with open(file_name, mode = 'rb') as f:
data = f.read()
except FileNotFoundError:
print('file', file_name, 'not found')
return ... | true |
8b48bf00dc0c339e0624c43c1b3d98f1c9756876 | qwe764840446/py-L | /_text_file/Done/shiyan1_1.py | UTF-8 | 553 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
profit_all = int(input('input your profit(10 thousand)\n'))
bouns = 0
if (profit_all > 100):
bouns += (profit_all - 100) * 0.01
if (profit_all <= 100 and profit_all > 60):
bouns += (profit_all - 60) * 0.015
if (profit_all <= 60 and profit_all > 40):
bouns += (profit_all - 40) * 0.0... | true |
f11a3cb82a783a6b7b5dce42f7057925882370f6 | enordberg/adventCode2018 | /day4-2.py | UTF-8 | 4,616 | 3.1875 | 3 | [] | no_license | from datetime import datetime
#filePath = "day4Puzzle1Sample.txt"
filePath = "day4Puzzle1.txt"
class RawInputLine:
def __init__(self, rawInput):
rawInput = rawInput.replace("[", "")
rawInputSplit = rawInput.split("]")
rawDate = rawInputSplit[0]
self.eventDate = datetime.strptim... | true |
d6922ea28618a635dc9bf83aee6ac4795576daee | Knightofcydonia51/TIL | /Algorithm/SSAFY/stack1/graphRoute.py | UTF-8 | 946 | 3.015625 | 3 | [] | no_license | import sys
sys.stdin=open("graphRoute.txt")
def dfs(v):
visited[v]=1 # visited[1]=1
# print(v,end=" ") # 1
for w in range(V+1):
if G[v][w]==1 and visited[w]==0:
dfs(w)
T=int(input())
for i in range(T):
V, E= map(int,input().split())
temp=''
for j in range(E):
M=inp... | true |
54cad78bd27bc56d0f6ccfa07fa4145cb9e3a740 | hientrinh93/SELEX | /tofastq.py | UTF-8 | 1,467 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python
import sys
import getopt
def open_file(arg): #defining function named "open_file" with variable "arg"
input_file="" #variables = string
output_file=""
#parsing command line (structure)
try:
a, b =... | true |
1dee9d7799e3a7a54770fae643f87ea0bc8b856c | RomuloOliveira/pass-generator | /generator.py | UTF-8 | 854 | 3.59375 | 4 | [
"Apache-2.0"
] | permissive | from datetime import date
from random import random
# You will get it, just continue
MAX_NUMBER = 100000000
pass_list = []
tries = 0
while len(pass_list) < 10:
# Our 8-digit pass candidate
number = str(int(random() * MAX_NUMBER))
if len(number) != 8:
continue
year = int(number[4:8])
mon... | true |
0ede4041c1ddb4744fba50562387c29180c89b00 | anjianshi/API-libs | /api_libs/route.py | UTF-8 | 3,976 | 3.125 | 3 | [] | no_license | import re
from . import APILibError
from .interface import interface as to_interface
__all__ = ['Router', 'Context']
class Router:
'''通过此对象集中管理(注册、调用)interface'''
def __init__(self, context_cls=None):
'''
:arg context_cls: 此 router 绑定的 context 类型。不同类型的 context 提供不同的功能。
:type context_... | true |
35424212cc3e04045a7fb5872ac9ca15b87c9138 | timkaing/cs-1.3 | /Lessons/source/bases.py | UTF-8 | 3,361 | 4 | 4 | [
"MIT"
] | permissive | import string
def decode(digits, base):
"""Decode given digits in given base to number in base 10.
digits: str -- string representation of number (in given base)
base: int -- base of given number
return: int -- integer representation of number (in base 10)"""
# Handle up to base 36 [0-9a-z]
ass... | true |
d1ddb225e633c04df6342dbfdc12b84cce466784 | cheetimloh/social-media-data-scripts | /02-personal-archives/scripts/ad-scraper.py | UTF-8 | 1,168 | 2.796875 | 3 | [] | no_license | import csv
from bs4 import BeautifulSoup
rows = []
foldername = 'facebook-lamthuyvo'
with open("%s/ads/advertisers_you've_interacted_with.html" % foldername) as page:
soup = BeautifulSoup(page, 'html.parser')
contents = soup.find('div', class_='_4t5n')
ad_list = contents.find_all( 'div' , class_='uiBoxWh... | true |
57fbe0bd002975ac6aded39b63bf8b0ab30112eb | vzkrish/Python | /opr1_1.py | UTF-8 | 329 | 3.484375 | 3 | [] | no_license | #! /usr/bin/python
import os
os.system ('clear')
class vector(object):
def __init__(self,a,b):
self.first=a
self.last=b
def __str__(self):
return "vector(%d,%d)" % (self.first,self.last)
def __add__(self,other):
return vector(self.first+other.first, self.last+other.last)
v1=vector(2,-5)
v2=vector(-7,6)
pri... | true |
3195af40577b0c67843733440b75a58f087f00e7 | ViDaSaGo/Proyecto1 | /ADN.py | UTF-8 | 1,027 | 3 | 3 | [
"Unlicense"
] | permissive | ############################################################
# Proyecto1 version 1.0
############################################################
from ADNsimple import *
"""""""""""""""""""""""""""""""""""""""""""""
Clase ADN doble
"""""""""""""""""""""""""""""""""""""""""""""
class cadena_doble(object):
def __... | true |
7bdda93701be2d1a78ef0cfe1b881d4bd68a04d2 | lucasmsantini/lucasmsantini | /p1_aula5/Exercicios/ex014.py | UTF-8 | 305 | 3.6875 | 4 | [] | no_license | km = float(input('Quantos km foram rodados? '))
dias = int(input('Quantos dias o carro ficou alugado? '))
vkm = km * 0.15
vdias = 60 * dias
total = vkm + vdias
print('Você deve ao total \033[32mR$ {:.2f}\033[m por ter rodado {} km em {} dias ao custo de {} por dia.'.format(total, km, dias, vdias/dias))
| true |
3588999bae9d3cb0e8a3855e957080a7b8d45be0 | socialpercon/simple-chat | /chat.py | UTF-8 | 9,652 | 2.703125 | 3 | [] | no_license | __metaclass__ = type
import time
from asyncore import dispatcher
from asynchat import async_chat
import socket
import asyncore
_PORT = 5005
_NAME = 'EdChat'
def now_str():
'''Get the string representation of the current time.'''
return time.ctime(time.time())
class ChatLogicError(Exception):
pass
cl... | true |
8ce7836299058efdfca8d5bc742a0d469b8fcbb5 | gnestor/binderhub | /binderhub/repoproviders.py | UTF-8 | 3,520 | 2.84375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | """
Classes for Repo providers
Subclass the base class, ``RepoProvider``, to support different version
control services and providers.
"""
import json
from tornado import gen, web
from tornado.httpclient import AsyncHTTPClient, HTTPError
from traitlets import Unicode
from traitlets.config import LoggingConfigurable
... | true |
21a01cbc069353891cf0e50a219a54962e566525 | TMsangohan/bact2 | /bact2/applib/utils/utils.py | UTF-8 | 5,651 | 2.875 | 3 | [] | no_license | import logging
import numpy as np
logger = logging.getLogger('bact2')
class Counter:
'''Faclitates counting measurements
Todo:
Check if implementation available
'''
def __init__(self):
self._old_value = None
self._counter = 0
# @property
# def counter(self):
# ... | true |
cd67ff396e6d57c3ca8ff4463afbe1b7c731292d | hamcheeseburger/coding | /programmers/뉴스_클러스터링.py | UTF-8 | 1,290 | 3.484375 | 3 | [] | no_license | # 프로그래머스 [1차] 뉴스클러스터링
# https://programmers.co.kr/learn/courses/30/lessons/17677
import math
def makeSplit(string): # 문자열을 순차적으로 2개씩 나누는 과정
string = string.lower()
str_list = []
index = 0
while index <= len(string) - 2:
st = string[index:index + 2]
if st.isalpha():
str_lis... | true |
cb70f4732f6af3f7b05285a44b630e0ab4b3a416 | damnmicrowave/cs102 | /homework01/caesar.py | UTF-8 | 1,234 | 3.765625 | 4 | [] | no_license | def encrypt_caesar(plaintext: str, shift: int) -> str:
"""
>>> encrypt_caesar("PYTHON", 3)
'SBWKRQ'
>>> encrypt_caesar("python", 3)
'sbwkrq'
>>> encrypt_caesar("Python3.6", 3)
'Sbwkrq3.6'
>>> encrypt_caesar("", 3)
''
"""
ciphertext = ''
for... | true |
7ebeacffe9d0e0dc18b7cf20b3f36a4d49bdfeee | thanhnd3996/HOG | /feature/gradient.py | UTF-8 | 545 | 2.53125 | 3 | [] | no_license | import cv2
import argparse
import matplotlib.pyplot as plt
if __name__ == '__main__':
parse = argparse.ArgumentParser(description='image')
parse.add_argument('--image', help='input_image')
args = parse.parse_args()
img = cv2.imread(args.image)
img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
gx = cv... | true |
f3633ec73fa9556e35d0a2a3e8e64673bdaffc3a | brbeardm/Pellet-Pirate | /LCDDisplay.py | UTF-8 | 3,819 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import threading
import time
import logging
import logging.config
import Adafruit_CharLCD as LCD
#import FakeLCD as LCD
buttons = ((LCD.SELECT, 'Mode'),
(LCD.LEFT, 'Left'),
(LCD.UP, 'Down'), # Hardware snafu
(LCD.DOWN, 'Up'),
(LCD.RIGHT, 'Right'))
Modes = ('Off', 'Start',... | true |
899ce081067c50f33026d8a56104ca71dbc11123 | webclinic017/fa-absa-py3 | /Python modules/ACIS_Clearing_Fee.py | UTF-8 | 3,212 | 2.609375 | 3 | [] | no_license | """---------------------------------------------------------------------------------------------------------------
Project : ACIS Clearing Fee
Purpose : The brokerage fee amount to be booked daily for every business day, and the payday must be
the 10th business ... | true |
17703c7732ce62adb367d166b6274546b69fc30d | ranicholson/holbertonschool-higher_level_programming | /0x0B-python-input_output/4-from_json_string.py | UTF-8 | 198 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python3
""" Function that returns Python object from JSON string"""
import json
def from_json_string(my_str):
"""Return pyhon obj from json str"""
return (json.loads(my_str))
| true |
b5ce79794168aec80c61002e9afed8a38db237ff | AdamZhouSE/pythonHomework | /Code/CodeRecords/2447/61135/319563.py | UTF-8 | 316 | 3.0625 | 3 | [] | no_license | num=input().split(" ")
lis=input().split(" ")
lis=list(int(a) for a in lis)
i=0
ans=[]
while(i<int(num[1])):
temp=input().split(" ")
temp=list(int(a) for a in temp)
ans.append(min(lis[temp[0]-1:temp[1]]))
i+=1
i=0
while(i<len(ans)-1):
print(ans[i],end=" ")
i+=1
print(ans[len(ans)-1],end=" ") | true |
7d164c15c5bdf731435af039c2eff2aef5a5bb0b | AlexGnz/QuoridorAIProjectAlex | /IA_partie4.py | UTF-8 | 6,333 | 2.953125 | 3 | [] | no_license | '''
Projet d'année partie 4
Alexandre Gonze - 439738
BA1 INFO
07/04/2019
'''
import numpy as np
import random
EPS_MIN = 0.06 # the lowest the epsilon-greedy parameter can go
'''
NOUVELLE METHODE
Possibilité de changer de type de fonction d'activation
'''
def activationFunction(x, type = None):
if type is not... | true |
f78fa1b5a6ac383071c7105556321e85c669f301 | SmallHedgehog/DistributeCrawler | /core/errors.py | UTF-8 | 273 | 2.546875 | 3 | [] | no_license | # coding: utf-8
"""
封装异常模块
"""
class DependencyNotInstalledError(Exception):
"""依赖模块未安装异常"""
def __init__(self, msg):
self.msg = msg
def __str__(self):
return 'Error because lacking of dependency: %s' % self.msg
| true |
26b04e20e7639877d3c4ad648a22dc9c2249ce70 | ninikolov/low_resource_summarization | /stat/sorted_outputs.py | UTF-8 | 3,721 | 2.609375 | 3 | [
"MIT"
] | permissive | import argparse
from random import shuffle
import numpy as np
from rouge import Rouge
import sys
from summary_rewriting.summarization_systems.oracle import repeat_rate
parser = argparse.ArgumentParser()
parser.add_argument('--input', "-i", help='The input file.', required=True)
parser.add_argument('--systems', "-s", n... | true |
6de203f1c23e2c4e22c30535066d215cd5c05277 | kvmu/KURRI-workterm | /side_project_kiwamu/numerical_method_compare.py | UTF-8 | 5,092 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 02 14:02:35 2015
@author: Kevin
"""
import numpy as np
from matplotlib import pyplot as plt
E_mat = np.genfromtxt('lifetime135Cs2 .txt')
RK4_mat = np.genfromtxt('rk4solution.txt')
time_axis = RK4_mat[:,0] # E_mat and RK4_mat have the same time_axis
###################... | true |
2b83c3f8db59976a08aa8e540d186fba0dda638c | EthanJamesLew/PSU_STAT671 | /project/figures/fig_utils.py | UTF-8 | 812 | 2.96875 | 3 | [] | no_license | '''
Ethan Lew
(elew@pdx.edu)
Utilities to create figures for the presentations
'''
import numpy as np
from sklearn import datasets
# PARAMS
n_samples = 700
seed_val = 0
# make the datasets
np.random.seed(seed_val)
noisy_circles = datasets.make_circles(n_samples=n_samples, factor=0.5, noise=0.05)
noisy_moons = datas... | true |
89c6682cff35dc881f28fedecc43ecad1052a21d | Indraja22/python-practice-coding | /pythonpractice/main.py | UTF-8 | 269 | 4.5625 | 5 | [] | no_license | #Program to print Odd and Even numbers in range(0,100) in Python
def check_odd_even():
for num in range(0,100):
if num % 2 == 0:
print(f"Even Numbers are : {num}")
else:
print(f"Odd Numbers are : {num}")
| true |
bdc617c432c745a3fc55d43fd029e400e0eb96f4 | PhiphyZhou/Coding-Interview-Practice-Python | /LeetCode/p433-MinGenMutation.py | UTF-8 | 2,103 | 3.71875 | 4 | [] | no_license | # 433. Minimum Genetic Mutation (Twitter)
# A gene string can be represented by an 8-character long string, with choices from "A", "C", "G", "T".
# Suppose we need to investigate about a mutation (mutation from "start" to "end"), where ONE mutation is defined as ONE single character changed in the gene string.
# For ex... | true |
d8a2b4940d283cff8d065c29375752f0b77f4fc4 | Vvegetables/python-spider-crawler-demo | /webpy/test1/session的使用.py | UTF-8 | 2,030 | 2.890625 | 3 | [] | no_license | #coding=utf-8
'''
如果用数据库代替磁盘文件来存储session信息,
只要用DBStore代替DiskStore即可。
使用DBStore需要建立一个表
create table sessions (
session_id char(128) UNIQUE NOT NULL,
atime timestamp NOT NULL default current_timestamp,
data text
);
db = web.database(dbn='postgres', db='mydatabase', user='myname', pw='')
store = web.session... | true |
c3f02914fe018e2e6ad1cbf7b69a32326f5fc41b | johnthemarksman/rubiks | /python/weight.py | UTF-8 | 776 | 3.796875 | 4 | [] | no_license | import time
### User entered data
startDate = (2019, 4, 29, 13, 3, 39, 0, 119, 1) #year, month, day
endDate = (2019, 5, 29) #year, month, day
startingWeight = 172.4 #
goalPerWeek = 3 #how many pounds you want to lose per week
goalPerDay = goalPerWeek/7
goalPerHour = goalPerDay/24
buffer = 2/24
currentWeight = fl... | true |
3c4cc83f42783282be352e6ffc51460cd8dc23ff | samishchandra/MapReduce | /KeyValueType.py | UTF-8 | 509 | 2.625 | 3 | [] | no_license | '''
Created on Nov 14, 2012
@author: KSC
'''
class KeyValueType():
'''
Class used for the defining the type of input to the MapReduce API
'''
keyType = None
valueType = None
def __init__(self, keyType, valueType):
self.keyType = keyType
self.valueType = valueType
cla... | true |
de57a13414dbe714aaf58c6426bc65a0936be040 | avi9414/Autonomous-Tagging- | /minor_project.py | UTF-8 | 1,773 | 3.15625 | 3 | [] | no_license | #importing the libraries
import pandas as shortpanda
import numpy as shortnum
import re
import datetime
from collections import Counter
from bs4 import BeautifulSoup
#reading CSV Data
QuestionData =shortpanda.read_csv('Questions.csv',encoding='latin-1')
TagsData=shortpanda.read_csv('Tags.csv')
#creating a list of Tags ... | true |
ac2e841a2fcdd7a8797dad94d11b16d5b7ff2796 | mrmuli/bootcamp_9_ke | /andelabs/multiple_occurence.py | UTF-8 | 939 | 4.15625 | 4 | [] | no_license | """
You are presented with two arrays, all containing positive integers.
One of the arrays will have one extra number, see below:
[1,2,3] and [1,2,3,4] should return 4
[4,66,7] and [66,77,7,4] should return 77
"""
def find_missing(a, b):
# a = [1,2,3]
# b = [1,2,3,4]
# this is the variable that holds the uniq... | true |
3c53c2878fb940dd1ea9140b1a3f9792ea5b15e1 | mmewen/UTSEUS-DataScience | /Project/_test/test_data_1.py | UTF-8 | 575 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import json
from sys import argv
cities = []
pathToCities = "../_out/dat_big_json/cities_1.json"
with open(pathToCities, 'r') as jsonfile:
cities = json.load(jsonfile)
print("Loaded {0} cities".format(len(cities)))
# i = 0
# for key in cities:
# if i == 100:
# break
# ... | true |
caa061e1c56b4b6957864e10913214efe1f15dfb | VVKot/coding-competitions | /leetcode/python/204_count_primes.py | UTF-8 | 509 | 2.984375 | 3 | [
"MIT"
] | permissive | class Solution(object):
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
if n < 3:
return 0
primes = [2]
for i in range(3, n, 2):
is_prime = True
for prime in primes:
if prime > (math.sqrt(i)):
... | true |
f36053771a070318b7cf44b880b2d7c8426917e8 | FedericoPonzi/TrasportiRomaBot | /bot/utils.py | UTF-8 | 657 | 3.359375 | 3 | [] | no_license | from datetime import datetime
def time_left(diff_delta):
'''
:param diff_delta: date- datetime.now()
:return: diff_delta as a telegram message formatted string.
'''
m = ""
diff_minutes = int(diff_delta.seconds / 60)
hours = int(diff_minutes / 60)
minutes = diff_minutes % 60
if dif... | true |
cb0c0e7b05691ed4c4223f7a20a3374b2a1b0b6d | roshanishiwa/postscriptInterpreter | /hw4/HW5_samplecode.py | UTF-8 | 2,963 | 3.265625 | 3 | [] | no_license |
## Change the following functions for static scope support.
# dictPush
# define
# lookup
# stack
# evaluateArray
# Add a scope argument to the the following functions
# psIf
# psIfelse
# psFor
# interpretSPS
# interpreter
# ------ SSPS functions -----------
# search the dictstack for the dictiona... | true |
2d04a0d28ed2253106d9d45f3d83049fcc38baae | JorgeBarcinilla/phyton_exercism | /yacht/yacht.py | UTF-8 | 1,750 | 3.765625 | 4 | [] | no_license | """
This exercise stub and the test suite contain several enumerated constants.
Since Python 2 does not have the enum module, the idiomatic way to write
enumerated constants has traditionally been a NAME assigned to an arbitrary,
but unique value. An integer is traditionally used because it’s memory
efficient.
It is a... | true |
45458be8a861a5c8ca832d301253117c434d3a67 | ssj24/TIL | /00_startcamp/03_day/list_prob_3.py | UTF-8 | 442 | 4.15625 | 4 | [] | no_license | '''
문제 3.
숫자를 입력 받아 짝수/홀수를 구분하는 코드를 작성하시오.
'''
number = int(input('숫자를 입력하세요: '))
# 아래에 코드를 작성해 주세요.
# if number%2 == 0:
# print('짝수')
# else:
# print('홀수')
#보통 true는 1이나 2,3 등 다른 값, false는 0을 인식하므로 그걸 이용해서 식을 짤 수 있음
if number%2:
print('홀수')
else:
print('짝수') | true |
1890d47ce8ba09033655fb37ba347fa50e213eff | alekseystryukov/notebooks | /games/race/race.py | UTF-8 | 590 | 3.109375 | 3 | [] | no_license | from car import Car
from track import Track
from counter import Counter
import pyglet
WIDTH, HEIGHT = 1100, 700
window = pyglet.window.Window(width=WIDTH, height=HEIGHT)
track = Track()
car = Car(track=track, window=window)
counter = Counter(car=car, height=HEIGHT)
@window.event
def on_draw():
window.clear()
... | true |
8b63892fc055ce5302ede68c7507201113db6c62 | xxLockonxx/Bigdata | /Ch02/2-1.py | UTF-8 | 1,055 | 3.046875 | 3 | [] | no_license | """
날짜 : 2020/07/16
이름 : 이성진
내용 : 파이썬 MongoDB 실습하기
"""
from pymongo import MongoClient as mongo
from datetime import datetime as dt
#mongodb 접속
conn = mongo('mongodb://lsj:1234@192.168.100.101:27017')
#db 선택
db = conn.get_database('lsj')
#컬렉션 조회
collections = db.list_collection_names()
#print(collections)
#컬렉션(테이블... | true |
a90ac7e4b848fc22223aae754b3ee0e1e57df843 | TPIOS/LeetCode-cn-solutions | /0664.py | UTF-8 | 698 | 2.90625 | 3 | [] | no_license | class Solution:
def strangePrinter(self, s):
strLength = len(s)
if strLength == 0: return 0
dp = [[float('inf') for i in range(strLength)] for j in range(strLength)]
for i in range(strLength):
dp[i][i] = 1
for i in range(strLength-1, -1, -1):
for j in ... | true |
4d069cee343db896e9afcedb4436828d1874799d | d-becker/dbd | /dbd/default_component_image_builder/cache.py | UTF-8 | 3,465 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
"""
This module contains a class which can be used to query cache locations that depend on the component and configuration.
"""
import logging
from typing import Dict, List, Optional
from pathlib import Path
from dbd.component_config import DistType
class Cache:
"""
A class that can b... | true |
32f906a190e9ba0fae5b960cc096f3f926077bb4 | Aang1993/python_mathesis_course | /code/week3/12_functions/12_1.py | UTF-8 | 768 | 3.59375 | 4 | [] | no_license | # mathesis.cup.gr
# N. Αβούρης: Εισαγωγή στην Python
# Μάθημα 12. Functions
'''12.1 Να κατασκευάσετε συνάρτηση isnum()
που δέχεται στην είσοδο μια συμβολοσειρά και
απαντάει αν είναι αποδεκτός αριθμός ή όχι.
'''
def isnum(n = ''):
if not type(n) is str : return False
print(n)
n = n.strip()
if n.isdigi... | true |
fa6c5167dfeaec4f70460bac61e5f5252d736d46 | aman0864/CWH_1-Python3 | /tutorial 55.py | UTF-8 | 506 | 3.78125 | 4 | [] | no_license | # Date 30-3-2021
class Student:
def __init__(self, fname, lname, previrios_year_precentage):
self.fname = fname
self.lname = lname
self.previrios_year_precentage = previrios_year_precentage
def details(self):
return f"Student first name is {self.fname}\nStudent last na... | true |
3d784c5eecf2d12c23adaa6a71a8ff7dfac16ed2 | Aasthaengg/IBMdataset | /Python_codes/p03229/s005211976.py | UTF-8 | 279 | 2.78125 | 3 | [] | no_license | n=int(input())
a=[int(input()) for _ in range(n)]
a.sort(reverse=True)
if n%2==0:
print(sum(a[:n//2])-sum(a[n//2:])+sum(a[:n//2-1])-sum(a[n//2+1:]))
else:
c=sum(a[:n//2+1])+sum(a[:n//2-1])-2*sum(a[n//2+1:])
d=2*sum(a[:n//2])-sum(a[n//2:])-sum(a[n//2+2:])
print(max(c,d))
| true |
04140dd55512182d240f46f93d7e61140dc896cb | mdmmsrhs/Learning_Python | /ex35.py | UTF-8 | 1,019 | 3 | 3 | [] | no_license | # /usr/bin/python
def do_twice(f):
f()
f()
def do_four(f):
do_twice(f)
do_twice(f)
def do_six(f):
do_twice(f)
do_four(f)
def print_beam():
print '+ - - - -',
def print_post():
print '| ',
def print_beams():
do_twice(print_beam)
print '+'
def print_posts():
d... | true |
3e8f881c3f12f0fc6ad97deb38043e02a558aebc | meeh420/reseedstatus | /ridate/netdb.py | UTF-8 | 4,522 | 2.640625 | 3 | [] | no_license | ##
## Thanks to psi for this python module!
##
import os,sys,struct,time
class _mutnum:
"""
Mutable Number
By Default python numbers are immutable
"""
def __init__(self,val=0):
self.val = val
def inc(self,n):
self.val += n
return self
def dec(self,n):
self... | true |
bcd5d6ff4b5146b7bbe50769bd39b32f4886526b | fp-computer-programming/cycle-2-labs-p22jdiao | /lab_6-1.py | UTF-8 | 220 | 3.734375 | 4 | [] | no_license | # Author: JD 09/21/2021
first_name = input("Please enter your first name: ")
last_name = input("Please enter your last name: ")
full_name = first_name + " " + last_name
print(full_name)
#print(first_name, last_name) | true |
4270f39ec5c26a1038631441087ce69428db9891 | abhishekmishragithub/python2-basic-exercises | /find the word count.py | UTF-8 | 254 | 3.4375 | 3 | [] | no_license | '''
Program to find the total number of times a particular word has repeated
'''
a = 0
with open("C:/Users/Jeri_Dabba/Desktop/test.txt", "r") as m:
for i in m:
if "Bari" in i:
print("true")
a += 1
print(a)
| true |
793c8c55a30067ee5c874b0fdb10a43012b0c494 | liousAlready/P9UI_Tests | /common/excel_utils.py | UTF-8 | 2,044 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2021/8/22 9:36 上午
# @Author : Li
# @Email : m15574933885@163.com
# @File : excel_utils.py
# @Software: PyCharm
# @desc : 读取excel表工具类,底层封装,读取excel表文件后,返回[],[],[]
import os
import xlrd
from common.config_utils import local_config
class ExcelUtils:
"""
先判定是否为excel文件,... | true |
ad7b3b4dfe9c6ac34b1c137565de4e4e2f40c3c0 | MasatoShima/Tutorial-Docker-Kubernetes | /chapter_007_004/app.py | UTF-8 | 2,207 | 2.65625 | 3 | [] | no_license | """
Name: app.py
Description: Sample Application
Created by: Masato Shima
Created on: 2020/01/01
"""
# **************************************************
# ----- Import Library
# **************************************************
import datetime
import responder
# **************************************************
#... | true |
109c45323bbb1694852254d1f5068f598dfa6e2f | daniel-reich/ubiquitous-fiesta | /jgpfraMtc9nrrPZkL_10.py | UTF-8 | 362 | 2.71875 | 3 | [] | no_license |
def switch_gravity_on(lst):
for x in range(len(lst[0])):
count = 0
for y in range(len(lst)):
if lst[y][x]== '#':
count += 1
for i in range(len(lst)):
if count>=1:
lst[-1-i][x] = '#'
count -=1
else:
... | true |
ed8eba9278a7f28fd59706b9699565a6bb2ae1c2 | DimaClaudiu/hover | /hover/core/dataset.py | UTF-8 | 16,607 | 2.546875 | 3 | [] | permissive | """
???+ note "Dataset classes which extend beyond DataFrames."
When we supervise a collection of data, these operations need to be simple:
- transferring data points between subsets
- pulling updates from annotation interfaces
- pushing updates to annotation interfaces
- getting a 2D embe... | true |
9089d149843601a2f3beb3b4447ebd0d709ebac4 | Cody066/School-Python | /gui6.py | UTF-8 | 877 | 3.234375 | 3 | [] | no_license | #!/usr/local/bin/python3
from tkinter import *
window = Tk()
window.geometry('400x400')
window.title("Check out the box")
lbl1 = Label(window, text = "Please check a box and click a button")
lbl1.grid(column = 0 , row = 0)
checkVar1 = StringVar()
check1 = Checkbutton(window, text = "Car", variable = checkVar1)
chec... | true |
8ce295b2667500a428f6089125ce87857e876f21 | jakevdp/BinaryTree | /ball_tree.pyx | UTF-8 | 5,277 | 2.59375 | 3 | [] | no_license | #!python
#cython: boundscheck=False
#cython: wraparound=False
#cython: cdivision=True
__all__ = ['BallTree']
DOC_DICT = {'BinaryTree':'BallTree'}
VALID_METRICS = ['EuclideanDistance', 'SEuclideanDistance',
'ManhattanDistance', 'ChebyshevDistance',
'MinkowskiDistance', 'WMinkowskiDis... | true |
d29cfec44146c811489723b02ee060391b6c1652 | cluelin/WebScraper | /webscraping_basic/17_headlessChrome.py | UTF-8 | 973 | 2.875 | 3 | [] | no_license | import time
from bs4 import BeautifulSoup
from selenium import webdriver
options = webdriver.ChromeOptions()
options.headless = True
options.add_argument("windwo-size = 1920x10800")
browser = webdriver.Chrome(options = options)
browser.maximize_window
url = "https://play.google.com/store/movies/top"
browser.get(ur... | true |
16edf6f2d2f46950068443c3e6411b01aa10dbe1 | aosanya/NCS-tech-problem-1 | /python/src/test/test_utilities.py | UTF-8 | 1,440 | 2.984375 | 3 | [] | no_license | import unittest
import sys
import os
curr_dir = os.path.abspath(os.path.dirname(__file__))
src_dir = os.path.abspath(os.path.join(curr_dir, '../../src'))
sys.path.append(src_dir)
import linklocator
class TestUtilities(unittest.TestCase):
def test_get_distance_x1(self):
print('Test get distance when only x1... | true |
8277da98cafaca2133ecfe848af7c8d218a11eca | apdaza/universidad-ejercicios | /python/lista_apuntador.py | UTF-8 | 604 | 3.75 | 4 | [] | no_license | class Alumno:
nombre = ""
apellido = ""
codigo = ""
notas = []
siguiente = None
def promedio(self):
p=0
cont = 0
for n in self.notas:
p+=n
cont+=1
p/=cont
return p
a = Alumno()
a.nombre = "Juan"
a.apellido = "Diaz"
a.codigo = "123"
a.notas = [2.5,3.0,4.0]
a.siguiente = Alumno()
a.siguiente.no... | true |
87350e5a5c898d99669e06345fd3c0139f592523 | krishna-rawat-hp/PythonProgramming | /codes/breakstring.py | UTF-8 | 87 | 3.109375 | 3 | [] | no_license | str = "python code"
for i in str:
if i == 'c':
break
print(i, end="")
| true |
2af7b0b50959de8d7dfda69cfa8bab29d25ee474 | esther-soyoung/Coding-Challenge | /StackQueue/progess.py | UTF-8 | 610 | 3.046875 | 3 | [] | no_license | import math
def solution(progresses, speeds):
release = []
ret = []
for i in range(len(progresses)):
left = 100 - progresses[i]
days = math.ceil(left / speeds[i])
release.append(days)
for i in range(len(release)):
if release[i] < 0:
continue
... | true |
0e71ce75e435fafc0edef2c802e4d95dfa088610 | otajisan/python_study | /zero_deep_learning/3_neural_network/multidimentional_array.py | UTF-8 | 3,362 | 3.8125 | 4 | [] | no_license | # coding:utf-8
'''
NumPyを使った多次元配列の扱い方
'''
import numpy as np
import matplotlib.pylab as plt
def run_simple():
'''
単純な行列
'''
# 1次元配列
A = np.array([1, 2, 3, 4])
print(np.ndim(A))
print(A.shape)
print(A.shape[0])
# 3 x 2の配列
B = np.array([
[1, 2],
[3, 4],
[... | true |
ff43126b0ac2f7c77c0534e059b728f74f40e7fe | Junaid-Ahmed94/mlops-lab-example-yelp | /src/model.py | UTF-8 | 2,009 | 2.71875 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
import pytorch_lightning as pl
import torch
from pytorch_lightning.metrics.functional import accuracy, auroc
class TextSentiment(pl.LightningModule):
def __init__(self, vocab_size, embed_dim, num_class):
super().__init__()
self.embedding = nn.EmbeddingBag(vocab_size, embed_di... | true |
6420c7b1508fbbebc57043448103924826d573b8 | hanaaa1925/SafeTweet_zenodo | /SafeTweet_zenodo/Implementation/Source Code/unit_test/test7_comment.py | UTF-8 | 2,085 | 2.6875 | 3 | [] | no_license | from selenium import webdriver
import time
import unittest
from selenium.webdriver.common.by import By
# 继承自unittest.TestCase
class testCase7(unittest.TestCase):
# 测试固件 (默认运行)
def setUp(self): # self为类的实例
self.driver = webdriver.Chrome('./chromedriver')
self.url = "http://localhost:8080/"
... | true |
0ee03c1897406110e00d77c511824811c89e259b | ondrno/track-covid19 | /tests/collect/helpers.py | UTF-8 | 1,754 | 3.21875 | 3 | [
"MIT"
] | permissive | from cov19.collect import DataCollector
def assert_if_provinces_have_no_cases_and_deaths(country: DataCollector, data: dict):
"""Check if the data contains all required provinces and that each province has an entry for 'cases' and 'deaths'.
Assert if not."""
for p, p_info in country.provinces.items():
... | true |
48eb6314cfd966d81e2cf6ef536ebb5ecf5f17c7 | drrdrem/Scientific-Computing-Practice | /SOR.py | UTF-8 | 539 | 2.859375 | 3 | [] | no_license | import copy
def SOR(A, b, x0, tol, w):
max_iter = 10000
n = b.shape[0]
x = x0.copy()
iters = 0
while iters < max_iter:
iters += 1
for i in range(n):
kp1_sum = np.dot(A[i, :i], x[:i]) #(20)
k_sum = np.dot(A[i, i+1:], x0[i+1:])
x[i] = (b... | true |
af9b1add0ef79c0c7ebdcdbe331d67d78beb03ef | benpry/resource-rational-goal-pursuit | /code/main/Microworld_experiment.py | UTF-8 | 4,709 | 3.390625 | 3 | [] | no_license | """
This file contains the code for the simulated microworld [expand]
"""
import torch
import numpy as np
from mpmath import *
class Microworld:
"""
Represents a simulated micro-world (SMW) with endogenous variables and exogenous inputs.
"""
def __init__(self, A=None, B=None, init=None, von_mises_par... | true |
237a724ecd95f8b72a7cc9fa075aaff93302e40a | christinapanto/project | /New folder/dmelt/macros/examples/data/root_example.py | UTF-8 | 2,380 | 2.84375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #
# To see the output of this macro, click begin_html <a href="gif/gerrors.gif">here</a>. end_html
#
from ROOT import *
from ROOT import gROOT
from array import array
from math import sin
from array import array
gROOT.Reset()
c1 = TCanvas( 'c1', 'A Simple Graph with error bars', 200, 10, 700, 500 )
c1.SetFillCol... | true |
cf1f218b8e72d8aca622a02cf64f6792584f6495 | AcrobatAHA/URI-Problem-Solving | /URI 1066 Even, Odd, Positive and Negative in python.py | UTF-8 | 468 | 2.96875 | 3 | [] | no_license | A =[int(input()),int(input()),int(input()),int(input()),int(input())]
count=0
c=0
d =0
e = 0
for i in range(0,5):
if A[i]%2==0:
c=c+1
if A[i]%2!=0:
d=d+1
if A[i] > 0:
count = count+1
if A[i]<0:
e = e+1
# else:
... | true |
668345051309624d28881fe20bc8a146ae8d963e | corey33p/sudoku_solver | /sudoku_display.py | UTF-8 | 943 | 2.875 | 3 | [] | no_license | import tkinter as tk
from tkinter import Tk,ttk,Label,Entry,Button,mainloop,Text,Frame,StringVar
import os
from PIL import Image, ImageTk, ImageDraw
from text_window import TextWriter
class Display:
def __init__(self,parent):
self.parent = parent
self.main_font = ("Courier", 22, "bold")
sel... | true |
59fdfeaf8fdef11e3e7d3512e5d9e67e83b94a43 | baldeaguirre/automate_the_boring_stuff | /dictionary.py | UTF-8 | 624 | 3.59375 | 4 | [] | no_license | myCat = {'size': 'fat',
'color': 'gray',
'disposition': 'loud'}
print(myCat['size'], '\n')
print('My cat has ' + myCat['color'] + ' fur.', '\n')
print('size' in myCat)
print('size' not in myCat, '\n')
print(list(myCat.keys()))
print(list(myCat.values()))
print(list(myCat.items()), '\n')
for k in m... | true |
c269be44e37c04d888f0c90a1d3e749d1dcb6e1b | MatGerlach/advent-of-code | /2020/day_4.py | UTF-8 | 1,880 | 2.6875 | 3 | [] | no_license | import re,copy
test_input="""ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm
iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884
hcl:#cfa07d byr:1929
hcl:#ae17e1 iyr:2013
eyr:2024
ecl:brn pid:760753108 byr:1931
hgt:179cm
hcl:#cfa07d eyr:2025 pid:166559648
iyr:2011 ecl:brn hgt:59in
"""
tes... | true |
1a93d0b6ff6c87cccd81b64186a91c771b130093 | YuanYuYuan/MIDP | /nifti2nrrd.py | UTF-8 | 1,582 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
from glob import glob
import os
import nrrd
from scipy import ndimage
import nibabel as nib
from multiprocessing import Pool
from tqdm import tqdm
import argparse
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument(
'--nrrd-dir',
required=True,
help='source dir... | true |
8e4f93f7c885968e61241a52a993e928a5f10ebc | tatsu0626/python-scraping | /ch1/sel-souseki.py | UTF-8 | 336 | 2.75 | 3 | [] | no_license | from bs4 import BeautifulSoup
import urllib.request as req
url="https://www.aozora.gr.jp/index_pages/person148.html"
res=req.urlopen(url)
soup=BeautifulSoup(res,"html.parser")
li_list=soup.select("ol > li")
for li in li_list:
a=li.a
if a !=None:
name=a.string
href=a.attrs["href"]
print... | true |
a02bad3df804f20795910be106b5ebf9cb49c791 | Jeltorotik/GANs | /model.py | UTF-8 | 1,989 | 2.609375 | 3 | [] | no_license | import torch.nn as nn
def init_gan_architecture(latent_size=100, base_size=64, num_channels=3):
G = nn.Sequential(
#(H_in - 1) * stride + kernelSize - 2 * padding
#100 x 1 x 1 -> 1024 x 4 x 4
nn.ConvTranspose2d(latent_size, base_size * 16, kernel_size=6, stride=4, padding=1, bias=False),
... | true |