blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
189050c550541696a3c88630f98a7062fb95ebbb | Python | liuwenwen313/store | /day17/Test数据在表格里测试.py | UTF-8 | 674 | 3.171875 | 3 | [] | no_license | import unittest
import xlrd
from Calc import Calc
from ddt import ddt
from ddt import data
from ddt import unpack
class Excle:
n=[]
#获取工作簿
wb=xlrd.open_workbook(filename="数据.xlsx",encoding_override=True)
#通过wb获取选项卡
sheet=wb.sheet_by_name("参数")
rows=sheet.nrows
cols=sheet.ncols
for... | true |
d341a0efee2ee84577c6b996ba8b824a704b0819 | Python | knighteagle789/learningpython | /fileOperation.py | UTF-8 | 155 | 3.296875 | 3 | [] | no_license | f = open ('myfile.txt','a')
for line in f:
print (line, end = '')
f.write('\nThis sentence will be appended.')
f.write('\nPython is Fun!')
f.close() | true |
a9f9324c2b622db894f202d63d1b396b927aadc2 | Python | 606keng/weeds_study | /python_study/contorl_study.py | UTF-8 | 1,301 | 3.921875 | 4 | [] | no_license | #!usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author:doulihang
@file: contorl_study.py
@time: 2020/07/07
@remark:python控制流语句学习
"""
"""#分支流与顺序流,分支流如if,控制流如for"""
a = 0
# 分支流
if a == 0:
print("a==0")
else:
print("a!=0")
# 多重分支
if a == 0:
print("a==0")
elif a == 2:
print("a==2")
elif a == 3:
print... | true |
e922c8ef95aafcde3c4dda8a02807adb580a8934 | Python | wangxiaohui2015/python_basics | /basic_11/search.py | UTF-8 | 432 | 3.75 | 4 | [] | no_license | import re
# Check if a string matches a regexp
str = "www.google.com"
match = re.search('g.*e', str)
print(match)
print(match.span())
print(str[match.start():match.end()])
print()
match = re.search('ag.*e', str)
if match:
print("Match")
else:
print("Not match")
print()
# Search and group
match = re.search('(... | true |
750c1c87fc7755c1c0c8d8f0724afb28497d6fc5 | Python | qynglang/Algorithm-intelligence | /CNN_integrated/con.py | UTF-8 | 4,843 | 2.609375 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
#import matplotlib.pyplot as plt
#from rotate import get_img_rot_broa as rotate
from loadone import load_sample as load
from convo import conv2d,maxpool2d,conv_net
def train_cov(A):
# Training Parameters
Num=0
learning_rate = 0.001
num_steps = 100
batch_siz... | true |
e25c027bb390056dbe387dede3f2b2ac832c2930 | Python | ras592/probable-happiness | /fantasyPickerHillClimbing.py | UTF-8 | 15,441 | 2.53125 | 3 | [] | no_license | __author__ = 'rsimpson'
# submission Richard Sharrott
from constraintSatisfaction import *
from scrape import import_data
from itertools import combinations
NFL_WEEKS = 13
MAX_ROSTER_NUMBER = 12
# An active team of 12 maxes around 2900 points per season,
# therefore the goal value was estimated at 2700 due to bye
# w... | true |
c5637b5ce50183e78163f25761e97f5c647e5590 | Python | imanasmishra/udacity-nanodegree-sf-crime-statistics | /consumer_server.py | UTF-8 | 1,732 | 2.53125 | 3 | [] | no_license | from kafka import KafkaConsumer
import json
import time
class ConsumerServer(KafkaConsumer):
def __init__(self, bootstrap_servers, group_id, auto_offset_reset, enable_auto_commit, **kwargs):
super().__init__(**kwargs)
self.bootstrap_servers = bootstrap_servers
self.group_id = group_id
... | true |
d9ddce042c7ec1525b24f49e5d2d6b09a1a59c18 | Python | D4rkD0g/Training | /hitcon/lab1/flag.py | UTF-8 | 270 | 2.671875 | 3 | [
"MIT"
] | permissive | key = "where_is_the_red_bao??"
flag = "shixiongfeichangshuaia"
cipher = []
for i in range(len(key)):
for j in range(1, 128):
if (ord(flag[i]) + j + i) % 128 == ord(key[i]):
print i, j
cipher.append(j)
break
print cipher | true |
c5ffe7172e359bfbfb13669e542bc2a44c46e7aa | Python | flyingaura/PythonLearning | /LearnOOP/learning0310001.py | UTF-8 | 2,074 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from io import StringIO
import os
#
# XS = input('input a string:')
MS = StringIO()
# MS.write(XS + '\n' + 'good luck')
# # print(MS.getvalue())
# MS.seek(0)
# # while True:
# # LS = MS.readline()
# # if(LS == ''):
# # break
# # print(LS.strip())
# LS = MS.readlines()
# for s... | true |
fb4fc37ba9c5010e4312b7240038491460117beb | Python | alaurentinoofficial/final-pjt-algorithms | /create_properties.py | UTF-8 | 1,290 | 2.828125 | 3 | [] | no_license | get_set = lambda x: ("""
@property
def {0}(self):
return self.__{0}
@{0}.setter
def {0}(self, x):
self.__{0} = x
""").format(x)
def write_propeties(properties, output="out.txt", encoding='utf8'):
out = ""
for p in properties:
out += "\n"
out += get_set(p)
with ... | true |
079e8c51bae9350b578fb819c44ca176c541ad62 | Python | carycarter/nt_tools | /prof.py | UTF-8 | 1,764 | 2.890625 | 3 | [
"MIT"
] | permissive | # -*- encoding=utf-8 -*-
# author: Cary
import os
import time
from datetime import datetime
import psutil
class Info(object):
def __init__(self, process):
super(Info, self).__init__()
self.process = process
@property
def process_name(self):
return self.process.cmdline()[-1]
@property
def cpu(self):
r... | true |
f93e75399d28908f952e947240afb0b9e92019a9 | Python | 2019-b-gr2-fundamentos/Fund-Alquinga-Chuquimarca-Jefferson-Gilberto | /Deberes/arreglos.py | UTF-8 | 1,019 | 3.046875 | 3 | [] | no_license | listacontacto=[]
contacto = {}
def listar ():
for cont in listacontacto:
print (cont["nombre"],"-",cont["celular"],"-",cont["correo"],"-",cont["direccion"],"-",cont["cumpleaños"])
def agregar():
contacto = {}
contacto ["nombre"] = input ("Ingrese nombre:")
contacto ["celular"] = input ("Ingrese ... | true |
cbba1f9ac06ab8a06995df02fa3535f3b7e16395 | Python | EricL0wry/algorithm-practice | /python-arcade/tennis-set.py | UTF-8 | 1,406 | 4.5 | 4 | [] | no_license | # In tennis, the winner of a set is based on how many games each player wins. The first player to win 6 games is declared
# the winner unless their opponent had already won 5 games, in which case the set continues until one of the players has
# won 7 games.
# Given two integers score1 and score2, your task is to det... | true |
1cfca0ea2ae08ee60278cc237c6e6f7cf50f4972 | Python | Kriznar4/moonGen | /scripts/pytorch/utils/feature_functions.py | UTF-8 | 3,035 | 3 | 3 | [] | no_license | # Authors: Aaron Wu / Howard Tai
# This script contains processing functions that define node features for input into a graph neural network
import pdb
import numpy as np
from scripts.pytorch.utils.full_process_utils import *
def gen_onehotfeatures(full_processed, nodes_keys):
"""
Input:
1. full_p... | true |
c70d133186c18644f30dd12b4055744febf89454 | Python | acganesh/euler | /550/pf_rule.py | UTF-8 | 1,018 | 3.1875 | 3 | [] | no_license | from collections import Counter
from itertools import product
def factor_sieve(n):
#sieve = [[] for x in xrange(n+1)]
sieve = Counter()
for x in xrange(2, n+1):
if sieve[x] == 0:
for y in xrange(x, n+1, x):
exp = 1
num = y
while num % x ==... | true |
9dc175d4285d07ded16f0c58fd04974dcf50deed | Python | marticongost/woost.extensions.sentry | /woost/extensions/sentry/sentry.py | UTF-8 | 3,911 | 2.515625 | 3 | [] | no_license | """
.. moduleauthor:: Martí Congost <marti.congost@whads.com>
"""
from typing import Dict, Optional, Tuple, Type
import sys
import traceback
from contextlib import contextmanager
from pkg_resources import get_distribution
import raven
import cherrypy
from cocktail.events import when
from woost import app
from woost.m... | true |
45066e5069fc65a91304797b4edc110e3e636df4 | Python | hamk-webdev-intip19x6/petrikuittinen_assignments | /lesson_python_basics/guess_game4.py | UTF-8 | 1,253 | 4.6875 | 5 | [] | no_license | """ TASK: To make a game, where player is trying to guess a random
number between 1...100. The player has maximum 10 guess attemps.
If the player guesses the correct number within those attempts, he wins.
The game tells if his guess is too small or large."""
import random
MAX_ATTEMPTS = 7 # maximum number of attempt... | true |
7ae7a3d0224503ff4989056dd3e139b4f3c7c20e | Python | SammyVimes/san_francisco_crimes | /plot/crime_plot.py | UTF-8 | 2,131 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import operator
from string import capwords
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from data.input_reader import load
from translator.yandex import translate
__author__ = 'Semyon'
def plot_gen(is_demo):
# Plotting Options
sns.set_style("whitegrid")
... | true |
c1736021e71a1c52e18f936ceea1ee1caf52a543 | Python | masakiaota/kyoupuro | /practice/ants_book/156_crane.py | UTF-8 | 3,610 | 3.359375 | 3 | [] | no_license | # 始点と終点のベクトルを更新していくイメージ
from math import sin, cos, pi
class SegmentTree:
def __init__(self, ls: list, segfunc, identity_element):
'''抽象化セグ木
一次元のリストlsを受け取り初期化する。O(len(ls))
区間のルールはsegfuncによって定義される
identity elementは[単位元](https://ja.wikipedia.org/wiki/%E5%8D%98%E4%BD%8D%E5%85%83)
... | true |
c610f2e7725f501ccc5f257f520e81f7189c39cf | Python | heitorchang/learn-code | /battles/arcade/intro/sudoku.py | UTF-8 | 2,480 | 4.09375 | 4 | [
"MIT"
] | permissive | description = """
Sudoku is a number-placement puzzle. The objective is to fill a 9 × 9 grid with digits so that each column, each row, and each of the nine 3 × 3 sub-grids that compose the grid contains all of the digits from 1 to 9.
This algorithm should check if the given grid of numbers represents a correct soluti... | true |
26c8c989c143754ad62f9800a080cebc0866fbe2 | Python | tianyingz/suixw | /suixw.py | GB18030 | 3,483 | 2.578125 | 3 | [] | no_license | # coding=gbk
import requests,time,os
from lxml import etree
url = 'http://book.suixw.com'
head = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
"Host": "book.suixw.com",
"Connection": "keep-alive",
"Upgrade-I... | true |
ffae2d2c1877d7841c712a94c533f4d1ecb27290 | Python | HDFGroup/hsds | /admin/aws/get_s3json.py | UTF-8 | 2,906 | 2.6875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... | true |
ae1fe724d9c3bc934bb741cdbd36f17d1b8e96a2 | Python | philipmarsden/Checkout_Oct20 | /src/views/create_views.py | UTF-8 | 831 | 2.53125 | 3 | [] | no_license | import configparser
import psycopg2 #postgresql db adapter
from locs import CONFIG_PATH
from create_views_sql import create_views_queries
def create_views (cur, conn):
"""run each of the view creation queries from the create_views_sql program"""
for query in drop_table_queries:
cur.execute(query)
... | true |
08619456ae9bde0de7a8ec0f34e1148b4d391c29 | Python | Weless/leetcode | /python/general/191. 位1的个数.py | UTF-8 | 143 | 3.171875 | 3 | [] | no_license | class Solution:
def hammingWeight(self, n: int) -> int:
return str(n).count('1')
s = Solution()
n = 1011
print(s.hammingWeight(n)) | true |
c8a4b7e291289bf10b8947416f078f1f0e6597ca | Python | 5l1v3r1/preimage-attacks | /eval.py | UTF-8 | 4,393 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import yaml
import numpy as np
from matplotlib import pyplot as plt
from collections import defaultdict
from optimization.main import main, load_factors
def log_ticks(x):
x_min = int(np.round(np.min(x)) - 1)
x_max = int(np.round(np.max(x)) + 1)
ticks = range(x_min, x_ma... | true |
b771b8213c9d76a454adc2c0093459f288552cfb | Python | ambosing/PlayGround | /Python/Problem Solving/BOJ/boj2783.py | UTF-8 | 290 | 3.078125 | 3 | [] | no_license | a, b = map(int, input().split())
min_val = a / b
min_gram = b
min_cost = a
for _ in range(int(input())):
a, b = map(int, input().split())
if min_val > a / b:
min_gram = b
min_cost = a
min_val = a / b
print("%.2f" % (round((1000 / min_gram) * min_cost, 2)))
| true |
3a34bafa4efb56728f1566f6cf857d7540382f8b | Python | austinsimpson/means-clustering | /images_to_movie/images_to_movie.py | UTF-8 | 1,630 | 2.90625 | 3 | [] | no_license | import sys
import cv2
import getopt
import glob
import os
def processFolder(path, outputFileName):
print ("Processing folder: " + path)
print ("Outputting to: " + outputFileName)
print (cv2)
if os.path.exists(path) and outputFileName != "":
fileNames = glob.glob(path + "/*.png")
fi... | true |
cad650f162a8b6d9b3e4ccd24cabdd1ee5a0f70e | Python | rafferino/projects | /KP Fellows/cards.py | UTF-8 | 1,618 | 3.515625 | 4 | [] | no_license | import numpy as np
import collections
class Card:
values = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
suits = ['Spades', 'Diamonds','Hearts','Clubs']
name_to_symbol = {
'Spades': '♠',
'Diamonds': '♦',
'Hearts': '♥',
'Clubs': '♣',
}
b... | true |
7e70b730271290ba8d47922acd9da79d87d92a56 | Python | ganjingcatherine/LeetCode-1 | /Python/Remove Duplicate Letters.py | UTF-8 | 2,123 | 4 | 4 | [] | no_license | """
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
Example:
Given "bcabc"
Return "abc"
Given "cbacdcbc"
Return "acdb"
"""
# https://leetc... | true |
b849487d924c8f4e25862d69a50a0891c98a98a5 | Python | pyg-team/pytorch_geometric | /test/transforms/test_normalize_scale.py | UTF-8 | 403 | 2.59375 | 3 | [
"MIT"
] | permissive | import torch
from torch_geometric.data import Data
from torch_geometric.transforms import NormalizeScale
def test_normalize_scale():
transform = NormalizeScale()
assert str(transform) == 'NormalizeScale()'
pos = torch.randn((10, 3))
data = Data(pos=pos)
data = transform(data)
assert len(dat... | true |
634e15ddc77a31e10291f0d4e71afc11b726dfd8 | Python | franklingu/leetcode-solutions | /questions/open-the-lock/Solution.py | UTF-8 | 2,788 | 3.46875 | 3 | [
"MIT"
] | permissive | """
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot.
The lock initially starts at '0... | true |
a941633baa9def37441b67b0d0432e984a60f064 | Python | harshaldhone/Diffie-Hellman | /server.py | UTF-8 | 877 | 3.046875 | 3 | [] | no_license | import socket
def powmod(p,e,n):
result=1
while e!=0:
result*= p % n
e-=1
return result%n
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host=socket.gethostname()
print("Server will start on host",host)
port=1024
s.bind((host,port))
print("")
print("Server done binding of host and po... | true |
ce8fe908a44b9d966c858d7bcc618ce8718c1ed7 | Python | Aasthaengg/IBMdataset | /Python_codes/p02705/s877345997.py | UTF-8 | 112 | 2.9375 | 3 | [] | no_license | def solve():
import math
R = int(input())
print(2*R*math.pi)
if __name__ == "__main__":
solve() | true |
02716d9de4880e98f131c5550d62b3f346fc5d0b | Python | fandoghi/bavy | /tic_tac_toe.py | UTF-8 | 146 | 3.0625 | 3 | [] | no_license | list_tic_tac_toe = [[0,0,0],[0,0,0],[0,0,0]]
def get_move():
move = input()
x = move[0]
y = move[1]
return x,y
print(get_move())
| true |
674946076764b07234eb50c0b8767ac9856d0026 | Python | spierre91/fraud_detection | /fraud_detection/Tests/unit_tests.py | UTF-8 | 2,623 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 27 16:23:16 2018
@author: spierre91
"""
import pandas as pd
import json
import unittest
import sys
sys.path.append("..")
from Tools import utility_library
from KNN_Algorithm import main_knn_script
from KNN_Algorithm import knnaccuracy
#read in ... | true |
12ba2f5f776953d2a2a86c5ff2578e4fce1c5c40 | Python | Criolo/Exercicios | /Exercicio 58.py | UTF-8 | 710 | 4.40625 | 4 | [] | no_license | from random import randrange
numero = randrange(1, 11)
chances = 0
print('''Sou seu computador...
Acabei de pensar em um número entre 0 e 10.
Será que você consegue adivinhar qual foi?''')
print(numero)
palpite = int(input('Qual seu palpite? '))
while chances < 4:
if palpite == numero:
break
... | true |
afcf5dca6bc3bed4610eaa340e71346899f6a32a | Python | varunagrawal/advent-of-code | /2018/day1.py | UTF-8 | 872 | 3 | 3 | [] | no_license | import numpy as np
from itertools import cycle, accumulate
def part1(filename):
with open(filename) as f:
data = f.readlines()
data = np.asarray(list(map(int, data)))
print(data.sum())
def part2(filename):
with open(filename) as f:
data = f.readlines()
data = list(map(int, data)... | true |
10bbe2518ed53c92fde450269fc40685b893f809 | Python | Pyot/API-tests | /api-airquality.py | UTF-8 | 1,062 | 2.765625 | 3 | [] | no_license | import urllib.parse
import requests
import json
base_url = r'https://api.waqi.info/map/bounds/?latlng=49.0020252,14.1228641,54.9054761,24.1458932&token=17e0fbc5712fd203efceed403b9c1102a4648e79'
json_data = requests.get(base_url).json()
#wyciagamy numery baz meteorologicznych
base_number = []
for base_num in json_... | true |
e4c1229156740e5f2520fc0846891c6130aa9bc3 | Python | total-c/hw_07 | /Task_05.py | UTF-8 | 402 | 3.828125 | 4 | [] | no_license | # Дан список строк. Отформатировать все строки в формате ‘{i} - {string}’,
# где i это порядковый номер строки в списке.
# Использовать генератор списков.
list_str = [item * 3 for item in 'list']
dict_list_str = [f'{i} - {value}' for i, value in enumerate(list_str)]
print(dict_list_str)
| true |
7ca4814f82f22eedb9201c246935223c606525c9 | Python | nakimera/Python-Practice | /Women level up/3.py | UTF-8 | 381 | 3.40625 | 3 | [] | no_license | def FindMinMax(ls=[ ]):
i=0
maximum=0
while (i<len(ls)):
if ls[i]>maximum:
maximum=ls[i]
i+=1
MinMax=[maximum]
minimum=ls[0]
while (i<len(ls)):
if ls[i]<minimum:
minimum=ls[i]
i+=1
MinMax.append(minimum)... | true |
eaf32b2f2280959df9a25ab6b0458a739f79c81b | Python | shlokashah/Coding-Practice | /Array/Remove Duplicates From Sorted Array.py | UTF-8 | 378 | 2.90625 | 3 | [] | no_license | class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
dif_num=1
if nums==[]:
return 0
for i in range(len(nums)):
if(i+1<len(nums)):
if nums[i]<nums[i+1]:
nums[dif_num]=nums[i+1]
dif_num+=1
... | true |
35d1ca7ec217a74413dc2204cc7d0c76ee8f6adb | Python | lel352/PythonAulas | /PythonExercicios/Desafio043.py | UTF-8 | 426 | 3.875 | 4 | [] | no_license | print('=========Desafio 043========')
peso = float(input('Peso (Kg): '))
altura = float(input('Altura (m): '))
imc = (peso / (altura ** 2))
print('IMC: {:.2f} '.format(imc))
if imc < 18.5:
print('Está Abaixo do Peso.')
elif 18.5 <= imc < 25.0:
print('Peso Ideal.')
elif 25.0 <= imc < 30.0:
print('S... | true |
e0fa3a888f580c80f5ff4b1fc61408f26bb4584d | Python | k-patton/TicTacToe | /main.py | UTF-8 | 593 | 3.71875 | 4 | [] | no_license | def main():
print('Hello, world!')
foo()
arr = [" "] * 9
print("Welcome to Tic Tac Toe!")
arr[0] = "X"
printBoard(arr)
def foo():
print(1+1)
def printBoard(arr):
print(' | |')
print(' ' + arr[0] + ' | ' + arr[1] + ' | ' + arr[2])
print(' | |')
print('--------------')
prin... | true |
169ad1c685362a0c8284dacc378400288ec3a091 | Python | mmontgomery95/cityxr-data-engine | /ingest/plugins/data_source.py | UTF-8 | 1,197 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from enum import Enum
from abc import abstractmethod, ABCMeta
from datetime import datetime, timezone
class DSState(Enum):
starting = "starting"
running = "running"
paused = "paused"
terminated = "terminated"
errored = "errored"
disabled = "disabled"
def __repr__(self):
return se... | true |
2caa1200b18108f8bed5b8c18244d36154389cba | Python | cardstdani/functions-python | /TanFunction.py | UTF-8 | 356 | 3.59375 | 4 | [] | no_license | import math
from matplotlib import pyplot as plt
xTan = [0]
yTan = [math.tan(0)]
maxNumber = 7
pointsPerUnit = 100
for i in range(maxNumber * pointsPerUnit):
xTan.append(xTan[i] + (1 / pointsPerUnit))
yTan.append(math.tan(xTan[i + 1]))
plt.plot(xTan, yTan)
plt.legend(["Tan"])
plt.grid(color='#1d1d1b', lines... | true |
5b6fab9cc27c53cb8673ddbc55171a171ae30679 | Python | SebastianCojocariu/Natural-Language-Processing-Laboratory-Assignments | /lesk/lesk_extended.py | UTF-8 | 8,609 | 2.90625 | 3 | [] | no_license | # Cojocariu Sebastian - 407 AI
import nltk
from nltk.corpus import wordnet, stopwords
from nltk.wsd import lesk
from collections import deque
from nltk.tokenize import word_tokenize
from nltk.tag.stanford import StanfordPOSTagger
import string
####### Exercise 1 #######
print("##### Exercise 1 ########")
def compute... | true |
e84daebad2932f5065fcb360dfc94b03450c1ed0 | Python | ross-fisher/cryptolytics | /cryptolytic/data/__init__.py | UTF-8 | 4,689 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
import ta
from scipy.stats import yeojohnson
import pandas as pd
from cryptolytic.util import *
import cryptolytic.data.sql as sql
def get_by_time(df, start, end):
q = (df.index > start) & (df.index < end)
return df[q]
def convert_datetime_to_timestamp(dt):
"""Convert pandas datetime ... | true |
73321af0f7f5be7712c64bcb56943aa16b192130 | Python | moniad/MOwNiT | /Lab10/TravellingSalesmanProblemBruteForce.py | UTF-8 | 1,012 | 3.59375 | 4 | [] | no_license | import itertools
V = 4 # no of vertices
start_v = 0
MAX_WEIGHT = 1e99999
def permutate(vertices):
for p in itertools.permutations(vertices):
yield p
def get_graph():
return [[0, 10, 15, 20], [10, 0, 35, 25], [15, 35, 0, 30], [20, 25, 30, 0]]
def travelling_salesman_problem():
vertices = []
... | true |
76ce023453fbeaad7b94c6d362de572c73606203 | Python | SIMEXP/vcog_hps_ad | /simulation_script.py | UTF-8 | 6,618 | 2.953125 | 3 | [] | no_license |
import numpy as np
import csv
import pandas as pd
########################################################### Helper functions################################################################
#In: The original raw data
#Out: The maximum and minimum for every variable
def getMinMaxValues(original_data):
max_values =... | true |
0a8b80a5ddb9c6c06a3dda5e775854f4a4ae2c1c | Python | xzeck/CodeRepo | /PalindromeOrFactorial.py | UTF-8 | 1,037 | 4.03125 | 4 | [] | no_license | import sys
def Palindrome(Number) :
temp = Number
Reverse = 0
while Number > 0 :
Reminder = Number % 10
Reverse = (Reverse*10) + Reminder
Number = Number // 10
if temp == Reverse :
return True
else :
return False
def Factorial(Number):
sum = 1
... | true |
71ce381d3cad9669699534e5fee546c5c701921c | Python | nvllsvm/dotfiles | /scripts/terminal/json-re | UTF-8 | 1,525 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import json
import re
import sys
def main():
parser = argparse.ArgumentParser('json-flat')
parser.add_argument('--key', metavar='PATTERN', help='key pattern')
parser.add_argument('--value', metavar='PATTERN', help='value pattern')
parser.add_argument(
'-i... | true |
30230797adf7614dcbfb8369102f67567393bbc7 | Python | kaki1104/Su-CS550 | /classpractice.py | UTF-8 | 6,130 | 4.3125 | 4 | [] | no_license | #Kaki and Chuma
#December 19, 2018
#practice on class
'''
On this assignment, you should work with a partner. You must submit what you have completed at the end of the class period, but you do not need to complete any leftover problems for homework.
For some of these problems you will need to create a clas... | true |
eafe82beb02cacc8b636ce6acec10f25273c02c6 | Python | zcielz/zciel-python | /pythoneBase/cn/zciel/selfstudy01/016.小结.py | UTF-8 | 1,120 | 3.90625 | 4 | [] | no_license | # 小结
# Python的函数具有非常灵活的参数形态,既可以实现简单的调用,又可以传入非常复杂的参数。
#
# 默认参数一定要用不可变对象,如果是可变对象,程序运行时会有逻辑错误!
#
# 要注意定义可变参数和关键字参数的语法:
#
# *args是可变参数,args接收的是一个tuple;
#
# **kw是关键字参数,kw接收的是一个dict。
#
# 以及调用函数时如何传入可变参数和关键字参数的语法:
#
# 可变参数既可以直接传入:func(1, 2, 3),又可以先组装list或tuple,再通过*args传入:func(*(1, 2, 3));
#
# 关键字参数既可以直接传入:func(a=1, b=2),又可以先组... | true |
678eb7c516bb92133d80d3a4e414e3d745f83fa6 | Python | jfoote/vulture | /vlib/analyzers/exploitability/lib/analyzers/x86.py | UTF-8 | 10,197 | 2.515625 | 3 | [
"MIT"
] | permissive | '''
Contains analyzers used to match rules that are used to classify the state
of a GDB inferior and some helper functions.
'''
import re
import signal
from lib.tools import memoized
class Analyzer(object):
'''
Contains methods that analyze a Target (a Linux GDB inferior state) to
determine properties o... | true |
d4c793447445b8b5aff9e623c0167b5cd818b74d | Python | yonicarver/ece203 | /Lab/Lab 6/my_xrange.py | UTF-8 | 192 | 3.453125 | 3 | [] | no_license | def my_xrange(start, stop, step = 1):
while start < stop:
yield start
start += step
if __name__ == "__main__":
for i in my_xrange(start, stop):
print "%i" % i
| true |
5d16efebe9953aab0bae6d0b44340f4b845c81eb | Python | rockgarden/python_demo | /matplotlib/holland_radar.py | UTF-8 | 2,424 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# HollandRadarDraw
"""
霍兰德人格分析
- 霍兰德认为:人格兴趣与职业之间应有一种内在的对应关系
- 人格分类:研究型、艺术型、社会型、企业型、传统型、现实型
- 职业:工程师、实验员、艺术家、推销员、记事员、社会工作者
需求:雷达图方式验证霍兰德人格分析
输入:各职业人群结合兴趣的调研数据
输出:雷达图
- 通用雷达图绘制:matplotlib库
- 专业的多维数据表示:numpy库
- 输出:雷达图
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy... | true |
04480f4ef96dcd46948c6342e1f24ef69c5a28cb | Python | soulgchoi/Algorithm | /Programmers/Level 3/디스크 컨트롤러.py | UTF-8 | 2,450 | 2.875 | 3 | [] | no_license | import math
import heapq
def solution(jobs):
answer = []
queue = []
hard_disk = []
sec = 0
jobs.sort(key=lambda x: (x[0], x[1]))
while jobs + queue + hard_disk:
while jobs:
if jobs[0][0] <= sec:
temp = jobs.pop(0)
heapq.heappush(queue, temp)
else:
break
if hard_disk:
if sec == (hard_... | true |
3bdb235ee8919441a31a128eb4a79b85225ca504 | Python | lcmonteiro/tool-mergex | /mergex/__init__.py | UTF-8 | 4,912 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
# extern
# ---------------------------------------------------------
from git.cmd import Git
from git.exc import GitCommandE... | true |
c376b8b69e07fbf60830e17c23b534c7af9c171f | Python | JaviCeRodriguez/Tkinter | /widgets/checkboxes.py | UTF-8 | 451 | 3.28125 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.title("Soy un título")
root.geometry("300x200")
var1 = IntVar()
var2 = IntVar()
# Utilizando place
# Checkbutton(root, text="Hombre", variable=var1).place(x=50, y=50)
# Checkbutton(root, text="Mujer", variable=var2).place(x=50, y=80)
# Utilizando grid
Checkbutton(root, text="H... | true |
7d893bea1b56a373be9ebea6d3d29dad909d5e24 | Python | sarpong4/ICPP | /2.1.py | UTF-8 | 447 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
pi = 3
radius = 11
area = pi * (radius**2)
radius = 14
side = 1 # length of sides of a unit square
radius = 1 # radius of a unit circle
# subtract area of a unit circle from area of unit square
areaC = pi*radius**2
areaS =... | true |
a78f899c152dfd8b753cc8e69048fbf62fb763b0 | Python | caueguedes/oop-python | /chapter_7_object_oriented_shortcuts/passing_functions.py | UTF-8 | 896 | 4.59375 | 5 | [] | no_license | def my_function():
print("The function was called")
my_function.description = "A silly function"
def second_function():
print("The second was called")
second_function.description = "A sillier function"
def another_function(function):
print("The description:", end=" ")
print(function.description)... | true |
3ead431510e4932e02a26377a3fc07019f0af65b | Python | vuminhdiep/BigO-Orange | /Number Theory I/fermat little theorem.py | UTF-8 | 406 | 3.453125 | 3 | [] | no_license | def modularExponentiation(a, b, m):
result = 1
a %= m
while b > 0:
if b % 2 == 1:
result = (result * a) % m
b //= 2
a = (a * a) % m
return result
def modInverse(b, m):
res = modularExponentiation(b, m - 2, m)
if (res * b) % m == 1:
return res
ret... | true |
39ae71607146a43ab0f8cf25fb5d734c49a972e5 | Python | ayushsgupta/atomic-structure | /Atom.py | UTF-8 | 2,635 | 2.765625 | 3 | [] | no_license | import re
import matplotlib.pyplot as plt
import Constants
from Orbital import Orbital
from Nucleus import Nucleus
# 9-27-17
# Latest update 10-2-17
class Atom:
def __init__(self, symbol):
# if len(configuration) < 3:
self.symbol = symbol
self.configuration = Constants.CONFIGURATION[symbo... | true |
ebb273cf6b0d9020a64016187da2dccad34a1960 | Python | brannerchinese/algorithm_play | /python_binary_search/binary_search_naive.py | UTF-8 | 6,617 | 3.78125 | 4 | [] | no_license | # binary_search_naive.py
# 20131023
# David Prager Branner
# Written for Python 3.3
"""
Implement a binary search tree with insertion from root and no rebalancing.
Requirements:
1. List of keys must be integers only and have no duplicates
2. List of data must be of the same cardinality as list of keys.
"""
i... | true |
1506e6f7c095c9636b147121a952787a46d2981c | Python | saliouprogress/AlgoAndDataStructure-Python | /IntersectinglinkedList.py | UTF-8 | 757 | 3.796875 | 4 | [] | no_license | def buy_and_sell_stock_once(prices):
min_price_so_far, max_profit = float('inf'), 0.0 # create variables to store minimum price and maximum profit.
for price in prices:
max_profit_sell_today = price - min_price_so_far # maximum profit equal current price minus minum price so far
max_profit = max(max_profit... | true |
ade1bb05b8f992781266a8cb8d9b116195b3e694 | Python | zhuyuanxiang/tencent-advertise | /src/无用代码/Train-Model-Keras-API.py | UTF-8 | 24,931 | 2.546875 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : 526614962@qq.com
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : tencent-advertise
@File : Train-Model-Keras-API.py
@Version : v0.1
@Time : 2020-06-15 8:36
@L... | true |
1954367b7ecf217634dabe6e702b6317b8093dbf | Python | sacherus/latex_tools | /para_parser.py | UTF-8 | 1,521 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python2
import sys, getopt
from sys import argv
def parse(filename):
start='{'
if(start == '{'):
end='}'
s=[]
i=1
with open(filename) as f:
for l in f:
p=''
for c in l:
if c == '%':
break
elif p ... | true |
f264811b6e010cb0e353c7df66ea8285c5ffb3c3 | Python | metaganal/rhea_rmd | /make_rxn.py | UTF-8 | 2,571 | 2.5625 | 3 | [] | no_license | #!/home/felix/miniconda3/bin/python
#$ -S /home/felix/miniconda3/bin/python
#$ -cwd
#$ -o /home/felix/digzyme/joblog/make_rxn_stdout/
#$ -e /home/felix/digzyme/joblog/make_rxn_stderr/
from datetime import datetime
from argparse import ArgumentParser
def append_mol(rxn_string, mol_dir, mol_list):
for mol in mol_... | true |
28a09b3abd7ccdc180eda55bc479f37886648672 | Python | umeshraj/pyPSADS | /Analysis/sumIntegers.py | UTF-8 | 791 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 11 08:34:31 2015
@author: umesh
"""
from time import time
def sumOfN(n):
""" sum of n integers"""
theSum = 0
t0 = time()
for i in range(1,n+1):
theSum += i
runTime = time() - t0
return theSum, runTime
def sumOfNEqn(n):
""" sum usin... | true |
a4a619e842895be2930f5ddb0d1bc203b46bfa04 | Python | lolilo/CS262_Udacity_Programming_Languages | /2. Lexical Analysis/html_lexer.py | UTF-8 | 2,014 | 3.53125 | 4 | [] | no_license | # sudo apt-get install python-ply
import ply.lex as lex
import re
tokens = (
'LANGLE', # <
'LANGLESLASH', # </
'RANGLE', # >
'EQUAL', # =
'STRING', # 'hello'
'WORD') # hello
# lexer states, built-in function of library
# state of 'htmlcomment' is 'exlusive' -- exclusive is built into libary
st... | true |
a7882576e3f5f7be2cd41a1facdb8a05db2588c2 | Python | Cuddlemuffin007/admin_portal | /admin_portal.py | UTF-8 | 657 | 3.296875 | 3 | [] | no_license | from portal_db_reader import PortalDBReader
from user import User
db_reader = PortalDBReader()
logged_in = False
while not logged_in:
print("Please log in with your username and password.")
user = User()
if user.login(db_reader):
print("Successfully logged in as {}".format(user.username))
... | true |
ace035615aa0c4a005547e15de314fb456343faf | Python | ifooth/checkio | /checkio/HOME/golden-pyramid.py | UTF-8 | 1,001 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Copyright 2015 IFOOTH
# Author: Joe Lei <thezero12@hotmail.com>
def count_gold(pyramid):
if len(pyramid) == 1:
return pyramid[0][0]
p = [list(i) for i in pyramid]
for x in reversed(range(0, len(p) - 1)):
p[len(p) - 2][x] += max(p[len(p) - 1][x], p[len(p) - 1][x + ... | true |
5731a4c131da0ff02a14fb849b1f9e5dcd42e111 | Python | JUNYIZHENG/deeplearning | /ResNet/tiny.py | UTF-8 | 7,587 | 2.734375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.utils.data
import torchvision
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import os
from torch.autograd import Variable
def conv3x3(in_channels, out_channels, stride=1):
return nn.Conv2d(in_channels, out_channels, kernel_size=3... | true |
c48bd3a9a03e6a8aedfd275ad23f05dceb1b163c | Python | jerquinigo/Brooklyn-Steam-Center-lessons | /classActivities/whitespaceAndIndentationActivity/whitespaceAndIndentationAssignment.py | UTF-8 | 1,472 | 4.21875 | 4 | [] | no_license |
#import random
## please correct the program and get it in working order
userInput = input("hello what is your name? ")
print("hello" + " " + userInput)
console.log("we are going to begin by starting to show you a range of numbers up to your favorite number.")
let favoriteNumber = input("what is your... | true |
eaad07ec587f231f697abdcccc5253dc4bba28d6 | Python | P-RASHMI/DataStructure | /DataStructures/Basic Python/Filemodificationdatetime.py | UTF-8 | 533 | 2.984375 | 3 | [] | no_license | '''
@Author: Rashmi
@Date: 2021-09-26 12:12
@Last Modified by: Rashmi
@Last Modified time: 2021-09-26 12:16
@Title : Write a Python program to get file creation and modification date/times
'''
import os.path, time
if __name__ == '__main__':
'''Description : to get file creation and modification date/times .getmt... | true |
f26baa690d6f354e61b47eda68bdba13aba77369 | Python | Jdecot/House-prices | /LibrairiePerso_v4_9.py | UTF-8 | 27,930 | 2.921875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import statsmodels.api as sm
import copy
from sklearn.metrics import mean_squared_error, r2_score
import scipy
from scipy import stats
def hellojuju():
print('Hello juju')
def dichotomize_dataset(dataset, columnsToNotDicho):
dichotomizeDF = pd.DataFrame()
for colum... | true |
40d58b388df2641d569346589339fac3c800bd20 | Python | Pritam-Biswas/Transaction-Cost-Analytics-Engine | /Single Process Application/analysis/SimpleAnalysisVolVwap.py | UTF-8 | 3,972 | 2.59375 | 3 | [
"MIT"
] | permissive | from AnalysisAbstract import CAnalysisAbstract
from data.DataMarketTrade import CDataMarketTrade
from data.DataTwapPortfolio import CDataTwapPortfolio
from data.DataPredicted import CDataPredicted
from data.FeederFile import CFeederFile
from data.FeederURL import CFeederURL
from data.FeederFIX import CFeederFIX
from ut... | true |
20655190b4c1690c8bc78b69a22e2714fd535a2b | Python | matheusvictor/estudos_python | /curso_em_video/mundo_03/ex079.py | UTF-8 | 483 | 3.890625 | 4 | [] | no_license | lista_valores = list()
continua = True
while(continua):
valor = int(input('Digite um valor a ser armanezado: '))
if not valor in lista_valores:
lista_valores.append(valor)
else:
print('Valor não adicionado! Motivo: duplicado.')
opc = input('Deseja continuar inserindo valores? [S/N]: '... | true |
3d74ded6c21b7be6d7b9e9bad8e6808aada9b9c8 | Python | glenl/mudev | /mutopia/tests/test_db.py | UTF-8 | 1,128 | 2.859375 | 3 | [] | no_license | from django.test import TestCase
from mutopia.models import Instrument, RawInstrumentMap
from mutopia.dbutils import instrument_match
class RawInstrumentTestCase(TestCase):
@classmethod
def setUpTestData(cls):
cls.guitar = Instrument.objects.create(instrument='Guitar')
cls.ukulele = Instrument... | true |
0356d9915996ec47fb013ed72feb3b8886383ae3 | Python | kokukuma/nupic_tutorials | /sine_wave/generate_data.py | UTF-8 | 457 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python
import csv
import math
ROWS = 3000
def run():
fileHandle =open("sine.csv", "w")
writer = csv.writer(fileHandle)
writer.writerow(["angle", "sine"])
writer.writerow(["float", "float"])
writer.writerow(["", ""])
for i in range(ROWS):
angle = (i * math.pi) / 50.0
... | true |
d0d6493a3bb7b2a67d78d10179ffb79636e470e6 | Python | ancaciascaiu/coursera-python | /assignment_9_4.py | UTF-8 | 1,041 | 3.859375 | 4 | [] | no_license | #9.4 Write a program to read through the mbox-short.txt and figure out who has sent the greatest number of mail messages.
#The program looks for 'From ' lines and takes the second word of those lines as the person who sent the mail.
#The program creates a Python dictionary that maps the sender's mail address to a c... | true |
ebef12d754d944e55ca09cc759c2a20c68a4d77a | Python | ohentony/Aprendendo-python | /Usando módulos do python/ex002.py | UTF-8 | 345 | 3.828125 | 4 | [
"MIT"
] | permissive | #Faça um programa que leia o comprimento do cateto oposto e do cateto adjacente de um triângulo retângulo.
#Calcule e mostre o comprimento da hipotenusa.
from math import hypot
o = float(input('Comprimento do cateto oposto: '))
a = float(input('Comprimento do cateto adjacente: '))
print('O valor da hipotenusa é {:.2f}'... | true |
f6ab90f8de570e05b38708936550bd9b8f3c7368 | Python | liyao001/BioQueue | /ui/ena.py | UTF-8 | 2,374 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding=utf-8
# @Author: Li Yao
# @Date: 05/01/20
import requests
import json
def get_download_link(acc, field="fastq_ftp"):
"""
Get download link from EBI ENA
:param acc: str
:param field: str
:return:
"""
links = list()
# https://www.ebi.ac.uk/ena/submit/read-d... | true |
1ccb94a2992a3ccbf9ead99259d63582e873efb4 | Python | quentin-lipeng/python-first | /less5/less5-3/part5-1.py | UTF-8 | 513 | 3.40625 | 3 | [] | no_license | li1 = [1, 2, 3, 4, 5, 6, 7, 8]
li1_new = [i * i for i in li1]
print(li1_new)
def squ(num):
return num * num
li1_new = [squ(i) for i in li1]
print(li1_new)
li1_new = [i for i in li1 if 2 % i == 0]
print(li1_new)
li1_new = [i ** 2 for i in li1 if i % 2 == 0 if i > 2]
print(li1_new)
li2 = [[1, 2, 3], [4, 5, 6]... | true |
d8927aa25d1f533054baf7f01b8f6edf26e2b589 | Python | matmaxgeds/iatisplit | /iatisplit/requests_wrapper.py | UTF-8 | 3,113 | 3.0625 | 3 | [
"Unlicense",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | """Make a response from the requests library work like a proper stream.
David Megginson
October 2018
License: Public Domain
"""
import io
class RequestsResponseIOWrapper(io.RawIOBase):
"""Wrapper for a Response object from the requests library. Streaming
in requests is a bit broken: for example, if you're ... | true |
45cf5be011d7fabbd5977863110016d9d12095ed | Python | sr3688/python | /100 Days of Coding/Day-2/day-2-1.py | UTF-8 | 208 | 4 | 4 | [] | no_license | number=input("Enter the number: ")
# typecasting and subscripting
# number[0] and number[1]-> subscripting
# int(number[0]) converting the datatypes -> typecasting
print(int(number[0])+ int(number[1]))
| true |
dff7aba59f5168ab15fea8013431ee7a00e9402f | Python | zain08816/Coding-Problems | /Set #1 Problems/Extra/alternatingSort.py | UTF-8 | 263 | 3.109375 | 3 | [] | no_license | from collections import deque
def alternatingSort(a):
a = deque(a)
b = []
for i in range(len(a)):
if i%2 == 0:
b.append(a.popleft())
else:
b.append(a.pop())
return all(i < j for i, j in zip(b, b[1:])) | true |
5e021a5161fc62908317760d4f24efd5d8f1f02b | Python | nasaabg/client_server_trent | /authenticationEngine.py | UTF-8 | 1,711 | 2.859375 | 3 | [] | no_license | from communicationModule import CommunicationModule
class AuthenticationEngine:
def __init__(self, users, hash_engine, connection, nonce):
self.connection = CommunicationModule(connection)
self.users = users
self.hash_engine = hash_engine
self.nonce = nonce
# function to find ... | true |
b8d9c837c04ad3a55a83dea71d5a045a38377945 | Python | lcbc-epfl/comp_chem_py | /src/PDOS/PDOS.py | UTF-8 | 1,640 | 2.96875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""PDOS.py is a program which automatically extracts information from Gaussian
(http://www.gaussian.com/) output and calculates partial density of states
(PDOS) based upon Lowdin or Mulliken orbital analysis."""
__author__="Pablo Baudin"
__email__="pablo.baudin@epfl.ch"
import argparse
from ... | true |
41827a8bf7dc750788fc2fcaa7f05b0c629c6a26 | Python | chandra786000000/smart-searcher | /query.py | UTF-8 | 758 | 2.546875 | 3 | [] | no_license | import sys
import re
#from porterstemmer import PorterStemmer
import copy
#porter = PorterStemmer()
class queryindex:
def __init__(self):
self.index={}
def readIndex(self):
f = open(self.index_file , 'r')
for line in f:
line = line.rstrip()
term,pos = line.spli... | true |
59c5b93f9a76cf69ac9f6be2946c9b0473ad0bfe | Python | JanpuHou/brain_tumor_detection_app | /image_classification.py | UTF-8 | 814 | 2.859375 | 3 | [] | no_license | from PIL import Image, ImageOps
import numpy as np
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
def teachable_machine_classification(img, weights_file):
model = load_model(weights_file)
data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)
... | true |
0e98d3c7a650c5c5e12ecb1755e960cada990d10 | Python | RahmouneManel/model | /predict.py | UTF-8 | 1,993 | 2.671875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
import torch
from torch import nn
from torch import optim
import torch.nn.functional as F
from torchvision import datasets, transforms, models
from collections import OrderedDict
import model_functions
import pr... | true |
e20025a2b021147895b2289f6ec3021b4f64b764 | Python | nerellapavan/IAC_Samples | /Scripts/Python/JsonLoadsExample.py | UTF-8 | 357 | 3.25 | 3 | [] | no_license | import json
# you can also use the open function to read the content of a JSON file to a string
json_data = {
"key 1": "value 1",
"key 2": "value 2",
"decimal": 10,
"boolean": true,
"list": [1, 2, 3],
"dictionary": {
"child key 1": "child value",
"child key 1": "child value"
... | true |
4ed35f05d4a9e77b37e40030de30821e5fa8c543 | Python | SEL-Columbia/shared_solar_data_warehouse | /processor/log_loader.py | UTF-8 | 7,191 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
"""
A script to open, parse, and insert Shared Solar SD log file csv data
into the database.
There are two types of log files, a main circuit, and a regular circuit,
defined in processor.csv_format.py.
"""
import os, sys, threading
from db_utils import connect, search, insert
from settings imp... | true |
af78080bfa1788721efd64a326a1596344c038da | Python | byeung18/machine-learning | /final/code/neural_net.py | UTF-8 | 5,015 | 3.015625 | 3 | [] | no_license | import numpy as np
from numpy.linalg import norm
# helper functions to transform between one big vector of weights
# and a list of layer parameters of the form (W,b)
def flatten_weights(weights):
return np.concatenate([w.flatten() for w in sum(weights,())])
def unflatten_weights(weights_flat, layer_sizes):
w... | true |
df59536956b33cd8c32e583c7cbf7e1f5e799021 | Python | myriam123/MCFNL2021 | /main.py | UTF-8 | 6,182 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 27 12:34:27 2021
@author: myriam
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import quad
from newton import newton
plt.close('all')
# definicion de paramtros
eps_0=8.854187817e-12 # Permitividad en espacio libre
e... | true |
01472c2bed4b2e76480858d42ad91317296f0ca8 | Python | nobody1570/lclpy | /lclpy/localsearch/vns/variable_neighbourhood.py | UTF-8 | 15,396 | 2.953125 | 3 | [
"MIT"
] | permissive | from lclpy.localsearch.abstract_local_search import AbstractLocalSearch
from lclpy.termination.always_true_criterion import AlwaysTrueCriterion
from lclpy.aidfunc.is_improvement_func import bigger, smaller
from lclpy.aidfunc.pass_func import pass_func
from lclpy.aidfunc.add_to_data_func import add_to_data_func
from lc... | true |
9acf49cf3680f54f40bb6c2a391aa9d27f89dd91 | Python | harihavwas/pythonProgram | /Data Collections/List/sort.py | UTF-8 | 516 | 3.703125 | 4 | [] | no_license | lim=int(input("ENter limit : "))
lst=[]
nlst=[]
print("Enter list elements")
for i in range(lim):
lst.append(int(input()))
print("List : ",lst)
# method 1
n=lst[0]
while lst:
n=lst[0]
for j in lst:
if j<n:
n=j
nlst.append(n)
lst.remove(n)
print("Sorted List : ",nlst)
#... | true |
3fcef2a4acf6eae8bd8fc7f565cbe8f7236fb971 | Python | Abhiniti/python-challenge | /PyPoll/practice.py | UTF-8 | 189 | 3.28125 | 3 | [] | no_license | from collections import Counter
cnt = Counter()
colors = ['red', 'blue', 'red', 'green', 'blue', 'blue']
count = 0
for word in colors:
if word == 'red':
count += 1
print(count) | true |
e02b5668f74c2350fade4775850b3536dbc8d119 | Python | mutdmour/projecteuler | /projecteuler-2015/p25.py | UTF-8 | 216 | 2.8125 | 3 | [] | no_license | def main():
a=0
b=1
counter = 1
c = 0
while len(str(c)) < 1000:
counter = counter + 1
c=a+b
b , a = c , b
# print(c, len(str(c)), counter)
print(counter)
main()
| true |