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 |
|---|---|---|---|---|---|---|---|---|---|---|
06e47cd96e7ac9aff591c76e39e185bf92654a2a | LarsLKarlsson68/Italian-Dungeons | /mind.py | IBM852 | 8,772 | 2.875 | 3 | [] | no_license | # -*- coding: cp1252 -*-
from verb import verbs, eng_verbs
from phrase import *
mind_verbs= {\
'sperare': {'trans':'hope'},
'avere_paura': {'trans':'fear'},
'rimpiangere': {'trans':'regret', 'perfect':'rimpianto'},
'sospettare':{'trans':'suspect'},
'dubitare':{'trans':'doubt'},
'concludere':{'... | true |
1f656bc107f86ac6c32f3e7ae970f5f1700ff8b6 | CatiGirisim/firsatarabam | /arabam_veri_cekme_kodları_deactive/insert_arabam_data_into_db.py | UTF-8 | 4,283 | 2.6875 | 3 | [] | no_license | """
This module grabs raw data from sahibinden.com.
Error Codes:
Error Code: 600 : Data Grabbing Error - insert_arabam_data_into_db.py
Error Code: 601 : Database periodic insertion error - insert_arabam_data_into_db.py
Error Code: 602 : Database remaining insertion error - insert_arabam_data_into_db.py
Error Code: 603... | true |
68536cd6aeed2cb6930d38811014fa5632a12d12 | piloulac/leetcode | /107.binary_tree_level_orderII.py | UTF-8 | 886 | 3.84375 | 4 | [] | no_license | # Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
#
# For example:
# Given binary tree [3,9,20,null,null,15,7],
# 3
# / \
# 9 20
# / \
# 15 7
# return its bottom-up level order traversal as:
# [
# [1... | true |
dbdfd487112c97c006de7afb89cea5b8b6d04975 | GaloisInc/covid-19 | /sandbox/COVID-19_EWD/oregon-scrape.py | UTF-8 | 1,393 | 2.578125 | 3 | [] | no_license |
import requests
import pandas as pd
import os, errno
from datetime import datetime
import re
today = datetime.date(datetime.now()).strftime("%Y-%m-%d")
directoryName = 'oregon_county_scrapes'
fileName = directoryName + "/" + directoryName + "_" + today + ".csv"
URL = "https://govstatus.egov.com/OR-OHA-COVID-19"
r = ... | true |
92dc4bf054cfc959496b57de16ca204d117f9841 | misaiya99/scipybook2 | /Notebooks/scpy2/tvtk/figure_rectilineargrid.py | UTF-8 | 896 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from mayavi import mlab
from .figure_imagedata import plot_cell
if __name__ == "__main__":
from tvtk.api import tvtk
import numpy as np
x = np.array([0,3,9,15])
y = np.array([0,1,5])
z = np.array([0,2,3])
r = tvtk.RectilinearGrid()
r.x_coordinates = ... | true |
aeada760e3eba0c980dea082f4a5ab47275737bd | wwwwodddd/Zukunft | /leetcode/minimum-absolute-difference.py | UTF-8 | 352 | 2.84375 | 3 | [] | no_license | class Solution:
def minimumAbsDifference(self, a: List[int]) -> List[List[int]]:
a.sort()
d = 9**9
z = []
for i in range(1, len(a)):
if d > a[i] - a[i-1]:
d = a[i] - a[i-1]
z = []
if d == a[i] - a[i-1]:
z.append(... | true |
ec7f7eff34a26fee119e831c0694e0808a9b2017 | lavinomenezes/Curso-python-3-do-zero-ao-avancado | /basico/aula18_strings/aula18.py | UTF-8 | 267 | 3.625 | 4 | [] | no_license | txt = 'o rato roeu a roupa do rei de roma'
tamanho_txt = len(txt)
print(tamanho_txt)
cont = 0
contr = 0
txt2 = ''
while cont < len(txt):
letra = txt[cont]
if letra == 'r':
txt2 += letra.upper()
else:
txt2 += letra
cont += 1
print(txt2) | true |
8bb6294827f551a958092aa1cea1dcc4a8c55d3c | Envinorma/envinorma-data | /envinorma/topics/simple_topics.py | UTF-8 | 3,200 | 2.875 | 3 | [
"MIT"
] | permissive | """Generate very simple topics for AMs."""
import re
from copy import copy
from typing import Counter, List, Optional, Union
from envinorma.models.arrete_ministeriel import ArreteMinisteriel
from envinorma.models.structured_text import Annotations, StructuredText
from envinorma.models.text_elements import Title
from e... | true |
663a42207f03949082c8b4668b0d028e670ce676 | HiKaylum/SpaceX-PY | /spacex_py/cores.py | UTF-8 | 511 | 2.53125 | 3 | [
"MIT"
] | permissive | from ._helpers._api import _get
def get_cores(method="", **query):
"""Gets all core parts based on query strings
Gets all core parts based on query strings
from the API
Parameters
----------
method : str (optional)
the method used for the request
query : keywor... | true |
0836bbb0cca911602b56a72976fd6ad4a0574e41 | jonathf/numpoly | /numpoly/poly_function/derivative.py | UTF-8 | 4,150 | 3.359375 | 3 | [
"BSD-2-Clause"
] | permissive | """Polynomials differentiation functions."""
from __future__ import annotations
from typing import Union
import numpy
import numpoly
from ..baseclass import ndpoly, PolyLike
def derivative(poly: PolyLike, *diffvars: Union[ndpoly, str, int]) -> ndpoly:
"""
Polynomial differential operator.
Args:
... | true |
939a1a1f454aea39c2401e039ed93f589ad2713a | manueldeprada/ComparingBERT | /src/model_tester.py | UTF-8 | 473 | 3.078125 | 3 | [] | no_license | from abc import ABC, abstractmethod
# Abstract class: concrete implementations of the models should override the methods.
class ModelTester(ABC):
def __init__(self, pairs):
"""
:type pairs: pairs that have the form (a,b).
We will return the similarity between a and b.
... | true |
9397a8a6736b08ac83b54a1bf5207883883e9ef4 | peggypan0411/CREST-iMAP | /cresthh/utils.py | UTF-8 | 6,330 | 2.5625 | 3 | [] | no_license | '''
This module stores some toolkits to aid results interpretation
'''
__date__='2020/06/24'
__author__='Allen Zhi Li'
import geopandas as gpd
import pandas as pd
import numpy as np
from cresthh.anuga import SWW_plotter
from netCDF4 import Dataset
def flowAreaCalc(samples, stage):
'''
calculate the lateral f... | true |
ba1cdb0d1bf2c9c2d6784998756c78178b37ffa2 | TryNeo/practica-python | /ejerccios/ejerccio-69.py | UTF-8 | 861 | 3.890625 | 4 | [] | no_license | """Desarrolla un programa el cual permita a un usuario ingresar, vía teclado, la siguiente información:
Nombre
Email
Edad
Código postal
A partir de estos datos el programa deberá crear un archivo .JSON El archivo deberá tener por nombre user.json
Nombre: 'Eduardo Ismael'
Email: 'eduardo78@gmail.com'
Edad: 27
Código P... | true |
af607f36f62436f3e27d445c0527744af3a2fe03 | harshith-1989/python | /BubbleSort.py | UTF-8 | 464 | 4.125 | 4 | [] | no_license | count = 0
def swap(a,b):
a=a+b
b=a-b
a=a-b
return (a,b)
def bubble_sort(array):
swap_happened = False
global count
for i in range(0,len(array)-1):
if array[i] > array[i+1]:
array[i],array[i+1] = swap(array[i],array[i+1])
swap_happened = True
if swap_happe... | true |
d763bc990a9ef557d8c67fc6d7362dccc7de65c2 | yytdfc/redisy | /test.py | UTF-8 | 2,803 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
from redisy import Redisy
from redisy import Converter
r = Redisy(host='localhost', port=6379, db=0)
def test_converter():
c = Converter('json')
assert (c.from_value(1) == '1')
assert (c.from_value(0.44) == '0.44')
assert (c.from_value('hello') == '"hello"')
... | true |
b214237732d5176559e8f7c90a14ca160675e31d | Jeff654/my_machine_learning | /NLP_exercise/基础算法/base_algorithm/sklearn/KNN/plot_classification.py | UTF-8 | 1,207 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn import neighbors, datasets
n_neighbors = 15
iris = datasets.load_iris()
x = iris.data[:, :2]
y = iris.target
# step size in the mesh
h = 0.02
# create color maps
cmap_light = ListedCo... | true |
fa09d4398e18e4202202e5a021ff8f57807eb22d | apoorvvw/Python | /Lab04/.svn/text-base/processReports.py.svn-base | UTF-8 | 5,104 | 2.515625 | 3 | [] | no_license | #! /usr/bin/env python3.4
__author__ = 'ee364e10'
import glob
def generateReportForAllUser():
f = open("users.txt")
directoryUsers = {}
count = 0
for line in f:
if count ==1 or count == 0:
count = count + 1
else:
a = line.split("|")
fullName = a[0]
... | true |
09919a0dabe8bb77f45cf1b2adb53b6c29593b18 | ashishadhikary/Proposal-on-Sentiment-Analysis | /Web Scraping/product detail of sastodeal.py | UTF-8 | 346 | 2.734375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
result=requests.get("https://www.sastodeal.com/ariel-detergent-powder-2kg.html")
print(result.status_code)
src=result.text
soup=BeautifulSoup(src,'lxml')
src1=soup.find('div',class_='product attribute description')
print(src1)
src2=(src1.find('div',class_="value"))
prin... | true |
942b93f158edb81065e9ddc085beda1e6f03f5d6 | everqiujuan/python | /day16/code/06_正则表达式的符号.py | UTF-8 | 2,623 | 3.65625 | 4 | [] | no_license |
import re
# 匹配单个字符
# . : 表示匹配任意单个字符,除了换行
pattern = "go.gle"
str1 = "go5gle"
res = re.search(pattern, str1)
res = re.search("go.gle", "go\ngle") # None
res = re.search("go.gle", "go\ngle", re.S) # 可以匹配到
print(res)
# [] : 表示单个字符的范围
# [abc] : 表示单个字符可以为a或b或c
# [a-z] : 表示a到z中的任意一个,小写字母
# [A-Z] : 表示大写
... | true |
46676dac5bf4b8691d38faca0ef3f9fc68072d72 | z01nl1o02/cs231n-camp | /assignment/assignment1/cs231n/classifiers/softmax.py | UTF-8 | 4,681 | 3.390625 | 3 | [] | no_license | import numpy as np
from random import shuffle
###########################################################
# loss = -log( softmax(x) )
#
#
#
###########################################################
def delta_softmax(softmax_values,idx):
val = softmax_values[idx]
softmax_values = -1*softmax_values * val
... | true |
7fd20d20992a46b3917f9471a72fed181f65862d | avatargu/AID1908 | /2_7_NETWORK_PROJECT/day03/webframe/webframe.py | UTF-8 | 2,788 | 2.890625 | 3 | [] | no_license | """
模拟网站后端应用工作流程
"""
from socket import *
from select import select
import json
from settings import *
from urls import *
# 应用类
class Application:
def __init__(self):
self.rlist = []
self.wlist = []
self.xlist = []
self.host = frame_ip
self.port = frame_port
self.s... | true |
b9711928fde1babec7d6d700430c3a2d4ef44acb | njoy/ENDFtk | /python/test/Test_ENDFtk_MF15_Probability.py | UTF-8 | 3,164 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | # standard imports
import unittest
# third party imports
# local imports
from ENDFtk.MF15 import Probability
class Test_ENDFtk_MF15_Probability( unittest.TestCase ) :
"""Unit test for the Probability class."""
chunk = ( ' 0.000000+0 0.000000+0 0 1 1 2943715 18 \n'
... | true |
bdd8ffd312a477fa3ddfb826e382bbaedb1dd5e0 | shoisaitoh/nlp100_drills | /test58.py | UTF-8 | 2,855 | 2.921875 | 3 | [] | no_license | # !/usr/bin/env python
# coding: utf-8
# python3系で動作
import os # ファイル操作のモジュール
import subprocess # コマンド実行のモジュール
import xml.etree.ElementTree as ET # XMLファイルの解析および作成のモジュール
import pydot_ng as pydot # グラフ描画モジュール
fname = 'nlp.txt'
fname_parsed = 'nlp.txt.xml'
def parse_nlp():
'''
nlp.txtをStanford Core... | true |
4f09dd418d14a30cf2bff5be62065320d18482b6 | jiangm18/leetcode | /Trie/findWords.py | UTF-8 | 1,163 | 3.609375 | 4 | [] | no_license | from Trie import Trie
def findWords(board, words):
res = []
if words == None or len(words) == 0:
return res
trie = Trie()
for word in words:
trie.add(word)
m = len(board)
n = len(board[0])
visited = []
for i in range(m):
visited.append([])
for j in range(... | true |
7a8059c042adb3f2d2a64cf1f043ee6afd439d7e | Deshan-Zhou/D3similarity | /data/deal_dict.py | UTF-8 | 2,407 | 3.515625 | 4 | [] | no_license | #对序列型符号进行分词,我们采用是n-gram的方法,将n个字符作为一个分词单位,用错开一个字符的方法构造出n个子序列
#而某个序列的高维向量表示就是这个子序列的对应向量的平均值。
#对于fasta序列,3个氨基酸可能有特殊的含义,所以一般使用3-gram
#对于smiles序列,这里将单个字符作为一个词
#在这里我们构造smiles序列和fasta序列的词汇表
import pandas as pd
import pickle
smile_gram = 1
fasta_gram = 3
smi_dict_set = set()
fas_dict_set = set()
one_fas_dict_set = set()
smi... | true |
f5f2fdb20130eeef7639b62f5fc182fb195a2c18 | jdelledonne/iX-DP-defect-synthesization | /test.py | UTF-8 | 116 | 3.140625 | 3 | [] | no_license | import random
import numpy as np
first = 1
second = 3
for i in range(50):
print(random.randint(first, second)) | true |
78972f53cdb5c818ed759bc3df07264d7b86a4b9 | striglia/vimap | /vimap/real_worker_routine.py | UTF-8 | 4,579 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | '''
The real worker routine used by vimap.pool. This provides a runnable which
consumes from an input queue, and enqueues results to an output queue.
TODO: Change debug print to use `logging`. This will require some real
testing though...
'''
from __future__ import absolute_import
from __future__ import print_function... | true |
c200e638a81b80311287794a2b048f1cebccfb87 | ototoi/GlassDB | /src/create_table_ohara3.py | UTF-8 | 3,060 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Demonstrate spline interpolation.
"""
import scipy.interpolate
import numpy as np
import matplotlib.pyplot as plt
import sqlite3
def get_valid_list(la, lb):
l = []
for (a, b) in zip(la,lb):
if type(b) is float:
l.append((a, b))
return l
... | true |
4e1c5c76edfcebc06efea749cb459ca0010eede7 | thatKidWithTheBeanie/DonaldDumpSim2017 | /dump.py | UTF-8 | 8,327 | 2.765625 | 3 | [] | no_license | ### copyright Donald Dump Simulator 2017, bananaPi 21/11/17 22:00
### ___ ___ ___
### | _ ) __ _ _ _ __ _ _ _ __ _ | _ \ |_ _|
### | _ \ / _` | | ' \ / _` | | ' \ / _` | | _/ | |
### |___/ \__,_| |_||_| \__,_| |_||_| \__,_| |_| |___|
### ... | true |
be764d02a1dae56dd4f43cc8b843c16d68ccfad2 | nya3jp/aoc2019 | /day11/day11a.py | UTF-8 | 4,774 | 3.015625 | 3 | [] | no_license | import abc
import enum
import typing
from typing import Dict, Iterable, List
class Point(typing.NamedTuple):
x: int
y: int
def __add__(self, other: 'Point') -> 'Point':
return Point(self.x + other.x, self.y + other.y)
def __sub__(self, other: 'Point') -> 'Point':
return Point(self.x ... | true |
c2a5073b565406def11e9878ecf842541f5a67de | Udayraj123/pythonPrac | /tfDos/test.py | UTF-8 | 2,201 | 3.078125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('mnist_data', one_hot=True)
# Enter an interactive TensorFlow Session.
sess = tf.InteractiveSession()
#CNN needs a lot of weights and biases.
# noise in weights for symmetry breaking, and to prevent 0 ... | true |
eaf8e9f116629b9addfad380c923915bf555d91d | shonxg/gunna | /src/gunnar/nodes/vtargetPublisher.py | UTF-8 | 2,868 | 2.625 | 3 | [] | no_license | """
Created on Dec 11, 2016
@author: tsbertalan
twist_to_motors - converts a twist message to motor commands. Needed for navigation stack
Copyright (C) 2012 Jon Stephan.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the ... | true |
577c50a2c7844508dfb431b3bdeba5da905c6b69 | YATHARTHVARDANdtu/Multi-Thread-Client-Server | /b.py | UTF-8 | 6,941 | 2.8125 | 3 | [] | no_license | import socket
import threading
from queue import Queue
IP = socket.gethostbyname(socket.gethostname())
PORT = 5566
ADDR = (IP, PORT)
SIZE = 1024
FORMAT = "utf-8"
DISCONNECT_MSG = "!DISCONNECT"
opponentTurn = "Opponent's Turn"
yourTurn = "Your Turn"
lost = "You Lose"
Win = "You Win"
#available boards ... | true |
4b953f2da0a1b0256f31ba00c06923915c40809f | MapLarge/MapLargeSDK | /python/MapLargeConnector.py | UTF-8 | 7,916 | 2.578125 | 3 | [
"MIT"
] | permissive | import urllib2
import urllib
import urlparse
import json
import mimetypes
import mimetools
class MapLargeConnector(object):
###
# Creates a connection to a MapLarge API server
###
###
# When NO_WEB_CALLS is true all MapLargeConnectors will not make remote
# calls. Instead, the response will b... | true |
4ad114c6c7e75239d18438a3dddee6360321cc80 | KaisChebata/Computing-in-Python-III-Data-Structures-GTx-CS1301xIII-Exercises | /Chapter 4.2 - Strings/Exercises/scramble.py | UTF-8 | 1,422 | 4.84375 | 5 | [] | no_license | #Write a function called "scramble" that accepts a string
#as an argument and returns a new string. The new string
#should start with the last half of the original string
#and end with the first half.
#
#If the length of the string is odd, split the string
#at the floor of the length / 2 (in other words, the second
... | true |
6392c464e126ddbcfa712b27e5c589ed399b681a | leorunwind/algorithms_learning | /sort/heapSort.py | UTF-8 | 2,012 | 3.875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 27 11:05:24 2016
@author: Administrator
"""
import time
def minHeapify(arr,i,heap_size):
#维护一个最小堆,降序排列用
l = 2*i+1#下标i从0开始,因此左孩子节点的下标是2*i+1
r = l + 1#右孩子节点
small = i
if l<heap_size and arr[l]<arr[small]:
small = l
if r<heap_size and arr[r... | true |
0c4969c1c6168e2c4bb2a81a03a5440590ec2f26 | Bennito14/Pagnia_web | /Python programas/proyecto ayuda.py | UTF-8 | 975 | 3.09375 | 3 | [] | no_license | #1erApellido_Nombre_10-X
print("Proyecto de Fundamentos de Eléctronica ----de lo que trata el proyecto-----")
#si queres poner alguna formalidad como bienvenido ponela o cualquier cosa antes de todo recorda que el proyecto debe tener formalidad
#pero no igual al mio aaahh
#hazlo con tu propio estilo
#no hablare para ... | true |
6e9d2823bff1a97cca458aa3107ce3fe018f610d | ozenerdem/HackerRank | /PYTHON/Easy/Find the Runner-Up Score!.py | UTF-8 | 432 | 3.28125 | 3 | [] | no_license | """
Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given n scores. Store them in a list and find the score of the runner-up.
Sample Input 0
5
2 3 6 6 5
Sample Output 0
5
"""
if __name__ == '__main__':
n = int(input())
arr = map(int, ... | true |
78a5ff9118e3fcd7d74d9fda768bbe8367b7833e | pyske/PySke | /pyske/examples/list/regular_sampling_sort_main.py | UTF-8 | 922 | 2.578125 | 3 | [
"BSD-2-Clause"
] | permissive | """
Execution of regular_samping_sort.py
"""
import gc
from pyske.core import Timing
from pyske.examples.list import util
from pyske.examples.list.regular_sampling_sort import pssr, is_sorted
def _main():
size, num_iter, choice = util.standard_parse_command_line()
pyske_list_class = util.select_pyske_list(cho... | true |
f73cc839dc8fab4a3a07edfd5e8a4d46f7c2e422 | bhuber/pyler | /py/primes.py | UTF-8 | 4,629 | 3.65625 | 4 | [] | no_license | #!/usr/local/bin/python
"""
This is a module for dealing with primes
"""
import math
import pdb
class PrimeGenerators(object):
'''
Class for defining generators for prime numbers
'''
_primes = None
def __init__(self):
self._primes = [2]
def __getitem__(self, nth_prime):
... | true |
60e0dfde3e9f35e70d8034dd39b39015327504f5 | au1206/DS-algo_practice | /DataStructures/Trees/BST_insertion.py | UTF-8 | 5,072 | 3.890625 | 4 | [] | no_license | class Node(object):
def __init__(self, value=None):
self.value = value
self.left = None
self.right = None
def set_value(self, value):
self.value = value
def get_value(self):
return self.value
def set_left_child(self, left):
self.left = left
def se... | true |
1953643d544c797f3cc1b81d57d6d2bdc1ede119 | qinger521/Basic_ML_algorithm | /KNN/KNN_regression.py | UTF-8 | 2,153 | 3.734375 | 4 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
'''
使用KNN解决回归问题,使用鸢尾花的前三个属性,预测最后一个属性
'''
data = pd.read_csv(r"iris.arff.csv")
# 删除不需要的列
data = data.drop(["class"],axis=1)
print(data)
# 删除重复行
data.drop_duplicates(inplace=True)
print(data)
# 使用KNN解决回归问题,使用鸢尾花的前三个属性,预... | true |
1679f59b64f43712ec2d5b8bc386852a76653d08 | mission1991/codingtest | /test17(퀵정렬).py | UTF-8 | 607 | 3.90625 | 4 | [] | no_license | '''
기준 데이터를 설정하고 그 기준보다 큰 데이터와 작은 데이터의 위치를 바꾸는 방법
첫 번째 데이터를 기준 데이터로 Pivot 설정합니다.
'''
arr = [7, 5, 9, 0, 3, 1, 6, 2, 4, 8]
def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[0] # 기준!
tail = arr[1:]
left_side = [x for x in tail if x <= pivot]
right_side = [x for x in tail if x >... | true |
b900b78482f1775c7fa48e1751df9881b49990c9 | exequit/pokemon_map | /pokemon_entities/models.py | UTF-8 | 4,115 | 3.234375 | 3 | [] | no_license | from django.db import models
class PokemonElementType(models.Model):
"""The PokemonElementType object contains pokemon element types and their characteristic features.
The PokemonElementType model uses for containing pokemon element types with their features like name,
image and info about which element... | true |
abb8df267b0d0a18f8c5f055bf3a202f05f9008a | MisaelAugusto/computer-science | /programming-laboratory-I/n4zo/investimento.py | UTF-8 | 358 | 3.546875 | 4 | [
"MIT"
] | permissive | # coding: utf-8
# Aluno: Misael Augusto
# Matrícula: 117110525
# Problema: Fundo de Investimento
saldo = 0
n = 0
while True:
valor = float(raw_input())
saldo += valor
n += 1
media = saldo / n
if valor < media:
saldo -= valor
media = saldo / (n - 1)
break
print "Saldo total do FIS: R$%.2f." % saldo
print "... | true |
bc5b970c518f05a0dda57684d18cd521aff280a3 | xrw560/learn-pyspark | /basic_python/object/Turtle.py | UTF-8 | 821 | 3.984375 | 4 | [] | no_license | #!/usr/bin/python
# -*- encoding:utf-8 -*-
"""
@author: zhouning
@file:Turtle.py
@time:2018/4/10 20:11
"""
"""
self:相当于C++中的指针,对象自身
__init__(self):构造方法
公有和私有:对象的属性和方法默认是公有的
在Python中定义私有变量只需要在变量名或函数名前加上“__”两个下划线,那么这个函数或变量就会为私有的了
_类名__属性名:可以访问私有属性
"""
class Turtle: # Python中的类名约定以大写字母开头
""""关于类... | true |
aded8956c02344494c78dcbb36bd3bd403d91d53 | streefje1996/Knn | /main.py | UTF-8 | 1,826 | 2.828125 | 3 | [] | no_license | import numpy as np
data = np.genfromtxt('dataset1.csv', delimiter=';', usecols=[0,1,2,3,4,5,6,7], converters={5: lambda s: 0 if s == b"-1" else float(s), 7: lambda s: 0 if s == b"-1" else float(s)})
validation = np.genfromtxt('validation1.csv', delimiter=';', usecols=[0,1,2,3,4,5,6,7], converters={5: lambda s: 0 ... | true |
3090adfb93269354540fef5373966e722872a83e | goocci/Learn_Python | /LearnPython/test/set.py | UTF-8 | 1,913 | 4.4375 | 4 | [] | no_license | '''
집합(sets) : set()
'''
ss = set(['a', 'b', 'c'])
print(ss)
ss = set([1,2,3])
print(ss)
ss = set("Good Morning")
print(ss)
# 집합의 특징 : - 중복을 허용하지 않는다.(중복을 제거하기위한 필터로 활용되기 한다.)
# - 순서가 없다.
# 리스트 튜플은 순서가 있다. 따라서 인덱싱을 이용하여 값을 얻어올 수 있다.
# 집합은 순서가 없기 때문에 인덱싱으로 값을 얻어올 수 없다. 딕셔너리 역시 순서가 없는 자료형이다.
# 집합과 딕셔너... | true |
45f219f913c7ee783b8963385f9577b45d51ba8e | neuroph12/Mindblocks2.0 | /Mindblocks/default_component_types/file_readers/csv_reader.py | UTF-8 | 2,218 | 2.640625 | 3 | [
"MIT"
] | permissive | from Mindblocks.model.component_type.component_type_model import ComponentTypeModel
from Mindblocks.model.execution_graph.execution_component_value_model import ExecutionComponentValueModel
from Mindblocks.model.value_type.soft_tensor.soft_tensor_type_model import SoftTensorTypeModel
class CsvReader(ComponentTypeMode... | true |
7c2e4856e04fcbf0f93e0a23d0bb855d08b1143f | sakoPO/bommerge | /bommerge/partnameDecoder/capacitors.py | UTF-8 | 2,494 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | import re
from components import capacitor
from decimal import *
from partnameDecoder import capacitors_murata
def capacitanceStringToFarads(string):
value = Decimal(string[:2])
mul = Decimal(string[2])
return value * Decimal('10')**mul * Decimal('10')**Decimal('-12')
def kemet(partname):
voltage... | true |
e25c5ce7cab1761659ae1543309e2658e331eff4 | StephenAjayi/learning_py1 | /custom_functions.py | UTF-8 | 85 | 3.21875 | 3 | [] | no_license | def add_two_numbers(a, b):
"""This function adds two numbers"""
return a + b
| true |
a910d3ab24f8f3a86bf98e446b676364fa343543 | PreranaPandit/HelloWorld | /mathoperators.py | UTF-8 | 1,949 | 4.4375 | 4 | [] | no_license | import math
# print(math.ceil(2.9))
# print(math.floor(2.9))
# If condition
# is_hot = True
#
# if is_hot:
# print("It's a hot day")
# print("Drink plenty of water")
# else:
# print("It's a cold day")
# print("Wear warm clothes")
# print("Enjoy your day")
# # if, elif, else
#
# is_hot = True
... | true |
a7fd799d6ab8dc04e2b660514bd19c2a634ee6b9 | suedeyang/newmypython | /13-4-攝影機抓圖前後比對.py | UTF-8 | 611 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 15:50:40 2020
@author: suedeyang
"""
import cv2
cap=cv2.VideoCapture(0)
img_pre=None
while cap.isOpened():
success,img=cap.read()
if success:
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)#灰階處理
img_now=cv2.GaussianBlur(gray,(13,13),15) #高斯模糊
... | true |
50c604a6a4d2208afa62ba3e213ba526bd0dd545 | xinsec/python_programming | /dummy code/robot.py | UTF-8 | 743 | 3.703125 | 4 | [] | no_license | class Robot(object):
'Sophisticated class that moves a robot'
def fetch(self, tool):
print('Physical movement! fetching')
def moveForward(self, tool):
print('Physical movement! Moving forward.')
def moveBackward(self, tool):
print('Physical movement! Moving backward.')
def re... | true |
d7aea670bd8931737755bbce9aefb891d386513e | lvreynoso/hackerrank | /new-year-chaos/nyc.py | UTF-8 | 1,541 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the minimumBribes function below.
def minimumBribes(q):
numberOfBribes = 0
chaotic = False
sortExhausted = False
bribeMap = {}
while not sortExhausted:
sortExhausted = True
for index in range(len(q)... | true |
1b2dbe7154c4d39f7f5a5f5bd9f1c338a44e0482 | Reego/quidem | /app/tests/unit/test_quidem_support.py | UTF-8 | 1,345 | 2.734375 | 3 | [] | no_license | import pytest
import math
from ...quidem import UserVisibility, VotingAlgorithm
class TestUserVisibility:
def test(self):
assert UserVisibility.visible_to_all is not None
assert UserVisibility.visible_to_author is not None
assert UserVisibility.anonymous is not None
class TestVotingAlgo... | true |
9cb1c54755ee962caeaeeeee57545d352538f3c5 | CorentinChanet/Radix_Project | /parsing/flair_ner.py | UTF-8 | 1,636 | 2.734375 | 3 | [] | no_license | from flair.data import Sentence
def _extract_persons(text, tagger):
text = " ".join(text.strip().split()[:50])
sentence = Sentence(text)
tagger.predict(sentence)
names = []
name_parts = []
chunks = sentence.to_tagged_string().split()
for i, chunk in enumerate(chunks):
if '<S-P... | true |
2a98e0c0d46904479a8ba9ba280c9f4f4c4e5fb5 | UltimateTimmeh/r-daily-programmer | /dailyprogrammer/challenges/021e.py | UTF-8 | 3,876 | 3.9375 | 4 | [] | no_license | #!/usr/bin/python3
"""
Information
-----------
.. _reddit: http://www.reddit.com/r/dailyprogrammer/comments/qp3ub/392012_challenge_21_easy/
.. _source: https://github.com/UltimateTimmeh/r-daily-programmer/blob/master/dailyprogrammer/challenges/021e.py
| **Challenge name:** Next Permutation (reddit_, source_)
| **Cha... | true |
8d9a72fff167f5b4a3262a2ffc05410ba9e0709c | Priyamsh/Hybrid-Recommender-System | /Hybridmodel.py | UTF-8 | 1,492 | 2.6875 | 3 | [] | no_license | from LatentRecommendation import LatentRecommendation
from CollaborativeRecommendation import CollaborativeRecommendation
import pandas as pd
import datetime
class Hybridmodel:
def __init__(self,user,top_n,filename,datasize):
print(datetime.datetime.now())
Latent1=LatentRecommendation(user,top_n,f... | true |
8bfd1ebef571dd2d392d17b520af1696b3357520 | mboles01/Realestate | /Old/elevation.py | UTF-8 | 2,700 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 15:28:37 2019
@author: BolesMi
"""
# set up working directory
import os
#os.chdir('/Users/michaelboles/Michael/Coding/2019/Realestate') # Mac
os.chdir('C:\\Users\\bolesmi\\Lam\\Coding\\Python\\2019\\Realestate') # PC
# import packages
import pandas as pd
import reque... | true |
faefbff9b41459a995c34aec28d1d0bf699f76ff | bobhilt/studies_vscode | /test1.py | UTF-8 | 299 | 2.71875 | 3 | [
"MIT"
] | permissive | import unittest
import inc_dec
class Test_TestIncrementDecrement(unittest.TestCase):
def test_increment(self):
self.assertEquals(inc_dec.increment(3), 4)
def test_decrement(self):
self.assertEquals(inc_dec.decrement(3), 4)
if __name__ == '__main__':
unittest.main()
| true |
51ba6829c29e70e46bafabe5c210555200c90c36 | qichenglao/CliNER | /cliner/features_dir/umls_dir/umls_features.py | UTF-8 | 4,641 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | ######################################################################
# CliCon - umls_features.py #
# #
# Willie Boag wboag@cs.uml.edu #
# ... | true |
25d6bfb290e844322dc0faa2b5d72e2982863bec | giopina/udpclust | /UDPClust.py | UTF-8 | 24,512 | 2.640625 | 3 | [] | no_license | #######################################################################
### This Class performs the unsupervised density peak clustering ###
### as described in ###
### D'Errico, Facco, Laio, Rodriguez, pending pubblication, 201? ###
### ... | true |
7fdaebf5c61fd316ea01774b12c6ac78d97ba8b6 | Harshin1/Python-and-DL | /ICP/ICP6/RBFKernelSVM.py | UTF-8 | 369 | 3.15625 | 3 | [] | no_license | from sklearn.svm import SVC
from sklearn import datasets
# Loading the dataset
irisdataset = datasets.load_iris()
# getting the data and response of the dataset
x = irisdataset.data
y = irisdataset.target
# fitting RBF kernel SVM
model = SVC(kernel='rbf', C=1, gamma=2)
model.fit(x, y)
print(model.predict([[7, 2,... | true |
1218fc77d4341be4c894deac9058801c2f4ae50f | PavelKolev/exercises | /dynamic_programming/max_mtx_path.py | UTF-8 | 1,399 | 3.53125 | 4 | [] | no_license |
# https://www.geeksforgeeks.org/maximum-path-sum-matrix/
def get_Neighbours(i, j, m, n):
# Left, Up, Right, Down
L = [(i,j-1), (i-1,j), (i,j+1), ((i+1,j))]
R = [(x,y) for x,y in L if x >= 0 and x <= m-1 and y >= 0 and y <= n-1]
return R
def dfs(A, P, D, i, j, m, n):
if D[i][j] >= 0:
return
N = get_N... | true |
8890d144dc5e1004bc1d69b5e8df7a33263e57bd | windavid/return_to_fixup | /examples/demo_bf.py | UTF-8 | 11,983 | 2.515625 | 3 | [] | no_license | """
This is an example usage of return_to_fixup technique
Copyright (C) 2016-2017 WindAvid
Join us now, share software,
You'll be a free hacker!
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either... | true |
3f4084f2258e4c6fab498c02eed7a87be47f9b86 | Matmatix/Weather-Data-Storage | /dataObj.py | UTF-8 | 220 | 3.015625 | 3 | [] | no_license | class DataObj:
def __init__(self, key, data):
#check key is int
self.key = key
self.data = data
def getKey(self):
return self.key
def getData(self):
return self.data | true |
5a0d686759ccd48aa2d86e4083dbe2fa42cdb578 | jasonkimprojects/rosalind-challenge | /INI3.py | UTF-8 | 557 | 2.890625 | 3 | [] | no_license | # Copyright 2019 Jason Kim. All rights reserved.
# INI3.py
# My solution to INI3 of the Rosalind Project.
# Jason Kim
# 7/23/2019
def main():
file = open("rosalind_ini3.txt", "r")
contents = file.readlines()
msg = contents[0]
indices = contents[1].split(' ')
start_first = int(indices[0])
end_f... | true |
c82a183b4987a3a0c25c6a51cf67783f06c9b280 | horrorclause/rosalindGC | /rosalindGC.py | UTF-8 | 817 | 3.265625 | 3 | [] | no_license | import re
def gcCount():
info=input('file location:')
data = open(info, 'r')
text = data.read()
text = text.replace('\n','')
taxonRegex= re.compile(r'(Rosalind[_]\d+)')
taxonInfo = taxonRegex.findall(text)
gcRegex = re.compile(r'Rosalind[_]\d+(\w+)')
gcInfo = gcRegex.fin... | true |
86bb14194f4831da2021a65a827a2dc70388b2c5 | TheGenocides/Whitehat | /whitehat/port_scanner.py | UTF-8 | 477 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | import socket
class port:
def __init__(self, IP: str, PORT: int):
self.IP = IP
self.PORT = PORT
def scan(self):
IP = self.IP
PORT = self.PORT
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(10)
def scan(PORT):
if s.con... | true |
2f8d5a524ba6b9ffa3ef392b16f7ff1f89fdc8c6 | rebootl/advent-of-code-2018 | /day2.py | UTF-8 | 1,748 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python
#
#
with open('day2-input.txt', 'r') as f:
lines = [ l.strip() for l in list(f) ]
#
#lines = '''abcdef
#bababc
#abbcde
#abcccd
#aabcdd
#abcdee
#ababab'''
#lines = lines.splitlines()
# example res.: 12
lines_ = '''abcde
fghij
klmno
pqrst
fguij
axcye
wvxyz'''
lines_ = lines_.splitlines()
# exampl... | true |
937cc8ca69bfc4435986ee09a293534073ba4243 | zeth/magpy | /magpy/server/config.py | UTF-8 | 2,238 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | """Read the magpy configuration file."""
import os
import re
import json
from copy import deepcopy
from magpy.server.utils import get_mag_path, make_cookie_secret
# Regular expression for comments
COMMENT_RE = re.compile(
r'(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?',
re.DOTALL | re.MULTILINE
)
class ... | true |
384a458d69b0e2ae08b80910b47478f77e523f6c | Cactusson/rain | /data/states/high_score.py | UTF-8 | 5,520 | 2.84375 | 3 | [] | no_license | import random
import pickle
import pygame as pg
from .. import prepare, tools
from ..components.label import Label
from ..components.button import Button
from ..components.empty_drop import EmptyDrop
class HighScore(tools._State):
"""
Screen with high score. Saves score and loads it using pickle.
"""
... | true |
44ee470dbd1c657bb5b0892b424936f337f8cd12 | samgoodgame/skills-1 | /sandbox/selenium/helperP3.py | UTF-8 | 13,206 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 13 21:12:30 2016
@author: Diego
"""
from selenium import webdriver
#from bs4 import BeautifulSoup # For HTML parsing
from time import sleep # To prevent overwhelming the server between connections
from collections import Counter # Keep track of our term counts
from nltk.c... | true |
ad4fa5dd1efa89e6a3b22a976570f0a9c7f144fa | bobleegogogo/building_height | /download_mapillary/utils/grab_utils.py | UTF-8 | 8,335 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
import os
import MySQLdb
import time
import datetime
from dateutil import parser as dp
config_path = "./config/"
datetime_format = '%Y-%m-%d %H:%M:%S'
def grab_area(lat_min, lat_max, lon_min, lon_max):
'''
根据输入的坐标范围生成抓取点阵
:param lat_min:
:param lat_max:
:param... | true |
254003b3f6fa2a4ccf4c3f1b52e986a05cdca50d | RookieLinLucy666/Codewar | /Human readable duration format.py | UTF-8 | 1,000 | 3.3125 | 3 | [] | no_license | def format_duration(seconds):
if seconds == 0:
return "now"
else:
m, s = divmod(seconds, 60)
h, m = divmod(m, 60)
d, h = divmod(h, 24)
y, d = divmod(d, 365)
result = [y, d, h, m, s]
title = ['year','day','hour','minute','second']
sentence = []
... | true |
4dbd1bf734c78cfe12696b9ac90ad107a72e97cd | chrisdl/bowling-game-kata | /bowling_game.py | UTF-8 | 2,258 | 3.65625 | 4 | [] | no_license | class Game(object):
'''
This describes a game of bowling.
'''
frames = []
current_frame = []
def __init__(self):
self.current_frame = []
self.frames = []
def frame_total(self):
return sum(self.current_frame)
def _frame_done(self):
return (self.is_strike... | true |
6057696dfef469db67048835c9ebc42f87af5ab4 | PtspluS/Jeu_Python | /src/Game_Object/Objets/Item.py | UTF-8 | 263 | 2.59375 | 3 | [] | no_license | from src.Game_Object.Objets import Objet
class Item(Objet.Objet):
def __init__(self, name, image, value):
self.image = image
self.name = name
self.value = value
def use(self):
pass
def describe(self):
pass
| true |
c6d30d97e6d14df2e0862bf5d3e7928e20c310a4 | terchiem/Cracking-the-Coding-Interview-Python | /01 - Arrays and Strings/1-8 zero_matrix.py | UTF-8 | 915 | 4.09375 | 4 | [] | no_license | """
Zero Matrix: Write an algorithm such that if an element in an MxN matrix is 0,
its entire row and column are set to 0.
"""
def zero_matrix(matrix):
"""Returns the input matrix where if an element is 0, its entire row and
column are set to 0.
>>> zero_matrix([[1,1,0],[1,1,1],[1,1,1]])
[[0, 0, 0], ... | true |
e4a6f924056974ed1d4eff0bd7bd6e976e284486 | spgeise/Restaurant-Selector | /Main.py | UTF-8 | 4,964 | 3.140625 | 3 | [] | no_license | from Files.GetRestaurants import RestaurantList
import time, sys, os
from random import randint
rest_dict = {}
final_options = []
def select_restaurants():
x = list(map(int, input("Make your selections: ").split()))
print('\n')
for i in x:
print(rest_dict[i])
final_options.... | true |
b0c1c5eb379d2533fbdd7de57a30e2eec9532803 | yikkin/personal_code | /machine_learning_school/exercices_sklearn.py | UTF-8 | 1,525 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 23 16:14:46 2016
@author: etu2016
"""
print(__doc__)
#importation de donnees
from sklearn import datasets
from sklearn.svm import SVC
from sklearn.grid_search import GridSearchCV
import numpy as np
import matplotlib.pyplot as plt
iris_data = datasets.load_i... | true |
991de5e5b875e563c11a60da3bf4bb1d191f162d | dalfast/instanon | /instanon.py | UTF-8 | 13,414 | 2.890625 | 3 | [
"MIT"
] | permissive | import os
import re
import shutil
from datetime import datetime
from html import unescape
from sys import exit
from urllib.parse import urlparse
import click
import requests
import urllib3
from bs4 import BeautifulSoup
from urllib3.exceptions import InsecureRequestWarning
class Directories:
"""Contains path in... | true |
62efdbca13c70fa04a0bac42f9ac2ea053416af0 | cbedroid/pydatpiff | /vercontrol.py | UTF-8 | 675 | 3.078125 | 3 | [
"MIT"
] | permissive | # Control the version numbering for git repo
import re
from subprocess import check_output
def getVersion():
try:
version_re_format = "(v\d\.\d\.\d)"
version = check_output("git tag", shell=True).decode("utf8").strip()
if version:
version = version.split("\n")[-1]
retu... | true |
c6e61037d8b1dd17e23fe33df2e0f111afdfbf42 | aaryajoc/ML_Scikit | /optimal_plot.py | UTF-8 | 2,212 | 2.828125 | 3 | [] | no_license | from sklearn.datasets import make_moons, make_blobs
import pandas as pd
import numpy as np
from sklearn import svm
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import cross_val_score
import matplotlib.pyplot as plt... | true |
c52511cb97e7e0ef680a3afebfd6776305fc5c81 | alex-rantos/StreamingSystemsEvaluation | /src/my_db.py | UTF-8 | 1,967 | 3.078125 | 3 | [] | no_license | import csv
import re
import ntpath
import settings
from typing import List
class MyDB():
EXTENSION = "_"
valid_query_names = settings.VALID_QUERIES_NAMES
def __init__(self, extension=""):
if extension != "": self.EXTENSION += extension
def store(self, identifier: str, data: List[str], mode... | true |
8552aff663e2494bb0c54435d713de262e8437ee | gbertagna/Python-sorting-list-of-movies | /pscript.py | UTF-8 | 1,016 | 3.1875 | 3 | [] | no_license | #!/usr/bin/python3.5
import pandas as pd
#import math
Film_fields = ['Year', 'Length', 'Title', 'Director']
Film_df = pd.read_csv('Film.csv',skipinitialspace=True, usecols=Film_fields, encoding = "ISO-8859-1")
Movie_fields = ['Year', 'Length', 'Title', 'budget', 'rating', 'Action', 'Animation', 'Comedy', 'Drama', 'Doc... | true |
93520fb1ea0381a8bb85244b3fa09c772912ca83 | Denrur/ecs_turn_based | /systems/map_processor.py | UTF-8 | 3,444 | 2.78125 | 3 | [] | no_license | import utils.esper as esper
from utils.noise_map import make_noise_map
from utils.layers import Layers
import itertools
from random import randint
from collections import defaultdict
from components.game_map import GameMap
from components.position import Position
from components.renderable import Renderable
from compon... | true |
831ad707fe1d1314cb4e71fc81f5f83060ed6a32 | victor20/woocommerce-rest-handler | /WooCommUpload/Upload/Model/remote_product.py | UTF-8 | 2,309 | 2.515625 | 3 | [] | no_license | class RemoteProduct:
def __init__(self,
*,
supplier_product_id,
remote_product_id,
remote_category_id,
product_name,
product_description,
remote_image_ids,
product_out_price):
... | true |
249c269b1b68a5bb5092950f6cbe0754dc709060 | Interesting6/FuckLeetCode | /225.用队列实现栈.py | UTF-8 | 1,865 | 3.65625 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=225 lang=python3
#
# [225] 用队列实现栈
#
# @lc code=start
class MyStack:
def __init__(self):
"""
Initialize your data structure here.
"""
self.queue1 = []
self.queue2 = []
def push(self, x: int) -> None:
"""
Push element x onto st... | true |
d38246b2d8b9d67cd5686b6ff5f6571b038a4cff | dondillonjr/MyPythonProject | /sshToUbuntuWorks.py | UTF-8 | 1,591 | 2.90625 | 3 | [] | no_license | import paramiko
import time
############# LINUX TO UBUNTU
# Call paramiko.SSHClient() to create a new SSHClient.
# Call paramiko.SSHClient.set_missing_host_key_policy(policy)
# with policy as paramiko.AutoAddPolicy() to allow the
# Python script to SSH to a remote server with unknown SSH keys.
#
# Call paramiko.SSHClie... | true |
4dd161d55b27c09723ca75d3d40618e90ebaa8be | Yackpott/public | /Yackpott-repo/Actividades/AC10/singleton.py | UTF-8 | 517 | 3.8125 | 4 | [] | no_license | class Singleton(type):
dicc = dict()
def __call__(cls, *args, **kwargs):
if cls not in Singleton.dicc:
Singleton.dicc[cls] = super().__call__(*args, **kwargs)
return Singleton.dicc[cls]
if __name__ == '__main__':
class A(metaclass=Singleton):
def __init__(self, value):... | true |
ee223fd09f6e1c5e430264f27b746f8744d5c774 | DanisovszkyErik/PythonBasics | /helloworld.py | UTF-8 | 245 | 3.0625 | 3 | [] | no_license | print('Hello, World!')
print(1+2)
print(7*6)
print()
print("The end","or is it", "keep watching to learn more abut Python",3)
print("Macsó ha véletlen olvasnád ezt akkor tudd meg, hogy ",10*10 ," szorosan megérte megvenni ezt a kurzust!")
| true |
129fe50c3f78dd5ec6f555783ac70124646dc09a | JoserraLP/MUII_G2_Family-Lock-Manager-Web | /__init__.py | UTF-8 | 2,632 | 2.515625 | 3 | [] | no_license | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_user import UserManager
from .config import default
# init SQLAlchemy
db = SQLAlchemy()
def create_app():
''' Create a Flask app, configure it. register some project blueprints as 'auth' or 'main',
... | true |
30c0bf069009d02e0177dab73581b06fbe06c42a | sandinocoelho/URI-Online-Judge | /1008.py | UTF-8 | 193 | 3.421875 | 3 | [] | no_license | employees = int(input())
hours = int(input())
valueHour = float(input())
salary = (hours * valueHour * employees) / employees
print("NUMBER = %d" %employees)
print("SALARY = U$ %.2f" %salary) | true |
159493de3d9715d557c936b3529d91762d43dac5 | minkymorgan/Reuters-full-data-set | /generate.py | UTF-8 | 2,332 | 2.921875 | 3 | [] | no_license | import os
import pickle
from datetime import timedelta, date, datetime
import bs4
import requests
def get_soup_from_link(link):
if not link.startswith('http://www.reuters.com'):
link = 'http://www.reuters.com' + link
print(link)
response = requests.get(link)
assert response.status_code == 200... | true |
41ec77ae73666d36ce7fcf24d25bf54df766a4a9 | Leebz/CCE | /Tools/sko/PSO.py | UTF-8 | 5,884 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/8/20
# @Author : github.com/guofei9987
import numpy as np
from Tools.sko.tools import func_transformer
from .base import SkoBase
import matplotlib.pyplot as plt
from Enviroments import CCE_ENV_MODIFIED as E
from Configs.config import Config
import copy
... | true |
93b2a99ad0a93aa890c559ba2f729743e5aeba29 | Schnei1811/PythonScripts | /Practice/practice.py | UTF-8 | 870 | 3.296875 | 3 | [] | no_license |
def binary_search(inputlist, val):
first = 0
last = len(inputlist) - 1
while first <= last:
mid = (first + last) // 2
if inputlist[mid] == val: return True
elif inputlist[mid] > val: last = mid - 1
else: first = mid + 1
return False
def dfs(graph, start, val):
vi... | true |
6e9b92a5b94498579763abfb1988e1cb8e52d7cb | h4wldev/seed | /tests/utils/test_convert.py | UTF-8 | 1,164 | 2.953125 | 3 | [
"MIT"
] | permissive | from seed.utils.convert import (
int2bitfield,
bitfield2int,
units2seconds
)
def test_int2bitfield():
assert int2bitfield(0) == [False]
assert int2bitfield(1) == [True]
assert int2bitfield(30) == [False, True, True, True, True]
assert (
int2bitfield(999) == [True, True, True, False... | true |
c6c219e0c885c748bf08d22912012a78f74f1074 | sudarshanchimariya/python | /Data Types/Q10.py | UTF-8 | 252 | 3.09375 | 3 | [] | no_license | def rem_odd_values(str3):
r = "" # r for result
for i in range(len(str3)):
if i % 2 == 0:
r = r + str3[i]
return r
print(rem_odd_values('coursework'))
print(rem_odd_values('123456'))
print(rem_odd_values('pqrstuv')) | true |
a9cc7f87d09ff3ea3be8452beafee8fe3435b860 | Nechi05/Programacion2021 | /Talleres/Ejercicioclasesyobj.py | UTF-8 | 2,361 | 3.875 | 4 | [] | no_license | class Torta ():
'''
Esta clase tiene los siguientes atributos:
Forma: habla de la forma de la torta con una figura geométrica
Sabor: el sabor de la torta
Altura: altura de la torta en centímetros
*mostrarAtributos()
muestra los atributos del usuario
'''
def __... | true |