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 |
|---|---|---|---|---|---|---|---|---|---|---|
337c6fc27257141f41a29955a75baf66d7fcfe89 | tblawson/HRBC | /R_info.py | UTF-8 | 11,672 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
R_info.py
Created on Fri Sep 18 09:40:33 2015
@author: t.lawson
"""
import string
import datetime as dt
import time
import math
import xlrd
from openpyxl.styles import Font,colors,PatternFill,Border,Side
import GTC
from numbers import Number
RL_SEARCH_LIMIT = 500
INF =... | true |
b418d47e44204dc79951f4108689fc9addc28279 | xszefo/misc | /test.py | UTF-8 | 249 | 3.6875 | 4 | [] | no_license | #!/usr/bin/python3
class C:
@staticmethod
def metoda():
print("hi")
obj = C()
obj.metoda()
C.metoda() # moge tez wywolac na klasie, a nie na obiekcie
sentence = 'This is a test'
for word in sentence.split():
print(word)
| true |
5b34739b78ce29cc95d281193d945ea89e712bcc | XuNeverMore/PythonDemo | /class/fibonacci.py | UTF-8 | 395 | 3.578125 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
class Fibonacci:
def __init__(self):
self.flist = [0, 1]
def check(self, num):
if num <= len(self.flist):
pass
else:
while len(self.flist) < num:
self.flist.append(self.flist[-1] + self.flist[-2])
... | true |
83d5a1c66077de9bf57503c13e8d9681c8ec5aa4 | jaykakadiya93/AWS | /dynamo/clients/python/dynamo_zoneLevel.py | UTF-8 | 1,020 | 2.84375 | 3 | [] | no_license | import pandas as pd
import boto3
import numpy as np
session = boto3.session.Session(profile_name='saml')
resource = session.resource('dynamodb','us-east-2')
df=pd.read_excel('ZipData.xlsx', dtype=str)
df.columns=["zip5","zip4","state","division_name","region_name","zone","zoneeffectivedate","createdate"]
df["division... | true |
9fcfb8d1276462edb7320d04b24466f4031205b1 | gaborbernat/cloud-scanner | /cloud_scanner/contracts/cloud_config_reader.py | UTF-8 | 1,192 | 2.828125 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | import json
import logging
from .storage_container import StorageContainer
class CloudConfigReader:
"""Helper to read cloud configuration file."""
def __init__(self, container_service: StorageContainer):
self._container_service = container_service
def read_config(self):
"""Read cloud co... | true |
93d1552bb28c9794c3795539bdb5302b28e02cc0 | Xiaqz/eigenlearning | /unit_circle.py | UTF-8 | 2,428 | 3.21875 | 3 | [] | no_license | import jax.numpy as np
from jax import random
def get_unit_circle_dataset(M, target_terms, full=True, n=None, subkey=None):
"""Generate a dataset on the discretized unit circle.
M -- The number of points the unit circle is discretized into
target_terms -- The target functions of the dataset to return. Must be ... | true |
35cd8c8fc2551e9e3b991ed9bd11e4dc3920a699 | victorhvivasc/check_list_ley_edc | /Victor/requisitos/requisito_5.py | UTF-8 | 1,307 | 2.515625 | 3 | [] | no_license | import numpy as np
from configuracion.listas import porcentajes
def validar_requisito_5(obj, ):
"""Procedimiento de clase para verificar cumplimiento de requisito 5 (% invertido en I+D)
recibe self desde la clase
validar_requisito_5(self, )"""
try:
dividir = (float(obj.lineEdit_3.text()) / flo... | true |
668c9ade50840cbf5e7028a67e13ea9469c3e892 | code4love/dev | /Python/demos/practice/student.py | UTF-8 | 262 | 3.421875 | 3 | [] | no_license | class student:
def __init__(self, name, age):
self.name = name
self.age = age
def desc(self):
print("name:%s, age:%d"%(self.name,self.age))
def name(self):
return self.name
def age(self):
return self.age | true |
44af1fcf2600cf52d32487e7010510ca8bc2f322 | CanaanShen/DataProcessor | /src/Crawler/MalletDataProcessor.py | UTF-8 | 2,902 | 2.6875 | 3 | [] | no_license | '''
Created on Apr 20, 2015
@author: dcsliub
'''
import os
class MalletDataProcessor:
def lineAsDoc(self, rootDir):
for dir in os.listdir(rootDir):
docFile = os.path.join(rootDir, dir, dir+".docs")
vocabFile = os.path.join(rootDir, dir, dir+".vocab")
... | true |
61f8b32ce16c68b1ee1bc30a40caef7d9d885e87 | ileefmans/CS-Practicals | /CS-Practicals/Algorithms/K-Means/CS_Practical3.py | UTF-8 | 3,133 | 3.296875 | 3 | [
"MIT"
] | permissive | import numpy as np
from matplotlib import pyplot as plt
class KMeans:
def __init__(self, data):
self.data = data
def distance(self, p1, p2):
return np.linalg.norm(p1-p2)
def average(self, matrix):
ones = np.ones((1, matrix.shape[0]))
average = np.matmul(ones, matrix)*(1/... | true |
b88dbcbb26dca5161cc5a302d4d9ff3a6589b540 | ElijahBahm/CSE | /Elijah Bahm - Guessgame.py | UTF-8 | 840 | 4.09375 | 4 | [] | no_license | import random
# Elijah Bahm
# Initializing Variables
number = (random.randint(1, 50))
print("Guess a number 1-50.")
guess = "0"
guesses = 0
# Describes one turn. The while loop is the Game Controller.
while int(guess) != number and guesses < 5:
guess = input("What is your guess?")
if guess == str(number):
... | true |
e5a1f8773cc105444e970fe2e51b553c44b6806e | peggypan0411/CREST-iMAP | /cresthh/UQ/analyze/correlations.py | UTF-8 | 2,170 | 2.84375 | 3 | [] | no_license | from __future__ import division
from ..util import read_param_file
import numpy as np
import scipy.stats
import matplotlib.pyplot as plt
# Perform Correlation Analysis on file of model results
def analyze(pfile, input_file, output_file, column = 0, delim = ' ', plot = True):
param_file = read_param_file(... | true |
7daf9591fe4a4fd218e47a19a4b042736ebf74da | aashray18521/competitiveCoding | /GFG/missingAndRepeating.py | UTF-8 | 660 | 3.59375 | 4 | [] | no_license | # https://practice.geeksforgeeks.org/problems/find-missing-and-repeating/0
def missingAndRepeating(arr, n):
for i in range(n):
if(arr[abs(arr[i]) - 1]) > 0:
arr[abs(arr[i]) - 1] = -arr[abs(arr[i]) - 1]
else:
print(abs(arr[i]), end=" ")
for i in range(n):
if(arr[i... | true |
bc0cf1f7a638beeab728097e2e65cb27c57aee5c | ntpdrop/ieeesp2021 | /python/cp1_code/cp1_package.py | UTF-8 | 1,983 | 2.765625 | 3 | [
"MIT"
] | permissive | import logging
from scapy.layers.ntp import NTPHeader
from ntp_raw import RawNTP, NTPField
class CP1Package(RawNTP):
"""
A child of RawNTP which adds functionality in order to extract and insert CP1 specific data into
and from a NTPRaw package
"""
def __init__(self, ntp_pck: NTPHeader = NTPHead... | true |
ff0da48cdfec953bd541729e7333a9bfe2f53570 | AG-droid/Projects | /Python Exercises/Ex_B.py | UTF-8 | 1,051 | 3.890625 | 4 | [] | no_license | #Creating the variables
d = 0
c = 0
a = {}
#Creating a class named bus
class bus:
def __init__(self):
pass
#Collecting the info from the user and sorting them on the basis of their type
def info(self):
global i
i = (input('How many passengers were on the bus --> '))
#Nest... | true |
8597670da1b637d24d152c50fa12d08f7c540f5b | AliRLee/UKC | /Scoring.py | UTF-8 | 2,455 | 3.546875 | 4 | [] | no_license | """
Author: Alistair Lee
Goal: Create a list of all climbing grades for the different styles and give these grades a score dependant on
their difficulty.
Created: 09/03/2020
"""
def get_score(my_list) -> dict:
"""
Given a list of grades, score these depending on the difficul... | true |
fa7f94cf78b2b56d650db3f603d84e987b2fa9d4 | PMcGoldrick/Tic-Tac-Toe | /src/common.py | UTF-8 | 914 | 3.1875 | 3 | [] | no_license | '''
Created on May 9, 2011
@author: pmtemp
'''
EMPTY = 0
NOUGHT = 1
CROSS = 2
DRAW = 3
DEBUG = True
shape_map = {0: " ", 1 : "0", 2 : "X"}
def singleton(cls):
""" Enforce single instance of decorated class """
instances = {}
def getInstance(name="main"):
if not name in instances.keys():
... | true |
a864e90aa06f3ab9169dc330bd8872d0e7c9eeb8 | NotYeshwanthReddy/PC_Assistant | /database_manager/combine_logs.py | UTF-8 | 1,982 | 2.828125 | 3 | [] | no_license | """
Written By - Yeshwanth Reddy
NnY_Packages
"""
from operator import itemgetter
from Data import strings
Key_Log_File_Name = strings.Key_Log_File_Name
Voice_Log_File_Name = strings.Voice_Log_File_Name
All_Log_File_Name = strings.All_Log_File_Name
Temp_Log_File_Name = strings.Temp_Log_File_Name
Mouse_Log_F... | true |
3f9fada65238bf56cbf2deff63aa0a5cc883e893 | BorisLestsov/PortraitSegmentation | /data_portrait.py | UTF-8 | 1,282 | 2.640625 | 3 | [] | no_license | import torch
import numpy as np
import PIL.Image as Image
import os
IMG_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp')
class SegDataset(torch.utils.data.Dataset):
def __init__(self, root, transform=None):
super(SegDataset, self).__init__()
self.root = ro... | true |
d91caf6acb1c945924fda481be499025e9795203 | haje01/swak | /swak/static/templates/tmpl_recordinput.py | UTF-8 | 596 | 2.609375 | 3 | [
"MIT"
] | permissive | {% extends "tmpl_base.py" %}
{% block class_body %}
def __init__(self):
"""Init."""
super(RecordInput, self).__init__()
def generate_record(self):
"""Generate records.
This function can be written in synchronous or asynchronous manner. To
make it work asynchronously, ... | true |
4d5a1b106db0e562523a8bd97e9590a71e9d2800 | spcl/dace | /tests/custom_reduce_test.py | UTF-8 | 537 | 2.640625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
import numpy as np
@dace.program
def customreduction(A: dace.float32[20], out: dace.float32[1]):
dace.reduce(lambda a, b: a if a < b else b, A, out, identity=9999999)
def test_custom_reduce():
A = np.random.rand(20).asty... | true |
39b962548d3051ef7d47f7f0ff2e63e3f879d61f | runningbug/FileDeDupe | /FileDeDupe.py | UTF-8 | 11,565 | 3.4375 | 3 | [] | no_license | import os
from FileDefinition import FileDefinition
from FileDuplicateData import FileDuplicateData
#
# Stores data about the files we are considering for de-duplication.
# Has the ability to add files for consideration and to delete files.
#
class FileDeDupe:
# constructor, takes a path which wi... | true |
29efea96ad5b85518d196579ba290a12ddf83927 | emirarditi/IEEEPythonDersleri | /Lecture4/BasicMethods.py | UTF-8 | 734 | 3.421875 | 3 | [] | no_license | # Void örnekleri
def cizgiKoyan(adamin_adi):
print("-" * len(adamin_adi))
print("Ali Emek")
cizgiKoyan("Ali Emek")
print("Ayşe Deniz")
cizgiKoyan("Ayşe Deniz")
print("Ali Koç <3")
cizgiKoyan("Ali Koç <3")
print("Aziz Yıldırım :@")
cizgiKoyan("Aziz Yıldırım :@")
# Return Örnekleri
def benimEnBuyugum(asjkhdf, b... | true |
c970291f219457f40df522d975137cc2284448cd | sunxm2357/TwoStreamVAN | /classifier/classifier_environ.py | UTF-8 | 6,684 | 2.78125 | 3 | [] | no_license | import sys
sys.path.insert(0, '..')
from classifier.network import *
from torch.autograd import Variable
import torch
import torch.optim as optim
import torch.nn.init as init
import os
from utils.util import Initializer
from tensorboardX import SummaryWriter
import time
import pdb
class Classifier_Environ(object):
... | true |
dd40ee04947f116f3cceb5cdab218c78b1dbb42d | crystalugarte93/python-datastructures | /DataStructures & Algorithms/ArraySequences/ReverseSentence.py | UTF-8 | 1,242 | 4.15625 | 4 | [] | no_license |
def rev_words(s):
words = []
length= len(s)
spaces = [' ']
i = 0
# We will iterate through the entire string and cross check with the
# spaces array (i.e. compare and exclude the white spaces)
while i < length:
if s[i] not in spaces:
# Only when we find a character that... | true |
b441d25ee8a22cfd21754034128901ee9d36925f | heroca/heroca | /ejercicio24.py | UTF-8 | 310 | 3.578125 | 4 | [] | no_license | num1=int(input("Ingrese nro 1:"))
num2=int(input("Ingrese nro 2:"))
num3=int(input("Ingrese nro 3:"))
if num1==num2 and num2==num3 and num3==num1:
suma=num1+num2
resultado=suma*num3
print("suma del primero con el segundo")
print(suma)
print('resultado por el tercero')
print(resultado)
| true |
0c70387a05cceb5aa4767076e0d62fca617bd449 | DevRyu/Daliy_Code | /Python/Binary_search.py | UTF-8 | 4,050 | 4.1875 | 4 | [] | no_license | # ‘이진 탐색(Binary Search)’ 알고리즘은 분할과 정복을 사용합니다..
# 이진 탐색 알고리즘은 정렬된 리스트를 전제로 합니다.
# 처음에 푼 방법
# for loop을 사용할려고 하니 파이썬의 for loop syntex의 in연산자 때문에
# 재귀함수를 사용해야 할 것 같았다.
# 값은 재대로 리턴을 하나... 인덱스 키값을 유지할려면 함수밖에 리턴을 하고
# 리턴한 값을 전역scope에서 원래 인덱스와 비교를 해야 했다 라고 생각했다
# 원하는 요구사항은 함수 내에서 해결을 해야하는 부분이였고
# 인터넷의 예제들은 조금 더 간단하게 wh... | true |
8aaf3f231d809b82476f0ffa100a5a7e412579e0 | DreamonZhu/AI | /tensorflow_code/myregression.py | UTF-8 | 1,738 | 3.09375 | 3 | [] | no_license | import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
def myrgression():
"""
自实现一个线性规划的模型
:return: None
"""
# 1. 准备数据
with tf.variable_scope('data'):
x = tf.random_normal([100, 1], mean=1.75, stddev=0.5, name='x_data')
y_true = tf.matmul(x, [[0.7]]) + 1.0
... | true |
3166bb33b0eb29f41e66f77e61137e5b17c82cca | caok168/pythondemo | /exceldemo/demo1.py | UTF-8 | 906 | 3.28125 | 3 | [] | no_license | import pandas as pd
def readExcelByPandas(excelFile):
df = pd.read_excel(excelFile,sheet_name=1)
nrows = df.shape[0]
ncols = df.columns.size
print('Max Rows:'+str(nrows))
print('Max Columns:'+str(ncols))
# 遍历全部内容
list = []
for iRow in range(nrows):
if iRow > 0:
date... | true |
12d47b0518f306348bcd9dc18aace2e85d3c4f7d | athletejuan/TIL | /Algorithm/BOJ/24_binary_search/17266.py | UTF-8 | 332 | 2.828125 | 3 | [] | no_license | N = int(input())
M = int(input())
lights = list(map(int, input().split()))
height = 0
for light in lights:
if not height:
height = light
else:
if height < (light - before + 1)//2:
height = (light - before + 1)//2
before = light
if N-light < height:
print(height)
else:
pr... | true |
2f84218e4650ae8951e6f23942d111980b2c666b | syclops/ctlogutil | /ctlogutil/common_http.py | UTF-8 | 2,272 | 3.34375 | 3 | [] | no_license | """
Convenient interface for making asynchronous HTTP requests.
Author: Steve Matsumoto <stephanos.matsumoto@sporic.me>
"""
import aiohttp
import logging
# This function is only used internally and thus is undocumented.
async def __get(session, url, params):
return await session.get(url, params=params)
# This ... | true |
99d707ae399e05335cd085f1414ca7aa7ca5e604 | bglossner/Python-Calculator | /Calculator/calcTester.py | UTF-8 | 1,862 | 2.921875 | 3 | [] | no_license | def isFloat(st):
try:
float(st)
return True
except ValueError:
return False
l = [1, 4, 4, 16]
l = [-1 * num for num in l] + l
print(l)
##ffacs = [1, 2, 4, 4, 8, 16]
##print(list(range(int(len(ffacs) / 2) - 1, -1,-1)))
##num = 8 ** (1/3)
##print(num)
#string1 = "-1*8.0"
#str1 = [char for ... | true |
40e8e79472d055def5ff9be7199353456b5d2424 | MarcoVelazquez/Tareas-Estructura-De-Datos | /Examen practico II/Ejercicio_3.py | UTF-8 | 731 | 4 | 4 | [] | no_license | #Ejercicio No.3
cont_ = 0
def New_pila():
pila = []
i = 0
return pila,i
def Push(pila,i,cont):
pila.append(cont)
print("Registro hecho")
i += 1
cont += 1
return pila,i,cont
def Pop(pila,i):
if i > 0:
del(pila[i-1])
i -= 1
return pila,i
else:
print("No hay registros")
return pila,i
def Menu(cont... | true |
0fe04a68fc22e6e015b0347377c35335ff3c7934 | jibminJung/pythonML | /kpca.py | UTF-8 | 1,133 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 13:07:54 2020
@author: tunej
"""
df = pd.read_csv("data_pepTestCustomers.csv")
dfx = df.drop(['pep','id'],axis=1)
dfy = df['pep']
#income, age 특성이 너무 크므로, StandardScaler를 이용하여 표준화해보았습니다.
from sklearn.preprocessing import StandardScaler
stdsc = StandardScaler()
df[['i... | true |
c817bba1a822d67a6840b8b50c1374d105a0f3e9 | Sukhrobjon/leetcode | /easy/1046_last_stone_weight.py | UTF-8 | 1,953 | 4.28125 | 4 | [
"MIT"
] | permissive | """
We have a collection of stones, each stone has a positive integer weight.
Each turn, we choose the two heaviest stones and smash them together. Suppose
the stones have weights x and y with x <= y. The result of this smash is:
If x == y, both stones are totally destroyed;
If x != y, the stone of weight x is tota... | true |
14f8b59c578db21125fbd06967f33ef629c10047 | saisrihari/Programs | /python_class/Srihari_strings(day1).py | UTF-8 | 1,115 | 4.03125 | 4 | [] | no_license | print("Write a program for printing ͞yhnetobgnes͟ from ͞pythonbestforbeginners͟.")
a="pythonbestforbeginners"
print(a[1::2])
print("Write a program to print reverse of a user given string.")
a=str(input('Enter a string:'))
print("Reverse of string is "+a[::-1])
print("Write a program to change all occurrences of 3 rd c... | true |
f84c6810754b8fe8753379796d44145a44336b1f | Khushisomani/codes | /34665659.py | UTF-8 | 194 | 3 | 3 | [] | no_license | # cook your dish here
for _ in range(int(input())):
t=int(input())
if t%2==0:
while(t%2==0):
t=t//2
count=t//2
else:
count=t//2
print(count) | true |
dc456f669f44e765a401350fd53b6a10aa41ee17 | diofant/diofant | /diofant/polys/orthopolys.py | UTF-8 | 7,538 | 3.3125 | 3 | [] | permissive | """Efficient functions for generating orthogonal polynomials."""
from ..core import Dummy
from ..domains import QQ, ZZ
from .constructor import construct_domain
from .polytools import Poly, PurePoly
def _jacobi(n, a, b, K):
"""Low-level implementation of Jacobi polynomials."""
ring = K.poly_ring('_0')
x ... | true |
47fdc47d9acd8fe645eb9338d7253f5f0e4839df | mladenangel/scripts | /pyLessions/crypto/lessSHA256.py | UTF-8 | 288 | 3.21875 | 3 | [] | no_license |
from Crypto.Hash import SHA256
plaintext = 'hello world from python'
print(plaintext)
sha256 = SHA256.new()
sha256.update(plaintext.encode())
hash_sha256 = sha256.digest()
hex_hash_sha256 = sha256.hexdigest()
print('hash sha256:', hash_sha256)
print('hex hash sha256:', hex_hash_sha256)
| true |
bd1f4977eadae21c57d36dc90b68d1dd54b15389 | PengfeiLv/LeetCode | /Level1/Array/48. Rotate Image.py | UTF-8 | 674 | 3.609375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/1/10 14:37
# @Author : Lvpengfei
def rotate(matrix):
def rotateEdge(x1, y1, x2, y2): # 指定两个角的坐标,操作更方便
"""(x1,y1): left_up point
(x2,y2): right_down point """
for i in range(x2-x1):
temp = matrix[x1][y1+i]
matrix[x1][y1+i] = matrix[x2-i][y1]
matrix[x2-i][y... | true |
e1c60066ab556e48020668cff984769d019c8a09 | peilinsun/filestagram-app | /app/main/forms.py | UTF-8 | 2,330 | 2.796875 | 3 | [] | no_license | from flask_wtf import FlaskForm
from flask_pagedown.fields import PageDownField
from wtforms import FileField, StringField, SubmitField, TextAreaField, BooleanField, SelectField
from flask_wtf.file import FileRequired, FileAllowed
from wtforms.validators import DataRequired, Email, Length, Regexp, ValidationError
from ... | true |
9c2fd9779772ef050ecc9c0c75779619fd42edb7 | BesnardConsultingSAS/django-screening | /agile/tests/test_models.py | UTF-8 | 427 | 2.625 | 3 | [] | no_license | from django.test import TestCase
from agile.models import Agile
class AgileMethodTests(TestCase):
def test_get_values(self):
"""Tests expected Agile type values from fixtures."""
self.assertTrue(Agile.objects.get_values().count(), 4)
def test_get_principles(self):
"""Tests expected A... | true |
c4fc28c3fee40095d02bac0a516c5f3804a1cc3d | Aasthaengg/IBMdataset | /Python_codes/p03006/s705118477.py | UTF-8 | 1,194 | 2.578125 | 3 | [] | no_license | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter... | true |
f0f8972e1ae417e227a0240b8a2e0a89301aa20a | Aasthaengg/IBMdataset | /Python_codes/p04019/s655325222.py | UTF-8 | 111 | 3.203125 | 3 | [] | no_license | t=input()
n='N' in t
w='W' in t
s='S' in t
e='E' in t
if n==s and w==e:
print('Yes')
else:
print('No') | true |
123163e1ef758302f5f812544a1514f6a07c77fd | beirbear/HarmonicIO | /data_source/__main__.py | UTF-8 | 2,216 | 2.5625 | 3 | [] | no_license | """
DataSource application entry point.
"""
def run_rest_service():
"""
Run rest as in a thread function
"""
from .rest_service import RESTService
rest = RESTService()
rest.run()
if __name__ == '__main__':
"""
Entry point
"""
print("Running Harmonic DataSource")
# Load Se... | true |
b4465f532fe6439259eb57a1812a4c58fbb0d2e8 | AnarchyTools/SublimeAnarchy | /package/stTextProcessing.py | UTF-8 | 8,451 | 2.515625 | 3 | [] | no_license | import re
placeholderRegex = re.compile(r"<#T##([^#]*)(##.*)*#>")
def fromXcodePlaceholder(placeholder):
"""Converts SK-style completions to ST-style completions.
input like ".append(<#T##other: String##String#>)"
output ".append(${0:other:String})"
"""
i = 0
while True:
match = p... | true |
f1f6636e717e24fd29c41c90d317cef3d8281aa1 | lcranda3/lindacrandallrepo | /PycharmProjects/403ex2/2.1.py | UTF-8 | 1,770 | 3.734375 | 4 | [] | no_license | import numpy as np
import numpy.random as rand
import matplotlib.pyplot as plt
def makelist(n):
mylist=[]
for i in range(10000):
avg=0
array=rand.random(n)
for num in array:
avg+=num
avg=float(avg)/float(n)
mylist.append(avg)
#print mylist
return myli... | true |
c0649aa49e07640b2a2c1dac07c15c722bf43f67 | zhanhui1987/docker-django | /z1987_web/sysadmin/z1987_glib/my_tool.py | UTF-8 | 2,765 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
# @Time : 2018/5/9 0:32
# @Author : zhanhui
# @File : my_tool.py
"""
本包主要用于封装django views.py中常用的一些函数。
"""
def init_response_data(list_field=None, dict_field=None, zero_field=None):
# 初始化页面返回的数据。list_field用于接受需要其初始化为空数组的字段,用英文","连接多个字段;dict_field
# 用于接受需要初始化... | true |
01a176808e8ca9f8d82fac6c5b183da320be6e52 | fragfutter/euler | /018.py | UTF-8 | 1,414 | 3.609375 | 4 | [] | no_license | #!/usr/bin/python
import itertools
data1 = """
3
7 4
2 4 6
8 5 9 3
"""
data2 = """
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
9... | true |
c0071ab0320487e8fdb05e88d5ca8f6d5c2a6824 | j7168908jx/ButterflyNet | /butterflynet/datasets/identity_datasets.py | UTF-8 | 2,625 | 2.859375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
class Identity:
def __init__(self, N, io_type = 'r2r',
x_range = [], k_range = [],
dtype = np.float32):
self.N = N
self.dtype = dtype
if (io_type.lower() == 'r2r') \
or (io_type.lower() == 'r2c'):
self.xtype = 'r'
... | true |
fbd02730247a133454b92c032f7ddb3084086ef6 | enformatik/expectigrad | /expectigrad/testing.py | UTF-8 | 4,450 | 3.421875 | 3 | [
"Python-2.0",
"MIT"
] | permissive | import numpy as np
def gradient_test_function(x, t):
"""Computes the gradient of the online optization problem below for unit testing.
The test function f_t(x) is defined as
f_t(x) = 3x_0^2 if t is odd
f_t(x) = x_0^2 + 8x_1^2 if t is even
"""
if (t % 2) == 1:
a = n... | true |
fc6ff61df844c2284a8ac8113006ed1de26a164a | daniel-cortez-stevenson/crypto-predict | /notebooks/tree_model_dev.py | UTF-8 | 4,648 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[1]:
get_ipython().run_line_magic('load_ext', 'autoreload')
get_ipython().run_line_magic('autoreload', '2')
p = print
from os.path import join
import pickle
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', '... | true |
aa3b5aeb9384c704e2a6d61c70917638e14c3689 | rvause/django-tiamat | /tiamat/urlencoder.py | UTF-8 | 1,330 | 2.90625 | 3 | [
"BSD-2-Clause"
] | permissive | import random
from base64 import urlsafe_b64encode, urlsafe_b64decode
from django.conf import settings
ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
class URLEncoder(object):
def __init__(self, secret, alphabet=ALPHABET, noise_length=12):
self.secret = secret
self.... | true |
4f35875443f1ae53805c17d1b653c74bcae268b0 | jacben13/PyGameLearn | /A Racey Game.py | UTF-8 | 3,446 | 3.546875 | 4 | [] | no_license | __author__ = 'Ben'
# First lesson on PyGame from Sentdex https://www.youtube.com/watch?v=ujOTNg17LjI
import pygame
import time
import random
pygame.init()
# Window resolution
display_width = 800
display_height = 600
# Color definitions
black = (0, 0, 0)
white = (255, 255, 255)
red = (255, 0, 0)
green = (0, 255, 0)
... | true |
5d707424b979c1600c0ecc53f8ba20fc06760f20 | dtrzepalkowska/Python_Ex | /EX1.py | UTF-8 | 1,388 | 4.1875 | 4 | [] | no_license | def Ex1():
print('-----------EXERCISE 1-----------')
str1="79-900"
str2="80-155"
num1=int(str1[:2]+str1[3:])
num2=int(str2[:2]+str2[3:])
print('List of post-codes:')
for x in range(num1,num2):
elem =str(x+1)
print(elem[:2]+"-"+elem[2:])
print('------------... | true |
df9e651965a3ba60428ab0684653dcaf7f2a4597 | vss2h/noise-detector | /program.py | UTF-8 | 2,642 | 3.21875 | 3 | [] | no_license |
#trying some simple python programming to check how well the email sending work
import datetime
import smtplib
from email.mime.text import MIMEText
def main():
now= datetime.datetime.now()
#now= datetime.datetime.now()
max_temp= 120.0
min_temp= 20.0
curr_temp= 0.0
myfile= open("pfile.txt", 'r')
for line in my... | true |
1d73eaf7b68b1c3427330e37fafa3a98a4044b8d | siddharthkale97/NLTK-tutorial | /stemming.py | UTF-8 | 227 | 3.359375 | 3 | [] | no_license | from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
ps = PorterStemmer()
text = "I enjoy riding, I rode the bike. It was very helpful"
words = word_tokenize(text)
for i in words:
print(ps.stem(i)) | true |
15aa734759458b1dc5ecc660157241cf678ee20b | Airseai6/test | /file_deal/json_deal/sun/sun_t.py | UTF-8 | 794 | 2.78125 | 3 | [] | no_license | #! python3
# -*- coding:utf-8 -*-
import re
# [
# {
# "1月1日": "-3分9秒",
# "1-1": "-3*60+9",
# "1-1": -189,
# num1 = r'\"(.+?)月'
# num2 = r'月(.+?)日'
# num3 = r'\"(.+?)分'
# num4 = r'分(.+?)秒'
with open('sun.json', 'r', encoding='utf8')as f:
data = f.readlines()
new_data = {}
for line in dat... | true |
7b857c38579a4b1b78eabe73a75a62324b7b2fe9 | thieu1995/ai | /do_an/cao_quyen/model/GA.py | UTF-8 | 9,476 | 2.9375 | 3 | [
"MIT"
] | permissive | import numpy as np
from random import random
from copy import deepcopy
from operator import itemgetter
from sklearn.metrics import mean_absolute_error
class BaseClass(object):
FITNESS_INDEX_SORTED = 1 # 0: Chromosome, 1: fitness (so choice 1)
FITNESS_INDEX_AFTER_SORTED = -1 # High fitness choose... | true |
5966f5847d567771dad2681ea6277033e7cb3a51 | BYU-PCCL/conversational-ai | /conversational_ai/dataset/chitchat.py | UTF-8 | 1,288 | 2.59375 | 3 | [
"MIT"
] | permissive | """Dataset utilities for the ChitChat Challenge dataset."""
from typing import Callable, Dict, Iterable, Iterator
import chitchat_dataset as ccc
import tensorflow.compat.v1 as tf
from conversational_ai.dataset import utils
def generate_compounding_conversations(**kwargs) -> Iterable[Dict[str, str]]:
"""Yields e... | true |
d784556f3dfe96c046c7ad0a32fb7020bbab1b12 | namanjain-iosdev/text-based-captcha-generator | /func.py | UTF-8 | 590 | 3.265625 | 3 | [] | no_license | from captcha.image import ImageCaptcha
from random import *
def captcha_img(captcha_text):
image=ImageCaptcha()
data = image.generate(captcha_text)
image.write(captcha_text,'cap_img.png')
def captcha_gen():
captcha_size=6
captcha_text=""
alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m... | true |
2c460a1154024486f43664b6611ffd0d896676ed | aquaerius/check-tpay-wallet | /send_mail.py | UTF-8 | 3,136 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 21 17:42:54 2018
@author: lapdog
"""
import smtplib
import logging
import requests
import time
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logging.disable(level=logging.DEBUG)
logging.debug('Start of... | true |
447df4f9e604c44fefc8ea102e51428c5a05d7af | Anisuraahman/Anisur-rahman | /Caccu.py | UTF-8 | 402 | 3.703125 | 4 | [] | no_license |
def Calc(num1, num2, operator):
if operator == '+':
return num1 + num2
elif operator == '-':
return num1 - num2
elif operator == '*':
return num1 * num2
elif operator == '/':
return num1 / num2
result = Calc(int(input("Enter the first number")), int(inp... | true |
77e8e16a61bcf9c790883b36befc1e494c40b3c1 | TaeJuneJoung/Algorithm | /sw_expert_academy/D4/p7701.py | UTF-8 | 282 | 3.28125 | 3 | [] | no_license |
T = int(input())
for t in range(1,T+1):
M = []
for n in range(int(input())):
M.append(input())
#중복제거
M = list(set(M))
#길이, 사전순으로 정렬
M.sort(key=lambda i:(len(i),i))
print("#{}".format(t))
for m in M:
print(m) | true |
bf0857c728102d73c7d2e6744c291b803e59144c | cmagnobarbosa/sara_public | /sara/core/pre_processamento.py | UTF-8 | 4,446 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# !/usr/bin/env python3
"""
Aplica o pré-processamento
Pre-processing
"""
# import ast
import re
# import base
import string
from collections import Counter
from unicodedata import normalize
import emoji
import spacy
import sara.stopWords.StopWords as stopWords
# print('spaCy Version: %s' % (s... | true |
148654ee9d4cb62d3c338266442bed1546e41d41 | HeliWang/upstream | /Stack/maximum-rectangle.py | UTF-8 | 1,488 | 4.0625 | 4 | [] | no_license | """
*(LC85) Maximal Rectangle*
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.
*Example:*
*Input:*
[
["1","0","1","0","0"],
["1","0","*1*","*1*","*1*"],
["1","1","*1*","*1*","*1*"],
["1","0","0","1","0"]
]
*Output:* 6
"""
class Solution(o... | true |
213aa50ea8bedb254ed43e4cd42bd27c05bb1d24 | chaoyifei/Practice | /practice/创建数据库表.py | UTF-8 | 1,368 | 3.171875 | 3 | [] | no_license | #coding=utf-8
import MySQLdb
#打开数据库
db=MySQLdb.connect(host="localhost",user="root",db="test",passwd="123456")
cursor=db.cursor()
#如果数据表已经存在就删除
cursor.execute("drop table if exists employee")
#创建数据表
sql = """CREATE TABLE EMPLOYEE (
FIRST_NAME CHAR(20) NOT NULL,
LAST_NAME CHAR(20),
AGE INT,... | true |
922d288cf513f0b2650e03d8f28842078ace78f5 | molchiro/AtCoder | /old/ABC152/E.py | UTF-8 | 258 | 2.78125 | 3 | [] | no_license | import math
mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
ans = 1
lcm = A[0]
for i in range(1, N):
a = A[i]
b = lcm
gcd = math.gcd(a, b)
lcm = (a*b)//gcd
ans *= lcm//b
ans += lcm//a
ans %= mod
print(ans) | true |
224706b3baf652e622bf0a9bfd21f68432cc4b9c | BerilBBJ/scraperwiki-scraper-vault | /Users/A/arctangent/isb_standards_library_isns.py | UTF-8 | 3,684 | 3.265625 | 3 | [] | no_license | # This scraper extracts a list of new standards and updates made
# to specific standards from the ISB Standards Library, ordered by date
import scraperwiki
import lxml.html
# Get a list of all ISB standards
url_all_ISNs = 'http://www.isb.nhs.uk/library/isn/all'
# Scrape the summary page and construct a parser object... | true |
600025d3a5802e13fc9b36b45c06bb84455b71d5 | NilsForssen/pawnshop | /tests/test_1.py | UTF-8 | 2,671 | 3.21875 | 3 | [] | no_license | # test_1.py
from pawnshop.ChessVector import ChessVector
from pawnshop.ChessBoard import initClassic
from pawnshop.Exceptions import IllegalMove, CheckMate
from pawnshop.GameNotations import board2FEN
from pawnshop.Pieces import Queen
board = initClassic()
class UnsuccessfulTest(Exception):
pass
def move(sta... | true |
6ee0d246afe7922ea00bc3e4a73b46ddefabc849 | gamefang/FileManager | /filemanager.py | UTF-8 | 8,718 | 2.90625 | 3 | [] | no_license | # -*-coding: utf-8-*-
import os # FileData
import json # FileData
import threading # SingletonType
from timeit_deco import timeit
class SingletonType(type):
'''
实现单例的元类
'''
_instance_lock = threading.Lock()
def __call__(cls, *args, **kwargs):
if not hasattr(cls, "_instance"):
... | true |
bc3a00e9ed279500cec059acc4e63234f6997c40 | yacinekedidi/holbertonschool-web_back_end | /0x03-caching/2-lifo_cache.py | UTF-8 | 1,683 | 3.625 | 4 | [] | no_license | #!/usr/bin/env python3
"""LIFOCache Module"""
from base_caching import BaseCaching
class LIFOCache(BaseCaching):
"""[LIFO caching system]
Args:
BaseCaching ([class]): [parent class]
"""
def __init__(self):
"""[summary]
"""
super().__init__()
def put(self, key, ite... | true |
488dac691a47f6f4263a88b04a51d8fd28d8bf48 | youanan/python-codes | /urllib/urllib_demo7.py | UTF-8 | 872 | 3.046875 | 3 | [] | no_license | '''
http POST请求
1,设置到URL网址
2,构建表单数据,并使用urllib.parse.urlencode对数据进行编码处理
3,创建Request对象,参数包括url网址和传递的数据
4,使用add_header()添加头信息
5, 使用urllib.request.urlopen()打开Request对象,完成信息传递
6, 处理网页内容
'''
import urllib.request
url = "http://www.iqianyue.com/mypost/"
postdata = urllib.parse.urlencode({
"name":"youanan",
"pass":"123456"
... | true |
e20e70ff3cf6cddda0ab0d14ab098b75bc74b1bd | tecdatalab/biostructure | /reconstruction/general_utils/temp_utils.py | UTF-8 | 656 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import os
import shutil
import tempfile
global_temp_dir = None
def free_dir(path_dir):
try:
shutil.rmtree(path_dir)
except:
pass
def gen_dir():
if global_temp_dir == None:
return os.path.abspath(tempfile.mkdtemp())
if not os.path.exists(global_temp_dir):
try:
os.mkdir(global_temp_dir... | true |
462f50ffcc5ce58e7933649fe03fe1537236f8d4 | SinghArshdeep/COMP1531 | /Lectures/demo/week06_flask_examples/bmi_url_for/routes.py | UTF-8 | 643 | 2.65625 | 3 | [] | no_license | from flask import Flask,render_template,request,redirect,url_for
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def calculate():
if request.method == 'POST':
mass = float(request.form["Mass"])
height = float(request.form["Height"])
name = request.form["Name"]
bmi = mas... | true |
150667f091afcbcce384848e7f01441d466d6275 | rkkothandaraman/Python-Strings | /string@insertion.py | UTF-8 | 153 | 3.078125 | 3 | [] | no_license | N=input()
count=0
for i in range(1,len(N)-1):
if(N[i]==N[i-1] and N[i]==N[i+1]):
N=N[:i]+'@'+N[i:]
count=count+1
print(count)
| true |
e3f5829cf5d369de8f571582085d9a75edcd71ff | massgiu/py-game-flappybird | /src/Main.py | UTF-8 | 682 | 2.96875 | 3 | [] | no_license | from src.Bird import Bird
from src.Ground import Ground
from src.PipeList import PipeList
from src.Utils import Utils
from src.Constants import Constants
import pygame
#clock = pygame.time.Clock() # create an object to help track time
def main():
win = Utils.initialize()
clock = pygame.time.Clock()
bir... | true |
23c17e229282e0d79d1d973e8baee0dadcb6e1bb | Lakhanbukkawar/Python_programs | /PalindromeUsingWhileLoop.py | UTF-8 | 264 | 3.625 | 4 | [] | no_license | num=int(input("enter the n digit number"))
rev=0
orgnum=num
while num>0:
digit=num%10
rev=rev*10+digit
num=num//10
if rev==orgnum:
print('number is palindrome')
else:
print('number is not palindrome')
| true |
3715af483c4554d444116b7062b13f19e8b696e6 | anhtu97/PayloadAllEverything | /LDAP injection/LDAP_injection_blind.py | UTF-8 | 469 | 2.5625 | 3 | [] | no_license | import requests
import string
char = string.ascii_letters + string.digits + "!@$%-()@_{}"
FLAG = ''
while 1:
lenFlag = len(FLAG)
for i in char:
payload = FLAG + i
url = "http://challenge01.root-me.org/web-serveur/ch26/?action=dir&search=admin*)(sn=admin)(password="+payload+"*))%00"
r = requests.get(u... | true |
6105df994644fe3d8e51e8316f499a3809f5b1c9 | radujica/data-analysis-pipelines | /benchmarking/preprocess_data.py | UTF-8 | 1,242 | 2.734375 | 3 | [
"MIT"
] | permissive | import argparse
import xarray as xr
"""
Join and convert the NETCDF3_CLASSIC files into a large NETCDF4 file (with full HDF5 API)
"""
parser = argparse.ArgumentParser(description='Combine data')
parser.add_argument('-i', '--input', required=True, help='Path to folder containing input files; also output folder')
args... | true |
06b3866f504c5a6fefcc3e36cc73882a670539aa | gngoncalves/cursoemvideo_python_pt2 | /desafio94.py | UTF-8 | 1,157 | 3.59375 | 4 | [] | no_license | pessoas = {}
grupo = []
somaidade = 0
while True:
pessoas['Nome'] = str(input('Nome: ')).strip()
while True:
sexo = str(input('Sexo: ')).strip().upper()[0]
if sexo in 'MF':
pessoas['Sexo'] = sexo
break
print('Opção Inválida. Tente Novamente.')
pessoas['Idade']... | true |
5026254b2b69007d44dc5c8023da475e70f39933 | javani/PC-Programs | /src/scielo/bin/xml/img_converter.py | UTF-8 | 1,495 | 2.765625 | 3 | [] | no_license | # coding=utf-8
import os
import sys
try:
from PIL import Image
IMG_CONVERTER = True
except:
IMG_CONVERTER = False
valid_img_ext = ['.eps', '.tif', '.tiff']
src_path = ''
destination_path = ''
if len(sys.argv) == 3:
ign, src_path, destination_path = sys.argv
elif len(sys.argv) == 2:
src_path = sy... | true |
fb7e159b948507c759c93e78882d1aeab43342a6 | roberlarues/PyTracer | /engine/io/ppm_writer.py | UTF-8 | 974 | 3.25 | 3 | [] | no_license |
def write_image_model(image_model, file_name="output.ppm"):
"""Guarda una imagen en un fichero con el formato PPM
Parámetros
----------
image_model - imagen a guardar"""
f = open(file_name, "w")
f.write("P3\n")
f.write("# Renderizado con PyTracer\n")
f.write(str(image_mode... | true |
81b7d8048144ce1856f6010f1f337967066c213a | alexanu/Python_Trading_Snippets | /Technical_Indicators/pivot_point.py | UTF-8 | 5,446 | 2.96875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
import yfinance as yf
yf.pdr_override()
import datetime as dt
# input
symbol = 'AMD'
market = 'SPY'
start = dt.date.today() - dt.timedelta(days = 365*2)
end = dt.date.today()
... | true |
7d527daa798ce75b1d9877a7aaaf60e6a42b1550 | jimyzhu/biosteam | /biosteam/_power_utility.py | UTF-8 | 4,213 | 3.3125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"NCSA",
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020-2021, Yoel Cortes-Pena <yoelcortes@gmail.com>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details... | true |
5156815711f88b241909fa58f7d0a8a8227daf7e | dportology/PiePartyScorer | /main.py | UTF-8 | 1,416 | 3.65625 | 4 | [] | no_license | mainList = []
num_users = int(raw_input("how many pie party goers? "))
num_pies = int(raw_input("how many pies were made? "))
for user in range(0, num_users):
is_string = False
user_name = ""
while not is_string:
user_name = raw_input("enter name for user " + str(user) + ": ")
if not isin... | true |
ebf0a575d7ca209e3318d4c89a2b0bb1f0d94a87 | KD-huhu/PyQt5 | /p026/Qlabel_demo.py | UTF-8 | 2,245 | 3.015625 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QVBoxLayout,QMainWindow,QApplication,QLabel,QWidget
from PyQt5.QtGui import QPixmap, QPalette
from PyQt5.QtCore import Qt
class QLabelDemo(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
# 创建标签
label1 = QL... | true |
fa7d0e4c4f541f5dc89e2c2d3a571a0060129fee | kaushal10/honeywell_Intern | /python/get_plansDetails.py | UTF-8 | 627 | 2.515625 | 3 | [] | no_license | import requests
print (requests.__version__)
# Fill in your details here to be posted to the login form.
payload = {
'username': 'h280674',
'password': 'green@123'
}
# Use 'with' to ensure the session context is closed after use.
with requests.Session() as s:
p = s.post('https://build.chevalpartners.com/us... | true |
cb02e56d94926a0d8690cc6c059a336b4756ad86 | SaifullahKatpar/pyusgs | /test3.py | UTF-8 | 986 | 2.9375 | 3 | [] | no_license | def do(name,alpha,num):
return f"""
<!-- http://ssei.herokuapp.com/water#{name} -->
<owl:NamedIndividual rdf:about="http://ssei.herokuapp.com/water#{name}">
<rdf:type rdf:resource="http://ssei.herokuapp.com/water#State"/>
<ontologies:alpha_state_code rdf:datatype="http://www.w3.org/2001... | true |
2d94eee013cf58e0ffabd9c8864c3e17874d80b7 | AkashPatel18/Basic | /Patterns/zig-zag.py | UTF-8 | 197 | 3.71875 | 4 | [] | no_license | n = 19
for i in range(1,4):
for j in range(1,n+1):
if (i+j)%4==0 or (i ==2 and j % 4==0):
print("* ",end = " ")
else:
print(" ",end = " ")
print()
| true |
a11aa8d1eddb44e3ff8acdfb1dfc74502cde4106 | padjal/computerSystemsArchitecture | /Homework/hw3-python/animal.py | UTF-8 | 419 | 3.390625 | 3 | [
"MIT"
] | permissive | class Animal:
def __init__(self):
self.name = ""
self.weight = 0
def get_name(self):
return self.name
def read_str_array(self, strArray, i):
pass
def print(self):
pass
def write(self, ostream):
pass
def special_number(self):
letters = ... | true |
b3bce36360263e10ae981dfa0910a5d70f23d3a1 | egocustos/customer_analytics | /eda_with_python.py | UTF-8 | 12,288 | 3.921875 | 4 | [] | no_license | #Preparations
#For the preparations lets first import the necessary libraries and
#load the files needed for our EDA
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Comment this if the data visualisations doesn't work on your side
%matplotlib inline
plt.style.use('bmh')
df = pd.read_csv... | true |
22a537d4e1417337dd65473441bdbca8bcb73dfd | alexandrelam/codedelaroute | /main.py | UTF-8 | 1,499 | 2.953125 | 3 | [] | no_license | import pyautogui as pg
import win32api
import keyboard
PLUS_X = 416
PLUS_Y = 118
PLUS_X_VALIDATE = 750
PLUS_Y_VALIDATE = 192
def calibrate():
print('Press Ctrl-C to quit.')
x = 0
y = 0
try:
while True:
state_left = win32api.GetKeyState(0x01) # Left button up = 0 or 1. Button down ... | true |
2a3de2ad63efe33961021d7c2470c997bdefb0b1 | zhangliang0825/weproject | /数据处理清洗/data_import.py | UTF-8 | 1,042 | 2.625 | 3 | [] | no_license | import csv
import re
from itertools import islice
import pymysql
DB_CONFIG = {
'host':'112.124.8.191',
'port':3306,
'user':'root',
'password':'Zycj@2020688',
'db':'toutiao',
'charset':'utf8mb4'
}
conn = pymysql.connect(**DB_CONFIG)
cursor = conn.cursor()
sql = '''insert into wo... | true |
c2641863fb412f339b1d9fd3876479ced76d5608 | altear/jam | /jam/backend/models.py | UTF-8 | 11,669 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
import uuid
from django.db import models
from django.contrib.postgres.fields import ArrayField
class Minesweeper(models.Model):
'''
Model for backend
When serialized, the player is only given visible information
'''
# The unique identifier of this game (used to return to an exi... | true |
40a748ffb416eee5a7789a2e31cf6dd42e1e565b | ChenJiR/generateUnittestCode | /unittestMain/tool.py | UTF-8 | 2,373 | 2.546875 | 3 | [] | no_license | import unittest
import redis
import pymysql
import unittestMain.config as config
class tool():
__env = 'dev'
__db = None
__db_name = None
__redis = None
__redis_db = 0
__token = None
def setEnv(self, env):
self.__env = env
def setDbName(self, db_name):
self.__db_nam... | true |
2c985788b93b17d4d89747ade253bae8cafc8f38 | gonzrubio/IBM_Deep_Learning | /PyTorch/Quizzes/Shallow_Neural_Networks/Neural_Networks_with_Multiple_Dimension_Inputs.py | UTF-8 | 1,061 | 3.53125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Shallow Neural Networks /
2.3 Neural Networks with Multiple Dimension Inputs
Quiz: Neural Networks with Multiple Dimension Inputs
"""
import torch
import torch.nn as nn
# 1) How many dimensions is the input for the following neural network object?
class Net(nn.Module):
def __init__(s... | true |
6ad1eaaf5aa773053bd1ffe47da4a0d5f35cabbe | dinosaurz/ProjectEuler | /id027.py | UTF-8 | 923 | 3.375 | 3 | [] | no_license | from time import clock
from id003 import isPrime
def eulerTest(a, b, n=2):
for i in range(1, 41):
if (n ** 2 + a * n + b) == ((n - i) ** 2 + (n - i) + 41):
return True
return False
def primeLength(ab):
a, b = ab[0], ab[1]
length = 0
for i in range(0, 80):
... | true |
8f615e80ffbfddcaff6956a44ae86558e7cb3a6a | mikibouns/python_lvl1 | /hw05_normal.py | UTF-8 | 3,554 | 4.125 | 4 | [] | no_license | __author__ = 'Матиек Игорь Николаевич'
# Задача-1:
# Напишите небольшую консольную утилиту,
# позволяющую работать с папками текущей директории.
# Утилита должна иметь меню выбора действия, в котором будут пункты:
# 1. Перейти в папку
# 2. Просмотреть содержимое текущей папки
# 3. Удалить папку
# 4. Создать папку
# Пр... | true |
3d6f2e796bfb5beb9de2232619a7e671b5b21b84 | wisesky/LeetCode-Practice | /src/51.N-Queens.py | UTF-8 | 2,174 | 3.015625 | 3 | [
"MIT"
] | permissive | from typing import List
from copy import deepcopy
class Solution:
def solveNQueens(self, n: int) -> List[List[str]]:
matrix = [['.']*n for _ in range(n)]
unchosen = []
for x in range(n):
# row = []
for y in range(n):
# row.append((x,y))
... | true |