blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
0ad412b3aa5853c32830af7088ebcf3ffcf4981e | Andy-Dufrein/course-content | /tutorials/W2D1_BayesianStatistics/solutions/W2D1_Tutorial4_Solution_ee8aff37.py | UTF-8 | 1,900 | 3.34375 | 3 | [
"CC-BY-4.0"
] | permissive | def expected_loss_calculation(x, posterior):
ExpectedLoss_MSE = np.zeros_like(x)
ExpectedLoss_ABSE = np.zeros_like(x)
ExpectedLoss_01 = np.zeros_like(x)
for idx in np.arange(x.shape[0]):
estimate = x[idx]
###################################################################
## Insert code below t... | true |
816908aa95750161d8e5bf227b0a4a164ae9c78e | edmondmanta/IT_School_book_project | /ItSchoolBookApp.py | UTF-8 | 4,309 | 3.46875 | 3 | [] | no_license | #
def add_book():
book_name = input("Insert a book name -> ")
author_name = input("Insert a author name -> ")
# importing CSV lib
import csv
with open('booksDB.csv', mode='a', newline='') as file:
# writer = csv.DictWriter(file, fieldnames=[
writer = csv.DictWriter(file, fieldnames=[... | true |
02f43340ec3153dfad329a576705911f6fbe64ce | DirkBremen/PP_GoogleCloudWebhook_IPN | /GoogleCloudFunctionsWebhookListenerPython/webhookListener.py | UTF-8 | 1,207 | 2.734375 | 3 | [] | no_license | def webhook_listener(request):
"""Responds to any HTTP request.
Args:
request (flask.Request): HTTP request object.
Returns:
The response text or any set of values that can be turned into a
Response object using
`make_response <http://flask.pocoo.org/docs/1.0/api/#flask.Flask... | true |
1e74c2ee2f92c605e668c468f96a372b3f08df40 | antonsolovyev/pybasil | /wordcount.py | UTF-8 | 299 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
f = open('/Users/antonsolovyev/Documents/usdeclar.txt')
contents = f.read()
word_counts = {}
for s in contents.split():
word_counts[s] = int(word_counts.get(s, '0')) + 1
for w in sorted(word_counts.keys()):
print('word: "%s" occurs: %d times' % (w, word_counts[w])) | true |
fbbe0256aee2267389a9f965308598c965719db2 | NextCenturyCorporation/MCS | /machine_common_sense/action.py | UTF-8 | 30,047 | 3 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | from enum import Enum, unique
from typing import Tuple
import typeguard
@unique
class Action(Enum):
"""
The actions available in the MCS simulation environment.
For actions requiring objectImageCoords or receptacleObjectImageCoords,
note that (0,0) represents the top left corner of the viewport, and... | true |
7769f9f4341600043b054b17fe446bf88e443c41 | Otavioarp/BCC-701 | /PT2/q2.py | UTF-8 | 1,355 | 3.609375 | 4 | [] | no_license | '''
Otávio Augusto de Rezende Pinto
Email: otaviopqsi@gmail.com
'''
def preencherMatriz(valores , tipo):
matriz = []
linhas = valores.split(';')
for i in range(len(linhas)):
colunas = linhas[i].split(',')
vetor = []
for j in range(len(colunas)):
if tipo == 'int':
... | true |
8b08547e05c73f502ea20536f21cd297057799aa | shahsarick/clueless | /client/Client.py | UTF-8 | 3,638 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import logging
import select
import socket
import sys
from observer.observer import observerObject
from common.MessageProtocol import MessageProtocol
# reference the subject
obsObj = observerObject()
class Client:
__socket_timeout = 2
__select_timeout = 0.5
__read_size = 4096
... | true |
11ed10df8130f5ebba2a45db094d01791febe972 | aelfering/100-Days-of-Python-Code | /Day 2 - Understanding Data Types and How to Manipulate Strings/Day 2 Mathematical Operations in Python.py | UTF-8 | 1,194 | 4.3125 | 4 | [] | no_license | # mathematical operations you can use in Python
subtraction = 3-7
addition = 3 + 7
multiplication = 3 * 7
division = 3/7
# division ALWAYS ends in a decimal
print(type(3/7))
exponent = 2**2
# order of operations matter
# PEMDAS LR
# Parentheses ()
# Exponents **
# Mul... | true |
eb678d5e94973679ee77db06fd86c60e770e5250 | iamzunclegithub/MyTest | /TextFire.py | UTF-8 | 1,127 | 2.671875 | 3 | [] | no_license | import win32gui,win32con,win32clipboard
def getPathAndList():
with open('垃圾话.txt','r') as file:
path = file.readline()
fivelist = []
five = file.readline()
while five:
fivelist.append(five)
five = file.readline()
return path,fivelist
def ... | true |
5e53e7a7ab2788f4e6a186aec58ee091277ff28f | ackness/preprocess_mpiigaze | /preprocess_mpii.py | UTF-8 | 1,526 | 2.546875 | 3 | [] | no_license | import argparse
import os
import pickle
import tqdm
from utils import *
parser = argparse.ArgumentParser()
parser.add_argument('-p', type=str, required=True, help='Path to MPIIGaze Orignal dir')
parser.add_argument('-s', type=str, default='mpiigaze-norm-rgb.pickle',
help='Path to save results, is... | true |
144955322a520dba66db80f21194e9c6f76e40dd | ThunderDogs5613/pyfrc | /lib/pyfrc/sim/sim_time.py | UTF-8 | 3,994 | 2.78125 | 3 | [
"MIT"
] | permissive |
import time
import threading
class FakeRealTime:
'''
This allows the robot to run in realtime, or we can pause and
single-step the robot.
This implementation will break anything that is trying to measure
time while paused.. but really, that shouldn't be expected to
wor... | true |
78632af0061f89e1744d816bd56919ecda568748 | flamma7/state-estimation | /kalman_linear/filters/kalman_dynamic_scalar.py | UTF-8 | 5,052 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import rospy
from geometry_msgs.msg import PoseWithCovarianceStamped
import numpy as np
from threading import Lock # locks can only be unlocked by their current thread
"""
This program should estimate the value of a dynamic scalar, printing out its mean covariance w... | true |
347f7dd1ed0c638fe8ede311821555fc9c157a49 | hannahramadan/sustainableseafood | /model.py | UTF-8 | 2,972 | 2.8125 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
import json
db = SQLAlchemy()
class User(db.Model):
"""A user belonging to Sustainable Fish."""
__tablename__ = "users"
user_id = db.Column(db.Integer, autoincrement=True, primary_key=True)
email = db.Column(db.String(50), nullable=False, unique = True)
p... | true |
38e3519b951c94f296a0342b6c68acaf6e0d926d | numpy/numpy | /numpy/lib/tests/test__datasource.py | UTF-8 | 10,571 | 2.703125 | 3 | [
"Zlib",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | import os
import pytest
from tempfile import mkdtemp, mkstemp, NamedTemporaryFile
from shutil import rmtree
import numpy.lib._datasource as datasource
from numpy.testing import assert_, assert_equal, assert_raises
import urllib.request as urllib_request
from urllib.parse import urlparse
from urllib.error import URLEr... | true |
e3fb5bb73cc88baa34d3f3498e81c8be606cc78f | Vazimax/map_filter_lambda | /lambda.py | UTF-8 | 396 | 4.03125 | 4 | [] | no_license | #### The first way : ###
"""
def sorter(item):
return item['age']
students = [
{'name':'Bakr','age':16},
{'name':'Carlos','age':16}
]
students.sort(key=sorter)
print(students)
"""
### The second way : ###
students = [
{'name':'Bakr','age':16},
{'name':'Carlos','a... | true |
5355a7561574bdd57506271c7d68dbf4c905baa4 | HighTowelie/pythonProject | /argparse_1.py | UTF-8 | 280 | 2.96875 | 3 | [] | no_license | import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("a", type=int)
parser.add_argument("b", type=int)
namespace = parser.parse_args()
print(namespace.a)
print(namespace.b)
print(namespace.a + namespace.b) | true |
6fd03aceedd9878cccd4570f3133f3528587688f | Chenyijun13/Coursework | /customer.py | UTF-8 | 858 | 3.53125 | 4 | [] | no_license | """Name: Yijun Chen; UoBNo:lm20306; StudentID:2033739.
This code is used to check the availability of the program
when incorrect values and information are entered
"""
Customer_Class in Part1,
define customer class with two actions,
renting and returning a car.
class Customer:
#Initialized wi... | true |
6beb225b983e81acc8b48785bdec959589363727 | yeongsunpark/good | /etri9/countmean.py | UTF-8 | 1,490 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by YeongsunPark at 2019-06-03
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import json
df = pd.read_csv("/home/msl/ys/cute/data/cw0530/result_morp/recall.txt", error_bad_lines=False, ... | true |
1b07b4b6ed0bcce1b5e79f7493fa2299494ef120 | student-work-agu-gis2021/lesson9-geopandas-Miwa-Yamamori | /Exercise_9_problem_1.py | UTF-8 | 4,175 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Problem 1: Create Polygon from lists of coordinates
#
import os
import geopandas as gpd
import matplotlib.pyplot as plt
from shapely.geometry import Polygon
# Longitudes in decimal degrees
longitudes = [29.99671173095703, 31.58196258544922, 27.738052368164062, 26.5001354217... | true |
a55cbb442ff50ec6ef45913878d92edb4fa722c9 | RagingClown/MyPy | /Exercises/EulerProject/e_3.py | UTF-8 | 402 | 3.921875 | 4 | [
"MIT"
] | permissive | # What is the largest prime factor of the number 600851475143?
#example -- > 45 -- > 3 * 15 -- > 3 * 3 * [5]
import math
def prime_factor(number):
while number % 2 == 0: # dealing with the unique prime 2
number /= 2
n = 3
while n < math.sqrt(number):
if number % n == 0:
... | true |
881481dc0d2442b37bf30248a013f615bbfaaf35 | kaminee1jan/list.py | /sb__ sath mai.py | UTF-8 | 608 | 3.25 | 3 | [] | no_license | elements=[23,14,56,12,19,9,15,25,31,42,43]
i=0
even_count=0
odd_count=0
s_count=0
even_sum=0
odd_sum=0
s_sum=0
while i<len(elements):
if elements[i]%2==0:
even_count=even_count+1
even_sum=even_sum+elements[i]
else:
odd_count=odd_count+1
odd_sum=odd_sum+elements[i]
s_sum=s_su... | true |
f95649885370ca80e51dbf27c176d0925f75e7a3 | zwbond/insitu_sim_python | /insitu/field_qterm.py | UTF-8 | 18,096 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
# from insitu.controlsair import load_cfg
import scipy.integrate as integrate
import scipy as spy
import time
import sys
from progress.bar import Bar, IncrementalBar, Fillin... | true |
eefdcb55449872ed6706339e02cf70beed96b7e6 | ankushjain2001/NYC-Open-Data-Profiling | /task2/src/task2.py | UTF-8 | 33,260 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import os
import re
import sys
import json
import time
import pyspark
from ast import literal_eval
from copy import deepcopy
from datetime import datetime
from pyspark import SparkContext
from pyspark.sql import SQLContext, SparkSession, Row
from pyspark.sql.functions import udf, ... | true |
b1fa21ce6a05b415f79d0389b5429b2f3ca95e37 | ParkerKain/ReservoirComputing | /PyESN Trial.py | UTF-8 | 2,670 | 3.15625 | 3 | [] | no_license | import numpy as np
from pyESN import ESN
#Set Seed
rng = np.random.RandomState(42)
def sigmoid(a):
"""Sigmoid (logistic) firing function."""
return 1/(1 + np.exp(-a))
def dsigmoid(b):
"""Derivative of sigmoid firing function b=fire(a), as function of b."""
# Used in the backpropagation algorithm... | true |
59e6d1e61316843f2638c5ef8104af3b4810a9cb | ArcSelf/GPT3-Chatbot | /GPT3-ChatBot.py | UTF-8 | 1,519 | 3.03125 | 3 | [
"MIT"
] | permissive | import openai as ai
def chat(question,chat_log = None) -> str:
if(chat_log == None):
chat_log = start_chat_log
prompt = f"{chat_log}Human: {question}\nAI:"
response = completion.create(prompt = prompt, engine = "davinci", temperature = 0.85,top_p=1, frequency_penalty=0,
presence_penalty=0.7, ... | true |
a7d880fbc2f93952401171e5e8ed7831e82c3f9a | VahagnAleksanyan/ExpressionCalculators | /qa/ExpressionGenerator.py | UTF-8 | 1,462 | 3.09375 | 3 | [] | no_license | import random
import os
INT32_MIN = -2**31
INT32_MAX = 2**31-1
class ExpressionGenerator:
def generateExpression(size):
numbers = []
signs = []
for _ in range(size):
type = random.randint(1,2)
if type == 1: numbers.append(random.randint(0,INT32_MAX)) # Integer
elif type == 2: numb... | true |
5a7baab3d370af2318df6e31c6a7e90c9f817845 | Joshua-Thornton/Joshua-Thornton.github.io | /profile/assets/projectCode/python/microbit.py | UTF-8 | 1,413 | 2.6875 | 3 | [] | no_license |
from microbit import *
import music
import random
running = False
ne = Image('00999:'
'00099:'
'00809:'
'07000:'
'60000:')
se = Image('60000:'
'07000:'
'00809:'
'00099:'
'00999:')
sw = Image('00006:'... | true |
e80187b35a47b963d09b9fc249f11741b1e63719 | nlandolfi/duo | /robot.py | UTF-8 | 2,477 | 2.84375 | 3 | [] | no_license | import numpy as np
import opt
import geo
import belief
# A robot is a function
# R: (alpha, state, goals, beliefs, past_u_r, u_h) -> (action, new_beliefs)
# four main robot controllers:
# 1. teleop (no inference, copy human)
# 2. shared (inference, expecation planning)
# 3. info (inference, entropy plannin... | true |
c9099697cda89b152f82b9c14ba8be8e127100ad | FredLoh/HackMTY | /Bot/src/router.py | UTF-8 | 7,816 | 2.546875 | 3 | [] | no_license | """
The Route Layer.
Here the message is routed to its proper view.
The routes are defined with regular expressions and callback functions (just like any web framework).
"""
import threading
import re
import logging
from yowsup.layers.protocol_messages.protocolentities import TextMessageProtocolEntity
from ... | true |
9af606a350b71bb10538993026548b393bfd2c43 | LeeSeok-Jun/Algorithms | /algorithms_questions/ch17_shortest_path/q40_0.py | UTF-8 | 2,311 | 3.546875 | 4 | [] | no_license | """
숨바꼭질
- 동빈이는 술래로 부터 도망치기 위해 1~N번 까지의 헛간 중 하나에 숨을 수 있다.
- 술래는 항상 1번 헛간에서 출발하여 동빈이를 찾는다.
- 전체 맵에는 총 M개의 양방향 통로가 존재하며 하나의 통로는 다른 두 헛간을 연결한다.
- 전체 맵은 항상 어떤 헛간에서 다른 어떤 헛간으로 도달이 가능한 형태로 주어진다.
- 동빈이가 1번 헛간으로 부터 최단 거리가 가장 먼 헛간이 가장 안전하다고 판단한다.
* 최단 거리는 지나야 하는 길의 최소 개수를 의미한다.
- 동빈이가 숨을 헛간의 번호를 출력하는 프로그램을 작성하시오.
입력 조건
- 첫... | true |
2a1fca9059fe69e76a252f214289afafbe93ee2e | USnark772/-RSCompanionV1 | /View/DisplayWidget/graph_frame.py | UTF-8 | 3,493 | 2.703125 | 3 | [] | no_license | """ Licensed under GNU GPL-3.0-or-later """
"""
This file is part of RS Companion.
RS Companion is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later versi... | true |
4c035fc7ae227241906e05028ae11af0a44eb91e | birendra7654/python_design_pattern | /SOLID/OpenClosedPrinciple/ocp.py | UTF-8 | 2,733 | 3.65625 | 4 | [] | no_license | from enum import Enum
from typing import List
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3
class Size(Enum):
SMALL = 1
MEDIUM = 2
LARGE = 3
class Product:
def __init__(self, name, color, size):
self.name = name
self.color = color
self.size = size
# Specificat... | true |
b83281a4626e3892153186b3102949c717646db5 | douglasliralima/Beak | /Clientes[CodigoLegado]/business/relatorio.py | UTF-8 | 417 | 2.71875 | 3 | [] | no_license | from business.gerenciadoresRelatorio.relatorioJson import relatorio_json
from business.gerenciadoresRelatorio.relatorioHtml import relatorio_html
class relatorio:
def __init__(self, tipo):
tipo = tipo.lower()
if (tipo == 'json'):
self.__relatorio = relatorio_json()
elif (tipo == 'html'):
self.__relator... | true |
7255f81f74d6cc681d09a166dbf87910c095c25e | SufyanIqbal1/Python-Training | /Nums.py | UTF-8 | 1,000 | 4 | 4 | [] | no_license | Ones = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
Tys = ["ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
strNum = int (input ("Please... | true |
5549e9c1e65c78b239c5e243265dc1c27f327fa6 | OrianaPeltzer/aa290_fall2018 | /src/drivingOrigin.py | UTF-8 | 10,984 | 2.578125 | 3 | [] | no_license | """
Nonlinear kinematic car model implemented by
James Harrison and Boris Ivanovic.
Implements a 5D state space where the agent drives to the origin.
"""
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
import scipy
from scipy.integrate import odeint
#from... | true |
a2a243d1db4893914353bc435715e89c11388658 | vmm221313/FineTuningBERT_Semeval17_Task3 | /.ipynb_checkpoints/finetuning_model-checkpoint.py | UTF-8 | 748 | 2.859375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.optim as optim
class finetuning_model(nn.Module):
def __init__(self, embedding_dim, num_output_classes):
super(finetuning_model, self).__init__()
self.embedding_dim = embedding_dim
self.num_output_classes = num_output_classes
self.l... | true |
dca28bc2c78b573a03ecd97ffd3bfb6e9c573ecb | amarnadhreddymuvva/pythoncode | /prime or not.py | UTF-8 | 223 | 3.625 | 4 | [] | no_license | num=int(input("enter a number"))
if (num>1):
for i in range(2,num):
if (num%i==0):
print("not prime")
break
else:
print("prime")
else:
print("enter a number above 1")
| true |
4ef9ee37c5cf359c7ad69a0fb9f3249f96ab41e4 | cieske/exercises | /Beakjoon/4949.py | UTF-8 | 623 | 3.609375 | 4 | [
"MIT"
] | permissive | while True:
sen = input()
if sen == '.':
break
stack = []
braek = True
for char in sen:
if char == '(':
stack.append(char)
elif char == '[':
stack.append(char)
elif char == ')':
if stack and stack[-1] == '(': stack.pop()
... | true |
9c96c9302ecf807d609d7be568eb2b627508d216 | sgonza03/Project_Uno | /Project_1 (2).py | UTF-8 | 5,232 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#Import packages needed
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import csv
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
#Bring excel file into python
df = pd.read_csv(r'C:\Users\gonza\Documents\Projects\proje... | true |
412bbdec427ff877770cab56f66485535178fc7e | Randomperson999/Python-2020 | /GUI/LoginScreen.py | UTF-8 | 2,907 | 3.3125 | 3 | [] | no_license | # Caleb Keller
# 1/26/2021
# 1st-2nd
# ---|Text Boxes|---
from tkinter import *
class App(Frame):
def __init__(self, master):
self.usernames = ["[name]"]
self.passwords = ["Passworld"]
self.trys = 0
super(App, self).__init__(master)
self.grid()
self.bg... | true |
4602f07f0692d697c5bff3bfc3fb02eac58277d3 | cohend2012/Python-and-EEE591-Python-for-Rapid-Engineering-Solutions | /m4_gui3.py | UTF-8 | 1,748 | 4.0625 | 4 | [] | no_license | # now show some radio buttons
import tkinter as tk # get the package
LANGS = ["None","Python","Perl","Java","C++","C"] # language choices
################################################################################
# callback function to display which button was pushed ... | true |
99e9487b095a328c8326f20298a42cea4646d5f6 | rkoschmitzky/logbook | /widget.py | UTF-8 | 17,357 | 2.578125 | 3 | [
"MIT"
] | permissive | import logging
from difflib import context_diff
from functools import partial
import re
from Qt import (
QtGui,
QtWidgets,
QtCore
)
from .handler import LogbookHandler
class Worker(QtCore.QRunnable):
def __init__(self, func, *func_args, **func_kwargs):
super(Worker, self).__init__()
... | true |
41495a957590672fb6d4d099058c2d688eb9a185 | rjanssen96/discrete_structures | /answer_checker.py | UTF-8 | 9,179 | 3.09375 | 3 | [] | no_license | from sympy.parsing.sympy_parser import parse_expr
import time
import file_writer
from pathlib import Path
# Checking if the user wants to automatically check every ccomma file or do one (or more) manually
def answer_check_manual_or_auto():
manual_or_auto = input("Do you want to check everything automatically (a) o... | true |
9befa1ea8e3fe0713fcd83bbf02bc87e169bc976 | JowOfBeco/BancoBlue---Python | /modulos.py | UTF-8 | 185 | 3.296875 | 3 | [] | no_license |
def Deposito(saldo_, deposito):
return saldo_ + deposito
def Saque(saldo_, saque):
return saldo_ - saque
def Consult(saldo):
print("Seu saldo atual é {}.".format(saldo)) | true |
1ca1eca2e43fa4b6abf034eefd386f897bf3946d | jssellars/aniket_filed | /Core/Web/FacebookGraphAPI/GraphAPIMappings/ActionFieldCondition.py | UTF-8 | 1,379 | 3.03125 | 3 | [] | no_license | import typing
from enum import Enum
def equals(x, y):
return x == y
def not_equals(x, y):
return not equals(x, y)
def is_in(x, y):
return x in y
def not_is_in(x, y):
return not is_in(x, y)
def is_like(x, y):
return y.find(x) > -1
class ActionFieldConditionOperatorEnum(Enum):
EQUALS =... | true |
e283f692aa483572aace9b1a63587b68afbc3620 | lshreyas/yelp | /yelp.py | UTF-8 | 17,465 | 2.546875 | 3 | [] | no_license | # Written by Mariah Krimchansky, Nicole Gonzalez, Shreyas Lakhtakia
# Last updated: 12/11/15, 11pm
# ELE/COS 381
# Final Project
import json
import sys
import matplotlib.pyplot as plt
from scipy import stats
# READ IN DATA -----------------------------------------------------------------
# some data doesnt list its ... | true |
db24e1966ea7712b3d13c79229ba018a4f254a88 | monsterone/lemotest | /class01/class5_tuple.py | UTF-8 | 1,480 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/3/10 22:10
# @Author : Monster
# @Email : 945534456@qq.com
# @File : class5_tuple.py
#【5】: 元祖 tuple 符号()
a=(1,0.02,'hello',[1,2,3],True,(4,5,6))
# 1:可与存在空元祖a=()
# 2:元祖里面可以包含任何数据类型 # print(type(a))
# 3:元祖里面的元素 根据逗号来进行分割
# 4:元祖里面的元素 也是有索引 索引值从0开始
# 5:获取元祖里面的单个值: 元祖... | true |
6aa73e8e44dc6adc1592ac916978c557fbc29620 | wsylearn/algorithm010 | /Week04/11寻找旋转排序数组中的最小值.py | UTF-8 | 4,378 | 3.734375 | 4 | [] | no_license | # 假设按照升序排序的数组在预先未知的某个点上进行了旋转。
#
# ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。
#
# 请找出其中最小的元素。
#
# 你可以假设数组中不存在重复元素。
#
# 示例 1:
#
# 输入: [3,4,5,1,2]
# 输出: 1
#
# 示例 2:
#
# 输入: [4,5,6,7,0,1,2]
# 输出: 0
# Related Topics 数组 二分查找
# leetcode submit region begin(Prohibit modification and deletion)
# 1 解答成功: 执行耗时:32 m... | true |
d5c9c8a89a289ee7c5fd64dcd069fa70a7e524db | VideoCarp/dromedary-lang | /source/functions/lexer_functions.py | UTF-8 | 537 | 3.171875 | 3 | [
"MIT"
] | permissive | def line_above(count=1):
return line_list[line_index + count]
def line_below(count=1):
return lines[line_index - count]
def advance(count=1):
if token_index + count < len(lexed) and token_index + count>= 0:
token_index += count
token = lexed[token_index]
def back(count=1):
if token_in... | true |
e40074c0739f24dbe44dc18418da2b4488924dee | Yurikimkrk/PythonInterview | /les3/task_3.py | UTF-8 | 1,055 | 4.0625 | 4 | [] | no_license | """
3. Создать два списка с различным количеством элементов.
В первом должны быть записаны ключи, во втором — значения.
Необходимо написать функцию, создающую из данных ключей и значений словарь.
Если ключу не хватает значения,
в словаре для него должно сохраняться значение None.
Значения, которым не хватило ключей, не... | true |
790eaffede6339adc3f06928ceb6924f09354b35 | souravbadami/hackerrank | /itertools-permutations.py | UTF-8 | 312 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import print_function
from itertools import permutations
#import os
_str,pl=map(str,raw_input().split())
_str2=list(permutations(_str,int(pl)))
_str2.sort()
for i in xrange(len(_str2)):
for j in xrange(len(_str2[i])):
print(_str2[i][j],sep="",end="")
print() | true |
bf6554063c34f4ecb671c80fce75145765505d08 | hasantokdemir155/deneme | /web3.py | UTF-8 | 851 | 2.5625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
imd='https://www.imdb.com/name/nm0362766/'
#?ref_=nv_sr_srsg_3'
r=requests.get(imd)
soup=BeautifulSoup(r.content,'html.parser')
veri=soup.find('div',attrs={'id':'filmography'})
#veri1=veri.find('a')
print(veri)
#veri2= soup.find("table",attrs={'class':... | true |
f30bb306bfb9a978d9afb88056c3a1d3463316ad | pixelatedbrian/Indie-Game-Recommender | /src/IndieGR.py | UTF-8 | 20,677 | 2.796875 | 3 | [] | no_license | # import all of the spark stuff
import pyspark as ps
from pyspark.sql.types import *
from pyspark.ml.tuning import TrainValidationSplit
from pyspark.ml.recommendation import ALS
from pyspark.ml.evaluation import RegressionEvaluator
import pyspark.sql.functions as F
import pandas as pd
import numpy as np
from GameReco... | true |
53c6df95b05b0c24e5ceea2b9253f539d2b08d4f | heywiki/jython-book-examples | /chapter7/searchdir.py | UTF-8 | 300 | 2.609375 | 3 | [] | no_license | #Packages
import search.scanner as scanner
import sys
help = """
Usage: searchdir.py directory terms...
"""
args = sys.argv
if args == None or len(args) < 2:
print help
sys.exit()
dir = args[1]
terms = args[2:]
scan = scanner.ScanResults.scan(dir, terms)
scan.display()
| true |
0757949b474171a80a5095b4916a1ec20c9db643 | francoishideyos/lyoexsinkuan | /guests/models.py | UTF-8 | 1,433 | 2.5625 | 3 | [] | no_license | from __future__ import unicode_literals
import datetime
from django.db import models
from django.dispatch import receiver
from django.core.validators import RegexValidator
# Create your models here.
# these will determine the default formality of correspondence
class Guest(models.Model):
"""
A single gues... | true |
40ab0d3e68c0eaa84ef95591c097d9aa641f72f0 | rsisto/MonsterButia | /pythonAPI/pinza.py | UTF-8 | 2,358 | 2.765625 | 3 | [] | no_license | import butiaAPI
import time
PINZA_IZQ_CHASIS = "23"
PINZA_IZQ_PZA = "24"
PINZA_DER_CHASIS = "21"
PINZA_DER_PZA = "22"
OPEN_DER = 311
CLOSE_DER = 666
ALT_MAX_DER = 368
ALT_MIN_DER = 823
OPEN_IZQ = 980
CLOSE_IZQ = 74
ALT_MAX_IZQ = 0
ALT_MIN_IZQ = 0
butiabot = butiaAPI.robot()
#set grip motors in joint_mode
def initMoto... | true |
fbd9ebf32a45a254803881092f9df04621a63a64 | sivacheerla93/python | /lib_demo/regex/re_split.py | UTF-8 | 210 | 2.984375 | 3 | [] | no_license | import re
m = re.split("[a-z]+", "123abc456def")
print(m)
m = re.split("[a-z]+", "123abc456def789hbkfhbk", maxsplit=2)
print(m)
m = re.split("[a-z]+", "123ABC456def789hbDDFfhbk", maxsplit=2, flags=re.IGNORECASE)
print(m)
| true |
c2347fc49cc01264593289c65a083c18b3d32114 | Sarefx/Dates-and-Times-in-Python | /Where on Earth do Timezones Make Sense/pytzstring.py | UTF-8 | 624 | 3.9375 | 4 | [] | no_license | # my solution to challenges/exercises in Where on Earth do Timezones Make Sense
# the challenge:
# task 1: starter is a naive datetime. Use pytz to make it a "US/Pacific" datetime instead and assign this converted datetime to the variable local.
# task 1: solved
# task 2: Now create a variable named pytz_string by us... | true |
8a96ddc588ec2bb8a0a48a7a3f50319cbc89e275 | SmileCJX/effective_python | /pers.caijx.tools/excel/sheetExample.py | UTF-8 | 277 | 3.328125 | 3 | [] | no_license | #! python3
# sheetExample.py - 从工作簿中取得工作表
import openpyxl
wb = openpyxl.load_workbook('.\\example.xlsx')
print(str(wb.sheetnames))
sheet = wb['Sheet3']
print(str(sheet))
print(type(sheet))
print(sheet.title)
anotherSheet = wb.active
print(str(anotherSheet)) | true |
5689a3be466be4e114e627b2d02cfb5f20da8c8b | HaooWang/Python_OpenCV | /tutorial13-histogram/1302-histogram applications.py | UTF-8 | 5,747 | 3.09375 | 3 | [] | no_license | #!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Copyright: Jihua Lab 2021.
@File Name : 1302-histogram applications.py
@Description: 彩色图、灰度图直方图统计、直方图绘制、直方图均衡化、直方图对比。
@Create Time : 2021/1/8 0008 8:57
@Author : HaoWANG, Foshan,China
@Email : haowanghk@163.com
@Software : Pycharm
@Version: V1.3
"""
i... | true |
070bfaecab324ecea08de94147fb5de8eb820658 | a23822/TIL | /Algorithm/SWEA/List/4835_구간합.py | UTF-8 | 407 | 3.25 | 3 | [] | no_license | T = int(input()) # 테스트케이스
for n in range(T):
nm = list(map(int, input().split())) # N 개의 정수 M개의 합이 가장 큰 경우/작은 경우
a = list(map(int, input().split())) # 정수 리스트
res = []
for i in range(nm[0]-nm[1]+1):
sum = 0
for j in range(nm[1]):
sum+=a[i+j]
res.append(sum)
print... | true |
1c57e26666d15fe3fa08ee914906f245216f923b | orgoro/FaceDetect | /face_detect.py | UTF-8 | 899 | 3.0625 | 3 | [] | no_license | import cv2
import sys
def main():
# Get user supplied values
imagePath = sys.argv[1]
visualise = sys.argv[2] == 'true' or sys.argv[2] == 'True'
cascPath = "haarcascade_frontalface_default.xml"
# Create the haar cascade
faceCascade = cv2.CascadeClassifier(cascPath)
# Read the image
i... | true |
bb1f16e3907d3166bf1f1bb6fa02f5ee11aa3a59 | arlw87/photoFrame | /timeCheck.py | UTF-8 | 806 | 3.140625 | 3 | [] | no_license | import datetime
def checkTimeImage(justCheckMinutes, minutes):
#get currentDate and time
currentTime = datetime.datetime.now()
#print("Passed min list: ", minutes)
for min in minutes:
#print("Actual Min: ", currentTime.minute)
#print("Min to check", min)
if justCheckMinutes:
... | true |
c8750204a5d8a70d228e81f2ac03d39ae96c213f | select766/PoBaLog | /pobalog/pipeline.py | UTF-8 | 3,857 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
動画の時系列処理
"""
import argparse
import os
import pickle
import time
from collections import defaultdict
import numpy as np
import cv2
from pobalog.preprocess_hp_area_friend import PreprocessHPAreaFriend
from pobalog.preprocess_hp_area_opponent import PreprocessHPAreaOpponent
from pobalog.preprocess_message_window im... | true |
3a34055709d851b8cd294ce93e7c869e541c565c | poojithayadavalli/Hashing | /largestsubsetwith fibonacci numbers.py | UTF-8 | 874 | 4.03125 | 4 | [] | no_license | """
Given an array with n positive numbers.The task is that we find largest subset from array that contain elements which are Fibonacci numbers.
Input:
Firstline indicates the integer n
secondline indicates the elements of array
Output:
print the largest subarray with fibonacci numbers
Examples :
Input :
7
1 4 3 9 ... | true |
002e7ad065c79662f51a669563020850d9c28500 | avast/labmanager-unit-vsphere | /undeployer.py | UTF-8 | 7,471 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import logging
import os
import time
from datetime import datetime
import requests
import yaml
logging.basicConfig(
level='INFO',
format='%(asctime)s %(thread)d %(threadName)s %(levelname)s: %(message)s',
datefmt='%Y-%m-%dT%H:%M:%S.000Z'
)
def load_config(config_file, env):
w... | true |
87a9f3450cf0289c42413e643a50c334ddc8c1d8 | Neuro-UOM/Reports | /FINAL/abstract_MLAlgo.py | UTF-8 | 575 | 2.5625 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod, abstractproperty
class MLAlgo:
__metaclass__ = ABCMeta
@abstractmethod
def train(self, train_data): pass
@abstractmethod
def test(self, test_data): pass
@abstractmethod
def predict(self, predict_data): pass
@abstractmethod
def cross_valid... | true |
fb3cc2c1996312bb724dde48c4d991a059969d8d | willisdc/PhysiCell_Studio | /PhysiCell-model-builder/bin/gen_qline_cb.py | UTF-8 | 1,176 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | # ~/git/PhysiCell-model-builder/bin$ grep qlineed cell_def_tab.py |grep self >qlineedits.txt
"""
self.apoptosis_death_rate = QLineEdit()
self.apoptosis_death_rate.setValidator(QtGui.QDoubleValidator())
self.apoptosis_death_rate.textChanged.connect(self.apop_death_rate_changed)
self.sec... | true |
30cf842cf8f99b27c5a8c9ab63dbf1f06a9202a5 | kachmark4423/CSC221 | /M2HW2_KhalilKachmar/M2HW2_FilesExceptions_KhalilKachmar.py | UTF-8 | 4,434 | 3.875 | 4 | [] | no_license | # Program will be menu driven, read text file and display file stats.
# such as word count etc...
# 09/05/2021
# CSC221 M2HW – FileExceptions
# Khalil Kachmar
# SET speech = OPEN('state_of_union.txt')
# DISPLAY " Menu
# 1. Display Entire Speech
# 2. Display Total Word Count
... | true |
b5b01f07b59ded2b824a9ad56538b5cf22f218d7 | ramudasari123/PythonPractice | /FirstProg/__init__.py | UTF-8 | 408 | 4.25 | 4 | [] | no_license | print("hi")
a="Welcome To Python Example"
b=5
print(a)
a=10
if(a>10):
print("Value of a is greater than 10")
else :
print("Value of a is 10")
if(b>=1):
print(b)
b=b-1
e=1
for b in range(1,10):
e=e+1
print("e is",e)
c=10
while c>0:
print ("Value of a is",c)
c=c-2
... | true |
629de2cbb47084dac0a8fccce09ab70cf67e13c8 | getkeops/keops | /keopscore/keopscore/formulas/maths/Sum.py | UTF-8 | 1,135 | 2.65625 | 3 | [
"MIT"
] | permissive | from keopscore.formulas.Chunkable_Op import Chunkable_Op
from keopscore.formulas.variables.Zero import Zero
from keopscore.utils.code_gen_utils import c_zero_float, VectApply
##########################
###### Sum #####
##########################
class Sum_Impl(Chunkable_Op):
# the summation operation
... | true |
3c2bd6e4cbc9e33e3665c5e080467810e33e0d92 | Ruei-Syuan/BPN | /diagram.py | UTF-8 | 630 | 2.890625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class Diagram(object):
def __init__(self , classifier):
self.classifier = classifier
self.setup()
def setup(self):
self.classifier.train()
def draw(self , xlabel = '' , ylabel = '' , legend_loc = '' , title = '')... | true |
235c4eb5d9fddbf1338f39e406990ee9d202f2f0 | supergravity/PythonLearning- | /Python/example2_05_2.py | UTF-8 | 196 | 3.640625 | 4 | [] | no_license | # The dynamic string from "f" function
# exercise 1
r = 9
print(f'if the radius = {r} , then the area of the circle = {3.14*r**2}')
# exercise 2
txt = 'I am the divider'
print(f'{txt:=^30}')
| true |
70d25e56dda1571e063cf7c1559605a4d0cf28bd | RensselaerRocketSociety/ControlFreak | /Chris's Stuff/variations.py | UTF-8 | 871 | 2.78125 | 3 | [] | no_license | #===================================================================
# Quick Active Energy Control
# ------------------------------------------------------------------
# Author: Chris Andre (chrisandre01@gmail.com)
#===================================================================
from numpy.random import normal
fro... | true |
0f04aa7f098e084a0c8a2f6deeb63e9b9085b481 | eirikhr/noroff | /UC1PR1102/02 Algorithms & Data Structures/src/Activity Sheet.py | UTF-8 | 3,567 | 4.875 | 5 | [] | no_license | """
Pseudocode:
Ask for the first persons name.
Ask for the first persons favorite programming language.
Print the first name and his/hers favorite programming language.
Ask for the second persons name.
Ask for the second persons favorite programming language.
"""
name = input("What is your name? ")
lang = input... | true |
9ab9fce9d6413409f051f70252d042a8375add16 | Deepakjyani/Denoise--RGB-Images-using-Autoencoder | /test0.py | UTF-8 | 1,849 | 2.609375 | 3 | [] | no_license | ### import the libraries
"""import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
from tensorflow.keras .datasets import mnist
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.layers import UpSampling2D
from tensorflow.... | true |
aae790e4c0da1e5a53c9640a9a0852fe3b0c8c14 | pieisland/BaekJoon | /py/step13/1021.py | UTF-8 | 731 | 3.125 | 3 | [] | no_license | '''
2019.03.27.Wed.
<회전하는 큐>
'''
def move(li, n1, n2):
if n1==0:
for i in range(n2):
num=li.pop(0)
li.append(num)
else:
for i in range(n2):
num=li.pop()
li.insert(0, num)
a, b=map(int, input().split())
nums=[]
for i in range(a):
nums.append(i... | true |
1411ad5a61ab1344e7b162c40ee5ad7258d5f84b | harishravi121/Pythoncodes | /googletts2andsentancesplitactions2_randlang_beep.py | UTF-8 | 1,244 | 3.109375 | 3 | [] | no_license | from google_speech import Speech
from googletrans import Translator
import random
langs=['kn','ta','hi','te','en','de','zh-CN','ru']
import winsound
para='''The role of literary theory in narrative has been disputed; with some interpretations like Todorov's narrative model that views all narratives in a cyclical... | true |
27cc9189489d250b6f8fd7cdf00be7eaab4bb007 | holermelecon/python_project | /Akanni Olamilekan Project.py | UTF-8 | 1,143 | 3.90625 | 4 | [] | no_license | #This is the beginning of the program
#this program is to calculate the rate at which land is sold per meter square.
print ("Welcome")
#user to select if he is a buyer or seller
print ("Select B for Buyer and S for Seller")
#user enters string for seller or buyr respectively
user = str (input("Enter S for ... | true |
6f868b4007900b43f2c1a729dd05e9116c3b6854 | rockplayer007/AdventOfCode2020 | /day13/day13.2.py | UTF-8 | 1,202 | 3.21875 | 3 | [] | no_license | from functools import reduce
def chinese_remainder(n, a):
sum = 0
prod = reduce(lambda a, b: a * b, n)
for n_i, a_i in zip(n, a):
p = prod // n_i
sum += a_i * mul_inv(p, n_i) * p
return sum % prod
def mul_inv(a, b):
b0 = b
x0, x1 = 0, 1
if b == 1: return 1
while a > 1:
q = a // b
a, b = b, a % b
x0... | true |
ecaa3eca3ccc1d0e0dce1ce9d27aa3b900dd2d90 | doug-letough/ants | /ant.py | UTF-8 | 10,652 | 2.75 | 3 | [
"WTFPL",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
# -*- coding:Utf-8 -*-
"""Provides the Ant class for the ants module.
"""
import config
import uuid
import threading
import multiprocessing
import random
import time
import logging
import utils
__author__ = "Doug Le Tough"
__copyright__ = "Copyright 2017, Doug Le Tough"
__credits__ = ["Doug Le ... | true |
9e6930a99bf3ea453dc0d47108bb6b05d6fe4339 | SamuelJWi/Starcraft_DES_Simulation | /main.py | UTF-8 | 7,690 | 2.828125 | 3 | [] | no_license | # Input: 문자열
# 생산 순서에 따라 Ex) SSSBSMMMBMMMMM
# units
# S: SCV 20
# M: Marine 24
#
# buildings
# C: Command Center 120
# U: Supply Depot 40
# B: Barracks 80
#
# 시간 단위는 Normal Gamespeed 기준에서 second 단위.
# Fastest 는 30% 빠름
import pandas as pd
import simpy
######
# initial parameters
##... | true |
af956a7868f22c61481616716bad8a57b646bd4c | stevearc/dql | /dql/grammar/common.py | UTF-8 | 5,033 | 2.75 | 3 | [
"MIT"
] | permissive | """ Common use grammars """
from pyparsing import (
Combine,
Forward,
Group,
Keyword,
OneOrMore,
Optional,
Regex,
Suppress,
Word,
alphanums,
alphas,
delimitedList,
nums,
oneOf,
quotedString,
upcaseTokens,
)
def upkey(name):
"""Shortcut for creating a... | true |
a7039d531c1f2dc8095f575e7fbcb1e15d0df242 | sstewart1993/gym_project_1 | /repo/booking_repo.py | UTF-8 | 1,647 | 2.609375 | 3 | [] | no_license | from db.run_sql import run_sql
from models.booking import Booking
from models.instructor import Instructor
from models.member import Member
from models.session import Session
import repo.instructor_repo as instructor_repo
import repo.member_repo as member_repo
import repo.session_repo as session_repo
def delete_all():... | true |
7f5f42a8a10911b245f02339f6bb55d84b2ff407 | RoboticsLabURJC/2020-tfg-daniel-pulido | /SigueLineas.py | UTF-8 | 662 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
from time import sleep
from ev3dev2.motor import LargeMotor, OUTPUT_A, OUTPUT_B, SpeedPercent, MoveTank
from ev3dev2.sensor import INPUT_1
from ev3dev2.sensor.lego import ColorSensor
from ev3dev2.led import Leds
cs = ColorSensor()
leds = Leds()
tank_drive = MoveTank(OUTPUT_A, OUTPUT_B)
print... | true |
5e9dfc03644e6ec20805c437cbfd41c2a249d1ec | vr100/rl-trading | /scripts/utils/dataset.py | UTF-8 | 4,334 | 3.03125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import os, random, math, csv
from pandas.core.series import Series
# mode to read just top few entries of the data file
FAST_MODE = False
TRAIN_ROWS = 100000
TEST_ROWS = 20000
RANDOM_SECTION_LENGTH = 50000
def compute_step(random_sections, random_count):
if random_sections <= 0:
return 0
step... | true |
8ceced361712337bc3a3904a60bc00dbdd8f34d1 | RivaAckerman/python | /huajiao.py | UTF-8 | 1,397 | 2.828125 | 3 | [
"MIT"
] | permissive | #爬花椒主播信息
from bs4 import BeautifulSoup
import requests
import re
__author__='cs'
def getlinks(url):
InformationList=[]
html=requests.get(url).text
soup=BeautifulSoup(html,'html.parser')
result=re.findall(r'<a href="(/l/\d.*?)" class="figure" target="_blank">',html)
name=soup.find_all('p','name ... | true |
65122fbb6e3825a3a33c76d64329f668d1433c0d | xingqiufen/interface | /commonMethod/readExcel.py | UTF-8 | 1,522 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@Auth : xingqiufen
"""
import xlrd,os
from commonMethod.baseInfo import rootDir
from commonMethod import commonWays
from xlutils.copy import copy
import json
excelDir=r'testData\testExcel.xls'
excelPath=rootDir+excelDir
def readExcel(excelPath):
if os.path.exists(excelPath):# 判断路径是否存... | true |
09c349cc1def9c173406163278df1ee4387d53ba | Stellupo/AutomateTheBoringStuffWithPython | /ZeroDividebyFunction.py | UTF-8 | 116 | 2.9375 | 3 | [] | no_license | def spam (divideBy):
return 42 / divideBy
print (spam (2))
print (spam (12))
print (spam (0))
print (spam (1)) | true |
57b2f8b465d5349fe36c410f55c65a32e09be4ed | Burry/JSON-Bourne | /bin/dropdown_select.py | UTF-8 | 764 | 2.59375 | 3 | [] | no_license | from selenium import webdriver #type sudo easy-install selenium (mac)
from selenium.webdriver.support.ui import Select
import sys
import re
driver = webdriver.Chrome(sys.argv[1])#this path is the path to chromedriver, downloadale from https://chromedriver.storage.googleapis.com/index.html?path=2.33/
driver.get(sys.arg... | true |
04fe39270f81133e61ce6996faf1dad79271410e | FrancoAlfano/lab | /alumnos/54056-Franco-Alfano/tps/tp2/legacy/threads.py | UTF-8 | 581 | 2.953125 | 3 | [] | no_license | from concurrent import futures
import os
import time
def red(seg):
print ("red:", os.getpid())
time.sleep(seg)
seg += 1
return seg
def green(seg):
print ("green:", os.getpid())
time.sleep(seg)
seg += 1
return seg
def blue(seg):
print ("blue:", os.getpid())
time.sleep(seg)
seg += 1
... | true |
687cb4567cd0a0d02aa47d4185ffb6e33820e440 | guoqi/pymatch | /example.py | UTF-8 | 967 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python2
#coding: utf-8
from pymatch import case, Match, match, Object, trait, unpack
@trait
class Seq(Object): pass
@case()
class List(Seq): pass
@case("left", "right")
class Branch(Object): pass
@case("value")
class Leaf(Object): pass
@match
def foo():
print List.__bases__
a = List(1, 2, 3, ... | true |
ed3111e65996af78aa8a76cd4a59b4ef79900110 | naoto0804/atcoder_practice | /contests/abc/00/009/c.py | UTF-8 | 670 | 2.890625 | 3 | [] | no_license | N, K = map(int, input().split())
S = list(input())
D = sorted(S)
ans = [""]*N
def check(D, d, S):
S2 = S.copy()
D2 = D.copy()
D2.remove(d)
for a in D2:
try:
S2.remove(a)
except ValueError:
pass
return len(S2)
change = 0
for i in range(N):
for d in D:
... | true |
a9f5973319df936934f1215adbe4245aba79baa1 | VPanjeta/Comic-Downloader | /src/9gag.py | UTF-8 | 2,340 | 2.6875 | 3 | [] | no_license | import re
import json
import urllib
from urllib2 import *
def download(images):
opener = build_opener()
for image in images:
try:
temp = opener.open(image)
print "Saving image....[%s]" %(image.split("/")[-1:][0])
except URLError:
continue
except HTTPError, e:
print " Cannot get [%s] Reason: [%s]" ... | true |
0abe363c876fa39b99851c8d1ddc9189cb85f795 | PixelWeaver/Gender-Bias-in-Age-Recognition-using-Face-Data | /dataset.py | UTF-8 | 9,656 | 2.625 | 3 | [] | no_license | import math
import os
import re
import cv2
import numpy as np
import tensorflow as tf
import util
# tf.enable_eager_execution()
class Dataset:
def __init__(self, force_preprocessing=False):
self.db_path = "db/"
self.unprocessed_path = "faces/"
self.preprocessed_path = "preprocessed/"
... | true |
3ce48c3fa5f5c5b3e02427875d952e559bb697d8 | lpsnedhead/CS-1400 | /youtube/my mad lib.py | UTF-8 | 1,532 | 4.0625 | 4 | [] | no_license | def words():
plural_noun = input("Enter a plural noun: ")
adjective = input("Enter an adjective: ")
plural_noun_animals = input("Enter a plural noun; animals ")
plural_noun2 = input("Enter a plural noun: ")
adjective2 = input("Enter an adjective: ")
color = input("Enter a color: ")
... | true |
d5d46cd40c27b6b7b3237452cef76f27af0019d2 | ddomurad/3d_printer_foam_cutter | /fcl/path_planner/path_planner.py | UTF-8 | 1,135 | 2.640625 | 3 | [
"MIT"
] | permissive | from fcl.options import Options
from fcl.path_planner.path_factory import PathFactory
from fcl.path_planner.tool_path import ToolPath
import fcl.utils.math as fm
class PathPlanner:
def __init__(self, options: Options):
self._options = options
self._path_factory = PathFactory(options)
def plan... | true |
c87f3aaec3df9d9fcae1b634a2b778e292fcfa32 | seokjaehong/Django-document | /app/relations/many_to_many/models/self.py | UTF-8 | 1,055 | 2.765625 | 3 | [] | no_license | from django.db import models
__all__ =(
'FacebookUser',
)
class FacebookUser (models.Model):
'''
자기자신을 MTM필드로 갖는모델
'''
name = models.CharField(max_length=50)
friends = models.ManyToManyField('self')
def __str__(self):
# name이 이한영이며
# 친구로 '박보영','아이유'를 가지는경우
# ####... | true |
1f774d60ee24224847e65d59523f52a9c9987d69 | jayleicn/maskrcnn-benchmark | /demo/visualize_loss.py | UTF-8 | 1,066 | 2.90625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | __author__ = "Jie Lei"
from tqdm import tqdm
import matplotlib.pyplot as plt
def parse_log(logfile):
with open(logfile, "r") as f:
lines = [l.strip("\n") for l in f.readlines()]
loss_lines = [l for l in lines if "loss_classifier" in l]
info_dict = dict(
iter=[],
loss=[],
lo... | true |
3d21cc7740ec1438e3dc091df114340aaaa4a200 | bwsw/system-utilities | /zabbix/opt/bin/date-difference-days | UTF-8 | 250 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
from datetime import datetime
import sys
date_format = '%Y-%m-%d'
date_start = datetime.strptime(sys.argv[1], date_format)
date_end = datetime.strptime(sys.argv[2], date_format)
delta = date_end - date_start
print(delta.days)
| true |