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 |
|---|---|---|---|---|---|---|---|---|---|---|
c71a140c8364c479e23f053f22d9631343d64ab8 | GuthiMahesh/n-code-it-pvt-ltd | /greatest common divisor of 2 numbers.py | UTF-8 | 384 | 4.53125 | 5 | [] | no_license | # Python code to demonstrate the working of
# copysign() and gcd()
# importing "math" for mathematical operations
import math
a = -10
b = 5.5
c = 15
d = 5
# returning the copysigned value.
print ("The copysigned value of -10 and 5.5 is : ", end="")
print (math.copysign(5.5, -10))
# returning the gcd of 15 and 5
pri... | true |
7c2355b42b7b32502f9237e60e9c5ea445ba4e48 | ivominic/opencv | /test.py | UTF-8 | 1,372 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | """ Transformacije slike"""
import argparse # biblioteka za parsiranje argumenata iz komandne linije
import cv2 # OpenCV biblioteka
import imutils # lokalni fajl/biblioteka imutils.py
# Čitanje argumenata iz komandne linije i njihovo smještanje u dictionary
AP = argparse.ArgumentParser()
AP.add_argument("-i", "--im... | true |
bbad4c96ef04ef3fd18dbb18793d7e97196f4ad3 | andrelima19/Projetos_Python | /Developer/Python_Definitivo/Aulas/venv/Funções Parte 1.py | UTF-8 | 520 | 3.96875 | 4 | [] | no_license | '''
FUNÇÃO
'''
'''
Função - Rotina de programação - Algo feito constantemente
DEF é Definição de Função
'''
'''
Exemplo 1
'''
def lin():
print('=' * 30)
# programa principal
lin() # O comando só é executado quando a função é chamada.
print('André')
print('Curso Em vídeo')
lin()
'''FUNÇÃO COM PARÂMETROS'''
def ... | true |
832c400a0fa5b855ec90b3b93caf6007c08d083a | CTISM-Prof-Henry/python-two-torturador-de-mentes | /test.py | UTF-8 | 9,926 | 3.234375 | 3 | [] | no_license | import unittest
from inspect import signature
class TestaTudo(unittest.TestCase):
def testa_soma(self):
from project.tarefa_00 import tarefa_0 as func
params = signature(func).parameters
self.assertEqual(len(params), 2, "A função deveria ter 2 parâmetros")
self.assertEqual... | true |
26f7e1cee4df0ed17179b3c34b42f5fe92b2f040 | antsyferov/LITS_hw | /dec2.py | UTF-8 | 912 | 3.65625 | 4 | [] | no_license | def type_check(arg_type=None):
arg_type = arg_type or str
def actual_decorator(func):
def wrapper(*args, **kwargs):
if not all([isinstance(arg, arg_type) for arg in args]):
raise Exception('Invalid arg for type {}'.format(arg_type))
res = func(*args, **kwargs... | true |
a9c9887fe11f20a31dbdd20a79f159f30e7802fc | a524919247/movies | /src/moviesapp/management/commands/get_wrong_russian_titles.py | UTF-8 | 1,359 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from django_tqdm import BaseCommand
from tabulate import tabulate
from moviesapp.models import Movie
ALLOWED_CHARS = 'абвгдеёжзийклмнопрстуфхцчшщьыъэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ123456789 -:0,"«».?+/–º·№!()½⅓\''
class Command(BaseCommand):
help = 'Displays wrong russian titles'
... | true |
1a13450e44eed88a3c82f58d47c7e0e34ee6a29d | yiyuanc/112tp | /pastsand/sand0423.py | UTF-8 | 25,497 | 3.046875 | 3 | [] | no_license | import pygame
import random
import math
import os
import numpy as np
from pygame.locals import *
from pygame import mixer
import scipy
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
YELLOW = (255,255, 153)
SANDDIM = 5
SCREENW = 1200
SCREENH = 300
INTERV = round((1.1)*(SCREENW/10)/2)
############################ sa... | true |
04c7dd10fa007e61bb2f8affd140720de4045828 | huyuu/magneticAField | /solenoidADistribution.py | UTF-8 | 2,842 | 2.6875 | 3 | [] | no_license | import numpy as nu
import pandas as pd
from matplotlib import pyplot as pl
from matplotlib import cm
from mpl_toolkits import mplot3d
import multiprocessing as mp
from numpy import abs, sqrt, cos, sin, pi
from scipy.integrate import quadrature, dblquad, tplquad
from scipy.special import ellipk, ellipe, ellipkm1
# Co... | true |
018928f49b762404f58eed67f9eba6b4dbf34a26 | khush611/algodaily | /day58.py | UTF-8 | 961 | 3.78125 | 4 | [] | no_license |
import math as mt
R = 3
C = 3
def minInitialPoints(points):
'''
'''
dp = [[0 for x in range(C + 1)]
for y in range(R + 1)]
m, n = R, C
if points[m - 1][n - 1] > 0:
dp[m - 1][n - 1] = 1
else:
dp[m - 1][n - 1] = abs(points[m - 1][n - 1]) + 1
'''
Fill last row and last column as base
to fill... | true |
ef0a63abd15d5f75d1c6656bdd660a46edbe2932 | prmishra123/python-ml | /New/assignment-1 LienarRegression.py | UTF-8 | 961 | 3.328125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.linear_model import LinearRegression
df=pd.DataFrame(data=[
['Rahul','X',53],
['Sunil','X',73],
['Rahul','XI',57],
['Sunil','XI',64],
['Rahul','XII',62],
['Sun... | true |
6e33140f390f1464948ad4f8ef5cb9b9eb54f7c6 | ponty/psidialogs | /psidialogs/mixins.py | UTF-8 | 2,335 | 2.671875 | 3 | [
"BSD-2-Clause"
] | permissive | from itertools import count
# class AllMixin:
# def multi_choice(self, args):
# s = self._choice(args)
# if not s:
# return None
# try:
# return [args["choices"][int(x)] for x in s.split(",")]
# except Exception:
# pass
# def text(self, args)... | true |
27495f8654a962669172757ad4ae0c044c319680 | Sannso/Cosas-de-python | /Python/Parcial_II/AbstractRetirarMonto.py | UTF-8 | 137 | 2.5625 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
class AbsRetirarMonto(metaclass=ABCMeta):
@abstractmethod
def retirarMonto(self, monto): pass | true |
b1739ba28cf1c3f3f985f71b288ef38ee61b512e | mgh3326/bigdata_hw2_news_title_generate | /wow.py | UTF-8 | 11,503 | 2.828125 | 3 | [] | no_license | #####################################################################
# Word2Vec 모델을 간단하게 구현해봅니다.
import os
import tensorflow as tf
import numpy as np
import tool as tool
from model import Seq2Seq
import time
# data loading
data_path = './sample.csv'
title, contents = tool.loading_data(data_path, eng=False, num=Fals... | true |
7394a27582f0996b4609289febbe3c3c984596d9 | wlmnzf/Instruction_Flow_Compression | /flagcompress/ARM/compress.py | UTF-8 | 2,614 | 2.828125 | 3 | [] | no_license | # coding=utf-8
import xlrd
def u2s(txt):
a = txt
b = []
for n in a:
if "a" <= n <= "z":
b.append(n.upper())
elif "A" <= n <= "Z":
b.append(n.lower())
else:
b.append(n)
return ("".join(b))
def table2str(key):
for i in range(len(key)):
... | true |
8c8201ec928e98da0c65fadbd01216e76b6a69bd | Rodyson/pythonpractise | /1.py | UTF-8 | 288 | 3.765625 | 4 | [] | no_license | print ('what is your name?')
myname = input()
print ('what's up ' + myname)
print ('what is the length of you name?')
print (len(myname))
print ('what is you age?')
myage = input()
print ('you will be ' + str(int(myage)+1)+ ' in a year')
print('do you smoke?')
ans = input()
print (ans)
| true |
91e9838bb6726593d6997ca2d72f42848692aae9 | rddaz2013/pysketcher | /examples/pendulum2.py | UTF-8 | 5,207 | 3.203125 | 3 | [
"MIT"
] | permissive | """
Modified version of pendulum1.py:
A function draws the free body diagram, given the angle.
This function can be coupled to a numerical solver
for the motion. Videos of the motion are made.
"""
import numpy as np
import pysketcher as ps
from scipy.integrate import odeint
from pysketcher.backend.matplotlib import Ma... | true |
f4e2123989940e56fecdbf815e16c15d42acbc0a | tsolakoua/python-hackerrank | /sets/symmetric_diff.py | UTF-8 | 290 | 3.140625 | 3 | [] | no_license | a = input()
lis = a.split()
newlist = list(map(int, lis))
setA = set(newlist)
a = input()
lis = a.split()
newlist = list(map(int, lis))
setB = set(newlist)
list_result = list(setA.symmetric_difference(setB))
list_result.sort()
for i in range(len(list_result)):
print(list_result[i])
| true |
9581b137a84a23e0e73274f9e14bcd807975ac14 | HiddenEvent/PYthon_Start | /workspace/.vscode/Day09/Exam01.py | UTF-8 | 149 | 3.109375 | 3 | [] | no_license | i = 0
while i < 20 :
i = i+1
print(i)
i = 0
reSum = 0
while i < 100 :
i = i+1
reSum = reSum+i
if i == 100 :
print(reSum) | true |
ab950a917ef2598aa8e43f6c96e06ba30ce3ae81 | Nvardharutyunyan/group-sudo | /nvard/python/#2/roundDown.py | UTF-8 | 272 | 3.890625 | 4 | [] | no_license | #!usr/bin/env python3
import math
lst = [1.2, 3.6, 4.1, 5.5]
print(lst)
def sumRoundDown(lst) :
summ = 0
for n in lst:
n = math.floor(n)
summ += n
return summ
print("The sum of the list numbers (numbers are rounded down)` ", sumRoundDown(lst))
| true |
01c9d8475af108ed8e955fac5a9d6728c9462612 | dlphia/Sepsis-Prediction | /FHIR/FHIR-simulator/server/simulator.py | UTF-8 | 1,520 | 2.53125 | 3 | [] | no_license | from flask import Flask
from flask import Response
from flask import jsonify
import json
import csv
import pandas as pd
import numpy as np
import traceback
app = Flask(__name__)
config = None
data = None
index = "time"
resource = "subject_id"
def init():
global data
global config
data = None
wi... | true |
2f7b71d05752c190eda079cd60f912554e13eca0 | ChannithAm/PY-programming | /decorator_1.py | UTF-8 | 542 | 3.796875 | 4 | [] | no_license | def p_decorator(func):
def func_wrapper(name):
return "<p>{0}</p>".format((func(name)))
return func_wrapper
def strong_decorator(func):
def func_wrapper(name):
return "<strong>{0}</strong>".format(func(name))
return func_wrapper
def div_decorator(func):
def func_wrapper(name):
... | true |
5da1cafa649bd4647e4fa1159ad51affdfab29b4 | Japskua/GameOfFreedom | /helpers/gameboard.py | UTF-8 | 18,285 | 3.40625 | 3 | [] | no_license | '''
Created on Feb 5, 2012
@author: japskua
'''
class GameBoard(object):
'''
The GameBoard object handles all the board-related functions
and stores the board pieces and state. This class is used
both by the server (to handle all the logic) and the clients
(to store the board state)
'''
... | true |
9942e6d9eb7eaf2d9d26929e85fc1a423c7e4aff | baidongbin/python | /疯狂Python讲义/codes/08/8.5/round_test.py | UTF-8 | 821 | 4.0625 | 4 | [] | no_license | class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
# 定义setSize()函数
def setSize(self, size):
self.width, self.height = size
# 定义getSize()函数
def getSize(self):
return self.width, self.height
# 使用property定义属性
size = pro... | true |
1fd9d6175c0923f6e53339d94ce37403619a9d9f | gustavoddainezi/Exercicios-URI-Online-Judge | /Python/1028.py | UTF-8 | 214 | 3 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
n = int(input())
while n > 0:
f1, f2 = map(int, input().split())
def mdc(a, b):
if b == 0:
return a
return mdc(b, a % b)
print(mdc(f1, f2))
n -= 1 | true |
262c90c91232b020f90f2a198020b58a1c71ebd8 | farazshamim9/RealTmeEmotionDetection | /EmotionAnalyzer.py | UTF-8 | 2,684 | 2.5625 | 3 | [] | no_license | import os
import cv2
import numpy as np
import requests
#from keras.models import model_from_json
from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import load_model
face_cascade=cv2.CascadeClassifier("haarcascade_frontalface_alt2.xml")
ds_factor=0.6
class EmotionAnalyzer(object):
def ... | true |
49b5a441c6ad7eed464825cf184f4a46e6e69d71 | ruchakhopkar/medical-diagnosis-using-SVM | /untitled0.py | UTF-8 | 1,719 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 01:15:17 2020
@author: rucha
"""
import numpy as np
import pandas as pd
from sklearn import svm
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, classification... | true |
c8c0c87b32ebdf134c0fb48bf560e1216e595857 | wwwwodddd/Zukunft | /leetcode/compare-strings-by-frequency-of-the-smallest-character.py | UTF-8 | 352 | 2.640625 | 3 | [] | no_license | class Solution:
def numSmallerByFrequency(self, a: List[str], b: List[str]) -> List[int]:
a = [i.count(min(i)) for i in a]
b = [i.count(min(i)) for i in b]
c = [0 for i in range(12)]
for i in b:
c[i] += 1
for i in range(11)[::-1]:
c[i] += c[i + 1]
... | true |
e9a4dc0b7e6cded4748cfac679bd2562dd9fe9e7 | gautamgitspace/LeetCode-OJ | /BSTfromPreOrder/bst_from_pre_order.py | UTF-8 | 1,263 | 3.921875 | 4 | [] | no_license | #!/usr/bin/python
'''
Gen BST from given list of preorder
KEY is to start with having root in place which is the
first element of preorder. after that we have to find
the pivot index (root), towards the left of which all
elements are smaller and towards the right of which all
elements are bigger.
i.e if (preorder[i] ... | true |
8632ca7bf9e719770c352ea52440366ac7958124 | b3m2a1/python-fauxkemon | /Fauxkemon/code/battle_animations/PuffAnimation.py | UTF-8 | 2,340 | 3.015625 | 3 | [] | no_license | #PuffAnimation.py animation loader
#This file needs to define either a function, load animation,
#or an iterable, animation
#
#The function load_animation takes an animation instance and an animation frame
#and optional arguments and keywords and must return an iterable of functions
#in no arguments.
#
#The animation ... | true |
cc7ba22c1b2f4b58d89210c1bf78d026d1a44c0d | Nawazsherif/aoc2020 | /day9.py | UTF-8 | 1,423 | 3.5 | 4 | [] | no_license | # This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
PREAMBLE = 25
VALUE = 0
# Not sum of first preamble numbers
def find_invalid_number():
file = open("./inputs/day9.bat")
dat... | true |
83e733a9c2a244ec274dc58ff1561124d90ef93d | TheShubham-K/Algorithmic_Toolbox | /Algorithms_on_Graphs/week2_decomposition2/1_acyclicity/acyclicity.py | UTF-8 | 1,216 | 3.53125 | 4 | [] | no_license | # Uses python3
import sys
def acyclic(adj):
# Mark all the vertices as not visited and not part of recusion stack
visited = [0 for _ in range(len(adj))]
rec_stack = [0 for _ in range(len(adj))]
# call the recursive helper function to detect cycle in different DFS Trees.
for i in range(len(adj)):
... | true |
e710e93d071cea2069add9432ba2c7814b2da568 | t-redactyl/Practical-Programming-exercises | /Scripts from book/merge.py | UTF-8 | 597 | 3.84375 | 4 | [] | no_license | def merge(L1, L2):
'''Merge sorted lists L1 and L2 and return the result.'''
newL = []
i1 = 0
i2 = 0
# For each pair of items L1[i1], L2[i2], copy the smaller into newL.
while i1 != len(L1) and i2 != len(L2):
if L1[i1] <= L2[i2]:
newL.append(L1[i1])
i1 +... | true |
e206a312b1dd14833385a1db268784cdf8b27ef0 | sbaker-dev/kdaHDFE | /kdaHDFE/Result.py | UTF-8 | 2,112 | 2.984375 | 3 | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from scipy.stats import t
import pandas as pd
import numpy as np
class Result:
def __init__(self, results, std_error, covariant_matrix):
"""
Adjusted results of regression
:param results: The mostly unadjusted results from OLS bar the degrees of freedom that was adjusted for clusters
... | true |
c514b9804f37932ff2bd7303d02a7d9418563a45 | emille38-asu/Python-Projects | /Main.py | UTF-8 | 6,568 | 3.5625 | 4 | [] | no_license | # Import statement
import math
# ORGANIZE CODE BEFORE PROCEEDING FURTHER
# implement images in text
# print if a monster attacks
def printMonsterImage():
print("███████████████████████████")
print("███████▀▀▀░░░░░░░▀▀▀███████")
print("████▀░░░░░░░░░░░░░░░░░▀████")
prin... | true |
3a5ff398f7f17c2483059a04607dd3ea21db6ca1 | seungtaek-hutom/pytorch_study | /MNIST/test.py | UTF-8 | 76 | 2.5625 | 3 | [] | no_license | import torch
x = torch.rand(5, 5)
y = torch.rand(5, 5)
z = x.eq(y)
print(z) | true |
1bdbdca08060fa31cfe3b77e2dde2613f4c2dbd1 | xiang58/censor-dispenser | /main.py | UTF-8 | 1,432 | 3.078125 | 3 | [] | no_license | ### Project: Censor Dispenser
### Author: Daniel Xiang
### Version: 1.0.0
### Since: 2020-03-19
from censor_dispenser import *
proprietary_terms = ["she", "personality matrix", "sense of self", "self-preservation", "learning algorithms", "her", "herself"]
neg_words = ["concerned", "behind", "danger", "dangerous", "a... | true |
8e32125ac267203690281be8482c3a016338c394 | shenoyrahul444/CS-Fundamentals | /Dynamic Programming/Largest Palindromic Substring - DFS.py | UTF-8 | 1,566 | 3.453125 | 3 | [] | no_license | class Solution:
def longestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
if s == None:
return ""
s = s.strip()
if s.strip() == "":
return ""
if len(s) == 1:
return s
maxlen = 1
start = 0
... | true |
454763d3f8602b204947355690c3ceb0084eef01 | beamind/machine-learning-from-scratch | /linear_model/Perceptron.py | UTF-8 | 2,562 | 3.375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from linear_model.LinearModel import LinearModel
class Perceptron(LinearModel):
"""Perceptron, optimized with SGD.
Args:
------
learning_rate: float, learning rate.
train_step: int, number of training steps.
rand_var: floa... | true |
3a91ac7c8e8d2cd21246af810fc8a4e5b3317c47 | dmitriyKolmogorov/VKVisualization | /vkvisualization/dataset.py | UTF-8 | 21,593 | 3.21875 | 3 | [] | no_license | import os
import pandas as pd
import numpy as np
class DataSet(pd.DataFrame):
def __init__(self, *args) -> None:
# DataFrame sorted by date
df = pd.DataFrame(*args).sort_values('Дата')
df = df[df['Дата'] >= df['Дата'][df['Критерий'] == 'views'].min()]
# DataFrame.... | true |
b775ccb90a8856f281010e8ac24612708e98366b | biman/Evaluation | /classifier.py | UTF-8 | 9,003 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
import argparse # optparse is deprecated
from itertools import islice # slicing for iterators
from sklearn import svm
from nltk.stem.porter import PorterStemmer
import nltk,re
def word_matches(h, ref):
sum1 =0.0 #sum(1 for w in h if w in ref)
sum2=0.0
sum3=0.0
sum4=0... | true |
53d760e3882e3e42e3f3e10f4ec2d99c5621d640 | jsxhzyf/computationalphysics_N2013301020169 | /Final_Project_Monte_Carlo/M_C_Ising_Model/Ising_correlation.py | UTF-8 | 4,749 | 2.890625 | 3 | [] | no_license | '''
PROGRAM : Ising corrrelation
this program give the corrrelation function of 2-d ising model
corrrelation function: fi=<s0si>
Author: Chen Yangyao Last Modify:20160615
'''
import matplotlib.pylab as plt
from numpy import *
'''
class : ising
this class solves the problem of 2-d ising model
where:
... | true |
5e28e5102be71a5e7faa0244145dcedb2af73287 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4134/codes/1585_2049.py | UTF-8 | 387 | 3.671875 | 4 | [] | no_license | # Teste seu codigo aos poucos.
# Nao teste tudo no final, pois fica mais dificil de identificar erros.
# Nao se intimide com as mensagens de erro. Elas ajudam a corrigir seu codigo.
var1 = int(input("Dividendo: "))
var2 = int(input("Divisor: "))
dividendo = var1
divisor = var2
quociente = (var1//var2)
resto = (var1%va... | true |
1c8638c8df2fe7bf63a06fc90373915316df26b7 | bhargav1488/Coding-Challenge | /turo.py | UTF-8 | 1,645 | 3.28125 | 3 | [] | no_license | import sys
class Transaction:
def __init__(self):
self.db = {}
self.transactions = []
def begin(self):
self.transactions.append([])
def recordTransaction(self, name):
self.transactions[-1].append((name, self.db[name] if name in self.db.keys() else None))
def set(self, name, value):
self.recordTrans... | true |
b882d1d75ef4531298a83559524f20379849000a | eselyavka/python | /mapper.py | UTF-8 | 687 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
from collections import defaultdict
def mapper():
mapDict = defaultdict(list)
duration = []
for line in sys.stdin:
data = line.strip().split('\t')
for i in range(len(data)):
if (i != (len(data) - 1)):
ts = data[i].split(' ')
... | true |
dc489f3ea6017cf569c6c443655e1eea2f5004a6 | mtpajula/gotiles | /core/tile_coordinates.py | UTF-8 | 1,580 | 3.375 | 3 | [] | no_license |
import math
from core.elements.point import Point
from core.elements.tilepoint import TilePoint
'''
Calculates TMS-koordinates
https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
'''
class TileCoordinates:
def __init__(self):
pass
def deg2num(self, point, zoom):
tp = TilePoint()
... | true |
a14df2f778b05d29273c397eb08c493ad5e423d3 | PressSergo/AlgoritmsPython | /dinamicForFibb.py | UTF-8 | 857 | 3.625 | 4 | [] | no_license | class fib:
def __init__(self,n):
self.kes = [-1 for i in range(n+1)]
self.len = n
self.kes[0] = 0
self.kes[1] = 1
def getFibRec(self,n):
if n == 1 or n == 2:
return 1
return self.getFibRec(n-2)+self.getFibRec(n-1)
def down_getFib(self,n):
... | true |
a7296de2a31d8c22b5a9bc7ca7392a2c467a6650 | hexatee/pwjs | /lab8/mojeklasy.py | UTF-8 | 1,233 | 3.5 | 4 | [] | no_license | import math
class punkt2D(object):
def __init__(self, x, y):
self.x = x
self.y = y
def drukuj(self):
print('x= %d' % self.x)
print('y= %d ' % self.y)
def zeruj(self):
self.x = 0
self.y = 0
class punkt3D(punkt2D):
def __init__(self, x, y... | true |
bb111a5b178d2e8aba0247ba5cd434f5e11412eb | Nigirimeshi/leetcode | /0117_populating-next-right-pointers-in-each-node-ii.py | UTF-8 | 2,035 | 4.09375 | 4 | [] | no_license | """
填充每个节点的下一个右侧节点指针 II
链接:https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node-ii
给定一个二叉树
struct Node {
int val;
Node *left;
Node *right;
Node *next;
}
填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL。
初始状态下,所有 next 指针都被设置为 NULL。
进阶:
你只能使用常量级额外空间。
使用递归解题也符合要求,本题中递归程序... | true |
229eb8e89c3f5fcb4d09e903cc25db8bd7d1684f | SayhellotoAI/teanaps | /handler/QueueHandler.py | UTF-8 | 878 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | import concurrent.futures
class QueueHandler():
def __init__(self, thread_count):
self.lambda_count = 0
self.pool = concurrent.futures.ThreadPoolExecutor(thread_count)
self.result_dict = {}
def add_lambda(self, input_function, parm_dict):
self.lambda_count += 1
... | true |
eb8e05bad91e7b7c0270b8bb8cf87509f7e1dc9e | johli/scrambler | /scrambler/utils/scrambler_utils.py | UTF-8 | 8,840 | 2.59375 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import scipy.sparse as sp
def get_sequence_masks(sequence_templates) :
sequence_masks = [
np.array([1 if sequence_templates[i][j] == '$' else 0 for j in range(len(sequence_templates[i]))])
for i in range(len(sequence_templates))
]
return sequ... | true |
ea3cf59215f7a631ce7cd3baa6bae52aeb11f3c8 | joaquimviana/Trabalho-Final-BRI | /BRITrabalho/src/functions/twoSlotFunctions.py | UTF-8 | 2,699 | 2.8125 | 3 | [] | no_license | import numpy as np
def minps_hashing(element_set, permutation):
rows,_ = np.nonzero(element_set)
min_id1,min_id2 = np.Inf, np.Inf
row_count = len(rows)
slot_size = row_count
slot_size //= 2
for i in range(slot_size):
perm_id1 = permutation[rows[i]]
perm_id... | true |
1082c0713db422dfca6e9b8fa76b0cc0a5b183ac | anaturrillo/intro-python | /clase_01/ejercicios/ej_10.py | UTF-8 | 484 | 4.34375 | 4 | [] | no_license | # 10) Escribir una función que reciba un numero y valide si el número es primo. La funcion debe retornar una mensaje
def chequear_primo(num):
es_primo = True
for i in range(2, num):
if num % i == 0:
es_primo = False
if es_primo:
return 'El número es primo'
... | true |
8a5fa6f697f6ca4f539ffaffa35e359acab8bb64 | junjange/Python-Learning | /행렬 계산/두 행렬 뺄셈.py | UTF-8 | 205 | 3.578125 | 4 | [] | no_license | # 두 행렬의 뺄셈을 계산하는 코드를 작성하시오
A =[[1,2], [3,4]]
B =[[4,3], [2,1]]
result =[]
for i in range(2):
result.append([A[i][0] - B[i][0] ,A[i][1] - B[i][1]])
print(result) | true |
ba850333d5f302464c926e2085dc5efddd89b7c9 | Alor-e/datascience_hire_task | /api_gen_helpers.py | UTF-8 | 2,211 | 2.703125 | 3 | [] | no_license | import _pickle as pickle
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from bs4 import BeautifulSoup
from product_info_scraper import user_agent
import numpy as np
def list_of_dict(list_of_tuples, page_tuple):
"""
Converts a list of tuples to ... | true |
98285bbc2359d39f6bb3f6940f49fb07191a4693 | Park-Yegi/CS206-DataStructure | /HW/HW2/Problem1(c).py | UTF-8 | 2,783 | 4.21875 | 4 | [] | no_license | import time
# Make Stack class
class Stack(object):
# Create Stack
def __init__(self, max_stack_size):
self.stack = []
self.top = -1
self.max_stack_size = max_stack_size
# Function IsFull
def IsFull(self):
if self.top >= self.max_stack_size-1:
r... | true |
39085b965d034bb692a1d8eb1e742c1e36082ab0 | opensesamedoors/pwnshop | /src/0x1E-cryptopals-se1-ch2/fixed-xor | UTF-8 | 571 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python3
import BitVector
import string
import sys
if __name__ == "__main__":
# ./fixed-xor 1c0111001f010100061a024b53535009181c 686974207468652062756c6c277320657965
# should return
# 746865206b696420646f6e277420706c6179
# the kid don't play
input_str_a = sys.argv[1]
input_bv_a... | true |
69fd99dcdf358c98c14d0afc656c38130ddceca1 | fengjunCN/Self-Driving-Car | /2 balance_data.py | UTF-8 | 1,825 | 3.703125 | 4 | [] | no_license | import numpy as np
import pandas as pd
from collections import Counter
from random import shuffle
'''
The problem with our data is that the occurence of going forward is way more
than that of going left, or right. If we feed this to a CNN, it would just
learn to go forward, no matter what. Therefore, we need t... | true |
c556296e0365e3ad30214ef236f5f6ef3d8ed1a2 | jgpacker/vnbot | /src/vnbot.py | UTF-8 | 2,344 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This Bot uses the Updater class to handle the bot.
"""
import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, filters
from bot_globals import *
from vndb import VNDB
import json
# Enable logging
logging.basicConfig(
format='%(asct... | true |
b665e0946c0fc83f91e74852ad364cffb47b5188 | cdburns22/ud036_StarterCode | /media.py | UTF-8 | 665 | 3.25 | 3 | [] | no_license | import movie
import fresh_tomatoes
#Create instances of movie class for movies with required properties
iron_man = movie.Movie("Iron Man", "ironManPoster.jpeg", "https://www.youtube.com/watch?v=8hYlB38asDY")
forrest_gump = movie.Movie("Forrest Gump", "forrestGumpPoster.jpg", "https://www.youtube.com/watch?v=uPIEn0M8su... | true |
71c09349201407c01a2e8a2e292ddf7cc3d495be | ajithkjajith/DataVisualization | /DataVisualization-Plots/pie_chart/donut.py | UTF-8 | 599 | 3.59375 | 4 | [] | no_license | import matplotlib.pyplot as plt
labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
sizes = [15, 30, 45, 10]
#colors
colors = ['#ff9999','#66b3ff','#99ff99','#ffcc99']
fig1, ax1 = plt.subplots()
ax1.pie(sizes, colors = colors, labels=labels, autopct='%1.1f%%', startangle=90)
#draw circle
centre_circle = plt.Circl... | true |
3d5a44fdd99cccbb482b9f0586306a131fdee9d7 | TapaniAlastalo/data_analytics | /data_analytiikka/ekstra/h2.py | UTF-8 | 698 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.read_csv('https://student.labranet.jamk.fi/~huoptu/datananal_s20/kerta2/harjoitukset/ehi_010_2020q2.csv', sep=",", decimal='.')
print(df)
columns = ['Year Total €/MWh']
#a.value[a['words'].isin(b)] = 0
b = ['.']
#df.values[df[columns[0]].isin(b)] = 0 #np.NAN
#df[df[colum... | true |
1388f902233d575ba30a43557dd94fe5c4f64b3c | BDesBrisay/csci3308 | /lab11/textproc_test.py | UTF-8 | 1,851 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Andy Sayler
# Summer 2014
# CSCI 3308
# Univerity of Colorado
# Text Processing Module
'''
CSCI 3308 - Lab 11
Author: Bryce DesBrisay
Error #1 from Question 5:
changed line in count_vowels function
from:
vowels = re.compile(r'[aeou]', re.IGNORECASE)
to:
vowels = re.... | true |
080100c6675a58ae81cd805d612bce1ceb2b2c72 | Confucius-Mencius/py_tools | /base/log_wrapper.py | UTF-8 | 1,623 | 2.875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
###############################################################################
# author: BrentHuang (guang11cheng@qq.com)
###############################################################################
import logging
from logging.handlers import RotatingFileHandler
import sys
class LogWrapp... | true |
630af5c38c1c7d30e614358b6b49a44027265965 | altitudenetworks/logchange | /logchange/cli_parser.py | UTF-8 | 6,196 | 2.640625 | 3 | [
"MIT"
] | permissive | """
Main CLI parser.
"""
import argparse
import sys
from pathlib import Path
from typing import Sequence
import pkg_resources
from newversion import Version, VersionError
from logchange.constants import LATEST, SECTION_ALL, SECTION_TITLES, UNRELEASED
def get_changelog_path(value: str) -> Path:
path = Path(value... | true |
c787ae181719acc682c24b9a824db1fc4b0b34b0 | RanHuang/Hello-World | /python/attendance-statistics/label_weekend.py | UTF-8 | 1,451 | 2.75 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
import openpyxl
from constant import *
# pathname filename
logging.basicConfig(format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
if ... | true |
cfd6e3aaaaa64475e5b0c1bb5ec2f5ac0cd8df13 | Fe0fan0v/IT-Cube-vk-bot | /working_table.py | UTF-8 | 729 | 2.828125 | 3 | [] | no_license | class Table:
def __init__(self, file_id):
self.file_id = file_id
self.data = {}
import requests
import csv
import io
url = f'https://docs.google.com/spreadsheets/d/{self.file_id}/export?format=csv'
r = requests.get(url)
sio = io.StringIO(r.c... | true |
8b6775e044d31a48a88cd5a35ae697b5a9931dfe | netengpy/automation | /IOS/Python/sh_cmds_multiple_hosts_separated_files/commands_file.py | UTF-8 | 137 | 2.8125 | 3 | [] | no_license | host_commands = []
f = open('show_commands.txt', 'r')
for line in f:
host_commands.append(line.strip())
f.close()
print host_commands | true |
b2506be605df7f06b15a5720503bf2762feef28c | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/bob/1a4ecf18471042e5ad6bd0fb25132320.py | UTF-8 | 362 | 3.421875 | 3 | [] | no_license | # Skeleton file for the Python "Bob" exercise.
def hey(what):
"""Return reply (unistring code) from Bob the teenager"""
quote = what.strip()
if quote.isupper():
return u"Whoa, chill out!"
elif quote.endswith("?"):
return u"Sure."
elif quote == "":
return u"Fine. Be that wa... | true |
d019cb755ea918c7d6146aaeb4956bc1420a88bb | Jefung/SQLAlchemy_wrap | /tests/test_mysql_factory.py | UTF-8 | 2,797 | 2.734375 | 3 | [] | no_license | # import unittest
#
# from exceptions import DbNotConnect
# from sql_factory import MysqlFactory
#
#
# class TestMysqlFactory(unittest.TestCase):
# db_name = "unittest"
# username = "unittest"
# password = "unittest"
#
# def test_operator_table_class(self):
# db_factory = MysqlFactory("tests.tab... | true |
032bcc0c5146899267709bfb699a7bd7c108b7c1 | Aasthaengg/IBMdataset | /Python_codes/p02863/s887455919.py | UTF-8 | 549 | 2.71875 | 3 | [] | no_license | N, T = map(int, input().split())
table = [[0] * (N + 1) for _ in range(T + 1)]
dish = sorted((tuple(map(int, input().split())) for _ in range(N)), key=lambda t: t[0])
for t in range(T + 1):
for n in range(N):
minutes_to_take, deliciousness = dish[n]
now = table[t][n]
if t < T:
ta... | true |
360f68c17b7f8600deeb19fe1eecadb48b9c8d06 | wqawasmi/Trauma-Tracker | /plotData.py | UTF-8 | 375 | 3.25 | 3 | [] | no_license | # Reads in recData.txt and plots it using matplotlib
import matplotlib.pyplot as plt
#import seaborn
data = []
with open("recData.txt") as f:
for line in f:
s = line.split()
data.append(float(s[0]))
fig=plt.figure()
plt.xlabel("Timestep")
plt.ylabel("Accelerometer Value")
plt.title("Acceleration ... | true |
a7ff7fc3fd2198bd1ca9e85f64dca42a14727d54 | dixonky/CS372 | /chatserver.py | UTF-8 | 2,660 | 3.65625 | 4 | [] | no_license | #!/bin/python
#Kyle Dixon
#CS 372 Summer 2019
#Project 1 Client/Server Application
#Sources: https://realpython.com/python-sockets/
#http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/wireless/5.html#1.%20Python%20Socket%20Programming
#https://docs.python.org/2/library/socket.html
#################
import sys
... | true |
fa39f9bfcab27120f4ae80e0476c5dfa66ea02b8 | kzmssk/cppn | /cppn/input_data.py | UTF-8 | 1,647 | 3.015625 | 3 | [] | no_license | import dataclasses
import numpy
from scipy.stats import truncnorm
def truncated_normal(x, a=-1, b=1, mean=0.5, std=0.2):
""" Normal dist. [a, b] """
return truncnorm.pdf(x, (a - mean) / std, (b - mean) / std, loc=mean, scale=std).astype(numpy.float32)
def sample_z(z_size):
return truncated_normal(numpy... | true |
feffbf899731405ed93fe1091468cd96df31d04a | jszendre/portfolio | /ComputationalScienceCoursework/Tree Data Structures and Algorithms/kdimensional-kdtree.py | UTF-8 | 8,815 | 3.828125 | 4 | [] | no_license | # kdtrees.py
"""Volume 2A: Data Structures 3 (K-d Trees).
<Name>
<Class>
<Date>
"""
import numpy as np
from trees import BST, BSTNode
from scipy.spatial import KDTree
import pdb
from sklearn import neighbors
# Problem 1
def metric(x, y):
"""Return the euclidean distance between the 1-D arrays 'x' and 'y'.
Ra... | true |
0dd5ecec8812cd1f340c6a8306e870eaaa68723d | fiza09/PythonTutorials | /Week 6/python_tutorial_week6.py | UTF-8 | 7,731 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 24 11:33:33 2016
@author: jledue
Note: file orginally named: cycle0_week5_MLw3.py, based on matlab tutorial week3.
"""
#Comment on the comments, notice the two different types of comments in python.
#If a line begins with a # it is ignored.
#Blocks of text can be isol... | true |
6fbf5c24b2760f9017686a849001c51afa7e33be | seoul-ssafy-class-2-studyclub/Hyejune | /baekjoon/17837_새로운게임2.py | UTF-8 | 1,390 | 2.875 | 3 | [] | no_license | from pprint import pprint
direction = {1:(0,1), 2:(0,-1), 3:(-1,0), 4:(1,0)}
change_d = {1:2, 2:1, 3:4, 4:3}
N, K = map(int, input().split())
original_board = [0]*N
for i in range(N):
original_board[i] = list(map(int, input().split()))
chess_idx = [0]*(K+1)
real_board = [[[] for j in range(N)] for i in range(N)... | true |
2c91ed95303bad2a609efa063f539ce70c8c80c0 | tbrizon/bootcamp_python | /day03/ex01/ImageProcessor.py | UTF-8 | 1,725 | 2.796875 | 3 | [] | no_license | # **************************************************************************** #
# #
# ::: :::::::: #
# ImageProcessor.py :+: :+: :+: ... | true |
6d73bc881f0e92bbe9c5935862bd8da1f62cb5dd | Brunochavesg/Guanabara | /ex008.py | UTF-8 | 145 | 3.828125 | 4 | [
"MIT"
] | permissive | n = int(input("Digite o Metro" ))
print (f"O metro é {n} o Centimetro é {n*100}cm e o Milimetro é {n*1000}cm")
import os
os.system ("pause")
| true |
031ee0421496978c8f6d8e38b2b6907b0c0ea110 | daily-boj/x86chi | /problems/P18868.py | UTF-8 | 1,281 | 3.1875 | 3 | [] | no_license | from typing import List
from itertools import combinations
def solution(spaces: List[List[int]]):
combines = combinations(range(len(spaces)), 2)
count = 0
for combine in combines:
if isBalance(spaces[combine[0]], spaces[combine[1]]):
count += 1
return count
def isBalance(A: List[... | true |
9f43296f311c567fc87fb15ccbb2475aa427c5e2 | iamsureshtumu/py-prgms | /python programs/demo.py | UTF-8 | 263 | 3.5625 | 4 | [] | no_license | for row in range(7):
for col in range(5):
if row==0 or col==0 or row==6 or ((row==3 or row==4 or row==5) and col==4) or (row==3 and col==3):
print("*",end=" ")
else:
print(" ",end=" ")
print()
| true |
8cb065676ad9280082c8cb3071256792ebbc4a74 | Jujuba2002/IVan-Fandeev-PI-201-2- | /Programming/Practice/06/Python/06.py | UTF-8 | 442 | 3.625 | 4 | [] | no_license | from math import sqrt
print("Введите a:")
a = input()
print("Введите b:")
b = input()
print("Введите c:")
c = input()
if (float(b)*float(b) - 4*float(a)*float(c)) < 0:
print("Решений нет")
else:
D = sqrt(float(b)*float(b) - 4*float(a)*float(c))
x1 = (-float(b) + float(D))/2
x2 = (-float(b) - float(D))/2... | true |
380f7ce042b178fb0f18dc9984d6bfda1eef4af9 | Abdur-Rahim-sheikh/Algorithms | /Hamiltonian path to SAT/code.py | UTF-8 | 1,420 | 3.09375 | 3 | [] | no_license | clauses = []
C = 1
mymap = {}
n = 0
def varnum(i, j):
global n
x = i * n + j
global C
if not x in mymap:
mymap[x] = C
C += 1
return x
n, m = map(int, input().split())
nodes = range(1, n + 1)
mymap = {}
for i in nodes:
for j in nodes:
if i != j:
mymap[(i... | true |
0d4a90804a12329cc62bf74b9d11c5cad9a16368 | oskomorokhov/python | /study/checkio/SendGrid/stressful_subject.py | UTF-8 | 934 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env checkio --domain=py run stressful-subject
# https://py.checkio.org/mission/stressful-subject/
#
# END_DESC
import string
import re
def is_stressful(subj):
stress = False
red = {"help", "asap", "urgent"}
if subj[-3:] == 3*"!" or subj.isupper():
stress = True
subj = [i for i ... | true |
bdf3078699520e51cf515208d811dd6faed60a33 | comtihon/catcher_modules | /test/prepare_test.py | UTF-8 | 11,010 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from os.path import join
import psycopg2
import test
from catcher.core.runner import Runner
from catcher.utils.file_utils import ensure_empty
from test.abs_test_class import TestClass
class PrepareTest(TestClass):
def __init__(self, method_name):
super().__init__('prepare', method_name)
@property
... | true |
f685d4761037bdbf36c4057e6a2ba4966dfb4c8e | Faithie30/OOP-FOR-DATA-SCIENCE | /oop.py | UTF-8 | 2,273 | 3.734375 | 4 | [] | no_license | # Importing libraries
import numpy as np
import matplotlib.pyplot as plt
# Creating ErrorCalculator class
class ErrorCalculator:
# Assigning values to object properties
def __init__(self, residuals, standard_res, mse, rmse, y, y_pred):
self.residuals = residuals
self.standard_res = s... | true |
27f21bd60d84f5deb2ddb5b3295bc5c3529adab6 | calebpitts/CryptoArbitrageBot | /exchange.py | UTF-8 | 8,841 | 2.515625 | 3 | [] | no_license | from kucoin.client import Market as KucoinMarket
from kucoin.client import Trade as KucoinTrade
from kucoin.client import User as KucoinUser
from binance.client import Client as BinanceClient
import parameters
import market
import helper
import log
import pandas as pd
import sys
class Exchange():
def __init__(s... | true |
be3b1a716be5ebd6d765a13b4b49cbca88e8b16f | sergiossc/lloyd-gla | /lloyd_sa.py | UTF-8 | 7,621 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: sergiossc@gmail.com
"""
import concurrent.futures
import numpy as np
import uuid
import json
import os
from utils import *
def run_lloyd_gla(parm):
instance_id = parm['instance_id']
results_dir = parm['results_dir']
json_filename = str(results_dir... | true |
2620df2f0df3484e8f7bef3b12c1d116bc43a0a9 | ksh60706/python_study | /ksh/ch4/list_in.py | UTF-8 | 242 | 3.703125 | 4 | [] | no_license | # 리스트를 선언합니다
# 리스트 내포
# 최종 결과를 앞에 적고 뒤를 for문 작성
# 리스트 이름 = [표현식 for 반복자 in 반복할 수 있는 것]
array = [i * i for i in range(0, 20, 2)]
# 출력
print(array) | true |
434b9d05e6c9dec422e496745839efa2fb52d2fd | yeti-platform/TibetanBrownBear | /tests/web/hostname_api_test.py | UTF-8 | 2,308 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | """Tests for the Hostname API."""
import json
import re
import pytest
@pytest.mark.usefixtures('clean_db', 'populate_hostnames')
def test_filter_on_subtype(authenticated_client):
"""Tests searching for regular expressions on the /observables/ endpoint
returns hostname objects."""
observable_json = {'valu... | true |
0dd0f3352098786629271c186c52baefd6c2755e | lxy1492/TradeHelper | /main.py | UTF-8 | 2,603 | 2.625 | 3 | [] | no_license | from manager.dataManager import DataHelper
import os,json
from multiprocessing import Process
from threading import Thread
import tkinter as tk
class TradeHelper(DataHelper):
def __init__(self,name="TradeHelper"):
DataHelper.__init__(self,name)
class winAPP():
def __init__(self,title="TradeHelper",si... | true |
abe57dc75f9b2c927c03375c4d5102a73e9d6a05 | dxhxy1983/Python | /PySide/91显示嵌入页面.py | UTF-8 | 889 | 2.59375 | 3 | [] | no_license | from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2.QtWebEngineWidgets import *
import sys
import os
class InnerHTML(QMainWindow):
def __init__(self):
super(InnerHTML,self).__init__()
self.setWindowTitle("显示嵌入web页面")
self.setGeometry(5,30,1... | true |
1435b4e06ca5f9ca9dae50e667f6ab8580d7ab71 | Unallocated/Trafficlight-2.0 | /test_scripts/off.py | UTF-8 | 749 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python2
print('script start')
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
seq = ['red', 'yellow', 'green', 'yellow',]
pins = {
2 : {'name' : 'red', 'state' : GPIO.LOW},
3 : {'name' : 'green', 'state' : GPIO.LOW},
4 : {'name' : 'yellow', 'state' : GPIO.LOW}
}
for ... | true |
2511c512405877a1769f3d8509ce7931462e1082 | c0mmand3r3/twitter_covid19 | /examples/remove_stopping_words_example.py | UTF-8 | 1,160 | 2.765625 | 3 | [] | no_license | """
- author: Ashish Mainali
- email: ashishmainalee@gmail.com
- date: 2021-01-13
"""
import os
import pandas as pd
from tweeter_covid19.utils import read_file
if __name__ == '__main__':
stopping_words_path = os.path.join('resources', 'additional_stop_words.txt')
read_path = os.path.join('data', 'original', ... | true |
3748b8efb14f71cb644b917c6625442522475d14 | Rsj-Python/project | /py_modules/numpy模块.py | UTF-8 | 3,635 | 4.125 | 4 | [] | no_license | import numpy as np
# 创建一个数组
array = np.array([[1,2,3],
[4,5,6],
[7,8,9]])# 3行3列的数组
print(array)
array = np.arange(24).reshape(4,6)# arange()类似于range()函数,reshape()用来决定数组的形状
print(array)
# 得到数组的维度数
n = array.ndim
print(n)
# 得到数组的维数
n = array.shape
print(n)
# 得到数组元素的个数
... | true |
1db35ee37311c1644a44455338efc1daa5d88e53 | bxclib2/bert_crf | /semicrf.py | UTF-8 | 18,054 | 2.890625 | 3 | [] | no_license | import torch
import torch.nn as nn
import warnings
class semiCRF(nn.Module):
'''
This class implemented a semi Markov conditional random field.
batch_first is default true in this implemetation.
Args:
tags_num: Number of tags.
batch_first: Whether the first dimens... | true |
7d1ed36a528e89c6e605d2507928e63f7f12c020 | RamySaleh/Algorithms | /Interview_MSFT/sec_min_trounament_tree.py | UTF-8 | 1,299 | 3.125 | 3 | [] | no_license | # https://leetcode.com/discuss/interview-question/algorithms/125110/tournament-tree-problem?fbclid=IwAR3oPVpCjaZeFPzWYDh4xs-n1HIZVZ8pf8Ii52hMehEGdfQAmx7p-WUbyo4
from typing import List
from Helpers import helper as hlp
from Helpers import test_class
from Helpers import node as nd
class Solution(test_class.test_class)... | true |
ec299f804bacd3b681297ef5e3693e6546c32e77 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2484/60796/247997.py | UTF-8 | 408 | 2.78125 | 3 | [] | no_license | n=int(input())
result=[]
while n>0:
num=input().split(" ")
num=[int(x) for x in num]
s1=input().split(" ")
s2=input().split(" ")
str1=","+",".join(s1)+","
i=0
while i<=len(s2)-1:
if str1.__contains__(","+s2[i]+","):
del s2[i]
i=i-1
i=i+1
result.app... | true |
848fa5ce626f7646550257d8bcf87d1a822f3ad7 | pengfei99/Atlas | /org/pengfei/entity_management/EntityManager.py | UTF-8 | 1,193 | 2.65625 | 3 | [] | no_license | from abc import ABC, abstractmethod
from atlasclient.client import Atlas
class EntityManager(ABC):
def __init__(self, atlas_client: Atlas):
self.client = atlas_client
@abstractmethod
def create_entity(self, *args, **kwargs) -> None:
pass
def get_entity(self, guid: str) -> dict:
... | true |
5194cccc5f213e7eb256447ee4fd8bb45a7525f3 | Dimev/Flowerbot | /engine.py | UTF-8 | 1,114 | 3.21875 | 3 | [] | no_license | import random
import re
# conversation manager
# calls the conversation class when called
# conversation takes input mem and output mem as inputs
# should return an array of responses
class Manager:
def __init__(self, conversation, mem_size = 8, inputmem = [], outputmem = []):
self.conversation = conversat... | true |
9a46ea87d7a0e0698e27755a0bd392dffddc4193 | OCC111/github | /caishu.py | UTF-8 | 280 | 3.671875 | 4 | [] | no_license | import random
pc=random.randint(1,100)
i = 0
while i < 3:
user = int(input('输入1~100其中一个数字,猜猜:'))
if user > pc :
print('数大了,好好想想')
elif user < pc:
print('数小了,干哈玩意的')
else:
print('恭喜您猜对喽!')
i += 1
| true |