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 |
|---|---|---|---|---|---|---|---|---|---|---|
84f975cf61013ac647d5a7c132750464e1ab9c22 | JacekGorski01/KursPython | /homeworks/day3/Z1.py | UTF-8 | 1,224 | 4.21875 | 4 | [] | no_license | #Przeliczanie temperatur
from whatnext import start_other_module
def FtoC(f):
'''Transforms Fahrenheitas to Celcius
Arguments:
f (int) - number of Fahrenheit`s degrees
Return:
c (int) - number of Celcius degrees
'''
c = (f - 32) / (9 / 5)
print("%.2f" % c)
return c
print("\n*** ... | true |
5d8df109f1243f64c20846a2f0e4edeb96d191d2 | anulekham/python | /sub.py | UTF-8 | 220 | 3.875 | 4 | [] | no_license | #program subtraction, multiplication, module,division
a=input("enter the value of a")
b=input("enter the value of b")
c=int(a)-int(b)
print(c)
d=int(a)*int(b)
print(d)
e=int(a)%int(b)
print(e)
f=int(a)/int(b)
print(f)
| true |
f086bc50c1eba12ade9d5b81e047bbbd6d829ebf | DandyCV/LITS | /Chat/ChatApp.py | UTF-8 | 10,496 | 2.75 | 3 | [] | no_license | import socket, threading, re, json, time
from kivy.app import App
from kivy.uix.button import Button
from kivy.config import Config
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.graphics import Color, Rectangle
'''To start char enter co... | true |
7486620c4bc42eedec52dbfd20d4fc4f02055f27 | xiaosean/leetcode_python | /Q1190_Reverse-Substrings-Between-Each-Pair-of-Parentheses.py | UTF-8 | 627 | 3.765625 | 4 | [
"MIT"
] | permissive | class Solution:
def reverseParentheses(self, s: str) -> str:
# stacks = list
# for each letter
# if '(':
# stack recording string => new_s
# elif ')':
# reverse new_s and concat the topest string of stack.
# else:
# append the... | true |
c94f10158125509445c0ffecc7a60842a538977b | BlackLight/platypush | /platypush/message/event/stt.py | UTF-8 | 1,347 | 2.578125 | 3 | [
"MIT"
] | permissive | from platypush.message.event import Event
class SttEvent(Event):
""" Base class for speech-to-text events """
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class SpeechStartedEvent(SttEvent):
"""
Event triggered when speech starts being detected.
"""
pass
c... | true |
548de0567ee1f53f88d071de7fd3d09388019c81 | xingyazhou/Data-Structure-And-Algorithm | /LinkedList/removeNthFromEnd_onepass.py | UTF-8 | 2,403 | 3.921875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 9 13:09:00 2020
19. Remove Nth Node From End of List (Medium)
Given the head of a linked list, remove the nth node from the end of the list and return its head.
Follow up: Could you do this in one pass?
Example 1:
Input: head = [1,2,3,4,5], n = 2
Output: [1,2,3,5]
Ex... | true |
4c2bbc79a637748c7711fe4197aa26bb83b77b69 | Dworkinson/python_homework | /tests/test_fibonacci/test_fibonacci.py | UTF-8 | 482 | 3.40625 | 3 | [] | no_license | import pytest
from fibonacci.fibonacci import fibonacci
@pytest.mark.parametrize('index, expected_values', [
(5, [0, 1, 1, 2, 3, 5]), (-5, [0, 1, -1, 2, -3, 5]), (0, [0])
])
def test_positive_fibonacci_sequence(index, expected_values):
test_generator = fibonacci(index)
test_values = []
for value in ... | true |
2a2187bcd07b1a4d00821d00fa26746476adac8b | 2017401336/Scrawker | /miniproject-master/deeplearning/minist.py | UTF-8 | 8,112 | 2.765625 | 3 | [] | no_license | '''
minist手写数字数据集,训练100个,过多个人电脑内存会溢出
'''
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import os
os.environ['TP_CPP_MIN_LOG_LEVEL'] = '2'
#n为卷积次数
#x为需要进行卷积的样本(传入shape为[batch,height,width,channels],可为None)
#filter_num为基础卷积次数
#F为卷积核的shape,填入长或宽其中一个即可,一般都是1或3或5
#multi参数为每次迭代卷积核的个数乘数的... | true |
97c1c91549d75c12322e87e0842cbdad43150dca | AssiaHristova/SoftUni-Software-Engineering | /Programming Basics/for_loop/logistics.py | UTF-8 | 725 | 3.46875 | 3 | [] | no_license | cargo_count = int(input())
avg_cost_per_tone = 0
transport_cost = 0
cargo_all = 0
bus_share = 0
truck_share = 0
train_share = 0
for cargo in range(1, cargo_count + 1):
tonnage = int(input())
cargo_all += tonnage
if tonnage <= 3:
transport_cost += tonnage * 200
bus_share += tonnage
elif... | true |
60f3092687472b6e1fb9badbe409d04a0d395179 | jettify/aiogibson | /aiogibson/parser.py | UTF-8 | 6,635 | 3.265625 | 3 | [
"MIT"
] | permissive | """The ``Reader`` class has two methods that are used when parsing replies
from a stream of data. Reader.feed takes a string argument that is appended to
the internal buffer. ``Reader``.gets reads this buffer and returns a reply
when the buffer contains a full reply. If a single call to feed contains
multiple replies, ... | true |
5c91d086cdde92fd2600400e9340e83f7a53dd26 | stevenczwu/view-synthesis | /voxel_network/voxelize.py | UTF-8 | 2,186 | 2.609375 | 3 | [] | no_license | from plyfile import PlyData
import os
import numpy as np
import random
current_dir = os.path.dirname(__file__)
input_dir = current_dir
output_dir = current_dir
voxel_num = 32 # cube side length
points_per_voxel = 32 # any further points are discarded
point_dim = 9 # x, y, z, dx, dy, dz, r, g, b
if not os.path.isdir(... | true |
ae029d0bd29b6d702d3cbc7cab1e073f7a13df0c | yeonlang/TIL | /startcamp/backjoon/sw1926.py | UTF-8 | 1,412 | 4.40625 | 4 | [] | no_license | # 3 6 9 게임을 프로그램으로 제작중이다. 게임 규칙은 다음과 같다.
# 1. 숫자 1부터 순서대로 차례대로 말하되, “3” “6” “9” 가 들어가 있는 수는 말하지 않는다.
# 2. "3" "6" "9"가 들어가 있는 수를 말하지 않는대신, 박수를 친다. 이 때, 박수는 해당 숫자가 들어간 개수만큼 쳐야 한다.
# 예를 들어 숫자 35의 경우 박수 한 번, 숫자 36의 경우 박수를 두번 쳐야 한다.
# 입력으로 정수 N 이 주어졌을 때, 1~N 까지의 숫자를
# 게임 규칙에 맞게 출력하는 프로그램을 작성하라.
# 박수를 치는 부분은 숫자 대신, 박수 횟수... | true |
0bd436f2f6e707c0d658c69327292370200cf765 | Neofight1/QQModel | /QQModel/Entity/request.py | UTF-8 | 4,359 | 2.546875 | 3 | [] | no_license | import pymysql as pymysql
from QQModel.Entity.friend import friend
class request:
# 请求 Request (account,receiver_account, state)
# state为0表示未处理,1表示同意,2表示拒绝
def __init__(self, account='', receiver_account='', state=0):
self.account = account
self.receiver_account = receiver_account
... | true |
4edd75a1315260fbee6fe592b2cd735b058b0f2a | uniyalabhishek/LeetCode-Solutions | /Python/148. SortList.py | UTF-8 | 1,634 | 4.25 | 4 | [
"MIT"
] | permissive | #Problem: Given the head of a linked list, return the list after sorting it in ascending order.
#Approach: We use merge sort and account for the use of a linked list to solve this
class Solution(object):
#returns the middle node of the linked list referenced by head
def getMiddle(self,head):
double_ste... | true |
d4f6d798d5adbe5445d8336808fcbb44a6ca3fa7 | Meng-Gen/StockCat | /stockcat/assembler/legacy/legacy_cash_flow_assembler.py | UTF-8 | 1,267 | 2.6875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
from stockcat.assembler.legacy.cash_flow_parser.aries_parser import AriesParser
from stockcat.common.string_utils import StringUtils
from stockcat.dao.cash_flow_dao import CashFlowDao
import lxml.html
class LegacyCashFlowAssembler():
def __init__(self):
self.base_xpath = '//html/bo... | true |
68503861369f207bc43c0d0de158db706812244b | wise-X/python_util | /usr/bin/rename.py | UTF-8 | 604 | 2.890625 | 3 | [] | no_license | #! /usr/bin/env python
import sys, string, os
for root, dir, files in os.walk(sys.argv[1]):
for file in files:
str = file
newname = str[9:]
newpath = sys.argv[1] + newname
oldpath = sys.argv[1] + file
try:
... | true |
4fa5e2939e87524db2f76951bb06874655ee9009 | Jarlosh/sheeps-n-wolfes | /MapStuff/GameMap.py | UTF-8 | 1,983 | 2.90625 | 3 | [] | no_license | import itertools
from random import sample, shuffle
from typing import Sequence, Tuple
from MapStuff.Creatures.Creature import Creature
from MapStuff.GameLogic.StepCollector import StepCollector
from MapStuff.MapGenerator import GameMapGenerator
from MapStuff.Misc.Alliases import Point
from MapStuff.Misc.DirectionEnum... | true |
abb9f62bb6e65396b5383bf3685a916ffb796527 | AnkitRajSri/MovieRecommenderSystem | /MoviesData.py | UTF-8 | 2,170 | 2.734375 | 3 | [] | no_license | #Importing libraries
import pandas as pd
class MoviesData:
def __init__(self, conn):
self.conn = conn
#Importing data from the oracle database
def importUsersData(self):
conn = self.conn
user_ratings = pd.read_sql("Select FAN_ID, FILM_ID, IMDB_RATING from RELMDB.FAN_RA... | true |
e5364a339c61afa711f946974145677f8b468aaf | superggn/myleetcode | /math/12-integer-to-roman-1.py | UTF-8 | 882 | 3.703125 | 4 | [] | no_license | """
贪心法,原po没考虑py3.6以下的字典无序问题,我加了个列表存储对应顺序
https://leetcode-cn.com/problems/integer-to-roman/solution/tan-xin-ha-xi-biao-tu-jie-by-ml-zimingmeng/
"""
class Solution:
def intToRoman(self, num: int) -> str:
# 使用哈希表,按照从大到小顺序排列
hashmap = {1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C', 90:... | true |
f71547140d49eafe45ade496fcbde7b8aa9470de | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/3410.py | UTF-8 | 512 | 3.21875 | 3 | [] | no_license | def solve(T, S, K):
flips = 0
S = [x == '+' for x in S]
for i in range(0, len(S) - K + 1):
if not S[i]:
flips += 1
for j in range(i, i+K):
S[j] = not S[j]
if all(S):
print("Case #{}: {}".format(T, flips))
else:
print("Case #{}: {}".form... | true |
b897e00f36753250dd9ce45cde748d12dd9cb309 | ngvinay/python-projects | /spring-2017/src/spark2-onramp-v2/Assignment1.py | UTF-8 | 5,032 | 3.703125 | 4 | [] | no_license | import sys
import numpy as np
import matplotlib.pyplot as plt
from pyspark import SparkContext, SparkConf
from pyspark.sql import SQLContext
from pyspark.mllib.linalg import Vectors
from pyspark.mllib.regression import LabeledPoint
from pyspark.ml.feature import MinMaxScaler
#Create Spark and SQL Context
sparkConf = ... | true |
75ab09729c82f280d91d173a036ca73c762378a4 | tjkendev/procon-library | /python/range_query/bit2.py | UTF-8 | 890 | 3.40625 | 3 | [] | no_license | # Binary Index Tree (2-dimension)
class BIT2:
# H*W
def __init__(self, h, w):
self.w = w
self.h = h
self.data = [{} for i in range(h+1)]
# O(logH*logW)
def sum(self, i, j):
s = 0
data = self.data
while i > 0:
el = data[i]
k = j
... | true |
5e39a65c0b196a527ef7571b0a3a0ae1a09b6b64 | domenic-curro/Pose-Aware-Embedding-Networks-and-Multi-Modal-Image-Language-Retrieval | /nets/net_poseemb_language.py | UTF-8 | 997 | 2.515625 | 3 | [] | no_license | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self, posebit_count):
super(Net, self).__init__()
# self.fc1 = nn.Linear(213, 1000)
self.fc1 = nn.Linear(posebit_count, 4608)
self.relu1 = nn.ReLU()
self.drop1 = nn.Dropout(0.5)
# self.fc2 = nn.L... | true |
6fbf02906939e9a88da4912ed0d6470afb975da5 | kimtree/scsc-mentoring | /lecture/20180326.py | UTF-8 | 568 | 3.921875 | 4 | [] | no_license | import collections
import random
a = 1
b = 'a'
c = True
def print_dd():
print('dddddddd')
def get_player_name(name):
b = 'blah'
return b + ' player ' + name
def sum(number1, number2=10, number3=1):
return number1 + number2 + number3
print('dljlkjlkdjf', end='')
def mult(number1, number2):
return number1 * n... | true |
432a729e42ecad413f4498ecc7b55a83c48546aa | Sandeep8447/interview_puzzles | /src/main/python/com/skalicky/python/interviewpuzzles/check_if_string_after_removing_one_character_is_palindrome.py | UTF-8 | 959 | 4.59375 | 5 | [] | no_license | # Task:
#
# Given a string, determine if you can remove any character to create a palindrome.
#
# Here's some examples and some starter code:
#
# def create_palindrome(s):
# # Fill this in.
#
# print(create_palindrome("abcdcbea"))
# # True
# print(create_palindrome("abccba"))
# # True
# print(create_palindrome("abcca... | true |
a79757fb17e3fcadf38e6beae2c28cf008ac4eec | xxcocoymlxx/Study-Notes | /CSC148/06 Tree(BST)/lab7/trick.py | UTF-8 | 1,670 | 4.0625 | 4 | [] | no_license | # Here is the binary tree node class that we will use
# Note that the constructor allows us to set the item
# at the node and also its left and right subtrees
class BTNode:
"""A node in a binary tree."""
def __init__(self: 'BTNode', item: object,
left: 'BTNode' =None, right: 'BTNode' =None... | true |
d6cf2e3b9234cdd27f9aabd73a7ba16d3e0db864 | l3pp4rd/dotfiles | /config/ranger/commands.py | UTF-8 | 1,445 | 2.53125 | 3 | [] | no_license | # This is a sample commands.py. You can add your own commands here.
#
# Please refer to commands_full.py for all the default commands and a complete
# documentation. Do NOT add them all here, or you may end up with defunct
# commands when upgrading ranger.
# You always need to import ranger.api.commands here to get ... | true |
f58b97b892c2b554dd3a2f89a3c019a63d310dcf | VPYen/algorithms | /tribonacciDynamicLinear.py | UTF-8 | 682 | 3.765625 | 4 | [] | no_license | # The Tribonacci sequence Tn is defined as follows:
# T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.
# Given n, return the value of Tn.
# Example 1:
# Input: n = 4
# Output: 4
# Explanation:
# T_3 = 0 + 1 + 1 = 2
# T_4 = 1 + 1 + 2 = 4
# Example 2:
# Input: n = 25
# Output: 1389537
# Const... | true |
1796aec55d68137933cd4fd32d05c07fc7043a49 | betty29/code-1 | /recipes/Python/252177_Find_commbeginning_list/recipe-252177.py | UTF-8 | 418 | 3.015625 | 3 | [
"Python-2.0",
"MIT"
] | permissive | def getcommonletters(strlist):
return ''.join([x[0] for x in zip(*strlist) \
if reduce(lambda a,b:(a == b) and a or None,x)])
def findcommonstart(strlist):
strlist = strlist[:]
prev = None
while True:
common = getcommonletters(strlist)
if common == prev:
... | true |
fa9966198d15159c5e480b38271acbc8dbd7bff1 | TOSUKUi/bitmex-bot | /logic/gorilla_skinhead_chaos.py | UTF-8 | 1,560 | 2.53125 | 3 | [] | no_license | import sys
sys.path.append('/mnt/c/Users/TOSUKUi/Documents/workspace/bitmex-bot')
import lib.bitmex_api_connecter as connector
import lib.technical_analysis as ta
import pandas as pd
from datetime import datetime
import logging
logging.basicConfig()
def execute(bins, conditions, client=None):
# Series set up
... | true |
c1eb5cfb798e5622a88d0ddfb963bdd05b8573a7 | eliotw/ecwong-18739L | /wargames/matasano_crypto/set01/script2.py | UTF-8 | 232 | 2.671875 | 3 | [] | no_license | import binascii, base64
arg1 = "1c0111001f010100061a024b53535009181c"
arg2 = "686974207468652062756c6c277320657965"
result = ""
for i in range(len(arg1)):
result += hex(int(arg1[i], 16) ^ int(arg2[i], 16))[2:]
print result
| true |
e5ec6e39e91d190f307564036ac4d1417b2dd810 | ts4051/retro | /retro/utils/cascade_energy_conversion.py | UTF-8 | 4,956 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
Functions for computing the hadronic factor given either the energy of an EM or hadronic cascade.
Modified only slightly from
sandbox/jpandre/multinest_icetray/private/multinest/HadronicFactorCorrection.cxx
"""
from __future__ import absolute_import, division, print_function
import numpy a... | true |
df4b2ec38c87280376e82804a10bc4eb8f86e09f | Hypothesis17/pattern-recognition-implementation | /MLE/window_estimation.py | UTF-8 | 4,054 | 3.03125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
num = 1000
LR = -10.0
RR = 10.0
delta = (RR-LR)/(num-1)
###==== Basic Function ====
def gen2mixtures(mu1, sigma1, mu2, sigma2, alpha=0.2, n_samples=10000):
norm1 = np.random.normal(mu1, sigma1, n_samples)
norm2 = np.random.normal(mu2,... | true |
10be977beca4baa205437a369ce64e951c678415 | Kaper156/GA_collector | /src/gacollector/tasks/csv/summarize.py | UTF-8 | 1,695 | 2.734375 | 3 | [] | no_license | from gacollector.misc.csv.helpers import get_additional_fields_for_file
from gacollector.misc.csv.row_type_aggregator import RowTypeAggregator
from gacollector.tasks.csv.base import CsvTask
class SummarizeCsvTask(CsvTask):
def __init__(self, folder_path, out_file_path=None, picked_columns=None):
super()._... | true |
83646d94cdf2852f3e3dda55de8bf2ba50f111b0 | 3gstudent/Homework-of-Python | /SophosUTM_ConfigParser.py | UTF-8 | 4,703 | 2.8125 | 3 | [] | no_license | #Python3
import sys
from storable import retrieve
from datetime import datetime
def GetAdminDataFull(file):
data = retrieve(file)
print("[*] Try to get the full data of admin")
print("[+] ")
for key, value in data['objects']['REF_DefaultSuperAdmin']['data'].items():
print(" " + ... | true |
cfb4ec41a8b177f2fe37a9d448ddbef653c33cd3 | toby1999/Sentiment-Analysis | /Data/Data cleansing/label.py | UTF-8 | 1,972 | 3.21875 | 3 | [] | no_license | import pandas as pd
from datetime import datetime
spreadsheet = pd.read_excel ('coursecheck_data.xlsx') # Open spreadsheet
dataset = pd.DataFrame(spreadsheet,
columns= ['General Comments'])
positive = open("positive.txt", "r")
negative = open("negative.txt", "r")
completed_positive = len(posit... | true |
fd2297198d2b155096f81f269efccb2cc8d34f6c | thiagomfl/python-studies | /contacts_w_groups_v2.py | UTF-8 | 805 | 2.890625 | 3 | [] | no_license | from collections import defaultdict
from database import new_connection
from mysql.connector.errors import ProgrammingError
sql_join = '''
SELECT
groups.description AS group,
contacts.name AS contact
FROM contacts
INNER JOIN groups ON contacts.group_id = groups.id
ORDER BY group, contact
'''... | true |
613f3d46f381c53b71bcbc6d07aaec72cbb0fdc9 | Resires/tietopythontraining-basic | /students/uss_tomasz/lesson_06_dictionaries_tuples_sets_args_kwargs/6_4/cubes.py | UTF-8 | 291 | 3.421875 | 3 | [] | no_license | ALICE_SET = {1, 2, 3, 4}
BOB_SET = {1, 2, 10000000}
print("Numerical colors of cubes in both sets:",
ALICE_SET & BOB_SET)
print("Numerical colors of cubes only in Alice's set",
ALICE_SET - BOB_SET)
print("Numerical colors of cubes only in Bob's set",
BOB_SET - ALICE_SET)
| true |
508618c46095b48ca7b0687ebd5d3f5e99cccaf3 | GoodAI/mlprague2019 | /code/lib/pyAudioAnalysis/audioSegmentation.py | UTF-8 | 45,001 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import print_function
import numpy
import sklearn.cluster
import scipy
import os
from code.lib.pyAudioAnalysis import audioFeatureExtraction as aF
from code.lib.pyAudioAnalysis import audioTrainTest as aT
from code.lib.pyAudioAnalysis import audioBasicIO
from scipy.spatial import distance
import matplot... | true |
142d3dbd32053c022d5ac625115de0158324fda3 | ecgaebler/Practice | /LeetCode/0520.py | UTF-8 | 156 | 3.203125 | 3 | [] | no_license | def detectCapitalUse(word):
return (word.isupper() or
word.islower() or
(word[0].isupper() and word[1:].islower()))
| true |
6e75837a28235212c4c0b4466815c6af9c101b0c | jasooney23/MLSnake | /MLSnake/Agent_4.py | UTF-8 | 12,473 | 3.21875 | 3 | [] | no_license | '''Changes in v4:
Clip TD Error to -1 to 1
DOUBLE DQN:
AVERAGE VALUES FOR EPSILON
NEW UPDATE FUNCTION
'''
# Import packages.
import queue
import random
import math
import time
import tensorflow as tf
# I chose NumPy instead of Pandas because it uses less RAM.
import numpy as np
from . impo... | true |
ad4cab7a22e47872d478fb43ba32a599821480cb | StevenLOL/kaggleScape | /data/script966.py | UTF-8 | 6,982 | 4.15625 | 4 | [] | no_license |
# coding: utf-8
# # A CLUSTER OF COLORS
# #### **PCA APPROACH**
# # 1. Introduction
#
# This notebook is not meant to be an exhaustive EDA nor will it attempt to run fancy stuff like XGBoosting or Ensembling methods. The chief focus of this script will simply be to try out sklearn's PCA (Principal Decomposition Ana... | true |
05ced6034ad5c987664905de57bb979943de22e7 | jtreminio/ansible-common | /filter_plugins/modify_list.py | UTF-8 | 542 | 2.65625 | 3 | [
"MIT"
] | permissive | # from https://gist.github.com/halberom/b1f6eaed16dba1b298e8#gistcomment-1679782
# ex: - {{ dirs | modify_list('(.*)','\\1.conf') }}
import re
def modify_list(values=[], pattern='', replacement='', ignorecase=False):
''' Perform a `re.sub` on every item in the list'''
if ignorecase:
flags = re.I
el... | true |
09fdf58f18f8f2f662ad5be69c31dc984715ad6b | vigneshN123/mystuff | /stlnetadmin01/test-py-files/ConvertTextToCsv.py | UTF-8 | 484 | 2.765625 | 3 | [] | no_license | # Custom script to break down vlanid text to 4 element list
from pprint import pprint
import csv
with open("vlanid_au.txt", "r") as f:
fdata = f.read()
fdata = fdata.splitlines()
nlist = []
for line in fdata:
line = line.split(maxsplit = 4)
nlist.append(line)
#print(f"{nlist}")
#break
print(nl... | true |
2101cb504987daa31be1e81eefd984d4db0b5374 | andrewychang/netguard | /sms-notifications/remoteit.py | UTF-8 | 1,411 | 2.609375 | 3 | [] | no_license | import requests
import json
import os
def get_auth_token() -> str:
"""
Get the session auth token from the remote.it API. This is needed to
authenticate all further requests to the remote.it API.
Returns:
str: The authentication token.
"""
headers = {
"developerkey": os.envir... | true |
13b40edf8fffb8dc8dccf5b9cbbf24cceea0df7f | nus-sps/workshops.tfi.data-visualisation | /files_python/matplotlib_grid.py | UTF-8 | 1,874 | 3.34375 | 3 | [] | no_license | # %% Results
# %% Code
from sys import argv # Hide
from matplotlib import pyplot as plt
import numpy as np
#--------- Generate cosine and sine values --------#
x = np.linspace(-np.pi, np.pi, num=100, endpoint=True)
cos_x = np.cos(x)
sin_x = np.sin(x)
fun_cos_x = np.exp(-x)*np.cos(5*x)
fun_sin_x = np.exp(-x)*np.sin(... | true |
689477defeca9f41c77a185cdfb65124374a1583 | kimchaelin13/Algorithm | /boj/practice3_class.py | UTF-8 | 819 | 3.140625 | 3 | [] | no_license | import sys
sys.stdin=open('input.txt','r')
'''
124783
3개 뽑아서 연속증가면 run+나머지가 모두 똑같으면 트리플렛 => 두개 다 있어야 베이비진 True
#1. 6개중에 임의로 3개를 뽑아서 3개짜리 조합을 만든다
#2. 그게 트리플렛인지 run인지 확인
-> 트리플렛이면, 나머지 카드가 run인지확인 => 맞으면 return True
-> 런이면, 나머지 카드가 트리플렛인지 확인=> 맞으면 return True
'''
def dfs(L,s):
if L==len(res):
f... | true |
49ffd3152b5052d349806c51cf64859b75006d6b | daniel-reich/ubiquitous-fiesta | /XPCqS7GYYouXg5ut9_3.py | UTF-8 | 271 | 2.734375 | 3 | [] | no_license |
def simplify_sqrt(n):
m,flag,fact=n,1,1
while flag:
flag=0
for i in range(2,int(m**.5)+1):
if n%(i**2)==0:
fact*=i
n//=i**2
flag=1
break
return (fact,n)
| true |
6b074606e28e3870b1ebedc12a8f6ae19d64052d | ychaparala/tdd_code | /code/exercise_solutions/13_Exercises_Pandas_Data_Management2_phishing.py | UTF-8 | 5,945 | 3.265625 | 3 | [] | no_license | ###########################################
# File: 06_Exercises_Pandas_Data_Management.py
# Created: July 15, 2018
# Last Modified: July 20, 2018
# Author: Ra Inta and Evan Carey, written for BH Analytics, LLC
###########################################
###########################################
### Part II ... | true |
66578d969f6df8e6f3bac6a86764c809983d4800 | beingsane/maxapp | /ltadatamall backup.py | UTF-8 | 1,642 | 2.609375 | 3 | [] | no_license | import json
import urllib
from urlparse import urlparse
import httplib2 as http
#External library
def traffic():
#Authentication parameter
headers = { 'AccountKey' : 'MnvwjNVGDVKl8Ig9uipL3Q==',
'UniqueUserID' : 'ee84f4e2-caae-4ab5-afa3-02a7348efd2f',
'accept' : 'applica... | true |
d180299dc47ed2aa47a3fdcfed51f777b3ed72c6 | SashaZd/WavefrontObjDetection | /main.py | UTF-8 | 1,297 | 2.734375 | 3 | [] | no_license |
import sys
import time
from Parser import Parser
from ConvexHulls import ConvexHulls
from shutil import copyfile
OBJ_FILE_NAME = sys.argv[-1]
# Start timer
t0 = time.time()
print "Starting at ", t0
"""
Reading the Object Room & Returning a Parser object
104 seconds
"""
directions=['z','y']
for direction in direct... | true |
63eb8a31530cde1ae6ed5c7de6e277644a19d94e | calebperkins/algorithms | /algorithms/permutations.py | UTF-8 | 565 | 3.65625 | 4 | [
"MIT"
] | permissive | def permute(sequence):
"Given an input sequence, generate all permutations of that sequence."
if not sequence:
return []
perms = [tuple()]
for elem in sequence:
next_perms = []
for perm in perms:
for next_perm in _add_element(perm, elem):
next_perms.ap... | true |
f9639a73fe402f3cf5caa4c3c140ba2cac099fb3 | Sunshine-Queen/Test | /day17/多态.py | UTF-8 | 343 | 3.34375 | 3 | [] | no_license | class Dog(object):
def print_set(self):
print("大家好,我是小猪佩奇,请大家多多关照.....")
class Xiaotq(Dog):
def print_set(self):
print("hello everybody,我是你们的老大,我是哮天犬...")
def introduce(temp):
temp.print_set()
dog1=Dog()
dog2=Xiaotq()
introduce(dog1)
introduce(dog2) | true |
b3abd8c94ad4460ca4fd58b3b42e3b3d37206ee6 | paradigm72/paradigm-euler | /lib/calendar.py | UTF-8 | 970 | 3.90625 | 4 | [
"MIT"
] | permissive | def isLeapYear(year):
if ((year % 4) == 0):
if ((year % 100) == 0):
if ((year % 400) == 0):
return True;
return False;
return True;
return False;
def daysInYear(year):
return 366 if isLeapYear(year) else 365
def daysInMonth(month, year):
if (mo... | true |
3153ff2aa19558c3a8162b41aef76c06fa20c358 | Code360In/21092020LVC | /day_01/transcripts/trans_strings.py | UTF-8 | 4,526 | 3.375 | 3 | [] | no_license | Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> # STRINGS
>>>
>>> s = "python"
>>> type(s)
<class 'str'>
>>>
>>>
>>> # -------------- accessing individual characters
>>> # [index]
>>> ... | true |
dba8791e8d9b1e4db8f5201d11889b4b511a3f70 | TonHai1111/DB_Implementation | /Database Implementation/Python/Experiments/Evaluation_3.py | UTF-8 | 24,413 | 2.921875 | 3 | [] | no_license | #!/usr/bin/python
#TODO:
# 1. Read data from postgres database
# 2. Insert data to IB-Tree/IBPlus-Tree
# 3. Print the tree
# 4. Do some queries
# 5. Obtain the results
from IBTree import IBTree
from PLITypes.IBEntry import *
from PLITypes.dataTypes import *
from tools.operations import *
from IBPlusTree import IBPlus... | true |
53c451f39473f2e7dc2d8a3eb6a25e9da53b68a3 | ChuLei0217/ECS272-Winter2020 | /Assignment4/HW4/venv/Lib/site-packages/alt/common.py | UTF-8 | 557 | 2.640625 | 3 | [] | no_license | import logging
def get_default_logger():
return logging.getLogger('alt')
def format_time(time_seconds):
m, s = divmod(time_seconds, 60)
m = int(round(m))
if m == 0:
to_return = "%.2fs" % s
else:
to_return = str(int(round(s)))
h, m = divmod(m, 60)
if h == 0:
... | true |
871670427aa0be8588a1edb6cacec5731389d43e | ca0heng/Snippets | /UDPServer.py | UTF-8 | 357 | 2.640625 | 3 | [] | no_license | from socket import *
server_port = 12000
server_socket = socket(AddressFamily.AF_INET, SocketKind.SOCK_DGRAM)
server_socket.bind(('', server_port))
print('THe server is ready to receive')
while 1:
message, client_address = server_socket.recvfrom(2048)
modified_message = message.upper()
server_socket.sendt... | true |
571cb692b114b205660b9165583852bf6ed73789 | wtberry/TF_practice | /t1.py | UTF-8 | 783 | 3.140625 | 3 | [] | no_license | # first tf tutorial on constants and session
import tensorflow as tf
import numpy as np
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0, tf.float32)
print(node1, node2)
### process are run inside of session
sess = tf.Session() # lanch the graph and run
#print(sess.run([node1, node2]))
#sess.close() # ... | true |
8210f06c882ef65b292a52b23803a25563568fa1 | virajvchavan/Data-Mining | /tweight/tweight.py | UTF-8 | 977 | 4.0625 | 4 | [] | no_license | #2014BIT026
#Calculates t-weight and d-weight for m products sold in n countries
m = int(input("Enter number of Products:"))
n = int(input("Enter number of Countries:"))
data = [[None] * m for i in range(n)]
print("Enter data:")
for i in range(n):
for j in range(m):
data[i][j] = int(input("Sales of Product " + str... | true |
59340172f55df455fdac8e8db75adb6b4eb29041 | Ashot-Sargsyan/home-wortk-python- | /lesspn4homework.py | UTF-8 | 6,241 | 3.609375 | 4 | [] | no_license | # '''1)We have celsius need to find a pharyngeate'''
# celsius=float(input('celsius is a :' ))
# pharyngeate=(celsius*9/5)+32
# print(pharyngeate)
# '''2)We have pharyngeate need to find a celsius'''
# pharyngeate=float(input('celsius is a :' ))
# celsius=(pharyngeate-32)*5/9
# print(celsius)
# '''3)We have 1 ... | true |
40a6ece982e5369eaed63f84061c204f53023ce4 | stoneape314/AdventOfCode2019 | /2019_day2_pt2_intcode.py | UTF-8 | 5,469 | 4.15625 | 4 | [] | no_license | '''
Advent of Code 2019, Day 2, Pt2
An encoding problem with list input of ints that's an analogy for
assembly language.
Intcode programs work in blocks of 4 numbers at a time, with 3 commands
1: tells you to take the numbers at the indices of the next two numbers,
add them, then place the result at the 3rd... | true |
83187fcc8d7c801bf82fba3dfa4790787582b013 | Tadataka-Matsumoto/test_machine_learning | /count_wine_data.py | UTF-8 | 410 | 3.4375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
# データを読み込む
wine = pd.read_csv("../../winequality-white.csv", sep=";", encoding="utf-8")
# 品質データごとにグループ分けして、その数を数える
count_data = wine.groupby('quality')["quality"].count()
print(count_data)
# 数えたデータをグラフに描画
count_data.plot()
plt.savefig("wine-count-plt.png")
plt.show | true |
39dd60c98e2f98b5acc7f3c2715a959185560e07 | Whoismeidk/compcamps-website | /the game.py | UTF-8 | 199 | 3.546875 | 4 | [] | no_license | print("Hello")
name = input("Hello, proud user! Please enter your name here.")\
if name == "the silliest man ever":
print ("hey bro, it's been a long time")
else:
print("Hello,",name)
| true |
3cae3e6604b6502a590f48700d58660284aea6e5 | Aasthaengg/IBMdataset | /Python_codes/p02609/s121203725.py | UTF-8 | 1,344 | 3.21875 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**8)
n = int(input())
x = list(input())
bit_cnt = x.count('1')
# bitを一つ増やす場合
pos = [0] * n
pos_total = 0
# bitを一つ減らす場合
neg = [0] * n
neg_total = 0
base = 1
for i in range(n):
pos[-i-1] = base%(bit_cnt+1)
if x[-i-1] == '1':
# 同時にmod(bit_cnt+1)の法でトータルを作成
pos_... | true |
d348fe3eb33bfd49186e0c7a89e55fd4e440b8e9 | danielfep03/holbertonschool-higher_level_programming | /0x0C-python-almost_a_circle/models/base.py | UTF-8 | 2,023 | 3.4375 | 3 | [] | no_license | #!/usr/bin/python3
''' Module to create Base class '''
import json
class Base:
''' Base class for all modules '''
__nb_objects = 0
def __init__(self, id=None):
'''Constructor Method'''
if id is not None:
self.id = id
else:
Base.__nb_objects += 1
... | true |
7e1747be0ae09b3addffa3c48097064a65fda915 | SenkoLS/desapp | /Des.py | UTF-8 | 10,670 | 2.828125 | 3 | [] | no_license | import time
from ConfDes import ConfDes as cf
# Класс, предоставляющий интерфейсы реализации шифрования и дешифрования алгоритма DES
class Des():
def __init__(self):
self.password = None
self.text = None
self.keys = list()
def encrypt(self, key, text, padding=False):
return se... | true |
37e4a1f05ceb68e1dac371846e313dd640ca91be | kedongh/507_final_proj | /scrape.py | UTF-8 | 1,514 | 2.625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
headers = {
'User-Agent': 'UMSI 507 final project',
'From': 'kedongh@umich.edu',
'Course-Info': 'https://si.umich.edu/programs/courses/507'
}
def get_info_from_url(url):
''' Scrape the info from the given url.
Args:
url (str): A string web link to scrape... | true |
ad5ff342d18b8b6d368ae6210b95f252c9284c9e | Alcanderian/ML-course | /De Tree/Impl/De Tree/datatools.py | UTF-8 | 1,736 | 3.234375 | 3 | [] | no_license | """
handle data set.
"""
import numpy as np
def count_each_tag(mat):
"""
get count of each tag.
"""
cnts = {}
for vec in mat:
if vec[-1] not in cnts:
cnts[vec[-1]] = 0.0
cnts[vec[-1]] += 1.0
return cnts
def select(mat, i, val, op):
"""
SQL: SELECT \* FROM ... | true |
922262eda9f84f088be1fcb14752e72572e7bf45 | capricieuxV/live-serial | /tests/test_livemon.py | UTF-8 | 7,018 | 2.796875 | 3 | [
"MIT"
] | permissive | """Tests the script entry to the live monitoring program by calling its run
method with different combinations of script arguments.
"""
import pytest
# The virtual, pseudorandom port is setup as a session fixture in conftest.py
def get_sargs(args):
"""Returns the list of arguments parsed from sys.argv.
"""
... | true |
042013722d553153bea79da8863475d72fdda474 | AlexMorson/dustmaker | /dustmaker/Map.py | UTF-8 | 12,467 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | from .MapException import MapException
from .Var import Var, VarType
from .Tile import TileSide, tile_maximal_bits
from .LevelType import LevelType
import copy
class Map:
""" Represents a Dustforce level.
A map contains the following attributes:
map.tiles - A dict mapping (layer, x, y) to Tile objects... | true |
5bfff7d6c18e538ef48017a5370173b0a0e119c5 | Wigrovski/Python3 | /test apps/test.py | UTF-8 | 149 | 2.96875 | 3 | [] | no_license | slovo = input("введите слово и оно добавится в файл:")
f = open('text.txt', 'r+')
f.writelines('/n' + slovo)
f.close()
| true |
32b89559e30e25cdc8a26761b7f5ee803bc60409 | Aasthaengg/IBMdataset | /Python_codes/p03795/s655809549.py | UTF-8 | 40 | 2.78125 | 3 | [] | no_license | x = int(input())
print(x*800-x//15*200)
| true |
bb156cf68a623618af1cade8a3eb9b5d1e7a966e | AlekseyAbakumov/PythonLearn | /Scripts/Course1/WEEK2/example4.py | UTF-8 | 2,570 | 3.953125 | 4 | [] | no_license | # Задача на словари. Нужно найти тре самых встречающихся слова в текст.перемен
zen = """
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't s... | true |
6d2e98cb078f1db3b2bd8e303435f2dbec127168 | averykhoo/temporal-patterns | /entropy.py | UTF-8 | 1,015 | 3.46875 | 3 | [] | no_license | """
Functions to calculate Shannon entropy of strings
"""
import math
from functools import lru_cache
# noinspection SpellCheckingInspection
BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
# noinspection SpellCheckingInspection
HEX_CHARS = '1234567890abcdefABCDEF'
@lru_cache(maxs... | true |
83ee45b5e870ab35e98daaf0e9790b2cd67a1d62 | ulikestyle87/python_tools | /send_email_test.py | UTF-8 | 2,097 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 开发人员 :黎工
# 开发时间 :2020/6/24 10:22
# 文件名称 :send_email_test.PY
# 开发工具 :PyCharm
import smtplib
import email.mime.multipart
import email.mime.text
from email.mime.application import MIMEApplication
import datetime
def getYesterday():
today = datetime.date.today()
... | true |
6613ff22247dff78a995eb1eed855027fc4e40ca | LittleSheepy/MyMLStudy | /ml06pyPackeg/pk02opencv/cv02官网教程470/cv3ImageProcessing/cv4Contours/cv2ConvexHull.py | UTF-8 | 1,555 | 2.578125 | 3 | [] | no_license | from __future__ import print_function
import cv2 as cv
import numpy as np
import argparse
import random as rng
from cv1findContours import my_findContours
rng.seed(12345)
# 凸包
def my_convexHull(img_gray, threshold):
contours, hierarchy, img_canny = my_findContours(img_gray, threshold)
hull_list = []
for i... | true |
9ecb47deb4360714dcfc1e72f460f8060d1c426e | CoderKevinZhang/cs325 | /assignment2/align.py | UTF-8 | 2,867 | 2.890625 | 3 | [] | no_license | import pdb
#from sys import argv
import sys
costMatrix = []
def getCost(old, new):
if (type(old) is not str or type(new) is not str
or len(old) != 1 or len(new) != 1
or old not in "-ACGT" or new not in "-ACGT"):
return -1
col = -1
row = -1
for i in range(1,6):
if cos... | true |
94434707c54d6b5cf7a7b1d50644576f762efe09 | algono-ejercicios-upv/CACM | /Programming-Challenges/Chapters/4/Bridge/Bridge.py | UTF-8 | 2,706 | 3.53125 | 4 | [] | no_license | """
Strategies one and two are only aplicable when len(people) > 3
"""
def time_apply_strategy_one(A, B, C, D):
return A + 2*B + D
def steps_apply_strategy_one(A, B, C, D):
return [(A, B), (A, None), (C, D), (B, None)]
def time_apply_strategy_two(A, B, C, D):
return 2*A + C + D
def steps_apply_strat... | true |
06a3ba96c0970f1471cc1a0cdd0614d04c547878 | 13240137000/Face | /recognition.py | UTF-8 | 737 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import face_recognition
import cv2
def main():
img = face_recognition.load_image_file("images/5z.png")
face_locations = face_recognition.face_locations(img)
img = cv2.imread("images/5z.png")
faces = len(face_locations)
for i in range(0, faces):
top = face_locations[i][0]
right ... | true |
884942c1ac62fdb764c561a9aba787894b693b1b | ruc98/Inter-IIT-Tech-Meet-2018-Project | /signals.py | UTF-8 | 3,910 | 3.125 | 3 | [
"MIT"
] | permissive | '''
Author : Siddharth Nayak
email:ee16b073@smail.iitm.ac.in
'''
import numpy as np
from sklearn.preprocessing import scale
from scipy.interpolate import interp1d
'''
library for getting the values with all parameters
'''
class Sample:
def __init__(self,flex1,flex2,flex3,flex4,flex5,flex6,flex7,angx,angy,angz,acx... | true |
cfb277e89b2684a01f045b6d4ee9abf318627e28 | TSJun677/MedicalImageProcess | /HDF5DatasetWriter.py | UTF-8 | 2,398 | 3.046875 | 3 | [] | no_license | import h5py
import os
class HDF5DatasetWriter:
def __init__(self, movingImages_dims, fixedImage_dims, outputPath, bufSize=200):
"""
:param movingImages_dims: 浮动图像的维度
:param fixedImage_dims: 固定图像的维度
:param outputPath:
:param bufSize: 当内存储存了 bufSize个数据时, 就需要flush到外存
"... | true |
f8226217a8381b13ede075cd1fae581aa07c3720 | basantech89/code_monk | /python/MITx/6.00.2x_Introduction_to_ComputationalThinking_and_DataScience/codes/eval and exec.py | UTF-8 | 116 | 2.640625 | 3 | [] | no_license | x = 1
eval('x+1')
print 'x+1'
print eval('x+1')
print eval('x == 2')
exec 'x = x+1'
print eval('x')
print x
| true |
666ded0c090637f14056257110c71d639df7d88b | Julianpse/python-exercises | /list_exercises.py | UTF-8 | 1,397 | 3.84375 | 4 | [] | no_license | list_of_numbers = [-21,1,14,-8,3,7,9,5,2,0,24,12,46]
#1. Sum the Numbers
print(sum(list_of_numbers))
#2. Largest Number
print(max(list_of_numbers))
#3. Smallest Number
print(min(list_of_numbers))
#4. Even Numbers
for numbers in list_of_numbers:
if (numbers % 2 == 0):
print(numbers)
#... | true |
108a02807099dabe4095f49b19dcddb0da7debc8 | jakobgt/pylancer | /Pylancer/pylancer.py | UTF-8 | 2,713 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
from sys import stdout, argv
from random import randint
from twisted.internet import protocol, reactor
# Client is the component connecting to the different web servers.
from twisted.internet.protocol import connectionDone
def debug(msg):
pass
#stdout.write("Could connect to the peer")
cl... | true |
f35790e52d6c2fe5fcb418f840ce9d89caf91c18 | Blank-09/12-Python | /Patterns/simple/triangle.py | UTF-8 | 649 | 4.4375 | 4 | [] | no_license | # Using for and operator
for i in range(5):
for j in range(9):
if not (j >= 4 - i and j <= 4 + i):
j = ' '
print(j, end=' ')
print()
# Separator
print('\n') # ignore this line: this line prints two new lines
# Separator
# Using for or operator
for i in range(5):
for j in range(9... | true |
98eaa70b02a3ed1b651f45a0b5f6b726a96c1892 | nrser/nansi | /nansi/utils/strings.py | UTF-8 | 2,210 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | from typing import *
from nansi.utils.collections import iter_flat
def connect(*parts, seperator: str = "/") -> str:
"""
A generalized version of `os.path.join` that handles nested lists.
>>> connect(
... ('/etc', 'dir'),
... 'sir',
... ('/projects', 'objects/'),
... 'fil... | true |
d166dcb4a543d399bcf1e7f135631b122bff7820 | arv78/3D-tic-tac-toe | /Alpha_Beta_pruning_limited.py | UTF-8 | 3,877 | 3.03125 | 3 | [] | no_license | import is_goal
import numpy as np
import heuristic_2
import heuristic
def copy_matrix(game_board):
new_board = np.zeros((8,8), dtype = str)
for i in range (len(game_board)):
for j in range (len(game_board)):
new_board[i][j] = game_board[i][j]
return new_board
def Minimax(game_board,... | true |
89b0c28284bf9b4aecc0dbec9fa48ad8ef700f7d | JackMcCrack/adventofcode2020 | /day09/task2.py | UTF-8 | 913 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python3
def read_input(filename):
read = []
lines=open(filename, "r")
for i in lines:
read.append(int(i.strip()))
return read
if __name__ == '__main__':
f = read_input("input")
pre = 25
pos = 0
for line in f:
if pos >= pre:
s = f[pos-pre:pos]
... | true |
2e2fb3eb3721b214d945d38c27928820083fe2b6 | jerome-white/pyzrt | /attic/src/stree.py | UTF-8 | 3,946 | 2.5625 | 3 | [] | no_license | import multiprocessing as mp
from pathlib import Path
from argparse import ArgumentParser
from tempfile import NamedTemporaryFile
from scipy import constants
import zrtlib.tokenizer as tkn
from zrtlib import zutils
from zrtlib import logger
from zrtlib.suffix import SuffixTree
from zrtlib.corpus import CompleteCorpus... | true |
601a1379b8ff5447c6e604017756d68a3c4ea7bd | DaikiOnodera/TUTORIAL_TEST | /visualization/relu_test.py | UTF-8 | 1,013 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding:utf-8
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def activate(x):
return np.maximum(x, 0)
def calc_val(x, y):
return -2.2*(activate((-1.654*x-0.025) + (1.710*y-0.025))) + \
1.1*(activate((-0.436*x+0.5894) + (1.190*y+0... | true |
cb3afb58b999261f1e5bae7078ccd6562398c628 | Mario4272/Assistant | /assistant_functions/location.py | UTF-8 | 1,441 | 3 | 3 | [] | no_license | from assistant_functions.determine_most_similar import determine_most_similar_phrase
import geocoder
from assistant_functions.speak_listen import speak_listen
class Location:
def main(self, text, intent):
samples = {
"where are we" : {'function' : self.say_location, 'type' : 'location'},
... | true |
969c67c7059b93afa1553d75cd6ff57b9a601ed1 | eduardomourar/azure-functions-python-worker | /azure/functions_worker/bindings/eventhub.py | UTF-8 | 4,298 | 2.578125 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | import datetime
import json
import typing
from azure.functions import _abc as funcabc
from . import meta
from .. import protos
class EventHubEvent(funcabc.EventHubEvent):
"""A concrete implementation of Event Hub message type."""
def __init__(self, *,
body: bytes,
enqueued... | true |
f23fe3a36f19065fa0dabd84dcd58150d900593a | UnrelatedString/anti-perspective | /Anti-Perspective/src/transform.py | UTF-8 | 1,444 | 2.9375 | 3 | [] | no_license | import numpy as np
import cv2
from math import sin, cos, radians
#from data_classes import * #??
class Transform:
def __init__(self):
self.d = 1
self.theta = 0
def get_mat(self):
a = radians(self.theta)
s = sin(a)
c = cos(a)
d = self.d
return np.array([
... | true |
5a3f175971935ed2ac18e8760262b363f511d2f3 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_123/630.py | UTF-8 | 1,118 | 3.0625 | 3 | [] | no_license | def ops_to_target(size, target):
n_ops = 0
while size < target:
size += (size-1)
n_ops += 1
return n_ops
def n_ops(my_size, mote_sizes):
my_size = int(my_size)
mote_sizes = sorted(mote_sizes)
n_ops = 0
it = 0
while it < len(mote_sizes):
target = mote_sizes[it]
if target < my_size:
my_size += targ... | true |
8697d28273ce32738e6e65de7e5a598024a4e4d9 | jwood91/Python-Crash-Course | /3 Introducing Lists/motorcycles.py | UTF-8 | 2,319 | 4.40625 | 4 | [] | no_license | # You can change the values of items within the list:
motorcycles = ["honda", "yamaha", "suzuki"]
print(motorcycles)
# This will replace the first item
motorcycles[0] = 'ducati'
# To add items to a list you need to use the .append() function
motorcycles.append("ducati")
print(motorcycles)
# You can use the append fun... | true |
e732e901f08c23c9dcc08dcda579487cb71f3adf | Kosaaaaa/sorting_visualization | /sorting.py | UTF-8 | 3,784 | 3.421875 | 3 | [] | no_license | import pygame
from settings import Settings
import random
def compare_bars(bar1, bar2):
bar1.color = Settings.GREEN
bar2.color = Settings.GREEN
if bar1.height <= bar2.height:
return True
return False
def reset_color(bar1, bar2):
bar1.color = Settings.PINK
bar2.color = Settings.PINK
... | true |
2d148ef913421c5eff148a20bf7d30b92bf9ac81 | NevilleAntony98/Gtk-Calculator | /calculator.py | UTF-8 | 8,203 | 2.53125 | 3 | [] | no_license | import gi, re
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
class NumberButtons(Gtk.Button):
def __init__(self, label):
Gtk.Button.__init__(self)
self.set_label(label)
self.set_size_request(80, 70)
class OperationButtons(Gtk.Button):
... | true |
ab3d0c6e4ba29b78b2f9433f10d63a1fc1436f92 | amourav/OCT-Image-Classification | /methods/preprocess.py | UTF-8 | 6,925 | 2.671875 | 3 | [] | no_license | from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, ArgumentError
import os
import traceback
import sys
from PIL import Image
import numpy as np
import pandas as pd
import skimage
def get_class_labels(intKey=False):
img_type_dict = {
"NORMAL": 0,
"DRUSEN": 1,
"CNV": 2,
... | true |
a36904b7cfc9dcd7a5c96a2cb7d5604586fd3abc | robinshi007/dotfile | /script/os_check.py | UTF-8 | 2,457 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
# test in debian 10 buster
import os
import io
import subprocess
import re
def print_section(title):
border = ("="*10)
border_left = border.rjust(10)
border_right = border.ljust(10)
print("{} {} {}".format(border_left, title.upper(), border_right))
def capture_stdout_lines(cmd):
... | true |