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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5c4c0813930807ee6f28aef82d6e26157fc51a1e | Python | dev-area/Python | /Examples/6.py | UTF-8 | 730 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
def testfn(f,x,y):
return f(x) + y
def add10(c):
return c+10
print testfn(add10,3,5)
'''
import numpy as np
from pylab import *
a = np.array([1, 4, 5, 8], float)
b = np.array([1, 2, 3, 4], float)
a=a*b
print(a[1])
plot... | true |
15647624719836d783fbea28b04977f95b8ad4b1 | Python | bilalsp/msp | /msp/utils/_state.py | UTF-8 | 9,284 | 2.5625 | 3 | [
"MIT"
] | permissive | """
The :mod:`mps.utils._state` module defines RL-Environment state.
"""
import copy
import tensorflow as tf
class MSPState(tf.Module):
def __init__(self):
self.is_build = False
def build(self, input_shape):
"""Create variables on first call."""
self.input_shape = input_shape
... | true |
5bbc88b8ae694f7d0daa849869f13b941d5dada9 | Python | duanyrocker/bootcamp-Python | /band-name-generator-start.py | UTF-8 | 425 | 4.53125 | 5 | [] | no_license | # 1. Create a greeting for your program.
print("Hello, Welcome on band-generator")
# 2. Ask the user for the city that they grew up in.
city = input("Whats is name the city that they grew up in?\n")
# 3. Ask the user for the name of a pet.
pet = input("Whats is name your pet?\n")
# 4. Combine the name of their city and... | true |
a5b08e02f5946e5a364642efe9300f317dac3590 | Python | jessieharada6/Mini-Python-Projects | /Day-48-Selenium-Webdriver-Browser-and-Game-Playing-Bot/click.py | UTF-8 | 408 | 2.578125 | 3 | [] | no_license | from selenium import webdriver
chrome_driver_path = "/Users/jewang/Desktop/16/Mini-Python-Projects/chromedriver"
driver = webdriver.Chrome(chrome_driver_path)
driver.get("https://en.wikipedia.org/wiki/Main_Page")
article_count_element = driver.find_element_by_css_selector("#articlecount a")
# article_count_element.cl... | true |
89a88996d7cad6a2d21db230c97d050aff84e4ad | Python | bwindrim/fparser | /fparser.py | UTF-8 | 6,736 | 2.6875 | 3 | [] | no_license | import sys
import os
def get_ftyp(f, atom_type, body_end):
"process the body of an ftyp atom"
type_list = []
# Loop reading 4-byte type fields
while ((body_end - f.tell()) >= 4):
magic2 = f.read(4)
# print ("magic2 = ", magic2)
type_list.append(magic2)
assert(f.tell() == bo... | true |
c06f24bf0c18328d579fa1aaa9639d8907170a84 | Python | aking1998/Python-Programs | /set_operations.py | UTF-8 | 1,056 | 4.28125 | 4 | [] | no_license |
myset = {'mango','apple','banana','orange'}
ch='y'
while ch!='quit':
print("1.Add Item ")
print("2.Clear Set ")
print("3.Remove Item ")
print("4.Copy Set ")
print("5.Pop Item ")
print("6.Print Sets")
print("7.Quit Program (type'quit')")
ch=input("enter your choice : ")
... | true |
f8fd15fb7660747f1c867bcbc74d2f16b88bbc2c | Python | JaroVojtek/Python | /Motion Detection Application/detection.py | UTF-8 | 1,619 | 2.578125 | 3 | [] | no_license | import cv2, time
from datetime import datetime
import pandas
first_frame=None
status_list = [None,None]
times=[]
df=pandas.DataFrame(columns=["Start","End"])
video = cv2.VideoCapture(0)
while(True):
check, frame = video.read()
status = 0
gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
gray=cv2.GaussianBlu... | true |
f5c1d9e2c4e0ee5e2ab30bb694349ec01a84b1e3 | Python | google/timesketch | /cli_client/python/timesketch_cli_client/commands/timelines.py | UTF-8 | 2,758 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2021 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | true |
959de2e4eb6a9d46d4523acd73d8391eea525e40 | Python | QuentinAndre/Surveyer | /Surveyer/models.py | UTF-8 | 2,738 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 18 19:14:56 2015
@author: Quentin ANDRE
"""
from Surveyer import db
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from instance.config import SECRET_KEY
class User(db.Mod... | true |
9dc6af5a09f299f59a64c85b5b3310536f705754 | Python | buidler/LeetCode | /字符串/14. 最长公共前缀.py | UTF-8 | 2,277 | 3.609375 | 4 | [] | no_license | import re
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if not strs:
return ""
length = len(strs) # 取得list的长度
if length == 1:
print(strs[0])
return strs[0]
... | true |
f676ea4197043227bae729d7c99e1c729059f2d5 | Python | MadSkittles/leetcode | /137.py | UTF-8 | 306 | 3.03125 | 3 | [] | no_license | class Solution:
def singleNumber(self, nums):
one = two = 0
for n in nums:
one, two = (~n & one) | (n & ~(one ^ two)), (~n & two) | (n & one)
return one
if __name__ == '__main__':
solution = Solution()
print(solution.singleNumber([2, 2, 3, 2]))
| true |
e2fbcd6ab79f686d983602a9007220f6e9aaad73 | Python | rohank05/hacktoberfest-2021 | /codes/Python/budapest_buslist.py | UTF-8 | 662 | 2.515625 | 3 | [
"MIT"
] | permissive | import requests
r = requests.get(
'https://futar.bkk.hu/api/query/v1/ws/otp/api/where/vehicles-for-location.json?lon=47.521822&lat=19.031826&radius=50')
list_r = r.json()
list_only_r = list_r["data"]["list"]
vehicles = []
vehiclescounter = {}
errors = 0
for i in list_only_r:
if "vehicleId" in i:
vehicl... | true |
ba00e1e58b5faba76b522d01b78a78e74f9249d8 | Python | jtprichett/md5_sum_checker | /md5_sum_checker.py | UTF-8 | 5,521 | 3.515625 | 4 | [] | no_license | """
MD5 sum checker to check files against their checksums
equating if they are equal.
Python 2.7.15
@author Joshua T. Pritchett <jtpritchett@wpi.edu>
@copyright ALAS Lab, 2016
"""
import subprocess
import os
import sys
import getopt
"""
Writes out information for the checksum comparison... | true |
833e5a1e4a7ade14d8cdd42c4f33528c51523ad2 | Python | sukhesai/algorithms_and_data_structures | /algorithms and ds/graph_algorithms/topsort.py | UTF-8 | 1,093 | 3.28125 | 3 | [] | no_license | import math
def topsort():
n = len(g)
V = [False]*n
res = [None]*n
i = n - 1
for at in range(n):
if not V[at]:
i = dfs(i, at, V, res)
return res
def dfs(i, at, V, res):
V[at] = True
for next_node in g[at]:
if not V[next_node[0]]:
i = dfs(i, nex... | true |
657a562fc7ad51f33f923e9c7dbc818fe4837d86 | Python | angru/pydapters | /tests/test_adapter.py | UTF-8 | 1,240 | 3.1875 | 3 | [
"MIT"
] | permissive | from pydapters import Adapter, NestedField, preprocess, postprocess, Field
class Ad(Adapter):
@preprocess
def prepare(self, data: dict, **kwargs):
data['z'] = {}
return data
@postprocess
def postpare(self, data: dict, **kwargs):
data['z']['x'] = 'y'
return data
... | true |
c14849098e98c992c560ac76e7a8fb760dd36f23 | Python | yangyi0318/raylab | /raylab/torch/nn/modules/activation.py | UTF-8 | 654 | 3.1875 | 3 | [
"MIT"
] | permissive | """Custom activation functions as neural network modules."""
import torch
import torch.nn as nn
class Swish(nn.Module):
r"""Swish activation function.
Notes:
Applies the mapping :math:`x \mapsto x \cdot \sigma(x)`,
where :math:`sigma` is the sigmoid function.
Reference:
Eger, Ste... | true |
7e03d68fc6f7140897c598848f36740fe122cd49 | Python | emfrias/python-bitshares | /bitshares/aio/block.py | UTF-8 | 969 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from .instance import BlockchainInstance
from ..block import Block as SyncBlock, BlockHeader as SyncBlockHeader
from graphenecommon.aio.block import (
Block as GrapheneBlock,
BlockHeader as GrapheneBlockHeader,
)
@BlockchainInstance.inject
class Block(GrapheneBlock, SyncBlock):
"""... | true |
f9f44165553eef9979af56a3ecd5562d6c98acfa | Python | ChrisMusson/Problem-Solving | /Project Euler/027_Quadratic_primes.py | UTF-8 | 1,425 | 4.125 | 4 | [] | no_license | '''
Euler discovered the remarkable quadratic formula - n**2 + n + 41
It turns out that the formula will produce 40 primes for the consecutive integer values 0 ≤ n ≤ 39.
However, when n=40, 40**2 + 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when n=41,
41**2 + 41 + 41 is clearly divisible by 41.
The in... | true |
81c7d4b052daebb5041bb43d687691f4b1ef01e8 | Python | yu5shi8/AtCoder | /ABC_B/ABC172B.py | UTF-8 | 234 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# B - Minor Change
# https://atcoder.jp/contests/abc172/tasks/abc172_b
S = input()
T = input()
n = len(S)
ans = 0
for i in range(n):
if S[i] != T[i]:
ans += 1
print(ans)
# 21:01 - 21:02(AC)
| true |
63fb4c21f681c17c6c0e4ed9d83df5ee30aae4b8 | Python | chengggguo/breathingrestraint_py | /test2/client/serialTestarduino.py | UTF-8 | 700 | 3.234375 | 3 | [] | no_license | import serial
import struct
import time
try:
ser = serial.Serial("/dev/ttyACM1",9600)
time.sleep(2) # it needs a delay for the serial connection
except:
ser = serial.Serial("/dev/ttyACM0",9600)
time.sleep(2) # it needs a delay for the serial connection
fh=open("number.txt","r")
num = fh.readline()
print n... | true |
e05ca0a4243adb284d1d374468386e52ab4a1f98 | Python | LemenuValentin/Car_self_driving-AI- | /Linear_regression_model.py | UTF-8 | 2,107 | 2.65625 | 3 | [] | no_license | import pandas as pd
import csv
import numpy as np
import matplotlib.pyplot as plt
import mmap
import pandas as pd
from sklearn import linear_model
import seaborn as sns
import cv2
from sklearn.linear_model import LinearRegression
from sklearn import datasets
from sklearn import linear_model
from sklearn.metrics import ... | true |
07c0db1cd9fe04b1eb9755b767669619b12a534d | Python | ginevracoal/adversarialGAN | /src/model/platooning_energy.py | UTF-8 | 9,536 | 2.765625 | 3 | [
"CC-BY-4.0"
] | permissive | import os
import torch
from model.electric_motor import ElMotor, ElMotor_torch
from utils.diffquantitative import DiffQuantitativeSemantic
USE_TORCH_EFF_MAP=True
class Car():
""" Describes the physical behaviour of the vehicle """
def __init__(self, device):
self.device=device
self.gravity =... | true |
5e6fc3067ee5334ab1530b40c8ef6213176503d8 | Python | hayleymathews/data_structures_and_algorithms | /Lists/_list_abstract.py | UTF-8 | 3,218 | 3.828125 | 4 | [] | no_license | """abstract class for ADT List"""
from abc import ABC, abstractmethod
class List(ABC):
"""
abstract class representing List
"""
@abstractmethod
def __init__(self):
self.head = None
self.size = 0
@abstractmethod
def __iter__(self):
"""
iterate through List
... | true |
9347bcacf565ef9d6fd4040cd12fe4bbf7a7fdd2 | Python | lawwantsin/ohome-timelocksafe-server | /tests.py | UTF-8 | 2,557 | 3.046875 | 3 | [] | no_license | #!/usr/local/bin/python3.6 -u
# Really there should be a more formalized set of unit tests, but there hasn't
# been much that I wanted to spend the time to test (my fault, I know), so you
# get this shitty stand-alone file instead.
import pytz
import Hardware
from datetime import datetime, timedelta
# First we check... | true |
7d5a47bb11928ff31f5caf24c03a065a0169fe21 | Python | molychin/LeaningPythons | /Pandas/Learning_pandas/2015/Learning pandas-11.py | UTF-8 | 16,333 | 4 | 4 | [] | no_license |
# coding: utf-8
# ## Visualization
# In[19]:
'''
Humans are visual creatures and have evolved to be able to quickly notice the
meaning when information is presented in certain ways that cause the wiring in our
brains to have the light bulb of insight turn on. This "aha" can often be performed
very quickly, given t... | true |
4c9a947201c0362c2705b55b1735766493c66bd6 | Python | manuck/Algorithm | /4.Stack1(실습)/그래프 경로.py | UTF-8 | 710 | 2.53125 | 3 | [] | no_license | import sys
sys.stdin = open("그래프 경로_input.txt")
def dfs(v):
global G, visited, V, flag, g
visited[v] = 1
if v == g:
flag = 1
for w in range(1, V+1):
if G[v][w] == 1 and visited[w]==0:
dfs(w)
T = int(input())
for case in range(1, T+1):
flag=0
V, E = map(int, input(... | true |
51ab80793520bdce2fad87a94ccc40c7cee60718 | Python | Accalmie/Stuffs | /Jarvis/build_news_source.py | UTF-8 | 296 | 2.9375 | 3 | [] | no_license | import json
import requests
if __name__ == '__main__':
url = 'https://newsapi.org/v1/sources?language=en'
r = requests.get(url)
j = json.loads(r.text)
sources = j['sources']
source_list = []
for source in sources:
source_list.append(source['id'].encode("utf-8"))
print(source_list) | true |
2662d977457c08c08e6f856fd5e9c2a35a5af1f2 | Python | neuroph12/python-demo | /study/chapter03/tensor_demo.py | UTF-8 | 1,731 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : tensor_demo.py
# @Author: wu gang
# @Date : 2018/9/3
# @Desc : 张量:tf中所有数据都是通过tensor的形式来组织的
# @Contact: 752820344@qq.com
import tensorflow as tf
if __name__ == '__main__':
a = tf.constant([1.0, 2.0], name="a")
b = tf.constant([2.0, 3.0], name="b")
... | true |
07966cb786b10838294eb11c6f6015f771670f9f | Python | rgkavodkar/centralized_index_file_sharing | /util/temo.py | UTF-8 | 909 | 3.140625 | 3 | [] | no_license | __author__ = 'rg.kavodkar'
import threading
import time
def print_me(text):
time.sleep(3)
while 1:
print(text)
th_1 = "thread_1"
th_2 = "thread_2"
t1 = threading.Thread(target=print_me, args=(th_1,))
t2 = threading.Thread(target=print_me, args=(th_2,))
t1.start()
t2.start()
print("Main thread exit... | true |
0337effe579f72608a63e4e272b006716dc55635 | Python | jinjin123/mywork-node | /docker-compose/kafka/bitnamiissue/kafka/cc.py | UTF-8 | 2,470 | 2.640625 | 3 | [] | no_license | class KafkaConsumer(object):
def __init__(self, hosts, topic):
self.client = KafkaClient(hosts=hosts)
self.topic = self.client.topics[topic.encode()]
def simple_consumer(self, offset=0):
"""
指定消费
:param offset:
:return:
"""
partitions = self.topic.... | true |
e4dbecbc4013d25cff09ddddaf1d9533dd1d7ef0 | Python | westgate458/LeetCode | /P0349.py | UTF-8 | 365 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 1 15:51:14 2019
@author: Tianqi Guo
"""
class Solution(object):
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
# simply find union o... | true |
c8019436a23bfdc83880039076b630698014965c | Python | thej00/Codeforces | /339A.py | UTF-8 | 87 | 2.953125 | 3 | [] | no_license | lst=list(map(int,input().split('+')))
lst.sort()
print('+'.join(list(map(str,lst)))) | true |
b8025cfc66da714ebe3eab82ab80ed9379625198 | Python | RunOrVeith/FGG | /FGG/dataset/graph_builder.py | UTF-8 | 8,492 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import enum
from typing import Union, Optional
import itertools
import warnings
import numpy as np
import networkx as nx
from scipy.spatial import distance
from FGG.dataset.tracks import TrackCollection
from FGG.dataset.split_strategy import SplitStrategy
from FGG.metrics.evaluation import GraphMetrics
@enum.unique... | true |
3911d7b7924faafad666d60c4b7cc0c688fc3655 | Python | Babtsov/Senior-Design | /webserver/config/create_database.py | UTF-8 | 339 | 2.640625 | 3 | [] | no_license | import sqlite3
db = sqlite3.connect('/data/logs.db', detect_types=sqlite3.PARSE_DECLTYPES)
cursor = db.cursor()
try:
cursor.execute('create table log (rfid integer, event integer , time timestamp)')
print "database was created"
except:
print "Error creating the database. perhaps it already exits?"
finally:
cursor.c... | true |
c10a1f20a7adfa9029c058d4974ce63d306e8996 | Python | srautomation/srautogitmation | /sr_automation/platform/android/Battery.py | UTF-8 | 1,695 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import re
import time
class Battery(object):
MIN_FETCH_DELAY = 0.01 # seconds
def __init__(self, android):
self._android = android
self._last_fetched = -1 * Battery.MIN_FETCH_DELAY
def _fetch(self):
current_time = time.time()
if (current_time < self._last_fetched + Battery.... | true |
74ae0bd9e931e14ea64423538ccee9660c26515b | Python | ndrd/freezing-batman | /dfa.py | UTF-8 | 8,812 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf8 -*-
# Jonathan de Jesus Andrade Lopez
# 414006962
# Marzo 15, 2015
# minimizador de automatas finitos no deterministas
# puede cargar un automata desde un archivo de texto
# o desde formato json
import json, copy, sys, os
#Clase para minimizacion de automatas finitos determinis... | true |
d7a1df870380d19eb766de6361d8b25b5bdeb90e | Python | lanstonpeng/Squirrel | /lanstonpeng/maximum_subarray.py | UTF-8 | 641 | 3.0625 | 3 | [] | no_license | class Solution:
# @param A, a list of integers
# @return an integer
def maxSubArray(self, A):
result = 0
for i in range(len(A)):
temp = 0
for k in range(i,0,-1):
temp += A[k]
if temp > result:
result = temp
r... | true |
837fea2c79ecf2089cf92d2fdb6840722c6c1737 | Python | shitian007/cfp-mining | /cfp_crawl/url_classifier.py | UTF-8 | 753 | 2.75 | 3 | [] | no_license | import re
from typing import List
from urllib.parse import urlparse
from selenium import webdriver
class URLClass:
COMMITTEE = 'org'
SPEAKERS = 'speakers'
ADMINISTRATIVE = 'admin'
UNKNOWN = 'unk'
# Regex string representations of possible keywords
org = 'organi[a-z]+|committee[a-z]*|prog[a-z]*|chair... | true |
f2457fc31ab9c93c5789f775cfe5e9b0e0b7cc3b | Python | samuel871211/My-python-code | /Additional/496.Next Greater Element I.py | UTF-8 | 594 | 2.96875 | 3 | [] | no_license | class Solution:
def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]:
ans = []
for i in range(len(nums1)):
for j in range(len(nums2)):
if nums1[i] == nums2[j]:
if j == len(nums2)-1 or max(nums2[j+1:]) <= nums2[j]:
... | true |
51e092a1bc710883e45860a948ab2634a26f5cf0 | Python | alexandraback/datacollection | /solutions_5738606668808192_0/Python/yaoshimax/Clarge.py | UTF-8 | 1,524 | 2.671875 | 3 | [] | no_license | import math
import random
from sets import Set
T=int(raw_input())
N,J=map(int,raw_input().split())
upperBound=1000000
isPrime=[True for i in xrange((upperBound-3)/2+1)]
for i in xrange((int(math.sqrt(upperBound-3))-3)/2+1): # k*k = (2i+3)^2 <= upperBound-3
if isPrime[i]:
k = i+i+3 # this is prime n... | true |
23d110cff79eb57616586da7f78c7ac6d4e7a957 | Python | vmmc2/Competitive-Programming | /Sets.py | UTF-8 | 1,369 | 4.5 | 4 | [] | no_license | #set is like a list but it removes repeated values
#1) Initializing: To create a set, we use the set function: set()
x = set([1,2,3,4,5])
z = {1,2,3}
#To create an empty set we use the following:
y = set()
#2) Adding a value to a set
x.add(3)
#The add function just works when we are inserting just 1 element into our ... | true |
af7b032315b9a4d978029e0358e11aa892949fd8 | Python | jjimenez32/UTSA-Courses | /3723/prog6/test2.py | UTF-8 | 712 | 2.625 | 3 | [] | no_license | from sys import argv
import re
array = list()
files = open(argv[1])
lines = files.readlines()
lister = list()
for line in lines:
array.append(line)
newline = "".join(array)
for line in newline:
line.rstrip()
lim = 55
#re.sub("(.{64})", "\\1\n", s, 0, re.DOTALL)
for s in newline.split("\n"):
if s == "":
... | true |
12c988682f7c2128b0430a15f6fad68e4cb1619c | Python | azman0101/videovignette | /frontend/tasks.py | UTF-8 | 497 | 2.5625 | 3 | [] | no_license | from __future__ import absolute_import
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
logger.setLevel('WARNING')
from celery import shared_task
import os.path
import shutil
@shared_task()
def add(x, y):
return x + y
@shared_task()
def delete_path(path):
if os.path.exists(path... | true |
94beb06947083790310a2f76e01ba8139c7e678c | Python | showsuzu/Automate-the-Boring-Stuff-with-Python | /ch11/lucky.py | UTF-8 | 899 | 3.265625 | 3 | [] | no_license | #Windows
# #! python3
#Mac
#! /usr/local/var/lib/pyenv/versions/anaconda3-2.0.1/python3.4
#Linux
# #! /usr/bin/python3
# lucky.py - 11.5章 Google検索結果を最大5タブ分開く。検索キーワードはコメンドラインの引数
# Usage:
# python lucky.py [検索ワード]
import requests, sys, webbrowser, bs4
print('Search word : ' + ' '.join(sys.argv[1:]))
print('Googling...... | true |
8c838c8e6c85f3ae0cacf1d90a6e3f0c7c8c4800 | Python | MdRafishafi/code | /Admin Dashbord and Backend/app/bus_stops_routes.py | UTF-8 | 3,814 | 2.5625 | 3 | [] | no_license | from database import app, db
from flask import request
from sqlalchemy import and_
from app import generate_ids as gids, constants as c
from database import bus_stops_database as bsd
@app.route('/bmtc/add/new/bus-stop', methods=["POST"])
def bmtc_add():
uid = gids.generate_id(bsd.BusStops)
bus_stop = request... | true |
288cfebe49700c469649328ea740497e4089adb7 | Python | awaliza1994/UAS-PBO-KIVY-Mengambar | /mengambar.py | UTF-8 | 1,011 | 2.625 | 3 | [] | no_license | # mengambar.py
from kivy.uix.popup import Popup
from kivy.uix.widget import Widget
from kivy.uix.colorpicker import ColorPicker
from kivy.app import App
from kivy.properties import ListProperty
from kivy.uix.relativelayout import RelativeLayout
col = [0,0,1,1]
class SelectedColorEllipse(Widget):
se... | true |
8a603eaaecf42bbd2939b4e21f1b59a597da6393 | Python | raph-amiard/learn-ada-in-y-minutes | /article/generate_article.py | UTF-8 | 2,933 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
import sys
import getopt
import glob
import os
import re
START_EXCLUSION_TAG = '-- Exclude from article'
STOP_EXCLUSION_TAG = '-- End of exclusion'
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
match_filename = re.compile("chapter_(\w+?)(-\w+)?.(ad[sb])")
def insert_header(out):
f... | true |
e1acb51e256a20ab38ff7046adc5af44cf68fd2c | Python | joy961208/Programmers-Coding-Test | /Level 1/신규 아이디 추천.py | UTF-8 | 936 | 2.875 | 3 | [] | no_license | def solution(new_id):
answer = ''
new_id = new_id.lower()
nums = "0123456789abcdefghijklmnopqrstuvwxyz.-_"
new_id = [i for i in new_id if i in nums]
if new_id == []:
return "aaa"
while True:
a = 0
if new_id[0] == ".":
new_id.remove(".")
a = 1
... | true |
050e8683a73eac59482d1f0ae0c2f784c72fb941 | Python | Jammy2211/PyAutoGalaxy | /autogalaxy/profiles/light/standard/moffat.py | UTF-8 | 4,905 | 3 | 3 | [
"MIT"
] | permissive | import numpy as np
from typing import Optional, Tuple
import autoarray as aa
from autogalaxy.profiles.light.abstract import LightProfile
from autogalaxy.profiles.light.decorators import (
check_operated_only,
)
class Moffat(LightProfile):
def __init__(
self,
centre: Tuple[float... | true |
a5541859ba1d44d9b8dd130da3ee68f4ea906094 | Python | btbuxton/python-itunes | /tests/itunes/test_common.py | UTF-8 | 1,343 | 2.765625 | 3 | [] | no_license | '''
Created on Sep 8, 2012
@author: btbuxton
'''
import unittest
from itunes.common import func_and, func_or, every_do
class CommonTest(unittest.TestCase):
def testFuncOr(self):
self.assertTrue(func_or(lambda: True, lambda: True)(), "T | T = T")
self.assertTrue(func_or(lambda: True, lambda: False... | true |
08c221f262cfb3795fa710f661a6766d1c951e0f | Python | Anaconda-Platform/anaconda-project | /anaconda_project/internal/windows_cmdline.py | UTF-8 | 3,881 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... | true |
a8b8c1011f79308a482d1596919f61410637bedd | Python | Voland2578/CourseraDataStructuresAndAlgorithms | /Algorithms Toolbox/week4_divide_and_conquer/4_number_of_inversions/inversions.py | UTF-8 | 2,730 | 3.515625 | 4 | [] | no_license | # Uses python3
import sys
import copy
import random
def get_number_of_inversions(a, b, left, right):
number_of_inversions = 0
if right - left <= 1:
return number_of_inversions
ave = (left + right) // 2
number_of_inversions += get_number_of_inversions(a, b, left, ave)
number_of_inversions +... | true |
5862ffe9451c55d7abc95ac112edfceb16100b2f | Python | IlosvayAron/script-languages | /Lesson9/homework/own_solution/shuffled.py | UTF-8 | 668 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
import random as rd
def shuffled(lst: list) -> list:
result = []
while len(result) != len(lst):
num = rd.choice(lst)
if num not in result:
result.append(num)
return result
def main():
numbers = [3, 8, 2, 5, 9, 1, 7, 10, 4, 6]
print('Eredeti lista:... | true |
9bc6cd129c649423c0207650cc39ab755df0d9e5 | Python | hk-bughunter/Framework_Test | /thirdProject/image_identification/simulate_sikulix.py | UTF-8 | 3,359 | 2.828125 | 3 | [] | no_license | import time,os
from PIL import Image, ImageGrab
class ImageMatch:
# 获取RGB
def get_pixel(self):
small = Image.open('login.png')
small_rgb = small.load()
if small.mode == 'RGBA':
big = ImageGrab.grab().convert('RGBA')
else:
big = ImageGrab.grab()
bi... | true |
38438bbe330b94ee7da87906bc39ee23e79fde26 | Python | scott0123/extsumm-reimplementation | /run_preprocess.py | UTF-8 | 505 | 2.546875 | 3 | [] | no_license | import subprocess
# subprocess.call(["python3", "preprocessing.py", "1", "&"])
# subprocess.call(["python3", "preprocessing.py", "2", "&"])
# subprocess.call(["python3", "preprocessing.py", "3", "&"])
# subprocess.call(["python3", "preprocessing.py", "4", "&"])
child_processes = []
for i in range(0, 5):
p = subpr... | true |
23ee9fdbff87bbbc45ea8e971cc43c17c52efc22 | Python | notfrannco/python-scripts | /jbs_domain_deploy.py | UTF-8 | 2,751 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
"""
Script para deployar app en jboss domain mode
Ejemplo:
new deploy
$ jbs_domain_deploy.py /location/to/app.war server-group-to-deploy jbs_host
replace
$ jbs_domain_deploy.py name-of-the-app server-group-to-deploy jbs_host
"""
import subprocess
import sys
def main():
... | true |
4097ab2f2862513b8ac3725c18df396f747e254e | Python | kjh03160/Algorithm_Basic | /CS_Shin/02_Divide_Conquer/binary_search.py | UTF-8 | 702 | 3.96875 | 4 | [] | no_license | def binary_search(A, i, j, x):
if i > j: # 탐색 범위 내에 없다
return None
m = (i + j) // 2 # 중간 인덱스
if x == A[m]: # x 발견
return m
elif x < A[m]: # 왼쪽 반 탐색
return binary_search(A, i, m - 1, x)
else: # 오른쪽 반 탐색
return binary_search(A, m + 1, j, x)
A = [2 *... | true |
25f5381b0afa210220dea0f91cb02467d6fe9144 | Python | tkkhhaarree/MLSysInPython | /threshold with cross validation.py | UTF-8 | 2,690 | 3.140625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
from threshold import fit_model, accuracy, predict
from sklearn.datasets import load_iris
data = load_iris()
features = data.data
feature_names = data.feature_names
target = data.target
target_names = data.target_names
# draw graph
for t in range(3)... | true |
01fba6e5ba6b66ec643672b146233e5a3e5dfab9 | Python | SvegincevVlad/Practicum1 | /58.py | UTF-8 | 748 | 2.96875 | 3 | [] | no_license | """
Имя проекта: practicum-1
Номер версии: 1.0
Имя файла: 1.py
Автор: 2020 © В.С. Свежинцев, Челябинск
Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru)
Дата создания: 18/12/2020
Дата последней модификации: 18/12/2020
Связанные файлы/пакеты: numpy, random
Описание:
... | true |
eb3710e82c7fd93bea36d5bee59ceb055f3b9eeb | Python | qingjiaowoyesusimida/59 | /15.day/3.函数计算器.py | UTF-8 | 465 | 3.5625 | 4 | [] | no_license | def jisuanqi(x,y,z):
if i == 1:
z = x-y
print('两数之差是%0.2f'%z)
elif i == 2:
z = x+y
print('两数之和是%0.2f'%z)
elif i == 3:
z = x*y
print('两数之积是%0.2f'%z)
elif i == 4:
if y != 0:
z = x/y
print('两数之商是%0.2f'%z)
else:
print('输入不合法')
while True:
x = float(input('请输入一个数字'))
y = float(input('请输入另一个数字'... | true |
731a8b147c054240d5e2977189aa1d08e1f5b076 | Python | charlsonso/coding_interview_practice | /python/lists/121_lc.py | UTF-8 | 699 | 3.421875 | 3 | [] | no_license | def maxProfit(self, prices: List[int]) -> int:
#Brute force, this is garbage, never again
max_profit = 0
for idx, val in enumerate(prices):
for jdx, jal in enumerate(prices[idx + 1:]):
profit = jal - val
if profit > max_profit:
max_profit = profit
return m... | true |
b7dd4dcce4fd9c3356fc64a8ae0578eb83d743d9 | Python | fonhorst/RENDLER | /python-mhgh/environment/ExperimentalResourcemanager.py | UTF-8 | 2,947 | 2.765625 | 3 | [] | no_license |
from ResourceManager import ResourceManager
from BaseElements import Node, Resource
class ExperimentResourceManager(ResourceManager):
def setVMParameter(self, rules_list):
"""
Established farm_capacity and max resource_capacity for each resource
"""
if len(self.resources) != len(... | true |
10fa2ef56efc410893d184b0436494b5d8db9f97 | Python | Deepthi05/pyxero | /tests/auth.py | UTF-8 | 8,535 | 2.65625 | 3 | [
"BSD-2-Clause"
] | permissive | import unittest
from datetime import datetime, timedelta
from mock import patch, Mock
from xero.auth import PublicCredentials, PartnerCredentials
from xero.exceptions import XeroException, XeroNotVerified, XeroUnauthorized
class PublicCredentialsTest(unittest.TestCase):
@patch('requests.post')
def test_init... | true |
b6225af98fcb94c99ae68e31b48b22d0e3cb551f | Python | JonesTPG/wikiparser | /multiple_threads.py | UTF-8 | 2,712 | 2.984375 | 3 | [] | no_license | import logging
import os
from time import time
from database import Database
from threading import Thread
from queue import Queue
import calculate_paths_parallel
import config
try:
from sets import Set
except ImportError:
Set = set
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(... | true |
f1896c5859bace2ee388274d8ea5fd1bd0fcee07 | Python | micko-plz/aoc20 | /d12.py | UTF-8 | 1,818 | 3.359375 | 3 | [] | no_license | input_file = open('inputs/d12.txt', 'r')
instructions = input_file.read().splitlines()
import time
from math import cos, sin, radians
# part1
t0 = time.time()
init = [0,0,0]
for instr in instructions:
if instr[0] == 'N':
init[0] += int(instr[1:])
elif instr[0] == 'S':
init[0] -= int(instr[1:])
elif inst... | true |
f8019ca989c8f7afabc96742a74a2432a5eefadd | Python | RaphaelMolina/Curso_em_video_Python3 | /ex065.py | UTF-8 | 690 | 4 | 4 | [] | no_license | from unidecode import unidecode
from Titulo import Titulo
e = Titulo(65, 'Média, Maior e Menor!!!')
e.Exercicio()
contador = media = maior = menor = n = int()
resposta = str('S')
while resposta[0] != 'N':
contador += 1
n = int(input('Informe um número: '))
resposta = unidecode(str(input('Quer digitar outr... | true |
d6d0be4edf0663ca968ab29b6e9135f62cfdf5ea | Python | balanalina/Formal-Languages-and-Compiler-Design | /SymbolTable/symbol_table_impl/code_example.py | UTF-8 | 774 | 3.5 | 4 | [] | no_license | from symbol_table_impl.hash_table import HashTable
""" mini_language
start
int count= 0
strings student1 = 17, student2 = 19, student3 = 18, student4 = 17
count+=1 if student1 >= 18
count+=1 if student2 >= 18
count+=1 if student3 >= 18
count+=1 if student4 >= 18
write count + " students can vote!"
end
"""
symb... | true |
4d8d6ca338a2918b9a1a03c1fd7724596289b686 | Python | ding4it/leetcode | /WordPattern.py | UTF-8 | 870 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@version: 1.0
@author: Ding4it
@license: Apache Licence
@contact: ding4it@gmail.com
@file: WordPattern.py
@time: 2015/12/11 16:53
"""
class Solution(object):
def wordPattern(self, pattern, str):
"""
:type pattern: str
:type str: str
:rtyp... | true |
507292fd25e3b2c03c90f2f9a1cd754564da2faf | Python | syurskyi/Algorithms_and_Data_Structure | /_temp/Beat the Codility Coding Interview in Python/template/Section 2 Time Complexity/timecomplexity/tape_equilibrium.py | UTF-8 | 448 | 2.796875 | 3 | [] | no_license | # This is the solution for Time Complexity > TapeEquilibrium
#
# This is marked as PAINLESS difficulty
___ solution(A
sum_left _ A[0]
sum_right _ sum(A) - A[0]
diff _ abs(sum_left - sum_right)
___ i __ r..(1, l..(A)-1
sum_left +_ A[i]
sum_right -_ A[i]
current_diff _ abs(sum_lef... | true |
657d17bfb1eddf63487428e04b3c44e53a0e4b22 | Python | RadGorzy/3DPointCloudClassification_GUI | /embedded_python/model.py | UTF-8 | 4,325 | 2.578125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.layers import Conv2D, MaxPool2D, Flatten, Dense, Dropout, Input
from tensorflow.keras.optimizers import Adam
def build():
inputs = Input(shape=(299, 299,1))
print(repr(inputs))
x = Conv2D(6, (6, 6), activation='relu', padding='same')(inputs)
print(repr(x)... | true |
1ab65aaf116307958f3a5cb207fee6f938ecacf0 | Python | hl-336/Hmtt_Ui_Test | /page/mp/publish_artical_page.py | UTF-8 | 3,452 | 2.8125 | 3 | [] | no_license | "发布文章界面"
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from base.mp_base.base_page import BasePage, BaseHandle
# 对象库层
from utils import DriverUtils, check_channel_opt... | true |
160098e244985e86b76ed4fe53e6391c12a42b43 | Python | pardro/algorithm | /04.Median of Two Sorted Arrays.py | UTF-8 | 328 | 3.1875 | 3 | [] | no_license | class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
a = num1 + num2
a.sort()
a_len = len(a)
a_center = int(a_len / 2)
if (a_len % 2 == 1):
return a[a_center]
else:
return (a[a_center - 1] + a[a_center... | true |
f7238bca191b1e687fcceacd67a9b9f1b1420068 | Python | makrandp/python-practice | /LeetCode/Solved/Hard/TrappingRainWater.py | UTF-8 | 836 | 3.875 | 4 | [] | no_license | '''
42. Trapping Rain Water
Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
'''
from typing import List
class Solution:
def trap(self, height: List[int]) -> int:
i, j, f = 0, len(he... | true |
4f8ab267786f75c4f6902ec16f957945d58d4d3e | Python | GeneMANIA/pipeline | /builder/update_attribute_descriptions.py | UTF-8 | 1,949 | 3.375 | 3 | [] | no_license |
'''
create a clean description file, containing only descriptions
for those attributes present after cleaning, and with empty descriptions
for any attributes lacking descriptions at all. Add an internal ID column
enumerating the attributes.
'''
import argparse
import pandas as pd
def main(attribute_file, descriptio... | true |
c06c57851a5356c141040cdde915fedca6f5929c | Python | Yonas247/s3659939_s3659090 | /Notification.py | UTF-8 | 2,268 | 3.078125 | 3 | [] | no_license | # Import relevant modules and classes to be used by the program
from DatabaseManager import DatabaseManager
from pushbullet import Pushbullet
class Notification:
"""
This class represents the sending of Notification
"""
def __init__(self,databaseManager = None):
"""
... | true |
b89c12652733526227cc92caaca07abbf1cc8053 | Python | tykkidream/HelloPython | /syntax-lesson/syntax-lesson01/syntax-lesson01-chapter09/dog_demo.py | UTF-8 | 226 | 3.671875 | 4 | [] | no_license | import dog
print("=============================")
my_dog = dog.Dog("willie", 6)
print("My dog's name is " + my_dog.name.title() + ".")
print("My dog is " + str(my_dog.age) + " years old.")
my_dog.sit()
my_dog.roll_over()
| true |
3c6fa822ef6ad3e0a15b65b19ea28c8205145620 | Python | bakunobu/NumPy | /basic_stat_func.py | UTF-8 | 303 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 13:42:50 2019
@author: bakunobu
"""
import numpy as np
def vwap(col_a, col_b):
return np.average(col_a, weights=col_b)
def twap(data):
t = np.arange(len(data))
twap = np.average(data, weights=t)
return twap
| true |
f4b6412a8c3b98d3ea0e1fb03d2705b7783004f0 | Python | NickHMC/LANL_2019_Clinic | /ProcessingAlgorithms/preprocess/fiducials.py | UTF-8 | 19,758 | 3.359375 | 3 | [] | no_license | # coding:utf-8
"""
::
Author: LANL Clinic 2019 --<lanl19@cs.hmc.edu>
Purpose: Look through a dig file for timing fiducials
Created: 11/10/19
"""
import os
import numpy as np
from scipy.optimize import curve_fit
import pandas as pd
from collections import OrderedDict
from ProcessingAlgorithms.preprocess.digfil... | true |
367a576b702d78344439b2f2da0529ba601ff8b8 | Python | idanov/CarND-Behavioral-Cloning-P3 | /sdc/generator.py | UTF-8 | 2,719 | 2.6875 | 3 | [] | no_license | import cv2
import numpy as np
import random
from sdc.processing import rotate_image, shift_image, scale_brightness, crop_image, resize_image, read_image
# Hardcoded params
shift_range = 15
rotation_range = 5
brightness_range = 0.25
adjust_brightness = True
random_flip = True
random_shift = False
random_rotation = Fals... | true |
d1012709a8f10873dfb5b33ba17756d29add07b8 | Python | barnett-yuxiang/ruyi | /test/autotest.py | UTF-8 | 1,516 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# _*_ coding: utf-8 _*_
import time
from uiautomator import Device
d = Device('038dfa3225202ab4')
# d.swipe(860, 170, 370, 160, steps=10)
# d.swipe(400, 1400, 280, 400, steps=10)
def main():
print d.info
for i in range(1):
# 1. Click Icon
time.sleep(20)
d.cli... | true |
fad15d5045f7f65edaf7925c3626be5b253e29fd | Python | hayatoise/sample-flask-login | /application/models/models.py | UTF-8 | 1,041 | 2.5625 | 3 | [] | no_license | from datetime import datetime
from flask_login import UserMixin
from application.database import db
class User(db.Model, UserMixin):
__tablename__ = 'users'
__table_args__ = (
db.UniqueConstraint('name'),
db.UniqueConstraint('email'),
)
id = db.Column(db.Integer, primary_key=True)
... | true |
fdd335b04f69793768dd3b27afed4bc90ce22608 | Python | Chekiria1-zz/kinder_moda | /tutorial/pipelines.py | UTF-8 | 4,399 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
from sqlalchemy.orm import sessionmaker
from tutorial.models import Products,Price, db_connect, create_table
import logging
from time import gmtime, strftime
from scrapy.exceptions import DropItem
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PI... | true |
2478eabdf3ded16c196af6ab5609e1bc5777ebd0 | Python | Ranjana151/python_programming_pratice | /last_first.py | UTF-8 | 140 | 3.96875 | 4 | [] | no_license | color=input("Enter the colors seperated by comma")
color=color.split(",")
print("First color is",color[0],"and last color is",color[-1])
| true |
e8cb3a05e0377f6c6bd0d7ff639d1e25f21bc93d | Python | likhithasai/Natural-Language-Query-System | /pos_tagging.py | UTF-8 | 3,632 | 3.25 | 3 | [] | no_license | # File: pos_tagging.py
# Template file for Informatics 2A Assignment 2:
# 'A Natural Language Query System in Python/NLTK'
# John Longley, November 2012
# Revised November 2013 and November 2014 with help from Nikolay Bogoychev
# Revised November 2015 by Toms Bergmanis
# PART B: POS tagging
from statements import *... | true |
ffb1a55c44b5613f82e0ab0522276bdc3334f6be | Python | saaiiravi/membership_and_affiliate_api | /_api/client_api/api/contact/routes.py | UTF-8 | 1,870 | 2.53125 | 3 | [
"MIT"
] | permissive | """
**Contact Module**
"""
import hmac
from typing import Optional
from flask import Blueprint, request, current_app, jsonify
from config.exceptions import UnAuthenticatedError, error_codes, if_bad_request_raise, InputError
from security.apps_authenticator import handle_apps_authentication, verify_secret_key
conta... | true |
eff93da04e9e12de30ef7e93742b4947d51a7783 | Python | Manjunathsk92/dbanalysis | /dbanalysis/network/read_modelerrors.py | UTF-8 | 1,034 | 2.5625 | 3 | [] | no_license | import json
f = open('modelerrors.log','r')
errors = f.read()
f.close()
errors = errors.split('\n')[:-1]
full_set = set()
data = {}
for error in errors:
item = json.loads(error)
item = item['error']
full_set.add((item[0],item[1]))
if item[0] not in data:
data[item[0]] = {}
if item[1] no... | true |
73253802e5e5ca07cfb4501f6ad356e8b5b0a089 | Python | Theblakley/pyProjects | /Drill#2Final.py | UTF-8 | 387 | 2.953125 | 3 | [] | no_license | import tkinter
from tkinter import *
from tkinter import filedialog
window = Tk()
MyText= StringVar()
def DisplayDir(Var):
feedback = filedialog.askdirectory()
Var.set(feedback)
Button(window, text='Browse', command=DisplayDir(MyText)).pack()
Entry(window, textvariable = MyText).pack()
Butto... | true |
1e390c98f47dc8cf112b2f4ee07a1a5eadc3a438 | Python | chbeae/scriptsThese_ChristineBeaulieu | /Python/AnalyseThermique/differenceT1_T2.py | UTF-8 | 545 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 15:47:27 2018
@author: ChristineB.local
Description:
This script calculates the difference between the mean temperature of all
particles of type 1 and all particles of type 2
"""
import numpy as np
temp1 = temp[boolType1]
temp2 = temp[boolType2]
averageTemp1 = np.... | true |
cd7e90e197f912a9fd67d302d59232bd7980f8d9 | Python | lokeshkumar9600/python_train | /dct1.py | UTF-8 | 162 | 3.1875 | 3 | [] | no_license | me = {"name" : "lokesh" , "age" : 18}
print(me)
print(me["name"] , me["age"])
me["age"]=19
print(me) #updated dict
me.pop("name")
print(me)
me.clear()
print(me)
| true |
61a7047e015edf6ef7fdc54d01bf0d9ba121189a | Python | JanssenProject/jans | /demos/jans-tent/tests/unit_integration/test_protected_content_endpoint.py | UTF-8 | 2,333 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from clientapp import create_app, session
from flask import Flask, url_for
from typing import List
from werkzeug import local
from helper import FlaskBaseTestCase
def app_endpoint(app: Flask) -> List[str]:
""" Return all enpoints in app """
endpoints = []
for item in app.url_map.iter_rules():
end... | true |
d96126a2f4124b541815465bacbe6b6d2bf89129 | Python | rajgupta5/Tensorflow-Specialization | /coursera-imperial-college-london/getting_started_tensorflow2/intro_tf.py | UTF-8 | 1,016 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import tensorflow as tf
tf.__version__
# # Introduction to TensorFlow 2
#
# ## Coding tutorials
# #### [1. Hello TensorFlow!](#coding_tutorial_1)
# ---
# <a id='coding_tutorial_1'></a>
# ## Hello TensorFlow!
# In[ ]:
# Import TensorFlow
import tensorflow as tf
... | true |
695a5fdbe9a00162879fbd2805d11816b467cbe1 | Python | MiaWong/TFSBugCountTool | /common/excelOperateCommon.py | UTF-8 | 2,453 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ------
# @Description :读取Excel数据
# @File : constant.py
# @Date : 2020-05-06
# @Author : MiaWang
# @copyright : Winning HealthCare
# ------
from openpyxl import load_workbook
from common.logger import Logger
class ExcelOperateCommonUtil:
def __... | true |
464febaa24618fc96d9f2be23b824dc14241888d | Python | jainhimani1999/adhocIntern | /problem-10(sender).py | UTF-8 | 644 | 2.875 | 3 | [] | no_license | import socket
recv_ip="127.0.0.1"
recv_port=4534 # 0 - 1024 -- you can check free udp port netstat -nulp
# creating udp socket
# ip type v4 , uDp
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
n=int(raw_input('Press key 1 or 2--->>>'))
if n == 2:
files=str(raw_input("enter the f... | true |
bb75a1d9a6206db24088dd97f36f3e8c509ebf3b | Python | nishikaverma/Python_progs | /Python multithreading progs/multithreading6.py | UTF-8 | 343 | 3.875 | 4 | [] | no_license | # Multithreading by extending thread class:
from threading import *
class MYthread(Thread):
def run(self): # as run is an empty body function inside the class "Thread"
for i in range(10):
print("Ping")
t =MYthread()
t.start() # this line will immediately call the function run()
for i in range(... | true |
15806386144324b7d5ae681420cbac3d674f1578 | Python | everybees/parsel_tongue_mastered | /janet/chapter_seven/question_27.py | UTF-8 | 61 | 2.84375 | 3 | [] | no_license | even = [(number * 2) for number in range(1, 21)]
print(even)
| true |
bb1fae67b2dba23049ce119b5b9b012e10f68db8 | Python | tschibu/hslu-dl4g | /notebooks/trumpSelectionDeepLearning.py | UTF-8 | 4,155 | 2.953125 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
import pandas as pd
import keras
from keras.optimizers import Adadelta
import matplotlib.pyplot as plt
from pathlib import Path
data_train = pd.read_csv('../data/trump/train_rounds_filtered_merged.csv', header=None)
data_test = pd.read_csv('../data/trump/test_rounds_filtered_... | true |
5126728f934333e9b995961b9e3008ed1dd41541 | Python | ravi3222/Live.Google.News | /live_news.py | UTF-8 | 530 | 3.265625 | 3 | [] | no_license | #Google news that keeps updated with the real time news.
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen
def G_news():
url="https://news.google.com/news/rss?ned=in&hl=en-IN"
#open the Given URL
Client=urlopen(url)
xml_page=Client.read()
Client.close()
soup_page=soup(xml_page,"xml")
n... | true |
d65f3c86fd9914a4fda55480f09ff147664d4565 | Python | OpenIxia/ixnetwork_restpy | /ixnetwork_restpy/samples/sessions/linux_sessions.py | UTF-8 | 1,655 | 2.59375 | 3 | [
"MIT"
] | permissive | """ Demonstrates IxNetwork Linux API Server session management
"""
from ixnetwork_restpy.testplatform.testplatform import TestPlatform
# setup the connection information for a windows gui test platform that has a default session of 1
# platform='linux' forces the scheme to https
# if the default platform='windows' i... | true |
18578446bb949b1b6b8baa0c3a4e9e566d8c1f60 | Python | Wu22e/JUNGLE_DS_ALGO | /ALGORITHM STUDY/2. 트라이/S3[14425] 문자열 집합.py | UTF-8 | 1,243 | 3.84375 | 4 | [] | no_license | import sys
input = sys.stdin.readline
class Node(object):
def __init__(self, key, count = 0):
self.key = key # 해당 문자를 key값으로 가진다.
self.child = {} # 자식들을 Dict에 저장을 한다.
class Trie(object):
def __init__(self):
self.head = Node(None) # 처음 Trie가 만들어지면 빈 Node 하나를 head로 만들어 놓는다.
def ins... | true |
dd26c057c8aa87ab4fdfd5e2ef6ba90e486054ea | Python | Carbonautics/misc-projects | /random_python/python.py | UTF-8 | 947 | 4.59375 | 5 | [] | no_license | # expand in both directions of low and high to find all palindromes
def expand(str, low, high, s):
# run till str[low.high] is a palindrome
while low >= 0 and high < len(str) and str[low] == str[high]:
# push all palindromes into the set
s.add(str[low: high + 1])
# expand in both directions
low = low - 1
... | true |