blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
3076497768f90c283a8d61d7ce27f530b441f318 | Python | Chappie733/MLPack | /networks/activations.py | UTF-8 | 3,552 | 3.09375 | 3 | [
"MIT"
] | permissive | import numpy as np
from numbers import Number
ACTIVATIONS = {}
def parser(func):
def wrapper(x, deriv=False, **kwargs):
if not isinstance(deriv, bool):
raise TypeError("Expected the parameter \'deriv\' to be a boolean, but received {type} instead!".format(type=type(deriv)))
elif not isinstance(x, n... | true |
47818f1cb70c838624badc2eb2a76477ab0dedad | Python | jrivo/prisma-client-py | /tests/test_raw_queries.py | UTF-8 | 4,905 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from prisma import errors, Client
from prisma.models import Post, User
from prisma.partials import PostOnlyPublished
@pytest.mark.asyncio
async def test_query_raw(client: Client) -> None:
"""Standard usage, erroneous query and correct queries"""
with pytest.raises(errors.RawQueryError):
... | true |
1354e9a676840826f45e30c33b8a791b405ef1db | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2984/60697/281306.py | UTF-8 | 263 | 3.390625 | 3 | [] | no_license | str1=input()
str2=input()
if(len(str1)!=len(str2)):
print("1")
else:
if(str1==str2):
print("2")
flag=True
else:
a=str1.upper()
b=str2.upper()
if(a==b):
print("3")
else:
print("4") | true |
7673c437f6e3a1f1a86ce860832be7a531852b6f | Python | medashiva/pybasics | /swapping.py | UTF-8 | 192 | 3.796875 | 4 | [] | no_license | x=input("enter the first number")
y=input("enter the second number")
z=x
x=y
y=z
print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))
| true |
76cdf6cb7d568077963313c61079e0b24f5c0caa | Python | animformed/problem-sets-mit-ocw-6 | /pylab_examples.py | UTF-8 | 1,213 | 3.984375 | 4 | [
"Giftware"
] | permissive | from pylab import *
import random
plot([1, 2, 3, 4]) # when not instructed explicitly, plot assumes x axis from 0 as 0, 1, 2, 3. These four values in list are y values
plot([5, 6, 7, 8])
plot([1, 2, 3, 4],[1, 4, 9, 16]) # with x and y axis values (x, y)
figure() # create a ne... | true |
6d31bfe38b55d59f104c883a7ce32eec67700600 | Python | RelaxedDong/python_base | /面向对象-2/demo-1.py | UTF-8 | 667 | 3.6875 | 4 | [] | no_license | # class Person(object):
# def __init__(self,name,age):
# self.name = name
# self.age = age
#
#
# def say(self):
# p = self.__class__('tanyajuan',20)
# print(p.name,p.age)
# print('my name is %s,age is %d'%(self.name,self.age))
#
# p = Person('donghao',20)
#
# p.say()
# pr... | true |
442ac389f12da4bafbd3fa4a2fef14e0054cb1b3 | Python | markberreth/DataCamp | /Manipulating Time Series Data.py | UTF-8 | 5,382 | 3.703125 | 4 | [] | no_license | '''
Starting new course for time series analysis
'''
# Create the range of dates here
seven_days = pd.date_range(start='2017-1-1', periods=7, freq='D')
# Iterate over the dates and print the number and name of the weekday
for day in seven_days:
print(day.dayofweek, day.weekday_name)
# Inspect data
print(data.in... | true |
67d80e9f6e08c777b363ce0c82c10aabe9387b7d | Python | ITIS-Python/practice-sobolev-2020 | /09_decorators.py | UTF-8 | 731 | 4.1875 | 4 | [] | no_license | # def do_ten(func):
# for i in range(10):
# func()
# def hello_world():
# print('hello world')
# do_ten(hello_world)
###############################
# def do_ten(func):
# def wrapper():
# for i in range(10):
# func()
# return wrapper
# @do_ten
# def hello_world():
# ... | true |
f99f2563a4fc7ac7021fd99f8fa39329c569ba10 | Python | rgreenblatt/Equality-Scoring | /calculator.py | UTF-8 | 1,538 | 3.515625 | 4 | [] | no_license | #cite http://planspace.org/2013/06/21/how-to-calculate-gini-coefficient-from-raw-data-in-python/
import copy
def gini(list_of_values):
sorted_list = sorted(list_of_values)
height, area = 0, 0
for value in sorted_list:
height += value
area += height - value / 2.
fair_area = height * len(list_of_values) / 2.
ret... | true |
34479cc8fedb7ce84af9ca5b95d5648d7e87f75c | Python | alexissitu/alexissitu.github.io | /Testfolder/chatbox.py | UTF-8 | 1,959 | 3.6875 | 4 | [] | no_license | def intro():
print()
print("Hi, welcome to chatbox!")
print("Please talk to me!")
print()
def is_valid_input(answer, listOfResponses):
#if answer is in list of listOfResponses
#return True
#else
#returnFalse
for x in listOfResponses:
if answer in listOfResponses:
... | true |
c25357582d9f339a219e0c11749ad7c28befd77a | Python | kiddays/Covid19-WWIE | /extract_abstracts.py | UTF-8 | 2,347 | 2.703125 | 3 | [] | no_license | import glob, json, jsonlines
import random
from nltk import word_tokenize, sent_tokenize
def jsonl_file_create(glob_list):
x = 0
y = 0
with jsonlines.open('100abstracts.jsonl', mode='a') as writer:
for file in glob_list:
if y == 100:
break
with o... | true |
9821190b068f8a3414fe0ded3f739bdc1f7f30e4 | Python | ivycheung7/Python_Scripts | /funScripts.py | UTF-8 | 3,087 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
#Python 3.5.2
from bs4 import BeautifulSoup
import requests
from PIL import Image, ImageDraw, ImageFont
import random, string
from time import strftime, gmtime
import datetime, time, sys
"Script returns and displays the links to each top trending projects from GitHub."
def displayGithubTrendi... | true |
6b39a18d0c47da945020770a7e6689e7fb2f279b | Python | eschanet/leetcode | /merge-two-sorted-lists/merge-two-sorted-lists.py | UTF-8 | 967 | 3.53125 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
result_list = []
while l1 and l2:
if l1.val <= l2.val:... | true |
228f10e6d2edc2accba41f9f3de4c85fa1c8531a | Python | erjantj/hackerrank | /special-palindrome-again.py | UTF-8 | 669 | 3.171875 | 3 | [] | no_license | def substrCount(n, s):
s = s+'*'
arr = []
row = ['', 0]
polindromes = 0
for i in range(n+1):
c = s[i]
if c == row[0]:
row[1] += 1
if c != row[0]:
if row[0]:
arr.append(row)
row = [c, 1]
for row in arr:
p... | true |
598bcd3c45efedae2e402d4305e11a81e6fd7eb2 | Python | wesreisz/intro_python | /PythonApplication1/11_WorkingWithFiles/_11_WorkingWithFiles.py | UTF-8 | 678 | 3.28125 | 3 | [] | no_license | TITLE = 'Party List to File'
print("-"*40)
print("{:^40}\n".format(TITLE))
print("-"*40)
#constants
FILENAME = "guestlist.csv"
MODE = "w"
OUTPUT_PATTERN="%s,%d\n"
#member varables
names = []
ages = []
while True :
name = input("Input guest name [blank to stop]: ")
if (len(name)<=0) :
break
else ... | true |
7a6741654fabd57ea286ab990fd2f64e489d1b07 | Python | kiteB/Network_Programming | /hw2/5.py | UTF-8 | 343 | 4.03125 | 4 | [] | no_license | # for 루프를 이용하여 다음과 같은 리스트를 생성하라.
# - 0 ~ 49까지의 수로 구성되는 리스트
# - 0 ~ 49까지 수의 제곱으로 구성되는 리스트
import sys
numbers = []
squared_numbers = []
for i in range(50):
numbers.append(i)
squared_numbers.append(i**2)
print(numbers)
print(squared_numbers) | true |
8921104ed97c620eb5c3c4277c5f317548f0f87d | Python | hubert-kompanowski/Natural-Selection-Simulation | /evolution/meal.py | UTF-8 | 417 | 2.90625 | 3 | [
"MIT"
] | permissive | from random import randrange
import pygame
from colors import *
class Meal:
def __init__(self, _screen, map, id_):
self.exist = True
(self.x, self.y) = (randrange(map[0], map[1]), randrange(map[0], map[1]))
self.screen = _screen
self.draw()
self.id = id_
def draw(self)... | true |
7c467281e3f3e898d5828fe421f916f890075f6a | Python | Deepakgarg2309/All_Program_helper | /Python/primeOrComposite.py | UTF-8 | 418 | 4.1875 | 4 | [
"MIT"
] | permissive | userEntry = int(input("Enter a number: "))
if userEntry > 1:
for i in range(2, userEntry):
if userEntry % i == 0:
print(userEntry, "is a Composite Number.")
break
else:
print(userEntry, "is a Prime Number.")
elif userEntry == 0 or userEntry == 1:
print(userEntry, "is... | true |
7120811a1b51c4450c6f6dfd5e10084c38da571d | Python | Santhosh02K/ENLIST-Task-1 | /BEST-ENLIST-ASSIGNMENT.py | UTF-8 | 1,127 | 4.5 | 4 | [] | no_license | # strings
#how to print a value:
print("30 days 30 hour Challenge")
print('30 days 30 hour Challenge')
#Assigning string to variables
Hours = "thirty"
print(Hours)
#indexing using strings
Days = "Thirty days"
print(Days[0])
#How to print the particular character from certain text?
Challenge = "i will win... | true |
d70302192240c7f4f87f80bb29b75d9fccf8dc05 | Python | ashokkumarramajayam/cp1404-assignment1 | /Country.py | UTF-8 | 305 | 2.9375 | 3 | [] | no_license | __author__ = 'Ashok_kumar'
class Country:
def __init__(self, name, code, symbol):
self.name = name;
self.code = code;
self.symbol = symbol;
def __str__(self):
return name + " " + code + " " + symbol;
def currency(self, amount):
return symbol + amount;
| true |
26efa6f5ad20468ca9406818ffcbc12d45a24dc4 | Python | RoseReyes/python | /score-grades.py | UTF-8 | 651 | 3.859375 | 4 | [] | no_license | def scoreGrades():
import random
random_num = 0
for index in range(10):
random_num = random.randint(60,100)
if random_num == 60 or random_num <= 69:
print("Score:",random_num,";","Your grade is","-",'D')
elif random_num == 70 or random_num <= 79:
print("Score:... | true |
f27b55ea9f52b1de012321dc772fa95f880134d3 | Python | takuwaaan/Atcoder_Study | /ABC/ABC93_C.py | UTF-8 | 161 | 2.71875 | 3 | [] | no_license | L = list(map(int, input().split()))
L.sort()
d1 = L[-1] - L[-2]
d2 = L[-1] - d1 - L[0]
if d2 % 2 == 0:
print(d1 + d2 // 2)
else:
print(d1 + d2 // 2 + 2)
| true |
e8d458dd35daf9eee800bd92478175a7aa09aa84 | Python | pandas-dev/pandas | /pandas/tests/tslibs/test_liboffsets.py | UTF-8 | 5,108 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | """
Tests for helper functions in the cython tslibs.offsets
"""
from datetime import datetime
import pytest
from pandas._libs.tslibs.ccalendar import (
get_firstbday,
get_lastbday,
)
import pandas._libs.tslibs.offsets as liboffsets
from pandas._libs.tslibs.offsets import roll_qtrday
from pandas import Timest... | true |
edfecf44f5624e00ff7e52cce6c55f8fba33ee60 | Python | frapa/A11 | /esperienza_1/pendolo100.py | UTF-8 | 2,592 | 2.875 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
from math import *
import csv
import itertools
mpl = False
try:
import matplotlib.pyplot as plt
from matplotlib import rc
mpl = True
except:
pass
def mean(data):
return sum(data) / len(data)
tex = "\\begin{table}\n\t\\begin{tabular} {" + " | ".join(["c c c c c"] * 2) + ... | true |
33078ed60dca9c7300dd66b398b9484d564f8187 | Python | Beovulfo/Python | /modules/utility/field2hdf5.py | UTF-8 | 3,152 | 2.796875 | 3 | [] | no_license | """
Module for converting binary file for field XZ generated by TOFIS_LOMA
into HDF5 compressed file
"""
def field2hdf5(filename):
"""
This function reads the XZ field generated by TOFIS fortran program and
converts it to same filename + .h5, using gzip compression. Furthermore
this new file includes: xvec,zvec,y... | true |
ba27d1e142c62399a60a629a647a36d5096af611 | Python | MatthewJin001/HECalib | /code/script_opt_optandinit.py | UTF-8 | 760 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
For the given data file, optimized distribution of X is unpicked
and compared with the original one
'''
from optimization import optandinit
import params
from helpers import stats
if __name__ == '__main__':
target = 'mean'
datafile = params.datafiles[0]
norms_initial... | true |
db0c8342b5bd2297d90ce55ac19291ca167c8ec1 | Python | Mika-IO/python-skills | /random-things/retorna lista de inteiros ordenados.py | UTF-8 | 319 | 3.34375 | 3 | [] | no_license | def ordenar_inteiros_numa_lista(lista):
for i in range(len(lista)):
lista[i] = int(lista[i])
lista.sort()
return lista
print(ordenar_inteiros_numa_lista([5,4,3,2,1]))
'''
UMA FORMA MAIS EFICIENTE DE ORDENAR AS LISTAS DE NUMEROS DOS EXERCICIOS 16.8 DO GRUPY-SANCA É UTILIZAR ESSA FUNÇÃO
'''
| true |
f51ddb69129804435391c602975917f8b1c87877 | Python | damiansp/completePython | /game/04_creating_visuals/color_utils.py | UTF-8 | 630 | 3.546875 | 4 | [] | no_license | def darken(color, scale):
assert 0 <= scale <= 1, '`scale` must be between 0 and 1'
color = [comp * scale for comp in color]
return color
def scale_color(color, scale):
'''alias for `darken()`'''
return darken(color, scale)
def saturate(color):
color = [min(comp, 255) for comp in color]
... | true |
2926f00bf50495b3eaa76a4c549c3ff028cf1074 | Python | madhubabuv/Path-Finding-Algorithms | /Qlearning.py | UTF-8 | 4,238 | 2.703125 | 3 | [] | no_license | import numpy as np
import cv2
import time
from random import randint
gamma=0.8
iterate=250
actions=8
cur_node=0
Q=[]
top=[0]
bottom=[]
right=[]
left=[0]
pose=[]
count=0
path_cost=[0,10,0,10,0,10,0,10]
img1=cv2.imread('images/example.jpg',-1)
img=cv2.cvtColor(img1,cv2.COLOR_BGR2GRAY)
img = cv2.medianBlur(img1,5)
fra... | true |
ba49726f6ab1c871cf0c1a0f9dfa70990df7cb25 | Python | mintchatzis/Algorithms_from_scratch | /CS core algorithms/Graph_Algos/graph.py | UTF-8 | 4,796 | 4 | 4 | [] | no_license | class Graph():
'''Graph representation using dictionary of sets
connections: list of tuples, eg. ('a','b'), meaning nodes a and b are linked
directed: if True, graph is directed
'''
def __init__(self, connections = None, directed = False):
self.__graph = {}
self.__directed =... | true |
4e4c039d51c5f829e93eb42a4a4fd8d4c0c0a1b4 | Python | dohyunjang/graph-adaptive-activation-functions-gnns | /Utils/graphML.py | UTF-8 | 19,844 | 3.234375 | 3 | [] | no_license | # 2018/11/01~2018/07/12
# Fernando Gama, fgama@seas.upenn.edu.
"""
graphML.py Module for basic GSP and graph machine learning functions.
Functionals
LSIGF: Applies a linear shift-invariant graph filter
Activation Functions - Nonlinearities (nn.Module)
MaxLocalActivation: Creates a localized max activat... | true |
6b5beb64154d47fbb3c45840c9ce13882a8ea367 | Python | kingtheoden/leet-code | /solutions/0001 - Two Sum/two_sum.py | UTF-8 | 372 | 2.859375 | 3 | [] | no_license | class Solution:
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
i = 0
li = []
for i, num in enumerate(nums):
if num in li:
return[li.index(num),i]
else:
... | true |
53a54d3d21ee4ffe0490569f64440f5353aa4630 | Python | thxa/test_python | /python_beyond_basics/Introspection/inspect_test.py | UTF-8 | 1,151 | 3.203125 | 3 | [] | no_license | import inspect
import sorted_set
# from sorted_set is import itertools.chain
from sorted_set import chain
# This is like chain
def chains(*iterables):
# result = (element for it in iterables for element in it)
# return result
for it in iterables:
for element in it:
yield element
def main():
# Is sorted_set... | true |
b18734ab2ce7156f3c35f1f918ef4e68091a63fd | Python | hadim/lsysdrawer | /src/viewer/opengl/utilities/myMath.py | UTF-8 | 7,551 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | #-*- coding: utf-8 -*-
# myMath.py
# Copyright (c) 2011, see AUTHORS
# All rights reserved.
# This file is part of Lsysdrawer.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributions of source code must r... | true |
c94859089bf6b06eb3ab67723b5d080c39499fee | Python | francisamani/pygametrial | /generic_game.py | UTF-8 | 733 | 3.515625 | 4 | [] | no_license | import pygame
# Initialising the module
pygame.init()
# Placing limits to the display using a Tupple
gameDisplay = pygame.display.set_mode((800,600))
# Setting the name of the game
pygame.display.set_caption('Car Chasers')
# Setting the timing of the game
clock = pygame.time.Clock()
# Placing Crashin... | true |
01608a304b6d1ece2983e0f85646ee30da1f2a21 | Python | harry-hao/wormhole | /udp-py/udp/connection.py | UTF-8 | 6,687 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#
# UDP: User Datagram Protocol
#
# Written in 2020 by Moky <albert.moky@gmail.com>
#
# ==============================================================================
# MIT License
#
# Copyright (c) 2020 Albert Moky
#
# Permission is hereby granted, free of charg... | true |
73cc00e6c617a9d6bf512e0a106865ed17fe263d | Python | rajeshvaya/reservoir | /src/src/ReservoirSocket.py | UTF-8 | 5,081 | 2.9375 | 3 | [] | no_license | '''
This is the wrapper for socket class which will contain creation of TCP & UDP sockets and interactions wit the sockets.
It should als maintain the threads for each client connections
'''
import sys
import os
import socket
import threading
import json
import logging
from thread import start_new_thread
from Reserv... | true |
602e4737a93b437f053e3fa0d62e8708fb395bc2 | Python | pdwarkanath/nand2tetris | /projects/06/Solutions/prog.txt | UTF-8 | 2,602 | 2.515625 | 3 | [] | no_license | import json
import re
import os
from argparse import ArgumentParser
ap = ArgumentParser()
ap.add_argument("-f", "--filename", required=True, help="Name of the symbolic machine instructions (.asm) file . eg. Max.asm")
args = vars(ap.parse_args())
asm_file = args['filename']
with open('symbol_table.json') as f:
sy... | true |
81eff7a9e955e2c241e57137168f42cb8aeff77d | Python | PatrickGhadban/DailyCodingProblem | /daily7.py | UTF-8 | 1,418 | 4.0625 | 4 | [] | no_license | '''
* Difficulty: Medium
* Asked by: Facebook
* Problem: Write a function that rotates a list by k elements.
For example, [1, 2, 3, 4, 5, 6] rotated by two becomes
[3, 4, 5, 6, 1, 2].
Try solving this without creating a copy of the list.
How many swap or move operations do you need?
Time Taken: < 10mins
... | true |
ce1c5670e1baaad23680395e957149c2c9e54401 | Python | ianbstewart/catalan | /scripts/experiment_2/experiment_2.py | UTF-8 | 6,810 | 2.515625 | 3 | [] | no_license | """
Hard-coded version of experiment_2.ipynb and experiment_2_addon.ipynb.
"""
from __future__ import division
import pandas as pd
from argparse import ArgumentParser
from scipy.stats import ttest_1samp
import re
import logging
import os
def run_compare_test(tweet_data_1, tweet_data_2):
relevant_users = set(tweet_... | true |
73959121bd47629e9b2107861fd8cb7a8ce2003e | Python | doraemon1293/ZOJ | /2433.py | UTF-8 | 558 | 2.765625 | 3 | [] | no_license | import sys
sys.stdin=open('test.txt','r')
testcases=int(sys.stdin.readline())
for testcase in range(testcases):
sys.stdin.readline()
n=int(sys.stdin.readline().strip())
a=map(int,sys.stdin.readline().strip().split())
a=[0]+a
if n<4:
print 0
else:
mini=sys.maxint
... | true |
983f46fc18435d014eb6759652b64c85f031c25c | Python | Liverworks/Python_dz | /7.formatting_comprehensions/search.py | UTF-8 | 741 | 3.765625 | 4 | [] | no_license | l = [1,4,5,3,6,7,0,2]
def lin_search(l, el):
"""
:param l: list
:param el: element to find
:return: index of element found
"""
for ind, i in enumerate(l):
if i == el:
return ind
def bin_search(l, el, ind=0):
"""
:param l: sorted list
:param el: element to find... | true |
8f3867fd26a0530f2558d203c918aa4b96f08d12 | Python | andrewmr/travellingsalesman | /tsp/importer.py | UTF-8 | 1,942 | 3.03125 | 3 | [] | no_license | import re
from tour import Tour
import logging
from algorithms import utils
logger = logging.getLogger(__name__)
class Importer:
def __init__(self):
self.regex = re.compile("[^a-zA-Z0-9,=]", re.UNICODE)
self.tour_name = ""
self.tour_size = 0
self.tour_nodes = []
self.success = False
def load(self,f):
"... | true |
458d74599132f0957ad58d1b4eda309a165f2852 | Python | Harjacober/CodeforcesSolvedProblems | /ChipsMoving.py | UTF-8 | 293 | 3.484375 | 3 | [] | no_license | import operator
def chipsMoving(n, coord):
zero = 0
one = 0
for i in coord:
if i%2 == 0:
one += 1
else:
zero += 1
return min(one, zero)
n = int(input())
coord = list(map(int, input().split()))
print(chipsMoving(n, coord))
| true |
1c99b4c22b4f821ba8fc04a274231c2f5f8b526e | Python | storopoli/seletivo-lattes | /seletivo-lattes/__init__.py | UTF-8 | 2,825 | 2.875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#importar bibliotecas
import pandas as pd
import requests
from bs4 import BeautifulSoup
from time import sleep
#importar lista e lattes do arquivo listalattes.xlsx
#coluna 0 e link lattes
#coluna 1 e PPG ex GEAS
#caso tenha um PPG com M e D colocar PPG-M ou PPG-D ex PPGA-D
lattes_df = pd.read_... | true |
7fb89940f55140c20d58307188c1539b5ee53303 | Python | cupertinoUsa/michigan-data-science | /network-analysis/wk3/part1.py | UTF-8 | 543 | 2.6875 | 3 | [] | no_license | import networkx as nx
def data():
return nx.read_gml('friendships.gml')
def q1(G):
return \
nx.degree_centrality(G)[100], \
nx.closeness_centrality(G)[100], \
nx.betweenness_centrality(G, normalized=True, endpoints=False)[100]
def q2(G):
return max(nx.degree_centrality(G).items(),... | true |
8f412696a739cf1d9056fefa5bbd2d113fb9a604 | Python | alldatacenter/alldata | /dts/airbyte/airbyte-integrations/connectors/destination-google-sheets/destination_google_sheets/helpers.py | UTF-8 | 2,750 | 2.640625 | 3 | [
"MIT",
"Elastic-2.0",
"Apache-2.0",
"BSD-3-Clause"
] | permissive | #
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import re
from typing import List
from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import ConfiguredAirbyteCatalog
from pygsheets import Spreadsheet, Worksheet
from pygsheets.exceptions import WorksheetNotFound
STREAMS_COUNT_LIMIT = 200
log... | true |
d0160b32b0372de3e5696844d0ed3abdbeaac772 | Python | joshua-who-now/Wumpus-No-Wumpus | /Wumpus-No-Wumpus_(Python)/WorldProperty.py | UTF-8 | 839 | 3.171875 | 3 | [] | no_license | # <SUMMARY>
# J WorldProperty is a class that will be passed into the ValueIteration Algorithm/Function
# Y because Java parameters in functions are pass by value, they are not deep copies therefore
# * changes will not be reflected in parameters if they are modified, therefore we want to create
# * an object to r... | true |
fc97d431fd54ea4515979f4e0f4fa3898196f35f | Python | cvelazquezr/library-naturalness | /analyse_dependencies.py | UTF-8 | 10,937 | 2.53125 | 3 | [] | no_license | import os
import pandas as pd
from pydriller import RepositoryMining
from xml.etree import ElementTree
from tokenizer import TokeNizer
from matplotlib import pyplot as plt
from get_entropy import *
REPOSITORIES_FOLDER = "data/"
def extract_dependencies(pom_file: str):
pom_str = list()
with open(pom_file) a... | true |
7bdee8ea5ee6463f60a5be30f98fc1e657aaae19 | Python | jtrujillo1024/Monty_Hall_Simulation | /Monty_Hall_Simulation.py | UTF-8 | 1,180 | 3.765625 | 4 | [] | no_license | import random
def choose():
return random.randint(1, 3)
def stay_game():
win_door = choose()
chosen_door = choose()
wrong_door = choose()
while wrong_door == win_door or wrong_door == chosen_door:
wrong_door = choose()
if win_door == chosen_door:
return True
... | true |
e6e1ec1916f9ba5215729c9c958e2054a093b590 | Python | jef771/competitive_programming_practice | /code_forces/160A/a.py | UTF-8 | 346 | 3.171875 | 3 | [] | no_license | import sys
def main():
sys.stdin.readline()
money = list(map(int, sys.stdin.readline().split()))
money.sort(reverse = True)
ans = []
for i in range(len(money)):
ans.append(money[i])
if sum(ans) > sum(money[i+1:]):
break
sys.stdout.write(f"{len(ans)}")
if __name__... | true |
e04ef7a8794633ca3452237b3f902ff74dd91851 | Python | tomron27/regex | /models/attention.py | UTF-8 | 7,709 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn.functional as F
from torch import nn
class SumPool(nn.Module):
def __init__(self, factor=2):
super(SumPool, self).__init__()
self.factor = factor
self.avgpool = nn.AvgPool2d(kernel_size=(factor, factor), stride=(factor, factor), padding=(0, 0))
def forward... | true |
979331787eff3f1579da3c347f7bbe66d08202d7 | Python | triquelme/MSc_Bioinformatics_projects | /Algorithmics/factorielle.py | UTF-8 | 102 | 3.46875 | 3 | [] | no_license | def factorielle(n):
if n==1:
return 1
return factorielle(n-1)*n
print(factorielle(3))
| true |
b3c03b0ef0aa240e7e45cdc7865b73d3c3e98e0f | Python | weidler/RLaSpa | /src/representation/network/janus.py | UTF-8 | 2,559 | 3.0625 | 3 | [
"MIT"
] | permissive | import random
import torch
import torch.nn as nn
import torch.optim as optim
class JanusAutoencoder(nn.Module):
def __init__(self, inputNeurons=4, hiddenNeurons=3, outputNeurons=4, actionDim=1):
super(JanusAutoencoder, self).__init__()
self.encoder = nn.Linear(inputNeurons, hiddenNeurons)
... | true |
32053a87ba50cc94f22736f6bad671626bfe65b8 | Python | gwhitaker13/pytest | /war.py | UTF-8 | 3,927 | 4.3125 | 4 | [] | no_license |
"""
# ***War Game***
# War is a card game designed for two players, utilizing a standard (French style) 52-card deck of playing-cards.
# The objective is to capture all the cards in the game before your opponent.
# *Gameplay*
# All cards are shuffled, and then divided equally to each player in face down stacks (one ... | true |
ef0d9b48fce8aafd3069bb6c866e8c6b39779ac6 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2636/60670/290784.py | UTF-8 | 1,609 | 3.15625 | 3 | [] | no_license | # 总路程=dist(A,B)+max{dist(A,C)+dist(B,C)}
# dist(A,B)是树的直径时最大,然后枚举C求最大值
class edge:
def __init__(self,cur,to,value,nextedge):
self.cur=cur
self.to=to
self.value=value
self.nextedge=nextedge
def dfs_dia(x,dist):
global visited,v,maxdist,side1
if dist>maxdist:
maxdist=d... | true |
7808b98852e1aa6a1304b3b58e1b0c3d51af79c4 | Python | YutingYao/my-crap-code | /traProject/utils.py | UTF-8 | 35,908 | 2.578125 | 3 | [
"MIT"
] | permissive | # utils
import heapq
import os
import numpy as np
from numpy.lib import interp
import pandas as pd
from numpy.lib.shape_base import tile
from scipy.stats import norm
from tqdm import tqdm
from shapely.geometry import LineString, Point, Polygon
from shapely.wkt import dumps, loads
def timespan2unix(ti... | true |
94e3b3b76e45c22d48287f23c46a849fcd7e220c | Python | orenkek/MousesOwlsSocialNetwork | /TelegramBotCommand/aboutMeCommand.py | UTF-8 | 1,171 | 2.578125 | 3 | [] | no_license | from telegram import Update
from telegram.ext import CallbackContext, ConversationHandler
import repository
def aboutMe(update: Update, context: CallbackContext) -> None:
userId = update.message.chat_id
owl = repository.getOwl(userId)
if(owl != None):
update.message.reply_text(
'You ar... | true |
d58c86c774178a4e66e0c70e7ea4b82bb1430cf7 | Python | codeprogredire/Python_Coding | /101.py | UTF-8 | 549 | 3.578125 | 4 | [] | no_license | '''
Given an array of n elements. We need to answer q
queries telling the sum of elements in range l to
r in the array.
Prefix sum
'''
from sys import stdin,stdout
n=int(stdin.readline())
arr=list(map(int,stdin.readline().split()))
tot=0
preSum=[]
for i in range(n):
tot+=arr[i]
preSum.append(tot)
q=in... | true |
e2b9ccdefbd0e65773a8876e2bcc64d3bdb45c7c | Python | Knight-zhang/economic | /实验2-久期的计算与应用/Duration.py | UTF-8 | 510 | 2.765625 | 3 | [] | no_license | from scipy import *
def Duration(c,y,f,num_beg,n):
a=1/f
c=100*c
t=num_beg/365
p=0
s=0
for i in range(n-1):
p_i=c*(1+y)**(-t)
p+=p_i
s_i=(c/(1+y)**t)*t
s+=s_i
t+=a
v_pr=(100+c)/(1+y)**t
s_pr=((c+100)/(1+y)**t)*t
p=p+v_pr
s+=... | true |
cf7d6fdf438dad49f336c2ba673e01ce363d6ec5 | Python | mateuszmidor/PythonStudy | /usd-to-pln/main.py | UTF-8 | 441 | 3.359375 | 3 | [] | no_license | import requests
def GetUsdToPlnRate(date):
# Construct the API URL
url = f'https://api.frankfurter.app/{date}?from=USD&to=PLN'
# Send a GET request to the API and parse the JSON response
response = requests.get(url)
data = response.json()
# Extract the exchange rate from the response and retu... | true |
5458d6f1ef2075b3f6b56aae681e329d1e767a94 | Python | derlih/async-fsm | /tests/test_state.py | UTF-8 | 2,370 | 2.828125 | 3 | [
"MIT"
] | permissive | import asyncio
from contextlib import contextmanager
from unittest.mock import MagicMock
import pytest
from async_fsm.exceptions import *
from async_fsm.state import *
async def check_state(state, enter, exit):
assert enter.call_count == 0
assert exit.call_count == 0
for x in range(1, 3):
await ... | true |
0e7faad8b944cdbb4a687fa829fbd98bb33c9edf | Python | praxis001/blackjack | /blackjack project_scheme.py | UTF-8 | 888 | 3.234375 | 3 | [] | no_license | #1 card preparations
#2 money preparations (under construction)
#2 should make the input integer.
#3 distributing cards for the game
#4 card scoring
#5 calculating total score
#6 request for betting
#6 (constructing, should make the input integer.)
#6 (construction needed: the betting money cannot be ... | true |
9033bd5121f4ac31494392f6907fbda07b4f8558 | Python | VoxelPixel/CiphersInPython | /AtBash.py | UTF-8 | 1,786 | 3.84375 | 4 | [
"MIT"
] | permissive | # *********
# -*- Made by VoxelPixel
# -*- For YouTube Tutorial
# -*- https://github.com/VoxelPixel
# -*- Support me on Patreon: https://www.patreon.com/voxelpixel
# *********
def at_encryption():
alpa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
# reversing alphabets of alpa variable
rev_alpa = alpa[::-1]
... | true |
20d760a9cc1697f5b9dad53b174077e82001d18b | Python | DavidZamanian/AutoFill-and-Checkout-for-supreme | /AutoBuySupreme.py | UTF-8 | 2,114 | 2.5625 | 3 | [] | no_license | from selenium import webdriver
from Config_for_supreme import keys
import time
# Add URL and details in the config file #
def timeme(method):
def wrapper(*args, **kw):
startTime = int(round(time.time() * 1000))
result = method(*args, **kw)
endTime = int(round(time.time() * 1000))
... | true |
bbdffb307975afca7c8b5c40fe003c1ae8113c5d | Python | bhuguu/GameSimulator | /Components/Node.py | UTF-8 | 786 | 2.84375 | 3 | [] | no_license | from .InformationSet import InformationSet
class Node:
def __init__(self, info_set_table, player):
self.next_nodes = []
self.player = player
self.info_set = InformationSet(info_set_table, self)
def get_info_set(self):
return self.info_set
def set_info_set(self, info_set):... | true |
bc138e82fe894378594602adb2e1bf2ca021a31e | Python | ChenLaiHong/pythonBase | /test/homework3/10.1.1-文件加减法.py | UTF-8 | 553 | 3.28125 | 3 | [] | no_license |
r = open("jisuan.txt", "r")
f1 = open("jieguo.txt", "w")
# 读写操作
content = r.readlines()
for i in content:
if i == "":
continue
else:
if "+" in i:
temp = i.split("+")
f1.write(str("%0.2f" % (float(temp[0]) + float(temp[1]))) + '\n')
elif "-" in i:
temp... | true |
d2f800ff7daef57f4a33d9cb92078338f006b42f | Python | yiyayiyayoaaa/pygame-alien | /setting.py | UTF-8 | 537 | 2.640625 | 3 | [] | no_license | class Settings(object):
'''存储所有设置的类'''
# 定义画面帧率
def __init__(self):
'''初始化游戏的设置'''
self.FRAME_RATE = 60
self.screen_width = 600
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_speed_factor = 8
self.bullet_speed_factor = 12
... | true |
c5e492f788d03d5a559333a9d064f2ea76f2faa6 | Python | dawdawdo/riddler_battle | /permutations.py | UTF-8 | 612 | 2.9375 | 3 | [] | no_license | # Standard Modules
from itertools import permutations
import logging as log
# User Modules
from cfg import app
@app()
def main():
log.info('Openinig output file...')
with open(r'C:\ProgramData\Scratchwork\permnutations.txt', mode='w') as twr:
log.info('Output file open')
for i, p in en... | true |
b59b5388440e93207e5bd396e54c6efc95fbc75c | Python | santitobon9/Cloud-Cluster-Freeway-Project | /src/query5.py | UTF-8 | 1,472 | 2.8125 | 3 | [] | no_license | from pymongo import MongoClient
from pprint import pprint
import getpass as gp
pw = gp.getpass()
username = "DJs"
password = pw
dbname = "djs-freeway"
uri = "mongodb+srv://" + username + ":" + password + \
"@ccdm-project.f4c6t.mongodb.net/" + dbname + "?retryWrites=true&w=majority"
try:
client = MongoClient(ur... | true |
04ec365679df6ca164891dc8bbfbd6c44840e2c3 | Python | Rahul2706/Python_Exercises | /ex9.py | UTF-8 | 304 | 4.5625 | 5 | [] | no_license | """Temperature of a city in Fahrenheit degrees is input through
the keyboard. Write a program to convert this temperature
into Centigrade degrees.
"""
Fahrenheit = int(input("Enter temp. in Fahrenheit : ")) #(32°F − 32) × 5/9 = 0°C
Centigrade = (Fahrenheit - 32)*(5/9)
print(Centigrade) | true |
d185ed94cf607326f274ac67a7b494b970db9bcf | Python | tnakaicode/jburkardt-python | /subset/rat_to_dec.py | UTF-8 | 3,853 | 2.609375 | 3 | [] | no_license | #! /usr/bin/env python3
#
import numpy as np
import matplotlib.pyplot as plt
import platform
import time
import sys
import os
import math
from mpl_toolkits.mplot3d import Axes3D
from sys import exit
sys.path.append(os.path.join("../"))
from base import plot2d, plotocc
from timestamp.timestamp import timestamp
from i... | true |
0ea6edce0f18487af525ac37989ad6411ac2c98d | Python | naitemach/IT_2ndyearlab | /dsa/lab4/hashtable.py | UTF-8 | 1,348 | 3.6875 | 4 | [] | no_license | class HashTable(object):
def __init__(self):
self.t=[None for i in range(30)]
def insertKey(self,key,value):
val=hashvalue(key)
slot=val%30
if self.t[slot]==None:
self.t[slot]=LinkedList()
self.t[slot].insertAtHead(key,value)
def searchKey(self,key):
value=hashvalue(key)
slot=value%30
temp=self.t[... | true |
bd6dfa44a41b187d2351316df50e1520737cb667 | Python | oywm/LearnCode | /GUI/grid.py | UTF-8 | 495 | 2.96875 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
root = Tk()
Label(root, text='账号:').grid(row=0)
Label(root, text='密码:').grid(row=1)
def callback():
if messagebox._show(message='您好,登陆成功'):
message = e1.get()
print(message)
print('欢迎进入游戏')
e1 = Entry(root)
e1.grid(row=0, column='1')
... | true |
6d94018cc995fa82a646ddecb1a49d36b7c1e8bb | Python | ShirleyMwombe/Training2 | /file detection.py | UTF-8 | 281 | 3.390625 | 3 | [] | no_license | import os
path = 'D:\\Linux\\test'
if os.path.exists(path):
print('That path exits')
if os.path.isfile(path):
print('That is a file')
elif os.path.isdir(path):
print("That is a directory")
else:
print('That location does not exist')
| true |
967c08a27a7277936816b2e37e1f3ba8c5b21769 | Python | furahadamien/Sentiment-Analysis | /analyzer.py | UTF-8 | 4,632 | 2.578125 | 3 | [] | no_license | #import io
from sklearn.datasets import load_files
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from nltk import FreqDist
import numpy as np
from sklearn.linear... | true |
0e02e416a920f06dc514b6aa2f8117233f0f7ecc | Python | cut3my/PythonExe | /coffeemachine/coffeemachine.py | UTF-8 | 805 | 2.984375 | 3 | [] | no_license | from data import MENU, resources
import os
def clear():
if os.name == "nt":
_ = os.system('cls')
def is_rss_suff(order):
for item in order:
if order[item] >= resources[item]:
print(f"Sorry there is not enough {item}")
return False
return True
prof... | true |
d55f0b79f445481c8f9ae97bee130f9b85a16602 | Python | Skycker/opensky_toy_api | /tests/test_api.py | UTF-8 | 1,961 | 2.921875 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import Mock, patch
from requests.exceptions import ConnectionError, Timeout
from opensky_toy_api import AirplaneState, OpenSkyApi, OpenSkyApiException
class TestAirplaneState(unittest.TestCase):
def test_getting_distance_valid(self):
first_point = (54.7800533, 31.85987... | true |
db0588380edf9f48d4bb9153f00b51722c4a285d | Python | lucasfreire017/Desafios_Python | /Exercício Python #115 - Cadastro de pessoas - A/main.py | UTF-8 | 3,119 | 3.390625 | 3 | [
"MIT"
] | permissive | from Desafio_115_a.arquivo import pessoas
from time import sleep
# Tratamento de erro caso o arquivo não exista
try:
arquivo = open('bd/pessoas.txt', 'r', encoding='utf-8')
except FileNotFoundError:
arquivo = open('bd/pessoas.txt', 'w', encoding='utf-8')
arquivo.close()
def titulo(msg, cor=36):
"Exibiçã... | true |
af1c654a0c03c2ed0621c22662b9bf646fbef096 | Python | sidkrishna92/survModels_Insurance | /readPreprocess.py | UTF-8 | 2,033 | 3.0625 | 3 | [] | no_license | import pandas as pd
class readPreprocess():
"""
Read data from Input Files
Pre-process and clean data
"""
def __init__(self, filename):
self.filename = filename
self.data_df = pd.DataFrame()
self.filter_df = pd.DataFrame()
self.read_data()
# self.preprocess... | true |
c3e0d313428da49aea693e39b48d77658cf92163 | Python | Mossata/Car-Go-Vroom-Vroom | /Sprites-Background-Classes.py | UTF-8 | 2,827 | 3.6875 | 4 | [] | no_license | # links:
# https://stackoverflow.com/questions/60387843/having-a-sprite-follow-a-line-of-a-specific-color-pygame
import pygame as pg
#83b925 - number for green
#7f7f7f - number for grey
#Loading Backgrounds
pg.init()
background = pg.transform.smoothscale(pg.image.load("green.png"), (1370,710))
bg_size = back... | true |
ec18908420948b9c8ab3329021ca90287421f1fe | Python | parthpankajtiwary/codeforces | /round287/A.py | UTF-8 | 399 | 2.6875 | 3 | [] | no_license | n, k = map(int, raw_input().split())
a = [int(x) for x in raw_input().split()]
s = [int(x) for x in a]
a.sort()
indices = []
count = 0
sum = 0
indexRemoved = 0
for x in a:
if sum <= k and (sum + x) <= k:
sum += x
count += 1
if s.index(x) not in indices:
indices.append(s.index(x))
s = s[:s.index(x)] + ["#... | true |
a5a4affa934ab66d26c230299a762bb3845da157 | Python | ottogroup/dstoolbox | /dstoolbox/pipeline.py | UTF-8 | 20,835 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | """Extend sklearn's Pipeline and FeatureUnion."""
import itertools
from functools import wraps
import time
import types
import warnings
import numpy as np
import pandas as pd
from scipy import sparse
from sklearn.pipeline import _transform_one
from sklearn.pipeline import _fit_transform_one
from sklearn.pipeline impo... | true |
ab1853170e4604f7fcb87c888f16e537cf8dca5a | Python | youhusky/Facebook_Prepare | /121. Best Time to Buy and Sell Stock.py | UTF-8 | 1,059 | 3.828125 | 4 | [
"MIT"
] | permissive | # Say you have an array for which the ith element is the price of a given stock on day i.
# If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
# Example 1:
# Input: [7, 1, 5, 3, 6, 4]
# Output: 5
# max. differe... | true |
f5dcd0cfa3cb196dac384bffe47f32a5eb744b9c | Python | witalomonteiro/compilador_de_Jogos | /forca.py | UTF-8 | 2,207 | 3.828125 | 4 | [] | no_license | import random
def jogar():
print("\n***************************************")
print("***** Bem-Vindo ao Jogo da Forca ******")
print("***************************************")
palavras = carregar_palavras("palavras.txt")
palavra_secreta = sortear_palavra(palavras)
palavra_dica = cria... | true |
e1086b3f54e9f5d9f3be317fb56e419d9cba19e2 | Python | ag300g/code_review_20180930 | /4/R2F/submission.py | UTF-8 | 14,016 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
'''
Sample submission for 2nd round competition.
'''
import pandas as pd
import numpy as np
# import all modules been used
class UserPolicy:
def __init__(self, initial_inventory, sku_cost):
self.inv = initial_inventory
self.costs = sku_cost
s... | true |
e23aafd5ed87ad7d4bb97b28ed3078feba19bf83 | Python | skywalker0803r/python101-lite | /FBCrawler/fb.py | UTF-8 | 491 | 2.625 | 3 | [] | no_license | import requests
import json
page_id = 'PAGE_ID' # 欲爬取 fans page id
access_token = 'YOUR_ACCESS_TOKEN' # 先到 https://developers.facebook.com/ 註冊一個 app,然後申請 Page Public Content Access 權限,之後可以從 https://developers.facebook.com/tools/explorer 取得 token
limit = 5 # 限制資料筆數
response = requests.get('https://graph.facebook.com... | true |
ec4da3ddff5e4c924afa18a8c1d26d286f528405 | Python | Gnahue/sanFranciscoBiclas | /prediccion/modelo/algoritmo/build_trees.py | UTF-8 | 2,540 | 3.328125 | 3 | [] | no_license | from classes import Tree
from serialization import serialize_tree
from data_import import get_train
from predictions import get_tree_prediction
from predictions import write_csv
import time
import datetime
from data_import import get_test
def build_RF_trees(n, train, target, n_random_columns, max_depth, sample_size):... | true |
03c42c93a4b3af472fd907dc881a4b238427ca9f | Python | crash-bandic00t/python_dev | /1_fourth/basics_python/lesson9/task5.py | UTF-8 | 3,963 | 3.9375 | 4 | [] | no_license | """
Реализуйте базовый класс Car.
при создании класса должны быть переданы атрибуты: color (str), name (str).
реализовать в классе методы: go(speed), stop(), turn(direction),
которые должны изменять состояние машины -
для хранения этих свойств вам понадобятся дополнительные атрибуты - придумайте какие.
добавьте метод... | true |
4f7ae9321026c5ed138ec8d20f15e92422232c1c | Python | cener-1999/thinkPython2 | /p8/practice.py | UTF-8 | 1,918 | 3.703125 | 4 | [] | no_license |
def overturn(string):
index=len(string)-1
while index >=0:
print(string[index])
index=index-1
#overturn('hello_world')
#我滴鬼鬼这也太智能了吧!
def fun_for(string):
for letter in string:
print(letter)
#fun_for('so good')
def duckname(prefixes,suffix):
for letter in prefixes:
... | true |
3b5e976d515249b69084cdccce7e5e7a45993855 | Python | Hadirback/python_algorithms_and_data_structures | /homework_2_pads/task_1_python.py | UTF-8 | 2,172 | 4.25 | 4 | [] | no_license | '''
1. Написать программу, которая будет складывать, вычитать, умножать или делить два числа.
Числа и знак операции вводятся пользователем. После выполнения вычисления программа не завершается,
а запрашивает новые данные для вычислений. Завершение программы должно выполняться при вводе символа
'0' в качеств... | true |
17003c92290b879aa8e3c6e6665ea996770b98ee | Python | naidenovaleksei/kutulu | /world/world.py | UTF-8 | 1,764 | 2.59375 | 3 | [] | no_license | CELL_EMPTY = '.'
CELL_WALL = '#'
CELL_SPAWN = 'w'
SPAWNING = 0
WANDERING = 1
SANITY_LOSS_LONELY = 3
SANITY_LOSS_GROUP = 1
SANITY_LOSS_SPOOKED = 20
WANDERER_SPAWN_TIME = 3
WANDERER_LIFE_TIME = 40
class KutuluWorld():
def __init__(self, fname='map.txt'):
with open(fname, 'r') as f:
... | true |
5d9fe1ac6f9db4a4bf5174d0df9b968e06af5ace | Python | jdotpy/watchtower | /watchtower/bin/worker.py | UTF-8 | 854 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
from watchtower.web import Watchtower
from watchtower.utils import import_class
from datetime import datetime
from pprint import pprint
import time
import sys
class Worker():
def __init__(self, app):
self.app = app
def run(self):
while True:
print('Doing ite... | true |
a2f6bed2c6f5ee60b1279ccca5780ca2a3fa85f3 | Python | Ninjalemur/PortfolioSim | /tests/test_simulator_init.py | UTF-8 | 13,087 | 2.796875 | 3 | [] | no_license | from portfoliosim import __version__
import portfoliosim as ps
import pandas as pd
def test_version():
assert __version__ == '0.1.0'
def test_simulator_check_desired_income_type():
"""
ensure that Simulator flags non float desired income correctly
Only things castable to float should be accepted
"... | true |
01f8d61febf6baa63df67fceb31f6196b9fb5cf1 | Python | akashshegde11/python-practice | /Introduction/dict_3.py | UTF-8 | 269 | 4.65625 | 5 | [] | no_license | # Accessing elements from a dictionary
dict1 = {1: 'Geeks', 'name': 'for', 3: 'Geeks'}
print("Accessing element using a key: ")
print(dict1['name'])
print("Accessing element using a key: ")
print(dict1[1])
print("Accessing element using get: ")
print(dict1.get(3))
| true |
c7a01905abccd90f3ebb92753d03fb8c85138b83 | Python | tushgup/python-basics | /solutions.py | UTF-8 | 2,266 | 4.0625 | 4 | [] | no_license | #
1. Count no of letters and digits
countL = 0;
countD = 0;
for c in "Test123":
if (c.isalpha()):
countL = countL + 1;
else :
countD = countD + 1;
print("No of letters: ", countL);
print("No of digits: ", countD);
#
2. Remove punctuation
import string
s = "It's a good day"
for c in s:
if c ... | true |
971f417417ee4cd01a8a195ec24d33ff6ad9f066 | Python | Erotemic/ubelt | /ubelt/util_zip.py | UTF-8 | 15,415 | 3.3125 | 3 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | """
Abstractions for working with zipfiles and archives
This may be renamed to util_archive in the future.
The :func:`ubelt.split_archive` works with paths that reference a file inside
of an archive (e.g. a zipfile). It splits it into two parts, the full path to
the archive and then the path to the file inside of the... | true |
495f79c3333bf6f087449a0744eaef4bb66dc010 | Python | twarogm/pp1 | /01-TypesAndVariables/Exercises/01-27.py | UTF-8 | 149 | 3.390625 | 3 | [] | no_license | import math
a = int (input("wprowadz 1 liczbe naturalna"))
b = int (input("Wprowadz 2 liczbe naturalna"))
nwd = math.gcd(a,b)
print(f"NWD to {nwd}")
| true |
249baf437ad150a920d4466ee85f85dd3b555112 | Python | zachdj/ultimate-tic-tac-toe | /services/SettingsService.py | UTF-8 | 616 | 2.578125 | 3 | [
"MIT"
] | permissive | """
The Settings singleton keeps track of application-wide settings
"""
# definition of themes
default_theme = {
"path_prefix": "default",
"id": 0,
"name": "Default",
"primary": (117, 64, 160),
"secondary": (61, 189, 73),
"tertiary": (150, 150, 150),
"widget_background": (63, 63, 63),
"... | true |
8433b6f712c83d9455b425a5d3d288dde00b18aa | Python | john-odonnell/csc_212 | /labs/lab11/lab11.py | UTF-8 | 7,704 | 3.8125 | 4 | [] | no_license | import sys
import unittest
class Node:
def __init__(self, key):
self.left: Node = None
self.right: Node = None
self.key: str = key
self.count: int = 1
class BST:
""" Binary Search Tree.
"""
def __init__(self):
self.root: Node = None
self.unique_words:... | true |