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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4e8ec638f7c903f77d0d4518b1dcfdd06bde1406 | Python | shimakaze-git/python-ddd | /python-onion-architecture-sample/usecase/user_usecase.py | UTF-8 | 1,328 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from domain.model.user_model import User
from domain.repository.user_repository import IFUserRepository
# UserUseCase interfase
class IFUserUseCase(metaclass=ABCMeta):
@abstractmethod
def get_users(self):
pass
@... | true |
2eb8eca33546feb2d88edb2525cc1c28c6f0baae | Python | mayosmjs/web-scraping-with-scrapy- | /scrapy-pagination.py | UTF-8 | 933 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
class WholepageSpider(scrapy.Spider):
name = 'wholepage'
allowed_domains = ['quotes.toscrape.com']
start_urls = ['http://quotes.toscrape.com/']
def parse(self, response):
quotes_container = response.css('div.quote')
for quote in ... | true |
6b1ffb0eb932adaaf88939ba83d637e913fbdd39 | Python | AlexLemna/learns | /Python/math/sphericalcoord.py | UTF-8 | 952 | 3.546875 | 4 | [
"Unlicense"
] | permissive | from dataclasses import dataclass
@dataclass
class Location_SphericalCoordinates:
"""A representation of location in the spherical coordinates system."""
ρ: float # rho - radial distance ('upwardness' from center of planet) - must be >= 0
θel: float # theta - polar angle ('northing' from the equator) - ... | true |
bdd75c794195827a6653014a7b4bfca335aa4196 | Python | themohitpapneja/OSINT-Tool | /scrapper.py | UTF-8 | 639 | 2.828125 | 3 | [] | no_license | import pyfiglet
import twitter as ta
class Scrapper:
def view():
ascii_banner = pyfiglet.figlet_format("Scrapper - An OSINT Tool")
print(ascii_banner)
print("\n Enter 1: For Instagram Scrapper >>>>>>>>\n")
print("\n Enter 2: For Twitter Scrapper >>>>>>>>\n")
i = i... | true |
548fcb31644c6be9dd7aeabb73dd01dea216cd33 | Python | seanmacb/COMP-115-Exercises | /smacbrideP5.py | UTF-8 | 7,711 | 3.78125 | 4 | [
"MIT"
] | permissive | # Sean MacBride
# Program: smacbrideP5.py
# Description: A program that simulates a european roulette table at a casino, where you can bet in 5$ increments.
# Input: Your starting bankroll, the amount you are willing to bet for bet 1, where you would like to bet for bet 1 (Must be a number 0-36 for numbers, R or B for ... | true |
d691360aaf25b7eca2514ba990ae66fc180bd171 | Python | kondrashov-do/hackerrank | /python/Sets/set_add.py | UTF-8 | 122 | 3.171875 | 3 | [] | no_license | stamps_amount = int(input())
stamps = []
for i in range(stamps_amount):
stamps.append(input())
print(len(set(stamps))) | true |
4fae0ec1d40cd35afe470c71ed3f52b088e2de7a | Python | omkarlenka/ctci_solutions | /ctci_1.5_one_way.py | UTF-8 | 1,381 | 3.5 | 4 | [] | no_license | def isOneEditAway(s1, s2):
'''
Allowed Edits: Replace,Remove,Insert
'''
if len(s1) == len(s2):
i =0
count = 0
while i < len(s1):
if s1[i] != s2[i]:
count+=1
if count > 1:
return False
i+=1
... | true |
d21c53f74a800f355d16bceea9b59bbc8b0a462a | Python | njesp/docker-stuff | /az_docker_app_gen3/app/app.py | UTF-8 | 1,235 | 2.640625 | 3 | [] | no_license | """
Docstring
"""
import psycopg2
from flask import Flask, request
APP = Flask(__name__)
@APP.route("/")
def hello():
"""
Docstring
"""
sql_insert = """
insert into visits(user_agent) values (%(user_agent)s)
"""
sql_query = """
select
v.time_of_v... | true |
5c9a6e83a2fd3e6df1eb62d3268852ccf23965bd | Python | kpiesk/hyperskill-to-do-list | /To-Do List/to_do_list.py | UTF-8 | 4,031 | 3.28125 | 3 | [] | no_license | from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Date
from datetime import datetime, timedelta
from sqlalchemy.orm import sessionmaker
today = datetime.today()
engine = create_engine('sqlite:///todo.db?check_same_thread=False... | true |
37e7e9b274077a032534135672a6576c29536469 | Python | cphenicie/si-photonics | /phot1x/Python_edX_Phot1x/Week 1 Introduction/Software_Installation_Python.py | UTF-8 | 484 | 3.9375 | 4 | [] | no_license | # Python 2.7 script
# by Lukas Chrostowski in Matlab, 2015
# by Huixu (Chandler) Deng in Python, 2017
from __future__ import print_function
# make 'print' compatible in Python 2X and 3X
import matplotlib.pyplot as plt
import numpy
a = 1
b = 2
c = a + b
print ('a=', a)
print ('b=', b)
print ('c=', c)
# Practice fig... | true |
9fbe6b67956427697f7d5742ab57377c1d169ee5 | Python | Paulo-Jorge-PM/ontology-assembler-majorminors | /lists/month.py | UTF-8 | 186 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
data = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]
| true |
79adc6d6baeff74c30baca0286274a2edcc59f6e | Python | AnnaLukina/ViennaBall | /sketches/sketch_181205b/staircase.py | UTF-8 | 915 | 3.15625 | 3 | [] | no_license | # Class for each step
class Staircase:
def __init__(self, img_H, numSteps):
self.x = -img_H / 2
self.y = 0
self.filla = 0
self.fillb = 0
self.fillc = 0
self.num = numSteps
self.stepH = img_H / self.num
def update(self):
#roll down the... | true |
e94cf7c90f02820b6d5ec81e726812ed58efa588 | Python | petereast/COMP1-2015 | /no_longer_skeleton_program.py | UTF-8 | 37,918 | 3.09375 | 3 | [] | no_license | # Skeleton Program code for the AQA COMP1 Summer 2015 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA COMP1 Programmer Team
# developed in the Python 3.4 programming environment, exceptionally poorly
import pickle, os
from datetime import date, timedelta
... | true |
1605465e8e3b84448f2c386ba48c095da27383a4 | Python | davidrodriguezm/HLC | /prueba_py/ejercicio_12.py | UTF-8 | 667 | 2.921875 | 3 | [] | no_license | from objetos.Persona import Persona
from objetos.Surfista import Surfista
from objetos.Agente_secreto import Agente_secreto
from objetos.Arma import Arma
pistolita = Arma('pistola', 'LG800')
as1 = Agente_secreto("Ambrosio",203,"12345123",'verde','009')
as1.armamento = 'banana'
as1.armamento = pistolita
print(as1.armam... | true |
a8681a67a35b4b7716f1f9174826ab01b7dac8b3 | Python | pehlivanian/RVAE | /hiddenlayer.py | UTF-8 | 3,004 | 3.234375 | 3 | [] | no_license | """
Standard hidden layer
.. math::
f(x) = G( b^{(2)} + W^{(2)}( s( b^{(1)} + W^{(1)} x))),
References:
- textbooks: "Pattern Recognition and Machine Learning" -
Christopher M. Bishop, section 5
"""
from __future__ import print_function
__docformat__ = 'restructedtext en'
import os
imp... | true |
2f730c1eca5c8165d6f2fa315f7974d0064657dd | Python | liama482/Final-Project | /Final.py | UTF-8 | 9,757 | 2.625 | 3 | [
"MIT"
] | permissive | """
by Liam A.
used: http://www.december.com/html/spec/color,
http://orig14.deviantart.net/7b77/f/2013/203/5/5/cartoon_boy_by_navdbest-d6ekjw9.png
http://cartoon-birds.clipartonline.net/_/rsrc/1472868952735/blue-birds-cartoon-bird-images/blue_bird_clipart_image_9.png?height=320&width=320
"""
from ggame import App, Co... | true |
4b647540e1086f55608dfa5b5ca9124401ed1c9e | Python | BrainsOnBoard/alife_outdoor_navigation_paper | /scripts/plot_difference_images.py | UTF-8 | 2,779 | 2.640625 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.colors import ListedColormap
from os import path
from sys import argv
import plot_utils
def plot_diff(diff, cmap, filename, subtitle):
fig, axis = plt.subplots(figsize=(plot_utils.column_width, (plot_utils.column_... | true |
72117a916d599fefe2c21a502cd5a0aa88334e09 | Python | BurnFaithful/KW | /Programming_Practice/Python/MachineLearning/Keras/keras17_minmax.py | UTF-8 | 2,081 | 3.28125 | 3 | [] | no_license | # LSTM(Long Short Term Memory) : 연속적인 data. 시(Time)계열.
# MinMaxScaler = X - Xmin / Xmax - Xmin
from numpy import array
from keras.models import Sequential
from keras.layers import Dense, LSTM
#1. 데이터
x = array([[1, 2, 3], [2, 3, 4], [3, 4, 5], [4, 5, 6], [5, 6, 7],
[6, 7, 8], [7, 8, 9], [8, 9, 10], [9, 10... | true |
0499372eef58d84bd3b89e90df3dd81c70ec10b5 | Python | CEckelberry/Python-Intro | /list_deduplication.py | UTF-8 | 493 | 4.0625 | 4 | [] | no_license | def remove_duplicates(entry_list):
"""
This function will add any unique elements in a list (no repeating members) and store them in a new list.
:param Entry_list lists of any size with strings or numbers:
:return: Deduplicated list
"""
comparison_list = []
for x in entry_list:
if x ... | true |
23f844773bf969953754aa0b7a3490ecf12369de | Python | arbuzov751/STC_toloka_project | /face_detector.py | UTF-8 | 804 | 2.765625 | 3 | [] | no_license | import cv2
from tqdm import tqdm
def videoStreamer(path, skip=None):
# Загружаем видео.
stream = cv2.VideoCapture(path)
frames = int(stream.get(cv2.CAP_PROP_FRAME_COUNT))
FPS = stream.get(cv2.CAP_PROP_FPS)
print(f"frames = {frames}, FPS = {FPS}")
if skip == None:
skip = int(FPS/2)
... | true |
7f38ce64941f5ecb8d5279c0d160844e24f95f01 | Python | wtjerry/hslu_pren | /controlling/TiltController.py | UTF-8 | 796 | 3.1875 | 3 | [
"MIT"
] | permissive | from time import sleep
from math import floor
from random import random
class TiltController:
def __init__(self, pos, tilt_engine):
self._lookup_table = []
self._position = pos
self._should_balance = True
self._tile_engine = tilt_engine
def start(self):
self.get_lookup_... | true |
2c812cb250526e1bb045a191b28b58dfabb48cdf | Python | Sohanpatnaik106/Color-Detector | /colour_predictor.py | UTF-8 | 10,047 | 3.171875 | 3 | [] | no_license | ''' Here we are going to find the bounding boxes around the
objects and then use K-means clustering to predict the
prominent colours inside the bounding box '''
# Import the required libraries
import numpy as np
from numpy import expand_dims
from keras.models import load_model
from keras.preproc... | true |
f38e3a4c18062c5c8fd5f2b7087a9dfefe995530 | Python | hunye/Groove | /tests/test_collapsing_scroll_view.py | UTF-8 | 2,644 | 2.609375 | 3 | [] | no_license | # coding:utf-8
import sys
import json
from components.scroll_area import ScrollArea
from View.playlist_interface.playlist_info_bar import PlaylistInfoBar
from PyQt5.QtCore import Qt, pyqtSignal, QSize
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QWidget, QListWidget, QListWidgetItem, QVBoxLayout, QAppli... | true |
6ffbb32d437308d6161356d96d1ab02ad811d661 | Python | mloud/Numbers | /Python/ConvertLevels.py | UTF-8 | 1,728 | 2.65625 | 3 | [] | no_license | from shlex import shlex
__author__ = 'mloud.seznam.cz'
import xlrd
import sys
import json
inputFile = sys.argv[1];
outputFileLevels = sys.argv[2];
outputFileAbilities = sys.argv[3];
print("Running xls->json export on " + inputFile + "->" + outputFileLevels)
book = xlrd.open_workbook(inputFile)
#levels
sh = book.s... | true |
08e078c78495f836b56fd88fe9a62dcafc038cd9 | Python | shiontao/MedVision | /medvision/aug_cuda/viewer.py | UTF-8 | 8,887 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import os
import time
import numpy as np
from PIL import Image
import cv2
import torch
from matplotlib.colors import Normalize
import random
from imageio import mimsave
from .base import CudaAugBase
from ..visulaize import getSeg2D, getBBox2D
def ResizeWithAspectRatio(image, width=None, height=None, inter=cv2.INTER_... | true |
5dd80d82027b48e4434baedbb7775f14b376bf9f | Python | MelvinYin/protein_family_classifier | /src/converters.py | UTF-8 | 9,141 | 2.8125 | 3 | [] | no_license | from collections import OrderedDict
import os
import re
# meme to minimal
def _parse_meme(fname):
composition = ""
pssms = []
in_composition = False
current_pssm = []
with open(fname, 'r') as file:
for line in file:
if not in_composition \
and line.startswith("Le... | true |
b51da2fa2857023d0c2b9277963e8b285459af1e | Python | Yuta123456/AtCoder | /python/第6回 ドワンゴからの挑戦状 予選/A.py | UTF-8 | 247 | 2.875 | 3 | [] | no_license | n = int(input())
data = []
for i in range(n):
s, t = input().split()
data.append([s, int(t)])
x = input()
ans = 0
flag = False
for i in range(n):
if flag:
ans += data[i][1]
if x == data[i][0]:
flag = True
print(ans) | true |
d6f312a30f357441ecf916dd35765e2a30440d68 | Python | rituraj-m/webscrape | /webscrape.py | UTF-8 | 898 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 22 11:51:33 2019
@author: Rituraj
"""
import pandas as pd
import requests
import numpy as np
from bs4 import BeautifulSoup
import pickle
res = requests.get("http://www.estesparkweather.net/archive_reports.php?date=200901")
soup = BeautifulSoup(res.content,'lxml')
table ... | true |
78616db3e051c43984392625005222bc997e068c | Python | ehdgua01/Algorithms | /coding_test/codility/perm_missing_elem/solution.py | UTF-8 | 174 | 2.5625 | 3 | [] | no_license | from typing import List
def solution(A: List[int]) -> int:
if len(A) == 0:
return 1
A = set(A)
return list(set(range(1, len(A) + 2)).difference(A))[0]
| true |
290c6f929f390b1cbdad6e98c8c6f0b5ce7ec36d | Python | msorins/UBB-Y2S2 | /AI/LAB2 - Optimize Function/Problem.py | UTF-8 | 706 | 3.390625 | 3 | [] | no_license | # https://www.tutorialspoint.com/genetic_algorithms
from Population import Population
class Problem:
paramsPath = ""
params = {}
population = None
def __init__(self, paramsPath):
self.paramsPath = paramsPath
self.loadParams()
self.initialisePopulation()
def loadParams(se... | true |
6a240ba74533be7302addbcb577e785e6cac3484 | Python | minttu/tito.py | /tito/vm/vm.py | UTF-8 | 8,391 | 2.53125 | 3 | [] | no_license | from pprint import pprint
from tito.compiler.binary_command import BinaryCommand
from tito.data.commands import reverse_commands
class Halt(Exception):
def __init__(self):
super(Halt, self).__init__()
class VM(object):
def __init__(self):
self.memory = []
self.commands = []
... | true |
fb76ad1a9725b86f3db588b013065700a7d00b50 | Python | ShieLian/BookList | /db.py | UTF-8 | 2,443 | 2.6875 | 3 | [] | no_license | #coding=UTF-8
import json
import os
class DB:
def __init__(self,filepath,readonly=False):
if(os.path.exists(filepath)):
with open(filepath,'r') as f:
self._dict=(json.load(f))
f.close()
else:
self._dict={}
with open(filepath,'w') as f:
... | true |
a222b92f8b70c9a2dc348c01f808e6dd801435c2 | Python | gabo-cs-zz/Python-Exercism | /hamming/hamming.py | UTF-8 | 216 | 3.6875 | 4 | [] | no_license | def distance(strand_a, strand_b):
if len(strand_a) != len(strand_b):
raise ValueError('Both strands must be of equal length.')
return sum(strand_a[i] != strand_b[i] for i in range(0, len(strand_a)))
| true |
5b4929717a68d436873b1b376dbdfe7f546753ec | Python | EXJUSTICE/Neural-Network-Style-Transfer | /styletransfer.py | UTF-8 | 7,101 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 19 14:17:57 2018
Neural Style transfer code for DeepDream based style transfer
Note that in this exercise, we use L2 regularization instead of weight regularization
We define loss not in matching to a label, but by three subcomponents.
Before, loss was defined as things s... | true |
7eded3fe016642338e63743bf8a334e3c8aa20b1 | Python | srajsonu/InterviewBit-Solution-Python | /Trees/Tree II/right_view.py | UTF-8 | 1,084 | 3.0625 | 3 | [] | no_license | from collections import defaultdict,deque
class Node:
def __init__(self,x):
self.val=x
self.left=None
self.right=None
class Solution:
def __init__(self):
self.ans=defaultdict(deque)
def right_view(self,A,level):
if not A:
return
self.ans[level].a... | true |
452425e46efb1d114f1aab14afa945f227d5ae8f | Python | Lambda-Journey/cs-module-project-hash-tables | /applications/no_dups/no_dups.py | UTF-8 | 409 | 3.234375 | 3 | [] | no_license | def no_dups(s):
# Your code here
word_list = []
s = s.split()
[word_list.append(word) for word in s if word not in word_list]
return " ".join(word_list)
if __name__ == "__main__":
print(no_dups(""))
print(no_dups("hello"))
print(no_dups("hello hello"))
print(no_dups("cats dogs fis... | true |
4de0a860942cbe0a1eb5610f5c174da070c4d525 | Python | varshajayaraman/SheCodesInPython | /src/M1208_GetEqualSubstringsWithinBudget.py | UTF-8 | 388 | 3.125 | 3 | [] | no_license | class Solution:
def equalSubstring(self, s: str, t: str, maxCost: int) -> int:
tot = 0
maxLen = 0
st = 0
for i in range(len(s)):
tot += abs(ord(s[i]) - ord(t[i]))
while tot > maxCost:
tot -= abs(ord(s[st]) - ord(t[st]))
st += ... | true |
b6b8636293816eb53c576ea88f4a38e938bdb1b6 | Python | dockerizeme/dockerizeme | /hard-gists/8321212/snippet.py | UTF-8 | 1,785 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import os
from django.core.files.uploadedfile import InMemoryUploadedFile, TemporaryUploadedFile
from PIL import Image
from PIL.ExifTags import TAGS
from cStringIO import StringIO
def orientation_rotation(im):
#take pil Image insctance and if need rotate it
orientation = None
try:
exifdict = im._g... | true |
ddb1a508ea6cf486969569d974e0548a1c11f6c1 | Python | Aasthaengg/IBMdataset | /Python_codes/p03209/s910153142.py | UTF-8 | 392 | 2.59375 | 3 | [] | no_license | N,X=map(int,input().split())
P=[1]
A=[1]
for i in range(N):
P.append(1+2*P[i])
A.append(3+2*A[i])
def f(n,x):
if n==0:
return 1
else:
if x==1:
return 0
if 1<x<2+A[n-1]:
return f(n-1,x-1)
if x==2+A[n-1]:
return 1+P[n-1]
if 2+A[n-1]<x<3+2*A[n-1]:
return 1+P[n-1]+f(n-1,x... | true |
9beae229728730d3b3ba73ef25cc558f8b8e90d0 | Python | JeffersonYepes/Python | /Challenges/Desafio006.py | UTF-8 | 215 | 4.15625 | 4 | [
"MIT"
] | permissive | n = float(input('Type a value: '))
print('The Double of {} is {}!'.format(n, n*2))
print('The Triple of {} is {}!'.format(n, n*3))
#pow or n**(1/2)
print('The Square Root of {} is {:.2f}!'.format(n, pow(n, (1/2))))
| true |
9ee388cfd71f7d40c97a6fbfa582212a65693dce | Python | alyildiz/covid_19_xray | /web_app/utils.py | UTF-8 | 2,483 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import streamlit as st
import torch
from PIL import Image
from src.utils import transform_inference
DEMO_IMAGE = "/workdir/web_app/sample_from_test/normal.jpeg"
def setup_parameters():
st.title("XRay classification using ResNet152")
st.markdown(
"""
<style>
[data-t... | true |
20d0d988f32b5f3cf1f586ca4a93040d90605b0f | Python | mdharani86/Grad | /Cloud/GradProj/lambdaCode_sentimeter.py | UTF-8 | 6,779 | 3.125 | 3 | [] | no_license | import json
import boto3
# input files used:
# 's3://dharu-database/sentimeter/supported_cd.csv' --> list of supported language code for sentiment analysis
# 's3://dharu-database/sentimeter/cd_lang.csv' --> list of language code and respective language
# output file: 's3://dharu-output-bucket/gradproj/output.txt'
... | true |
0b9a3ad3226d8ad8b51932c46a5212da4dee84a2 | Python | Illugi317/forritun | /mimir/assignment2/4.py | UTF-8 | 527 | 4.46875 | 4 | [] | no_license | '''
Accept d1 and d2, the number on two dice as input.
First, check to see that they are in the proper range for dice (1-6).
If not, print the message "Invalid input".
If d1 and d2 have the same value, print out "Pair".
Otherwise print the sum.
'''
d1 = int(input("Input first dice: ")) # Do not change this lin... | true |
4c5888d1508d852d3809c1e08804bab37031a5a7 | Python | polarisguo/2019GWCTF | /wp/crypto/aes/Dockerfile/task.py | UTF-8 | 4,020 | 2.890625 | 3 | [] | no_license | # -*- coding:utf8 -*-
import SocketServer
import os
import random
import signal
import base64
from string import hexdigits
from hashlib import md5
from Crypto.Cipher import AES
from secret import flag, key
BS = 16
def pad(s):
return s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
def unpad(s):
pad = s[-1]
... | true |
40c1c6e6c72e946e7c2adf23dcd8186b8fcf32bf | Python | Anjali-M-A/Code | /Code_16funct.py | UTF-8 | 2,100 | 4.8125 | 5 | [] | no_license | # Script to demonstrate Function types with arguments and without arguments
print("Functions with arguments")
# Default Argument
"""
** We can provide a default value to an argument by using the assignment operator (=).
"""
def Func(a=3, b=2):
print(a+b)
Func() #calling without arguments
# b value... | true |
d9f07209fd991396b38473f471ec0669de54b7df | Python | how2945ard/Homework-and-Projects | /Implementation_of_Embedded_Operating_Systems/Final_Project__Raspberry_pi_2_Image_Analyze/video.py | UTF-8 | 2,050 | 2.765625 | 3 | [] | no_license | # import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import sys
import numpy as np
from matplotlib import pyplot as plt
center = (36,14)
width = 10
radious = width / 2
def color(img):
line_img = img[center[1]][center[0]-radious:center[0]+radio... | true |
5a224a408f7b7a36e4b148e18931937ed7d8cde8 | Python | BenPalmer1983/isotopes | /testing/at216b.py | UTF-8 | 2,482 | 2.984375 | 3 | [] | no_license | import numpy
def activity(t, l, b, w, n0):
nt = numpy.zeros((len(n0),),)
for m in range(0,len(n0)):
if(l[m] > 0.0):
nt[m] = activity_unstable(t, l, b, w, n0, m)
elif(l[m] == 0.0):
nt[m] = activity_stable(t, l, b, w, n0, m)
return nt
def activity_unstable(t, l, b, w, n0, m):
s = 0.0
for... | true |
667dfaeb9d35b6eb9a18ad1b548118483c66cba2 | Python | abhinavhinger12/ala | /canny.py | UTF-8 | 364 | 2.515625 | 3 | [] | no_license | import cv2
import numpy as numpy
from matplotlib import pyplot as plt
img = cv2.imread("test2-tone-enhance.jpg",0)
edges = cv2.Canny(img,100,200)
plt.subplot(121),plt.imshow(img,cmap="gray")
plt.title('OriginalImage'),plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap="gray")
plt.title('Edge Image... | true |
0e2eda362fca6780c9878fe9e3d50077a6b1f972 | Python | DmitriuSsS/Time-Server | /server.py | UTF-8 | 1,093 | 2.71875 | 3 | [] | no_license | import socket
import time
import configparser
class Server:
def __init__(self, settings='settings.ini'):
self.time_mistake = Server._get_time_mistake(settings)
self.ip = 'localhost'
self.port = 123
self._count_read = 1024
self._time_out = 0.1
@staticmethod
def _get... | true |
5e16a6598e98023cf2bb11c9fc6e778410719021 | Python | Moomay/devasc-study-team | /myLocation.py | UTF-8 | 544 | 3.890625 | 4 | [] | no_license | class Location:
def __init__(self, name, country):
self.name = name
self.country = country
def myLocation(self):
print("Hi, my name is " + self.name + " and I live in " + self.country + ".")
loc = Location("Your_Name", "Your_Country")
loc1 = Location("Tomas", "Portugal")
loc2 = Location... | true |
f95533a9e27fb82ea17293fc977d6d5a2255a442 | Python | ACM-Indiana-University-South-Bend/Python3tutorial | /firstGraph.py | UTF-8 | 1,121 | 3.265625 | 3 | [] | no_license | #uses csvjson.com to convert csv file into json from
#data source
#tested on Windows 10, Python 3.8
import matplotlib.pyplot as plt
import json, operator
data = []
with open('csvjson.json', 'r') as f:
data = json.load(f)
classifications = {}
totalEntries = 0
for entry in data:
classCode = en... | true |
a2fe4e0b62c92a325d1be717759e10f480663b65 | Python | aritra2494/assignment | /sqlite.py | UTF-8 | 488 | 3.0625 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect(#server name with user and password)
c=conn.cursor()
def create_table():
c.execute("CREATE TABLE mydata(Name varchar(255), Email varchar(255), phoneNo int, Skills varchar(455)")
def data_entry():
c.execute("INSERT INTO mydata VALUES('Aritra Dutta','dutta94aritra2... | true |
d2ae6de8d989488f62f72cbc9219edaabe615801 | Python | alhulaymi/cse491-drinkz | /drinkz/recipes.py | UTF-8 | 3,293 | 3.28125 | 3 | [] | no_license | import db
class Recipe(object):
def __init__(self,n = "",i = []):
self.name = n;
self.ingredients = i
def need_ingredients(self):
# the list we're hoping to return
missing = []
found = False
# go through the ingredients
for ... | true |
392100a5bc101c26bd515a0b80af113f2bc5794b | Python | romanandre/datalogger | /live/show-live.py | UTF-8 | 1,003 | 2.765625 | 3 | [] | no_license | import serial, time, string, thread
import numpy as np
import matplotlib
matplotlib.use('GTKAgg') # do this before importing pylab
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ser = serial.Serial("/dev/ttyUSB0", 57600, timeout=1)
x = np.arange(0, 100, 1)
y = np.arange(0, 100, 1)
gy ... | true |
901f7c4c22d2dcb5c46d1dcfd2538d31eb82ebea | Python | larrymyers/python-utils | /localcdn.py | UTF-8 | 9,813 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
# Local CDN
Copyright (c) 2011 Larry Myers <larry@larrymyers.com>
Licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php)
## Usage
This script dynamically combines js and css assets, and provides a webserver for live dev mode
development. For static builds it c... | true |
0fbbf81a8a2f407fcc6277c3fd5653a25294bf31 | Python | shanacheng/pv-dashboard | /dashboard.py | UTF-8 | 9,467 | 2.703125 | 3 | [] | no_license | import dash
from dash import dcc
from dash import html
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import matplotlib.pyplot as mat
from dash.dependencies import Input, Output
df = pd.read_csv('./datasets/lab2.csv')
df3 = pd.read_csv('./datasets/lab3.csv')
mapp = px.choropleth(dat... | true |
f1dd182118d9d0bb5d7b3f9af9e61733bdfe1324 | Python | polinaalex1602/time_zone_python | /test_app.py | UTF-8 | 2,116 | 2.765625 | 3 | [] | no_license | import unittest
import request
from app import timezones_app
from wsgiref.simple_server import WSGIServer, WSGIRequestHandler
import threading
from datetime import datetime
from pytz import timezone
class TimezoneTest(unittest.TestCase):
def setUp(self):
self.port = 8000
self.url = 'lo... | true |
fb47cbae58a372e88dd4ae8a71590550e4acd4c4 | Python | mikegagnon/battle-pets-arena | /test.py | UTF-8 | 2,091 | 2.515625 | 3 | [
"MIT"
] | permissive | # pip install requests
import os
import requests
from time import sleep
CONTEST_SERVICE_API_TOKEN = os.environ['CONTEST_SERVICE_API_TOKEN']
def createContest(
contestType,
petId1 = "2251ef5c-4abb-4f97-943e-0dc8738b5844",
petId2 = "1d4d557b-2470-40cb-b2e4-1bc138914464"):
r = requests.post(... | true |
02a8cb6ad658830ba2d9395bb7c2954df4bfd2cf | Python | bonoron/Atcoder | /ABC004C.py | UTF-8 | 244 | 3.265625 | 3 | [] | no_license | from collections import deque
n=int(input())
num,mod=(n//5)%6,n%5
N=["1","2","3","4","5","6"]
N=deque(N)
for i in range(num):
N.append(N.popleft())
for i in range(mod):
N[i%5],N[i%5+1]=N[i%5+1],N[i%5]
print("".join(N))
print() | true |
557c5a564780fa20cb93d0065bad623f2f6e56a6 | Python | Jmizraji/PythonFiles | /lightswitchgui.py | UTF-8 | 676 | 3.296875 | 3 | [] | no_license | from Tkinter import *
class Application(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
self.bttn = Button(self, text = "Light is: OFF", command = self.update_button)
self.bttn.grid()
de... | true |
2109a7514e23dfb0f59093fd404e07d293770222 | Python | b4fun/snippet | /flyio_kube_db/app.py | UTF-8 | 2,675 | 2.75 | 3 | [
"CC-BY-3.0",
"CC-BY-4.0"
] | permissive | import dataclasses
import dns.resolver
import logging
import os
import psycopg2
import time
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('flyio_kube_db')
logger.setLevel(logging.INFO)
@dataclasses.dataclass
class Config:
"""Config specifies the ap... | true |
06c0e18b2e4b4327465f6c4d7e8f3594cde06fc2 | Python | this0702/data | /practice_oop/Ex_run.py | UTF-8 | 378 | 3.0625 | 3 | [] | no_license | def fn(self,value):
print('hello',value)
Hello=type('Hello',(object,),dict(hello=fn))#类名、tuple父类列表、dict是挂上去的函数
h=Hello()
h.hello('python')#动态时直接可以用
class he2(Hello):
def __call__(self, *args, **kwargs):
return print(super(he2, self).hello('lisa'))
h2=he2()
h2()
Hello.new_attribute = 'foo'
print(Hello.ne... | true |
f4c31070a432f1b8bfa91e173cbe9ebc3406f18d | Python | veritas919/Flask-ML-web-app | /database/types.py | UTF-8 | 7,564 | 2.890625 | 3 | [] | no_license | from sqlalchemy import Column, Integer, String, ForeignKey, Date, Text, Float, func
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, relationship
from .driver import get_session
from typing import List, Dict
Base = declarative_base()
"""
WORTH NOTING THAT I WOULD REALLY PREF... | true |
f4b3a332dde490353286c71ca964c6354e046fe5 | Python | amnh-digital/hope-climate-ia | /system-ocean-atmosphere/scripts/generateGradient.py | UTF-8 | 1,794 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# python generateGradient.py -grad "#0087ff,#00caab,#cdb300,#ff9d00,#fc0000" -out "../data/colorGradientRainbowSaturated.json"
# python generateGradient.py -grad "#42a6ff,#5994af,#9e944f,#c17700,#fc0000" -out "../data/colorGradientRainbow.json"
# python generateGradient.py -grad "#8196cc,#fffff... | true |
aa5ad658c8ebe512d7f35b4302a76bc3789db2bf | Python | ayurjev/z9img | /models.py | UTF-8 | 2,093 | 3.453125 | 3 | [] | no_license | """ Модели """
from io import BytesIO
from PIL import Image
class ImageProcessor(object):
""" Класс для работы с изображениями """
def __init__(self, image_bytes: BytesIO):
self.image_bytes = image_bytes
def scale(self, size: int) -> BytesIO:
""" Метод для изменение размера изображения
... | true |
1cd4c4416f0a3a6e0c70d218f65f644d3aa69fb8 | Python | RubenMkrtchyan30/lesson | /tuple.py | UTF-8 | 1,381 | 3.703125 | 4 | [] | no_license | # num1 = float(input('your number '))
# num2 = float(input('your number '))
# gorcoxutyun = input('(+,-,*,/,%)')
# if gorcoxutyun == "+":
# print(num1 + num2)
# elif gorcoxutyun == "-":
# print(num1 - num2)
# elif gorcoxutyun == "/":
# print(num1 / num2)
# elif gorcoxutyun == "*":
# print(num1 * num2)
# elif gorc... | true |
f824db2db7ebad9f71e7d420a05e6ea1ba15193d | Python | kernowal/projecteuler | /32.py | UTF-8 | 807 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: alexogilvie
Project Euler Problem 32: Pandigital products
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
"""
import time
from math import sqrt
def compute():
timer = time.time()
... | true |
5ace31bad39220fd0fbc41394d807c6398657c81 | Python | Jappy0/GGP-TF2 | /graph_kernel.py | UTF-8 | 6,154 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import gpflow
from gpflow import Parameter
from gpflow.inducing_variables.inducing_variables import InducingPointsBase
from gpflow import covariances as cov
import tensorflow as tf
from utils import sparse_mat_to_sparse_tensor, get_submatrix
class GraphPolynomial(gpflow.kernels.base.Kernel):
"... | true |
5561e810afab81c849040bdbfc213113acaeefcc | Python | joaobarbirato/Trabalhos-Grafos | /grafos-problema-1/src/matrix.py | UTF-8 | 876 | 2.78125 | 3 | [] | no_license | import numpy as np
def getSTM(G):
# save the adjency matrix
# init probability matrix (pmatrix)
# init adjacency matrix (amatrix)
# init result matrix (state transition matrix - stmatrix)
amatrix = np.array([[0. for i in range(G.number_of_nodes())] for j in range(G.number_of_nodes())])
lmatrix... | true |
098c4edbf5364c3ba52fcc569069fc564e86325b | Python | taitc012/IMU_Event | /compass_correction.py | UTF-8 | 2,052 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import sys, os, math, time, thread, smbus, random, requests
#import Adafruit_BMP.BMP085 as BMP085
import Queue
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
power_mgmt_1 = 0x6b
power_mgmt_2 = 0x6c
bus = smbus.SMBus(1)
addrMPU = 0x68
addrHMC = 0x1e
def init_imu():
# No... | true |
3d3024b362dfd1ac97557e4e1f013ca333f72456 | Python | benjdelt/indexer | /indexer.py | UTF-8 | 8,865 | 3.609375 | 4 | [] | no_license | """ Creates an index of all the files contained in the path's folder and subfolders.
The module creates an list of dicts representing all the files in the folder and subfolders
of the path provided. That index can then be filtered and dumped in a csv file.
Typical usage:
index = Indexer("../")
index.create_index(min... | true |
646d243b427547e74439917b671cf34efb88b6c2 | Python | subbuwork/SeleniumWithPython1 | /Tests/test_demo.py | UTF-8 | 582 | 2.9375 | 3 | [] | no_license | from selenium import webdriver
def test_demo1():
browser = webdriver.Chrome()
browser.get("https://www.google.com")
print "Current url::", browser.current_url
print "Title::", browser.title
browser.get("https://www.facebook.com")
print "Current url::", browser.current_url
print "Title::",... | true |
33be6a0f08978e5e1da906ee55441ee7170e060e | Python | nadeeraka/algov3 | /algov3/bin/s1/maxChar/1.py | UTF-8 | 381 | 3.703125 | 4 | [] | no_license | s = 'abcccc'
def maxChar(str):
myObj = dict()
val = 0
arr = list(str)
for i in arr:
if i in myObj:
myObj[i] += 1
else:
myObj[i] = 1
for i in myObj:
if val < myObj[i]:
val = myObj[i]
return [number for number, i in myObj.i... | true |
8024713e55c5a21bf0a54a49a358a29764c09716 | Python | yahaa/violent_python | /chapter9/test13.py | UTF-8 | 504 | 2.75 | 3 | [] | no_license | import hmac
import hashlib
import base64
signature = hmac.new("zihua", '123456', digestmod=hashlib.sha256).digest()
print type(signature)
def toHex(str):
lst = []
for ch in str:
hv = hex(ord(ch)).replace('0x', '')
if len(hv) == 1:
hv = '0' + hv
lst.append(hv)
return re... | true |
4caa33fbd83e3030dfbf2cdca24c054c58a362dd | Python | github653224/GitProjects_SeleniumLearing | /SeleniumLearningFiles/SeleniumLearning01/Test1/my-def.py | UTF-8 | 2,217 | 4.59375 | 5 | [] | no_license | def my_abs(x):
if x>0:
print("走了这一步")
return x
else:
return abs(x) #return -x
print(my_abs(-99))
# 我们修改一下my_abs的定义,对参数类型做检查,只允许整数和浮点数类型的参数。
# 数据类型检查可以用内置函数isinstance()实现:
def my_abs(y):
if not isinstance(y, (float)):
raise TypeError('bad operand type')
if y >= 0:
... | true |
9d40d532f7e343777df145ed9dd2a66911a56293 | Python | timlegrand/iovh | /OvhApi.py | UTF-8 | 6,048 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# Copyright (c) 2013, OVH SAS.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#* Redistributions of source code must retain the above copyright
# notice, this list of co... | true |
91912828bd90d6c4222e72a9df116ecefbe5bdb9 | Python | tatiana-curt/Home_Task_14_08_dynamic-templates | /task3/app/templatetags/news_filters.py | UTF-8 | 1,393 | 2.609375 | 3 | [] | no_license | from django import template
from datetime import datetime, timedelta
# import datetime
register = template.Library()
@register.filter
def format_date(value):
data = datetime.fromtimestamp(value)
past_10 = datetime.now() - timedelta(minutes=10)
past_24_hours = datetime.now() - timedelta(hours=24)
if ... | true |
c7c48e61aa73db328c440cd4a67556bdc4cf3cbf | Python | Annapoorani16/Hackerrank-Problem-solving | /matrix_boundary_ele_equal_to_k.py | UTF-8 | 519 | 3.5625 | 4 | [] | no_license | #accept a matrix of size n*m & integer k
#check all boundary elements are equal to k
#if yes print "yes" else "no"
import numpy
n,m,k = map(int,input().split()) # getting inputs
a=numpy.array([[int(j) for j in input().split()[:m]]for _ in range(n)]) #getting array inputs
if((list(a[0,:]).count(k)==m)and (list(a... | true |
4dba476387828a9a4d162fe438b075ccd102ce92 | Python | DethRaid/VIEWER | /src/main/python/viewer/py_wrapper.py | UTF-8 | 941 | 2.6875 | 3 | [] | no_license | """
Wraps the VIEWER C API so life can be easy
"""
from ctypes import *
view_native = cdll.viewer
glm_vec4 = c_float * 4
class ViewerMaterial(Structure):
_fields_ = [("ambient", glm_vec4),
("diffuse", glm_vec4),
("specular", glm_vec4),
("emissive", glm_vec4),
... | true |
f350dd5af7d816134cf604ed489ddae173503b15 | Python | romulocraveiro/python-exercises | /tarefa-de-casa-aula19-faixaetaria.py | UTF-8 | 746 | 4.1875 | 4 | [] | no_license | # 1) Solicite ao usuário digitar o ano de nascimento:
# 2) A partir do ano digitado:
# 2.1 - calcule a idade
# 2.2 - informe a idade
# 2.3 - informe sua faixa etária:
# Adolescente (13-17), Adulto(18-64), ou Idoso(65 ou acima)
# 3) Caso o usuário tenha menos de 16 anos:
# 3.1 - informe ao usuá... | true |
24abdda44875d815d00baa507ae4075b5b49e07d | Python | alexjeman/exceptions | /exceptions.py | UTF-8 | 781 | 3.84375 | 4 | [] | no_license | # Errors and Exceptions
x = -5
if x < 0:
raise Exception('x should not be negative.')
x = -5
assert (x >= 0), 'x is not positive.'
try:
a = 5 / 0
except:
print('Error!')
try:
a = 5 / 0
except Exception as e:
print(e)
else:
pass
finally:
print('cleaning up')
# Defining
class ValueToo... | true |
83c7f2b443bc9d16a527b81d1390bbf0a11d27a9 | Python | vincentnifang/PyShooterSubDownloader | /ShooterUtil.py | UTF-8 | 702 | 2.546875 | 3 | [] | no_license | __author__ = 'vincent'
import os
import hashlib
SHOOTERURL = "http://shooter.cn/api/subapi.php"
def get_API_URL():
return SHOOTERURL
def get_shooter_hash(filepath):
ret = ''
try:
file = open(filepath, "rb")
fLength = os.stat(filepath).st_size
for i in (4096, int(fLength / 3) *... | true |
0c904ddce1ffd14c538d8d624c162446b56652fd | Python | MrRooots/Project_Euler | /Problem_22.py | UTF-8 | 797 | 3.359375 | 3 | [] | no_license | # Совершенно не понятно где ошибка, скорее всего файл косой...
def name_count():
from string import ascii_uppercase
file = open("name.txt")
new = list(file)
line = str(new)
name_num = 1
name_weight = 0
result = 0
line = line.replace('","', ',')
line = line.replace('"', ... | true |
717b19e76d992348eb117d39405ef01dfc8c86e9 | Python | wieshka/toolbox | /Dynamic Folder/Amazon Web Services/EC2/EC2InstanceConnectGroupedByTagValuesSample.py | UTF-8 | 2,818 | 2.796875 | 3 | [
"MIT"
] | permissive | import boto3
import json
'''
- Tested on MacOS only, but with little modifications should work elsewhere.
- Uses systems default Python as I failed to specify any other. A venv support for Royal TSX would be awesome.
- Make sure you have boto3 installed for default Python.
'''
class RoyalProvider:
def __init__(se... | true |
bd6df6af6c813a3a4b4d508bf41fdb9365698d54 | Python | mianfg/photofitter | /fitter.py | UTF-8 | 3,231 | 3.046875 | 3 | [
"MIT"
] | permissive | """
fitter
======
Image rendering facilities
"""
__author__ = "Miguel Ángel Fernández Gutiérrez (@mianfg)"
__copyright__ = "Copyright 2020, @mianfg"
__credits__ = ["Miguel Ángel Fernández Gutiérrez"]
__license__ = "MIT"
__version__ = "1.0.1"
__mantainer__ = "Miguel Ángel Fernández Gutiérrez"
__e... | true |
9f92617984d6f3c8f2903aab180139ec21662a4a | Python | astroumd/astr288p-public | /scripts/linearfit.py | UTF-8 | 700 | 3.40625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
#
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy import stats
# make some data (the # makes a comment in the script)
x = (np.arange(10)+1)*0.2
y = x*3-4
# add a little noise
y = y + np.random.normal(0.0,0.2,len(x))
# do the fit
slope, intercept, r_value, p_valu... | true |
ba4c0977befbf12ccbdaf999aeb2b7d487ed0ed0 | Python | KBergers/python-and-gis-class | /intro-to-python-gis/data_classification_and_aggregation.py | UTF-8 | 3,832 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 28 15:34:47 2018
@author: SWP679
"""
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
import pysal as ps
from fiona.crs import from_epsg
"""
PROBLEM 1: JOIN ACCESSIBILITY DATASETS INTO A GRID AND VISUALISE THEM BY
USING A CLASSIFIER
"""
#Read t... | true |
bdc548edd36c67a70e78f6084d3347523a4a9536 | Python | omazapa/ipython | /IPython/quarantine/ipy_workdir.py | UTF-8 | 1,074 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
from IPython.core import ipapi
ip = ipapi.get()
import os, subprocess
workdir = None
def workdir_f(ip,line):
""" Exceute commands residing in cwd elsewhere
Example::
workdir /myfiles
cd bin
workdir myscript.py
executes myscript.py (stored in bi... | true |
9ede00b1858591ad7e062d163b2d49c74b964bf7 | Python | GyxChen/AmusingPythonCodes | /dmn/read_data.py | UTF-8 | 3,226 | 2.859375 | 3 | [
"MIT"
] | permissive | """ a neat code from https://github.com/YerevaNN/Dynamic-memory-networks-in-Theano/ """
import os
from .utils.data_utils import DataSet
from copy import deepcopy
def load_babi(data_dir, task_id, type='train'):
""" Load bAbi Dataset.
:param data_dir
:param task_id: bAbI Task ID
:param type: "train" or... | true |
890c37bd934824752a921a260a9562a8cac239e7 | Python | KinoriSR/Computing-Problems | /ProjectEulerProblem101.py | UTF-8 | 4,170 | 3.84375 | 4 | [] | no_license | #Project Euler: Problem 101
#Problem URL: https://projecteuler.net/problem=101
#Problem Summary: Given a series of numbers produced by a polynomial, guess the the polynomial. If given the right number of terms, I
#should be able to produce the actual polynomial. The Project Euler problem asks for us to guess a polyn... | true |
96beeb82c4edeb6e6f0470732794c1111a8907fa | Python | joseph-mutu/Codes-of-Algorithms-and-Data-Structure | /Leetcode/颜色排序.py | UTF-8 | 863 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020-02-23 07:09:33
# @Author : mutudeh (josephmathone@gmail.com)
# @Link : ${link}
# @Version : $Id$
import os
class Solution(object):
def sortColors(self, nums):
"""
[0:one_interval) = 0
[one_interval:i) = 1
[two_int... | true |
35145abf25e9410f146ae4ad6e1427e9301d5869 | Python | PiyushChaturvedii/My-Leetcode-Solutions-Python- | /Leetcode/Find Duplicate Subtrees.py | UTF-8 | 2,461 | 3.3125 | 3 | [] | no_license | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def findDuplicateSubtrees(self, root):
table = {}
res = set()
def util(node):
if no... | true |
a1949bd461ef24d7fcb80513e65338e0ec30d9a8 | Python | iunupe/python-challenge | /PyBank/main.py | UTF-8 | 4,893 | 3.453125 | 3 | [] | no_license | # ------------------------------ NOTES! ------------------------------ #
# Import dependencies: os module & csv module
# os - allows you to create file paths across operating systems
# csv - for reading in csv files
# ---------------------------- CODE BELOW ---------------------------- #
i... | true |
0afdf9e15c316de6eea448b5bbfb643e5d3d1225 | Python | zhouhaian/python3 | /listv2.py | UTF-8 | 1,039 | 2.71875 | 3 | [] | no_license | import requests
from accesstoken import AccessToken
# ak、sk、bucket必需参数,limit范围1-1000
def Listv2(accessKey, secretKey, bucket, limit=1000, prefix=None, marker=None, delimiter=None):
method = 'GET'
path = "/v2/list?bucket=" + bucket + "&limit=" + str(limit)
host = "rsf.qbox.me"
contentType = "applicatio... | true |
28b341d0e4d24d7f96c68eb06ddf73fcc06c6e1e | Python | sivasathyanarayana/hacker-rank | /ShapeandReshape.py | UTF-8 | 109 | 2.78125 | 3 | [] | no_license | import numpy
arr=list(map(int,input().split()))
arr=numpy.array(arr)
arr=numpy.reshape(arr,(3,3))
print(arr)
| true |
a53b42a5f24edbc43e8ea0b4c55a9a06f01044af | Python | rr-/mdsm | /mdsm/__main__.py | UTF-8 | 2,873 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import email.utils
import mailbox
import sys
import typing as T
from getpass import getuser
from pathlib import Path
from socket import gethostname
import configargparse
import xdg
DEFAULT_MAILDIRS = ['~/Maildir', '~/maildir', '~/mail']
def resolve_path(path: T.Union[Path, str]) -> Path:
... | true |
85a4a6f3346b8df1fdef593c176e1eaab5feb834 | Python | umairmohd8/attendanceBot | /attend.py | UTF-8 | 3,030 | 2.71875 | 3 | [] | no_license | from selenium import webdriver
import tweepy
import vars
CONSUMER_KEY = vars.apikey
CONSUMER_SECRET = vars.apisecret
ACCESS_KEY = vars.Accesstoken
ACCESS_SECRET = vars.Accesstokensecret
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth, ... | true |
c63ef90fdc9fcdf26b9b88dddf1d8e48183d1ee4 | Python | maheshdivan/project-outbreak | /API/Market/app.py | UTF-8 | 2,414 | 2.546875 | 3 | [] | no_license | import psycopg2
from flask import Flask, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
# conn = psycopg2.connect(host='localhost',user='mahesh1',password='mahesh',dbname='marketing_db')
conn = psycopg2.connect(host='localhost',user='mahesh1',password='mahesh',dbname='marketing_db')
cur = conn.... | true |
10717d83e1d8dc0e915ce37088cdcaf4bc865b0b | Python | guv-slime/python-course-examples | /section11_ex02.py | UTF-8 | 1,354 | 3.765625 | 4 | [] | no_license | # Exercise 2: Change your socket program so that it counts the number of characters it has
# received and stops displaying any text after it has shown 3000 characters. The program
# should retrieve the entire document and count the total number of characters and display
# the count of the number of characters at the en... | true |
1cb3cb7353afbfe51d2c40e331e61163ddd48111 | Python | lesyk/Evolife | /Tools/Averaging.py | UTF-8 | 3,217 | 2.890625 | 3 | [
"MIT"
] | permissive | ##############################################################################
# EVOLIFE www.dessalles.fr/Evolife Jean-Louis Dessalles #
# Telecom ParisTech 2014 www.dessalles.fr #
##############################################################################
... | true |