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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a932f834b159bbdde421a1cdb1026fdbf3a4a763 | Python | SilverSova-ui/Python_lab | /python lab1/lab1.2.py | UTF-8 | 209 | 3.328125 | 3 | [] | no_license | a = int(input()) #ввод первой переменой
b = int(input()) #ввод второй переменой
s = (a * b)/2 #формула площади
print (s) # вывод результата | true |
5fcee4fdd7ed825c49624897beff7ba7fa07a0a4 | Python | canyon289/UdacityMachineLearning | /Intro to Machine Learning/ud120-projects-master/outliers/outlier_cleaner.py | UTF-8 | 783 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python3
def outlierCleaner(predictions, ages, net_worths):
"""
clean away the 10% of points that have the largest
residual errors (different between the prediction
and the actual net worth)
return a list of tuples named cleaned_data where
each tuple is of the fo... | true |
0268e9b0d6b9baaf421635b1bab136c895c75c16 | Python | autofasurer/hangman | /hangman2.py | UTF-8 | 1,844 | 4.15625 | 4 | [] | no_license | #! /usr/bin/env python3
#! python3
#TO DO: WORDTOGUESS NEEDS TO BECOME RANDOMLY PICKED FROM A LIST OF WORDS
from termcolor import colored
import os
wordtoguess = 'banana'
userguess = ''
guessedsofar = []
guessed = False
lettersguessed = set()
numguesses = 0
def checkguess(userguess):
#FIRST CHECK IF THE GUESS C... | true |
b6fe40070ef42dca482136cfddea7da25ce40468 | Python | kk2250/Byte_Academy | /SQL/practice_school/view.py | UTF-8 | 1,203 | 2.953125 | 3 | [] | no_license | import sqlite3
import os
import time
connection = sqlite3.connect('School.db')
cursor = connection.cursor()
def main_menu():
print('\n\nWhat woud you like to add to our DB?')
choice = input('\n\n[C]lass\n[T]eacher\n[S]tudent\n[L]ookup\n[E]xit')
return choice
def add_class():
os.system('clear')
cu... | true |
cc3c7d8ff7a1f386ae97301feadb7ec6ab490203 | Python | titiman1013/Algorithm | /21.01.07/Programmers_42578.py | UTF-8 | 897 | 3.4375 | 3 | [] | no_license | # first solve
# def solution(clothes):
# hash_map = {}
# for cloth in clothes:
# if cloth[1] in hash_map:
# hash_map[cloth[1]] += 1
# else:
# hash_map[cloth[1]] = 1
# answer = 0
# for val in hash_map.values():
# if answer:
# answer *= (va... | true |
1e8ad0cd305bb32bd66dc81ba9d8f087b9d64e47 | Python | gamingpigeon/Vara_story | /addSIX.py | UTF-8 | 211 | 3.953125 | 4 | [] | no_license | """
This program will take the input of the user and return that number plus 6 in a print statement
"""
x =int(input("please type a rock solid number: "))
print("your number, " + str(x) + "+ 6 = " + str(x+6))
| true |
d8425de77fbb796428c27130c2934ccf4c93cafc | Python | migowei0621/pycharm | /刷题/jiangxuejin.py | UTF-8 | 752 | 2.609375 | 3 | [] | no_license | import sys
all = []
def solution(n,r,avg,lista, listb):
nn = n*avg
rest = nn - sum(lista)
if rest <=0:
return 0
num =0
j = sorted(range(n),key = lambda k:listb[k])
for u in j :
if(lista[u]<r and rest<=r-lista[u]):
num = num + listb[u]*rest
return num
... | true |
c382fcaff8693cb100a5605c2a536298a11d14d7 | Python | Shadowztorm/python-practice | /IF exercise 1.py | UTF-8 | 1,905 | 5 | 5 | [] | no_license | ## Exercise: Python If Condition
# 1. Using following list of cities per country,
# ```
# india = ["mumbai", "banglore", "chennai", "delhi"]
# pakistan = ["lahore","karachi","islamabad"]
# bangladesh = ["dhaka", "khulna", "rangpur"]
# ```
# Write a program that asks user to enter a city name ... | true |
72ffa6bfffc39b4cf7d3077922f24bd2f3c7be09 | Python | TrendingTechnology/imodels | /tests/notebooks/imodels_comparisons.py | UTF-8 | 7,539 | 2.59375 | 3 | [
"MIT"
] | permissive | # ---
# jupyter:
# jupytext:
# formats: ipynb,../tests/notebooks//py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.10.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
... | true |
05e1bd5a96751e029ef3dec063e99f0c056c4965 | Python | ippo615/blog | /_posts/ally_cd.py | UTF-8 | 2,090 | 3.15625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/python
import urllib, xml.dom.minidom, re
def getAllyRate(rateIndex):
"""Returns the current rate (APR) of your ally Raise Your Rate CD."""
# Download the rate information from the website and parse it into a DOM
rssFeed = urllib.urlopen("http://www.ally.com/rss/rates.xml")
rssData = xml.dom.minidom.p... | true |
a5f9456eef430fdbc028cbeaae29c54854562ab1 | Python | ESA-PhiLab/buried-archaeology | /scripts/task_generator_sentinel.py | UTF-8 | 3,826 | 2.53125 | 3 | [] | no_license | from pyproj import Proj, transform
import csv
import furl
wms_service_user_id = 'USER_ID_TOKEN'
wms_url = 'https://services.sentinel-hub.com/ogc/wms/' + wms_service_user_id
x_dimension = 1600 # meters.
y_dimension = 800 # meters.
lat_bounds = [51.72, 52.22]
lng_bounds = [-2.28, -1.21]
# Upper left hand corner coord... | true |
df8d72a5efad87e31613dbce883ddae8b8dd785f | Python | spacewizard66/Crypto-Price-Tracker | /crypto.py | UTF-8 | 1,822 | 3.421875 | 3 | [] | no_license | # API URLs
# Bitcoin - https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD
# Monero - https://min-api.cryptocompare.com/data/price?fsym=XMR&tsyms=USD
# Raven - https://min-api.cryptocompare.com/data/price?fsym=RVN&tsyms=USD
# Dogecoin - https://min-api.cryptocompare.com/data/price?fsym=DOGE&tsyms=USD
#... | true |
aebaa3343f51872e0ed2e69674dcdeff407dd1a4 | Python | Naif18/PythonCourse | /firstWeek/FifthDay.py | UTF-8 | 77 | 3.546875 | 4 | [] | no_license | x = "apple"
y = "orange"
z = "limon"
basket = x + y + z
print(len(basket)) | true |
fbe61ec2b24ae371b4545f7903f76067532797a0 | Python | emmaliden/thePythonWorkbook | /E17.py | UTF-8 | 723 | 4.4375 | 4 | [] | no_license | # Take a mass of water and a number of degrees as input
# Calculate the energy required to heat the water by this many degrees
mass_water = input("Grams of water: ")
number_degrees = input("Number of degrees: ")
energy_required = mass_water * number_degrees * 4.186
print("The energy required to heat %r grams of wat... | true |
8392ee62c99b1c1d8fd3e7fbca5c137ee95a401e | Python | jkbockstael/leetcode | /2020-06-month-long-challenge/day18.py | UTF-8 | 1,096 | 3.984375 | 4 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
# Day 18: H-Index II
#
# Given an array of citations sorted in ascending order (each citation is a
# non-negative integer) of a researcher, write a function to compute the
# researcher's h-index.
# According to the definition of h-index on Wikipedia: "A scientist has index h
# if h of his/her N ... | true |
d9d626c107f98c3c8e01f2abc945d60041b0fda7 | Python | shivapodugu91/BigData | /Recommender System/RecommenderSystem.py | UTF-8 | 7,606 | 2.765625 | 3 | [] | no_license | # Databricks notebook source
#Book-Crossing dataset
display(dbutils.fs.ls('/FileStore/tables/jcroftps1499817600813'))
# COMMAND ----------
import sys
import os
from test_helper import Test
baseDir = os.path.join('FileStore')
inputPath = os.path.join('tables', '3l60imup1499819875788')
bookRatingsFilename = os.path.j... | true |
3e5a25928b2e8f44490f4d759ef5633edf37984e | Python | Salaudeen-Hafeez/ml-lbd | /caltech-lfd/svm.py | UTF-8 | 3,879 | 2.84375 | 3 | [] | no_license | from perceptron import Perceptron, inner_product
from lregression import generate_random_function
from cvxopt import matrix, solvers
import cvxopt
import random
import numpy as np
class SVM(object):
def __init__(self, weights=None):
self.weights = weights
def train(self, samples):
X_l = []
... | true |
a54ff6d31ee8b89c1da45d843f78b9673606ffe0 | Python | wisnupr/TestDasar | /3.py | UTF-8 | 204 | 3.40625 | 3 | [] | no_license | import re
def sortNumber(string):
x = re.findall("[0-9]", string)
if (x):
x.sort()
print(x)
else:
print("No number found in parameter!")
sortNumber("wisnu14523") | true |
ddba2e30ed6518753a3fe7bddff030964faf6a08 | Python | gzabala/cursopython | /Ejemplos basicos/Ejemplos Alumnos/Campeonato/Persona/Persona.py | UTF-8 | 1,125 | 3.75 | 4 | [] | no_license | # Quiero representar el personal de una escuela.
# Tengo administrativos, directivos, docentes y alumnos. PEnsar qué tienen en común, qué diferente y hacer una implementación sencilla de Personal.
from datetime import date
class Persona():
def __init__(self, nombre, apellido, fecha_de_nacimiento):
self.__... | true |
88eba97524084fc914452beca721873c5df4e203 | Python | Aztic/AniList-date-search | /next_anime.py | UTF-8 | 2,309 | 3.09375 | 3 | [] | no_license | import os
from anilist import AniList
from time import gmtime, strftime, time
#This is only necessary if you are going to use the client
Client_ID = os.getenv('ANILIST_CLIENT_ID')
Client_Secret = os.getenv('ANILIST_CLIENT_SECRET')
client = AniList(client_id=Client_ID, client_secret=Client_Secret)
#Searchs ... | true |
7490f37b8f6926e2b67d65fa2e1358a79cabb277 | Python | EduardaValentim/programacao-orientada-a-objetos | /listas/lista-de-exercicio-02/questao10.py | UTF-8 | 125 | 3.65625 | 4 | [] | no_license | celsius = float(input('Digite a temperatura em Celsius: '))
fahrenheit = 1.8 * celsius + 32
print('{}°F'.format(fahrenheit)) | true |
ad5a24276bae0b809cc284b12aa1454de957fe5e | Python | iamtariqueanjum/p4e_coursera | /ex_9_4.py | UTF-8 | 531 | 2.609375 | 3 | [] | no_license | fname = input("Enter file:")
if len(fname) < 1 : fname = "mbox-short.txt"
fhand = open(fname)
counts = dict()
for line in fhand :
line = line.rstrip()
words = line.split()
if len(words) < 1 or words[0] != 'From' :
continue
else :
email = words[1]
if email in counts :
... | true |
db6db4a08cdaf6067517a46472e272d7e4875095 | Python | NeoBryant/brain_project | /save_load_net.py | UTF-8 | 663 | 3.03125 | 3 | [] | no_license | # coding: utf-8
import torch
def save_model(model, path='model/unet.pt'):
"""
Save the model `model` to `path`\\
Args:
path: The path of the model to be saved
model: The model to save
"""
torch.save(model.state_dict(), path)
def load_model(model, path, device):
"""
Load `... | true |
98c3dc0ba0f857faea8a9b032354deab5514eaa1 | Python | SpencerFelton/LeetCode | /Easy/String/validAnangram.py | UTF-8 | 594 | 3.5 | 4 | [] | no_license | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
if(len(s) != len(t)):
return False
dict_s = {}
dict_t = {}
for x in range(0, len(s)):
if(s[x] in dict_s):
dict_s[s[x]] += 1
if(t[x] in dict_t):
dict_t[t[x... | true |
db757582504ccfbfed05d1b94e8eb539d6ae837e | Python | AndrewWalker/project-euler | /prob367.py | UTF-8 | 1,158 | 3.328125 | 3 | [] | no_license | import euler
import numpy
import matplotlib.pyplot as plt
def naive_transition_matrix( n ):
states = [ tuple(state) for state in euler.permutations( range(1,n+1) ) ]
m = len(states)
mat = numpy.zeros( (m,m) )
state2id = dict(zip(states, range(len(states))))
id2state = dict(zip(range(len(states)), s... | true |
6fe528c79bf9481242e64787eb994e471435fb6f | Python | ahg223/ProblemSolve | /PS/s_1.py | UTF-8 | 3,088 | 3.28125 | 3 | [] | no_license | '''
start,end=map(int,input().split())
sum=0
for i in range(start+1,end):
if i%3==0 or i%5==0:sum+=1
print(sum)
'''
'''
Num=int(input())
Num1,Num2=Num,Num
Binary=''
Octat=''
while Num1!=0:
Binary=str(Num1%2)+Binary
Num1=Num1//2
while Num2!=0:
Octat=str(Num2%8)+Octat
Num2=Num2//8
print(Binary,Octat... | true |
04a42e46d410a5bc53c1d1d678ff4b7cfe8b069f | Python | Parthu8108/PythonCode | /multipleInheritance.py | UTF-8 | 414 | 3.6875 | 4 | [] | no_license | class A:
def __init__(self):
self.a="A"
print(self.a)
class B:
def __init__(self):
self.b="B"
print(self.b)
class C(A,B):
def __init__(self):
A.__init__(self)
B.__init__(self)
print("hello")
def funct(self):
print("I... | true |
b276c26e6c30ebae69fc60d40b42bd889184f75d | Python | kerwinxu/PythonFinance | /FinanceDataMining/zip/AUTD_zip.py | UTF-8 | 2,395 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Last Change: 2017-12-30 10:03:27
"""@File Name: AUTD_zip.py
@Author: kerwin.cn@gmail.com
@Created Time:2017-12-29 21:27:51
@Last Change: 2017-12-29 21:27:51
@Description : 看看AUTD的zip转向
"""
import sys
import os
sys.path.append(
os.path.join(
o... | true |
03f45e806893d351dd763a3eae1d44b2f24d0abb | Python | TheGreatFan/Lagrange-Scheduling | /BAS.py | UTF-8 | 2,795 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 7 13:16:58 2020
@author: Administrator
"""
# 需要用的包
#import numba
import numpy as np
import random # random 0,1 之间 uniform 自定义区间 random.random()
#import copy
import time
import matplotlib.pyplot as plt
# 外部子程序
import problem_2 as problem # 导入 problem 2
... | true |
7f280827197f0394040528c7654aba62970ef481 | Python | KrwawyOrk/console-rpg-game | /little_rpg.py | UTF-8 | 3,705 | 3.71875 | 4 | [] | no_license | import random
def CreateCharacter():
print("Noc zapanowala na niebie. Jestes w lesie i dostrzeles ogien. Podchodzisz blizej i napotykasz maga, ktory robi magiczne sztuczki na ognisku.")
print("- Oczekiwalem Ciebie, widzialem w ogniu jak kroczysz lasem...")
print("Mag nieco zachwial sie, kiedy podparty o ma... | true |
2ce81848c2ae9d986bd05e91f72ba8b48870c5a1 | Python | Madhavpawar600/madhav | /tell grade and store into list.py | UTF-8 | 291 | 3.078125 | 3 | [] | no_license | a=int(input("enter the no you want store info"))
list1=[]
for i in range(0,a):
b=input("enter the name")
c=int(input("enter the marks"))
if c<=100 and c>80:
g="A+"
elif c<=80 and c>70:
g="a"
else:
g="fail"
list1.append([b,g])
print(list1)
| true |
a131f263b3e6a7f874cf46a3c3feb346d76ab877 | Python | Phyks/cozyweboob | /cozyweboob/tools/jsonwriter.py | UTF-8 | 1,576 | 3.359375 | 3 | [
"MIT"
] | permissive | """
This module implements a custom JSON writer to be able to serialize data
returned by Weboob and pretty print the output JSON.
Based upon
http://stackoverflow.com/questions/11875770/how-to-overcome-datetime-datetime-not-json-serializable-in-python.
"""
import json
from datetime import date, datetime
from decimal i... | true |
3a73d005f05f08e8490267704dfecd5ef8bc2729 | Python | emeyva/assessing-malaria-blood-samples | /Python_OpenCV/circle_detection.py | UTF-8 | 6,512 | 2.71875 | 3 | [] | no_license | #circle detection test - python circle_detection.py --image 012.jpg
# import the necessary packages
import glob
import os
import numpy as np
import cv2
from matplotlib import pyplot as plt
def image_rect(out,x,y,z):
cv2.rectangle(out, (x, y), (x+75, y+75), (0, 0, 0), z, 4)
def cell_rect(out,x,y,h,w):
cv2.re... | true |
7853a09446c775845e6e23437e6c3f805268ec9e | Python | chingisooinar/Leetcode | /All_Nodes_Distance_K_in_Binary_Tree.py | UTF-8 | 873 | 3.03125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def distanceK(self, root: TreeNode, target: TreeNode, K: int) -> List[int]:
def dfs(node, par = None):
if node:
... | true |
355c291c71513f12cc31788f39dad98e1ecbf2ea | Python | oturing/python2001 | /ftp.py | UTF-8 | 929 | 2.765625 | 3 | [] | no_license | from ftplib import FTP
from StringIO import StringIO
HOST = 'ftp.br.yahoo.com'
PORT = '21'
USER = 'magnet'
PASSWORD = 'mg!47z@'
def ftp(nome_arq, dados):
arq = StringIO(dados)
ftp = FTP()
ftp.connect(HOST, PORT)
ftp.login(USER, PASSWORD)
command = 'STOR ' + nome_arq
ftp.storlines(command, arq... | true |
a9537b42afa5d8ca6314e16c9c4facf49eb92559 | Python | andrehoracio97/investigacao | /SCRIPTS_USED_ON _METRICS/SCRIPTS_RLS_1/make_ber.py | UTF-8 | 3,946 | 2.671875 | 3 | [] | no_license | def compare_bits(compare,original):
bit_errado=0
temp=compare>>7
temp_original=original>>7
if temp&1 != temp_original&1:
bit_errado=bit_errado+1;
temp=compare>>6
temp_original=original>>6
if temp&1 != temp_original&1:
bit_errado=bit_errado+1;
temp=compare>>5
temp_original=original>>5
if temp&1 !=... | true |
12fb694167d92356fd6919b504d2c8bc86716a4f | Python | Yuipas/Fluto | /src/grammar/lexer.py | UTF-8 | 2,146 | 3.71875 | 4 | [
"MIT"
] | permissive | from grammar import tokens
class Lexer(object):
def __init__(self, text):
self.text = text
self.pos = 0
self.currentChar = text[self.pos]
def error(self, ms = ""):
raise Exception(ms)
def advance(self):
self.pos = self.pos + 1
if self.pos < len(self.tex... | true |
dd34434b592b1b24b292b0d85e7c3488e6485ec0 | Python | corydodt/Goonmill | /doc/simple.py | UTF-8 | 2,404 | 2.890625 | 3 | [] | no_license | import sys, shutil
from itertools import count
from lucene import (IndexWriter, StandardAnalyzer, Document, Field,
MultiFieldQueryParser, IndexSearcher, initVM, CLASSPATH, Hit,
FSDirectory, BooleanClause)
initVM(CLASSPATH)
DIRECTORY = 'xxindex'
STORE = FSDirectory.getDirectory(DIRECTORY, True)
def in... | true |
3f72aaa5e49acb04adf60ea7be9dac29d79faaff | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2952/48102/252669.py | UTF-8 | 617 | 3.21875 | 3 | [] | no_license | def search(string: str) -> list:
res = []
now = ''
for i in string:
if i.islower():
now += i
elif i == 'B':
now = now[0:len(now)-1]
elif i == 'P':
res.append(now)
return res
def find():
s = input()
ans = search(s)
n = int(input())... | true |
d8738bae8f1c514614e799cf46c6737c791097cd | Python | fstoltz/schoolwork | /Object-oriented programming/OOPInlam2-master/person.py | UTF-8 | 741 | 3.828125 | 4 | [] | no_license |
class Person:
def setAddress(self, address):
"""
Checks that the address is of type string before setting it
"""
if isinstance(address, str):
self._address = address
else:
self._address = None
def __init__(self, initialName, initialAddress):
self._name = initialName
self._address = None
self... | true |
beafa2e12b597bf292460676e5c0b739805cd892 | Python | optionalg/super-awesome-paste | /paste.py | UTF-8 | 4,360 | 2.953125 | 3 | [
"MIT"
] | permissive | import sublime
import html
import re
from .util import RegexPatterns
class Paste:
def __init__(self, view, file_info, preferences):
self.view = view
self.file = file_info
self.preferences = preferences
# Load current text from clipboard, clear if empty
self.text = sublime.g... | true |
2fe5995910c393680727aa853a13338270873bd9 | Python | mileswwatkins/slack_state_flags | /get_flags.py | UTF-8 | 1,549 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import os
import re
import shutil
import lxml.html
import requests
import us
FLAGS_URL = 'https://en.wikipedia.org/wiki/Flags_of_the_U.S._states_and_territories'
html = requests.get(FLAGS_URL).text
doc = lxml.html.fromstring(html)
doc.make_links_absolute(FLAGS_URL)
STATES_XPATH = '//span[@id=... | true |
121a90c0a2cdf103d1661bde870744aba1c1f76b | Python | eltonography/python | /generate_tours2.py | UTF-8 | 1,051 | 2.515625 | 3 | [] | no_license | #!/usr/local/bin/python2.7
import location
import xml.etree.ElementTree as XML
# ----------------------------------------------------------------------------
# Converts the concerts.txt file to an XML file, including songs from
# each of the dated sub-folder files.
# -------------------------------------------------... | true |
5ad282ef2d4599200db57dc7c9c8de8bdcf4ad53 | Python | hizocar/aves | /src/aves/features/geometry.py | UTF-8 | 3,061 | 3.5625 | 4 | [
"CC-BY-3.0"
] | permissive | import numpy as np
import scipy.interpolate as si
def euclidean_distance(a, b):
diff = a - b
return np.sqrt(np.dot(diff, diff))
# source: https://stackoverflow.com/questions/34803197/fast-b-spline-algorithm-with-numpy-scipy
def bspline(cv, n=100, degree=3, periodic=False):
"""Calculate n samples on a bs... | true |
d25e522254c3306cf9ec4d5a6c0cf0fe00f18037 | Python | rcosnita/fantastico | /virtual_env/libs/mysql-connector/python3/examples/inserts.py | UTF-8 | 2,761 | 2.78125 | 3 | [
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-or-later",
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | true |
b3deec3f0941c3a72a24602758b1e84353ef6ced | Python | JAlejandroMG/Django-TrelloClone | /users/serializers.py | UTF-8 | 879 | 2.640625 | 3 | [] | no_license | from rest_framework.serializers import ModelSerializer
from users.models import CustomUser
class UsersSerializer(ModelSerializer):
class Meta:
model = CustomUser
fields = ('id', 'first_name', 'last_name', 'email')
class UsersDetailSerializer(ModelSerializer):
class Meta:
model = Cus... | true |
896ce4a854501bff0d33ef2bd0ad87116903a19b | Python | pkepley/blog-notebooks | /20190726_RiddlerSoln/solution.py | UTF-8 | 14,390 | 2.5625 | 3 | [] | no_license | import os, sys
import requests
import zipfile
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point, LineString
import matplotlib
import matplotlib.pyplot as plt
import networkx as nx
from simulated_annealing import simulated_annealing
def get_contiguous_states_list(data_pat... | true |
ab8e4cc9d903e7326ee0d51ff2a89c9b6365b77f | Python | ksomemo/Competitive-programming | /atcoder/agc/024/B.py | UTF-8 | 3,336 | 3.3125 | 3 | [] | no_license | def main():
N = int(input())
P = [int(input()) for _ in range(N)]
#f1(N, P)
editorial(N, P)
def dp(N, P):
"""
https://beta.atcoder.jp/contests/agc024/submissions/2539848
https://beta.atcoder.jp/contests/agc024/submissions/2534307
"""
pass
def uf(N, P):
"""
https://beta.a... | true |
a63ba3dc7fb0363ac41f13ab8920d645b5725698 | Python | cfxing/flower | /花.py | UTF-8 | 1,688 | 3.40625 | 3 | [] | no_license | import turtle
turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)
#huizi
printer = turtle.Turtle()
printer.hideturtle()
printer.penup()
printer.back(150)
printer.write("something just like this\n\n", align="right", font=("楷体", 12, "bold"))
printer.write(" cfxing", align="center"... | true |
67caee8f6277e488d7dff4d2d47f0059f5832e7c | Python | seblars/AdventOfCode2020 | /day9.py | UTF-8 | 602 | 3.125 | 3 | [
"MIT"
] | permissive | import fileinput
import numpy as np
data = [int(i) for i in "".join(fileinput.input()).split('\n')]
# part 1
def twoNumCombi(d1,d2):
return np.array(np.meshgrid(d1, d2)).reshape(2,-1).T.sum(-1)
for i in range(25, len(data), 1):
n = (twoNumCombi(data[i-25:i],data[i-25:i]) == data[i]).sum()
if n... | true |
22d4ec013f1b491db07be586be902725ac27e760 | Python | finchmeister/log-pings | /stats.py | UTF-8 | 1,420 | 3.015625 | 3 | [] | no_license | import os
from datetime import datetime
up_count = down_count = 0.0
offline_count = 0
previous_state = up = previous_state_change_time = None
duration = ''
last_time_went_online = current_time = None
for line in open("status.log").readlines():
log_entry = line.rstrip()
if log_entry.endswith('s'):
cont... | true |
a2cbf7c7ef532ecb189b207b266dc61951b51afd | Python | CodeDrome/redirection-piping-python | /filterdata.py | UTF-8 | 450 | 3.296875 | 3 | [] | no_license | import sys
def main():
if(len(sys.argv) > 1):
try:
minimum = int(sys.argv[1])
except ValueError:
print("Argument must be valid integer", file=sys.stderr)
for amount in sys.stdin:
if(abs(int(amount)) >= minimum):
print(amount, end=... | true |
21213d431b39b4cb8602b1b0f17ec9938fb6c414 | Python | JT4life/PythonCodes | /PracticeCodes/pymongoUpdate.py | UTF-8 | 373 | 2.890625 | 3 | [] | no_license | #Update pymongo
from pymongo import MongoClient
conn=MongoClient("localhost",27017)
# 2 Access The database
db=conn.test9.Empl
oldEname = input("Enter the Ename to update")
myquery = { "Ename":oldEname }
newEname = input("Enter new Ename")
newvalues = { "$set": { "Ename":newEname } }
db.update_one(myquery, newvalue... | true |
15b4db10b0e79e96d5acb626c8955456da2f7ab4 | Python | zettsu-t/cPlusPlusFriend | /scripts/analyze_tweet_activity/convert_hashtags.py | UTF-8 | 1,470 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# coding: utf-8
'''
Convert hashtags
'''
import codecs
import csv
import sys
HASH_TAGS = {'#newgame':'NewGame',
'#けものフレンズ':'KemonoFriends',
'#やめるのだフェネックで学ぶ':'StopFennec'}
def convert_file(infilename, outfilename):
'''
Convert hashtags
'''
... | true |
e57c8a26d34328afd61d4c91a8a4ca604ab9702c | Python | prince6635/python-basics-by-cookbook | /06_OOP/chain_dictionaries.py | UTF-8 | 2,822 | 3.515625 | 4 | [] | no_license | """Chaining Dictionary Lookups."""
class ChainedMap(object):
"""docstring for ChainedMap."""
"""it is not a "full mapping" even within the read-only design choice."""
def __init__(self, *mappings):
"""Constructor."""
# record the sequence of mappings into which we must look
self.... | true |
d2a3283d37ef3ccdad317969404860c35e9ff886 | Python | p513817/tao-eco | /prepare_datasets/classification/formatted_innodisk_usb.py | UTF-8 | 4,610 | 2.953125 | 3 | [
"MIT"
] | permissive | import os
import numpy
import logging
import shutil
import argparse
from random import shuffle
from tqdm import tqdm
import glob
"""
DIR : data
NAME: defect, perfect
SAMPLE: ./data/defect.Z252_3.jpg
1. prepare label dir and classify usb data from train and test
- formatted
- label_1_name
- *.jpg
- la... | true |
aec3f05979b274490bfd7f77ac48168b3dcd340f | Python | navid-data-analytics/Navid-ai-project-team-work | /src/components/joiner.py | UTF-8 | 1,980 | 2.8125 | 3 | [] | no_license | from src.components.pushplug import PushPlug
class Joiner:
def __init__(self, process=lambda inputs: True):
"""
Collects data on it's inputs and joins them.
Note: The join operation triggered only if all input received at least
one data
:param process: The joiner process re... | true |
71d8328bc6fc12f75cfbb6925e311a52a0c33503 | Python | Marco2018/leetcode | /dp/leetcode198.py | UTF-8 | 339 | 2.59375 | 3 | [] | no_license | class Solution:
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n=len(nums)
index=[0 for i in range(n+2)]
for i in range(2,n+2):
index[i]=max(index[i-1],index[i-2]+nums[i-2])
return index[n+1]
input=[2,7,9,3,1]
s=Solution()
p... | true |
8d1607e93173471d16a9b3ba6187c5efc0694895 | Python | Lukazovic/Learning-Python | /CursoEmVideo/exercicio032 - ano bissexto.py | UTF-8 | 453 | 3.859375 | 4 | [] | no_license | from datetime import date
print('\nTestando se um ano é bissexto')
ano = int(input('Informe o ano: '))
print(' ')
if ano == 0:
ano = date.today().year
if ano % 100 == 0:
if ano % 400 == 0:
print('{} é um ano bissexto!' .format(ano))
else:
print('{} não é um ano bissexto!' .format(ano))
else:
if ano % ... | true |
e1fa6ee863422e0d594290a2550daa9f80ce9522 | Python | xun6000/Laidata_projects | /project_7_ALS_online_recommender_Flask/app.py | UTF-8 | 1,621 | 2.59375 | 3 | [] | no_license | from flask import Blueprint
main = Blueprint('main', __name__)
import json
from engine import RecommendationEngine
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
from flask import Flask, request
@main.route("/<int:user_id>/ratings/top/<int:count>", methods=["GET"])
def t... | true |
cd403b1560372b4f209ae1c4747ed4f431d15e7a | Python | Shikhar1121/Placement | /placement.py | UTF-8 | 4,660 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 26 18:14:10 2020
@author: Shikhar
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv("Placement_Data_Full_Class.csv")
df.isnull().sum()
df.set_index(['sl_no'], inplace = True)
df['salary']=df['salary'].fillna(value = df['salary']... | true |
8fc0935e70f2e689d731803a7028fb72c7ea68b9 | Python | AnLi-Mi/Python_Studying_Projects | /mini_projects/Project Crypting Machine.py | UTF-8 | 1,745 | 4.40625 | 4 | [] | no_license | print('----------------------Project-Crypto---------------------------')
# Creating an encrypting or decrypting (depenading on the usre's request) machine
# that replaces each letter of given string with a letter with the same index in
# the rotated alphabet (zyxwu...)
import random, string
#asking user to choose if... | true |
ab6c4574d936299765cd0c3ecb7d2d56200cfa94 | Python | xenonrazels/Wheelars | /test.py | UTF-8 | 119 | 2.96875 | 3 | [] | no_license | from datetime import datetime
year =[]
for i in range(2000,datetime.now().year +1):
year.append((i,i))
print(year) | true |
b4f58cbcc87c5bba6fb19815c08f300e5e04bad5 | Python | pakoy3k/MoreCodes-Python | /Loops/problem11.py | UTF-8 | 291 | 4.0625 | 4 | [] | no_license | #Problem 11: Write a program that checks if a number
#is palindrome.
num = 3333
sum = 0
temp = 0
rmdr = 0
temp = num
while (temp != 0):
rmdr = int(temp % 10)
sum = sum * 10 + rmdr
temp = int(temp / 10)
if num == sum:
print("Palindrome number")
else:
print("Not a Palindrome number")
| true |
3be4528f775ed0a97125f07297fe1cc44d2cc7cd | Python | sunshiding/data-processing | /augmented_data/showBBox.py | UTF-8 | 1,146 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: Jinbo
time: 2018-4-8
function: Visualized bounding box.
notice:The txt file's data format:[xmin,ymin,bboxw,bboxh].
"""
import os
import sys
import shutil
import math
import cv2 as cv
import random
sys.path.append("..")
from jinbo_lib.my_os import file_name,isimg,get_file_names
def... | true |
d30a11f082c7f013774d25b04f9217f83ce4d4bb | Python | DestrosCMC/Machine_Learning | /getting_started/tensor_flow/optimize_w_gradient.py | UTF-8 | 475 | 3.515625 | 4 | [] | no_license | from tensorflow import Variable, GradientTape
def compute_gradient(x0):
# Define x as a variable with an initial value of x0
x = Variable(x0)
with GradientTape() as tape:
tape.watch(x)
# Define y using the multiply operation
y = x*x
# Return the gradient of y with respect to x
return tape.gradien... | true |
dba2594f03eaad0fcd87fa5de343a3727a5b0cd7 | Python | ObinnaObeleagu/evalml | /evalml/pipelines/components/estimators/regressors/linear_regressor.py | UTF-8 | 2,059 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | from sklearn.linear_model import LinearRegression as SKLinearRegression
from evalml.model_family import ModelFamily
from evalml.pipelines.components.estimators import Estimator
from evalml.problem_types import ProblemTypes
class LinearRegressor(Estimator):
"""Linear Regressor.
Arguments:
fit_interce... | true |
d221fef20a88350367117f8ce039e72b48c64e90 | Python | felixblind/InfoGAN-for-Shapes | /CreateShapes.py | UTF-8 | 10,512 | 3.3125 | 3 | [] | no_license | import pygame
import sys
import os
import numpy as np
from Shapes import Ellipse, Rectangle, Triangle
from MatrixContainer import Container
def createArea(margin, imageSize):
"""
This method just goes through a all possible combinations of position
and length of sides and gives back all these combination e... | true |
2b3ba412d6c4bd276d1af3a4aaf48dbfa21bbe8e | Python | Lex-23/decorators_and_descriptors | /decorators/descriptors/Descriptor.py | UTF-8 | 1,750 | 2.828125 | 3 | [] | no_license | import json
import datetime
from urllib.parse import urlparse
class BaseField:
def __init__(self, value):
self.value = value
def __get__(self, instance, owner):
issues = instance.parse()
val = instance.metadata[self.value]
return issues[str(val)]
class IntField(BaseField):
... | true |
afd00492ce42e6369fb92e67239ad390259521bc | Python | MichelleZ/leetcode | /algorithms/python/plusOne/plusOne.py | UTF-8 | 483 | 3.15625 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/plus-one/
# Author: Miao Zhang
# Date: 2021-01-13
class Solution:
def plusOne(self, digits: List[int]) -> List[int]:
n = len(digits) - 1
while n >= 0:
if digits[n] < 9:
digits[n] +... | true |
446baea3fb38a4d827c7354e2505bc8a4109b011 | Python | daryadm/python | /Misc/item in seq.py | UTF-8 | 189 | 3.640625 | 4 | [] | no_license | def count(sequence, item):
counter = 0
for i in sequence:
if i == item:
counter +=1
else:
counter == 0
print(counter)
count([1,2,"ff",4,"ffff",3,"ff",3,], "ff") | true |
518819834eb5f01a6df60f3bd4106ba280ce9009 | Python | sportsguys/NOM_backend | /server/roster/routes.py | UTF-8 | 2,192 | 2.71875 | 3 | [] | no_license | from flask import Blueprint, jsonify
from flask.globals import request
from server.roster.roster import RosterModel
from db.constants import position_map
from server.salary.routes import fit_salary_curve
from server.roster.roster_data import RosterDataLoader
import json
bp = Blueprint("roster_model", __name__)
@bp.ro... | true |
8f604dd0232653302658bdfcd94bd6ad4208f6f2 | Python | kosioreka/complex-retrieval | /Vector_Similarity.py | UTF-8 | 1,184 | 3.46875 | 3 | [] | no_license | import math
def Cosine(vec1, vec2):
result = InnerProduct(vec1, vec2) / (VectorSize(vec1) * VectorSize(vec2))
return 0 if math.isnan(result) else result
def VectorSize(vec):
return math.sqrt(sum(math.pow(v, 2) for v in vec))
def InnerProduct(vec1, vec2):
return sum(v1 * v2 for v1, v2 in zip(vec1, ... | true |
2a69c84e649d3d61707b73246562c4b445e732ad | Python | gefero/data_misc | /data_misc/cat_encoding.py | UTF-8 | 873 | 3.015625 | 3 | [] | no_license | class Thermo_Encoding(BaseEstimator, TransformerMixin):
"""
Thermometer encoding for ordinal variables in pd.Series objects.
Parameters:
-----------
order_labels: dict, with categories of the variable as keys and codes as values
Values:
-------
Returns a pd.DataFrame.
"""
def... | true |
fc219ccfd3ac600e3b31a6f482274d04c8889cdb | Python | bmjcode/tkFilterList | /tkfilterlist/widget.py | UTF-8 | 10,974 | 2.96875 | 3 | [
"MIT"
] | permissive | """Implementation of the FilterList widget."""
try:
# Python 3
from tkinter import *
from tkinter.ttk import *
except (ImportError):
# Python 2
from Tkinter import *
from ttk import *
__all__ = ["FilterList"]
class FilterList(Frame):
"""A combination Listbox and Entry widget with automa... | true |
740f9e0cf6f7d4ef4f83abcb42a2c661a2a31f86 | Python | bast-i/hierarchy | /hello.py | UTF-8 | 1,777 | 2.71875 | 3 | [
"MIT"
] | permissive | """Cloud Foundry test"""
from flask import Flask, render_template, Markup, request, redirect, url_for
import os
import json
from werkzeug import secure_filename
UPLOAD_FOLDER = '/tmp/'
ALLOWED_EXTENSIONS = set(['txt'])
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
COLOR = "#33CC33"
# get CF envi... | true |
313354e3a5c2a7326c565be3bf038d54a4c975c0 | Python | Manav-Tailor/robot2021 | /docs/other/python_example/example2.py | UTF-8 | 807 | 4.1875 | 4 | [] | no_license | # Classes
import math
class Point:
# The constructor
def __init__(self, x, y):
self.x = x
self.y = y
# An instance method
def distTo(self, other):
if not isinstance(other, Point):
raise TypeError("Must be to another point")
return math.dist((s... | true |
e3c3333c132f9d9bd22fd292eaa590a69a26bb0f | Python | atcollab/at | /pyat/at/physics/harmonic_analysis.py | UTF-8 | 9,471 | 2.875 | 3 | [] | no_license | """
Simplified version of harpy from
Jaime Coello Maria de Portugal - Martinez Vazquez
Github: https://github.com/pylhc/harpy
"""
from __future__ import annotations
import numpy
from warnings import warn
from scipy.fft import fft, fftfreq
from at.lattice import AtWarning
from at.lattice import AtError
__all__ = ['ge... | true |
63ea6a943f48c81c5aca11afd636da74e548d951 | Python | Tubbz-alt/SSRGAN | /ssrgan/models/utils.py | UTF-8 | 9,706 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2020 Dakewe Biotech Corporation. 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... | true |
9188f661cc51162ef1779ccf70a03bfbffadddb7 | Python | kluczkovski/course_of_python | /lesson_21_QS.py | UTF-8 | 748 | 3.09375 | 3 | [] | no_license | #! /usr/bin/Python
import os
import cgi
import urllib.parse
def printHeader():
print("Content-type: text/html")
print("")
print("<html>")
print("<head><title>Get information by Query String</title></head>")
print("<body>")
def printFooter():
print("</body>")
print("</html>")
printHeade... | true |
fd46577f6b6540a3b9f5b713805a617eb838e009 | Python | edebie/pyalcs | /tests/lcs/agents/racs/test_Effect.py | UTF-8 | 1,969 | 2.5625 | 3 | [
"MIT"
] | permissive | import pytest
from lcs import Perception
from lcs.agents.racs import Configuration, Effect
from lcs.representations import UBR
class TestEffect:
@pytest.fixture
def cfg(self):
return Configuration(classifier_length=2,
number_of_possible_actions=2,
... | true |
38aed567ab0e24f1c3c2330d55e246461c8d73a3 | Python | luzpaz/freecad-transportation-wb | /transportationwb/transversmercator.py | UTF-8 | 2,477 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
TransverseMercator:
"author": "Vladimir Elistratov <vladimir.elistratov@gmail.com> and gtoonstra",
"wiki_url": "https://github.com/vvoovv/blender-geo/wiki/Import-OpenStreetMap-(.osm)",
"tracker_url": "https://github.com/vvoovv/blender-geo/issues",
'''
import FreeC... | true |
213659e11a92a68b4e5a9218c71579b885ed2144 | Python | nischalshrestha/automatic_wat_discovery | /Notebooks/py/priyanksharma/kernele38d5c1513/kernele38d5c1513.py | UTF-8 | 8,059 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Neural network for Titanic Problem. However my model is not doing great.
# But I hope it might help those who are just starting with Machine learning.
# In[ ]:
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/pyt... | true |
ebb103f18be148c81f60d92d5fc2b930986cd1de | Python | mjpcollins/food-shop-generator | /tests/unittests/test_data.py | UTF-8 | 1,817 | 2.609375 | 3 | [] | no_license | from unittest import TestCase
from tests.unittests_utils.misc import *
from utils import Data, Recipe
class TestData(TestCase):
def setUp(self):
self.starting_recipes = get_starting_recipes()
self.starting_recipes_plus_one = get_starting_recipes_plus_one(self.starting_recipes)
self._filep... | true |
b2d168ba313e058cc30e1f352c697ae2f00e5e50 | Python | rjjanney/OWGR-Headshots | /6_scrape_rank_name_2ndPass.py | UTF-8 | 4,630 | 3.03125 | 3 | [] | no_license | from bs4 import BeautifulSoup
from openpyxl import load_workbook
from openpyxl import Workbook
from openpyxl.styles import PatternFill
import requests
red = "00FF8080"
green = "0080FF80"
def get_rank_names_list():
'''
A function to scrape the top 100 PGA player rankings and names
from www.owgr.com/ranki... | true |
3ae046908aff4a706db1cccb4c39c9a7de98578a | Python | Lucila666/Python | /Programacion1/tp1/funciones.py | UTF-8 | 10,818 | 4.125 | 4 | [] | no_license | #1.Desarrollar una función que reciba tres números positivos y devuelva el mayor de los tres,
# sólo si éste es único (mayor estricto). En caso de no existir el mayor estricto devolver -1.
#No utilizar operadores lógicos (and, or, not). Desarrollar también un programa para ingresar
#los tres valores, invocar a la fun... | true |
44042a622a74f4ecdc46a6b0d7177b90f473bb8e | Python | godspysonyou/everything | /datastructure/shu/erchashu.py | UTF-8 | 3,551 | 3.75 | 4 | [] | no_license | #######
#类名称:SequenceBinaryTree
#类说明:定义一颗顺序存储的二叉树
#类释义:包含存储二叉树每一个结点的数组
#######
class SequenceBinaryTree(object):
def __init__(self):
self.sequenceBinaryTree=[]
#######
#类名称:LinkedBinaryTreeNode
#类说明:定义二叉树的一个结点
#类释义:分别有结点值data,该结点的左孩子LeftChild和该结点的右孩子RightChild
#######
class LinkedBinaryTreeNode(object):... | true |
c5e99ec8388c106afd1eace01fa5536eae0b8e6e | Python | tyut-zhuran/python_learn | /基础/进程间通信.py | UTF-8 | 567 | 3.453125 | 3 | [] | no_license | from multiprocessing import Queue
if __name__ == "__main__":
q = Queue(3)#创建一个队列,最多容纳3条消息
print(q.qsize())#当前的size
print(q.full())
q.put("1")
q.put("2")
print(q.get())
print(q.get())
print(q.empty())
q.put("1")
q.put("2")
q.put("3")
print(q.full())
print(q.get())
print(q.get())
print(q.get())
#print(q... | true |
020b69d174233be0b0a300b8eac336d364edbddf | Python | FrankYogan/Kears-AI_MOOC | /12.绘制网络结构.py | UTF-8 | 2,554 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
from keras.datasets import mnist
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Dropout, Convolution2D, MaxPooling2D, Flatten
from keras.optimizers import Adam
from keras.utils.vis_utils import plot_model
import m... | true |
7a646828922e1ef31a4149d90275e25de151003d | Python | crodrigr/Fundamentos-Programaci-n | /DiccionarioContarIniciales.py | UTF-8 | 294 | 2.96875 | 3 | [] | no_license | from collections import Counter
line = 'El:elef:ante:avanza:hacia:Asia'
#line = 'Varias vacas vuelan sobre Venezuela'
words = line.split(":")
print(words)
letters = [word[0] for word in words]
print(letters)
final = "".join(letters)
mini = str.lower(final)
frase = Counter(mini)
print (frase) | true |
9c209e1a569537cf608844a7b364aad554c0b70f | Python | slp520/Python-zixue | /Nginx.py | UTF-8 | 3,193 | 2.609375 | 3 | [] | no_license | # !/usr/bin/python
# --*coding:utf-8 -*-
'''
auth:lzq
desc:监控Nginx后端服务响应的状态,一旦响应时间超过10ms,累计次数超过10次,将通过邮件告警
date:2016-12-06
remake:因为nginx每天23:59分会做一次备份,旧的access.log会被临时删掉,一旦删掉该监控程序将会
失效(问题暂时还不能通过python自身解决),只能通过把如下语句加入Nginx备份脚本配合,定时重启python程序,但能解决问题就OK了。
ps aux | grep monitoring.py | grep -v "grep" | awk -F' ' '{pr... | true |
57531baac3dff7c167203e2f2313ee7a88d2db59 | Python | isce-framework/fringe | /src/despeck/despeck.py | UTF-8 | 2,568 | 2.71875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import os
import argparse
def cmdLineParser():
'''
Command line parser.
'''
parser = argparse.ArgumentParser(description = 'Despeckle SLC amplitude / single look interferogram',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i'... | true |
2a874eb4ec8b4801a4dc335b3c2102245f08d80c | Python | JAYARAKKINI/code_kata_guvi_python | /Basics/reverse.py | UTF-8 | 40 | 2.90625 | 3 | [] | no_license | S=input().split()
S.reverse()
print(*S)
| true |
ce90763610798202bba824e355bb51b26aafd54a | Python | liuguang1004/T149_python_dev | /class2/demo15_for.py | UTF-8 | 525 | 3.75 | 4 | [] | no_license | #for的第二种用法
# score_list=[100,99,77,66,54,1000]
#
# for score in score_list:
# print(score)
# 1. 1到100求和
# sum=0
# for i in range(1,101,1):
# sum=sum+i
#
# print('1+2+3+...+100=%d'%sum)
# 2. 100到1求和
# sum=0
# for i in range(100,0,-1):
# sum=sum+i
#
# print('100+99+98+...+1=%d'%sum)
# 3. 1到100求和,如果结果累计到了66... | true |
de4d5b0dca0353a0a52fb069df501a0e66b84167 | Python | accxev/social_choice_fairness | /socialchoice/vote/society.py | UTF-8 | 12,917 | 3.421875 | 3 | [] | no_license | '''
This package contains all basic objects related to social choice / assigment problems and their solution
Created on 8 Sep 2015
@author: Tobias Meggendorfer
'''
import collections
import math
from functools import total_ordering
@total_ordering
class Choice(object):
'''
Wrapper class for choice objects
... | true |
38f353cb62a5366fb1cc44380d7bb1825afae114 | Python | HLT-ISTI/QuaPy | /quapy/data/reader.py | UTF-8 | 4,413 | 3.46875 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from scipy.sparse import dok_matrix
from tqdm import tqdm
def from_text(path, encoding='utf-8', verbose=1, class2int=True):
"""
Reads a labelled colletion of documents.
File fomart <0 or 1>\t<document>\n
:param path: path to the labelled collection
:param encoding: the text enc... | true |
956a83dfecc5f66fcbd4dbf4169efdec3f1d9f11 | Python | AliceRabbit/- | /work1/exgcd.py | UTF-8 | 445 | 2.859375 | 3 | [] | no_license | A=[0,1]
N=[1,0]
A.append(int(input('Please input a:')))
N.append(int(input('Please input n:')))
def Extended_Euclid(a,n):
if a[2]==0:
print('无逆元,gcd(%d,%d)= %d'%(a[2],n[2]))
elif a[2]==1:
print('gcd(a,n)=%d\na的逆元: %d'%(a[2],a[1]))
else:
Q=n[2]//a[2]
t1,t2,t3=[(n[0]-Q*a[0]),(n... | true |
77df2904ad3f41359f51df675d70228c5d2902ad | Python | geokala/music_tutorial | /toolbox/4_multiple_hands.py | UTF-8 | 443 | 2.578125 | 3 | [] | no_license | # Or multiple instruments, yes, that too.
right_hand = stream.Part()
right_hand.append(note.Note('c4'))
right_hand.append(note.Note('d4'))
right_hand.append(note.Note('e4'))
right_hand.append(note.Note('f4'))
left_hand = stream.Part()
left_hand.append(note.Note('c5'))
left_hand.append(note.Note('d5'))
left_hand.appen... | true |
edd155255dd361e9584cba8815b6b24941eca311 | Python | k3-cat/olea | /olea/packages/pypat/pat.py | UTF-8 | 3,226 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | __all__ = ['Pat']
import time
from typing import Any, Dict, Tuple
from .cipher import BaseCipher, aes_gcm
from .encoder import base85
from .serializer import BaseCompresser, BaseObjSerializer, json, lzma
from .signer import BaseSigner, hmac
class Serializer():
def __init__(self, obj_serializer: 'BaseObjSerializ... | true |
3c390136492e82047da8d8849735038cad704474 | Python | daniel-reich/ubiquitous-fiesta | /bo4REhn9paGcFoMBs_20.py | UTF-8 | 176 | 3.265625 | 3 | [] | no_license |
def age_difference(ages):
ages.sort()
diff = ages[-1]-ages[-2]
return "{} year{}".format(diff, "s" if diff>1 else "") if diff else "No age difference between spouses."
| true |