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 |
|---|---|---|---|---|---|---|---|---|---|---|
e6258dd54224515d1ea443ab3ac63ed349970fb4 | prabhat-krai/puzzles_and_games | /game.py | UTF-8 | 3,920 | 3.671875 | 4 | [
"MIT"
] | permissive | import random
#imported random to shuffle the deck of cards before making a deal
def poker(hands):
"Return the list of best hand: poker([hand,...]) => hand"
return max(hands, key=hand_rank)
def deal(numhands, n=5, deck = [r+s for r in "23456789TJQKA" for s in 'SHDC']):
random.shuffle(deck)
return [dec... | true |
96d595455c5e7a3ce880f6590e8287f19eb0e66c | shuiqukeyou/CodeExercise | /python/python crash course/dataVisualization/python_repos.py | UTF-8 | 2,547 | 3.015625 | 3 | [] | no_license | import requests
import pygal
from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS
url = "https://api.github.com/search/repositories?q=language:python&sort=stars"
r = requests.get(url)
print("响应码:" + str(r.status_code))
response_dict = r.json()
# print("Total Repositories:", response_dict["total_co... | true |
1fbe8855c59f5f983393b1e5373cdc513847b112 | stanfordnlp/stanza | /stanza/models/common/bert_embedding.py | UTF-8 | 18,058 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import math
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence, pack_sequence, PackedSequence
logger = logging.getLogger('stanza')
BERT_ARGS = {
"vinai/phobert-base": { "use_fast": True },
... | true |
77dc3cea5cdfa7353800b57ba530d6b333a4d24c | Sarayaar/python01 | /Assignments/sr.assignment11.py | UTF-8 | 249 | 3.40625 | 3 | [] | no_license | import re
Fname = raw_input("Enter File Name: ")
F = open(Fname)
for line in F:
numbers = re.findall("[0-9]+", line)
numbers = map(int, numbers)
ints = []
for number in numbers:
converted = int(number)
ints.append(converted)
print sum(ints) | true |
3436b18c182ce382438942ee154ccd1f0c831d21 | zHigor33/ListasDeExerciciosPython202 | /Estrutura de Decisão/L2E16.py | UTF-8 | 637 | 3.890625 | 4 | [] | no_license | A = float(input("Informe o valor de A: "))
if A == 0:
print("A é igual a zero, portanto não é uma equação de segundo gráu")
else:
B = float(input("Informe o valor de B: "))
C = float(input("Informe o valor de C: "))
delta = B ** 2 - 4 * A * C
if delta < 0:
print("A equação não possui raiz... | true |
3e2c7e2a2bb81a0e711b5fd2af519cccc97a4076 | chazu/python-vfl | /solver.py | UTF-8 | 917 | 2.953125 | 3 | [] | no_license | from kiwisolver import (Variable as Var,
Solver)
class App:
def __init__(self):
self.columns = 50
self.rows = 50
class ViewSolver:
def __init__(self, view, app):
self.app = app
self.view = view
self.left_side = Var("left_side")
self.... | true |
e4c36747ff9e099d99a0fe346f6f368f89569dc9 | wingkitlee/PythonDemo2015 | /SliderSHM.py | UTF-8 | 1,905 | 2.953125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
g = 9.8 #m/s^2
plt.rc('font', size=18)
fig, ax = plt.subplots()
fig.canvas.set_window_title("Wing Kit Lee's Sample Lecture (2015)")
plt.subplots_adjust(left=0.2, bottom=0.4)
t = np.arange(0.0, 10.0, 0.001)
x... | true |
7ab4d6cb7ca048b6661b6b4d92d4f6235b5920f3 | sachinolickan/Machine-Learning | /linerreg.py | UTF-8 | 478 | 2.953125 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
x=[[1],[2],[3],[4],[5],[6]]
y=[[2],[4],[6],[8],[10],[12]]
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=.30)
model=LinearRegression()
model.fit(x_train,y_train)
z=[[20],[15]]
z_predict=model.predict(... | true |
8178d88ba59c6fd76abf9492e491dac154e5999c | heeseung2ya/bioinfo-lecture-2021 | /src/031.py | UTF-8 | 52 | 2.65625 | 3 | [] | no_license | s = "AA,AC,AG,AT"
l_seq = s.split(',')
print(l_seq)
| true |
341361daff4b9bbcb5e91ea22980c3e4704aca71 | ChrisFugl/Reasoning-From-Memory | /app/validate.py | UTF-8 | 689 | 2.875 | 3 | [] | no_license | """Contain function to validate input."""
from app.types.command import Command
from app.types.validation import Validation
def validate_command(text):
"""
Validate command.
:type text: str
:rtype: app.types.validation.Validation
"""
if text in [Command.ASK, Command.BYE, Command.HELP, Command... | true |
ccf86db0caaba1696f073d2a771b08d0f03a9760 | bkface/leetcode | /python/review/49/code.py | UTF-8 | 375 | 3.296875 | 3 | [] | no_license | # https://leetcode.com/problems/group-anagrams/description/
from collections import defaultdict
class Solution(object):
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
d = defaultdict(list)
for s in strs:
d[''.join(so... | true |
d1e1c93e8eb1b9bfa72ba272d6695b818583e920 | eastonhuch/ab_test_simulator | /example_decision_function.py | UTF-8 | 1,340 | 2.90625 | 3 | [
"MIT"
] | permissive | from generate_data import get_mme, save_data, read_data
from evaluation_functions import evaluate_all
# These are the parameter values that will be used to validate your decision function
MAX_TEST_SIZE = 10000
HORIZON_LENGTH = 200000
BASELINE_CONVERSION_RATE = 0.1
A_STDDEV = 0.002
# This one is secret; the value below... | true |
b0c56e27d9ad4335a19938685149d4fa84fb2244 | ramansbach/cluster_analysis | /clustering/data/dummgsdfull2type.py | UTF-8 | 9,037 | 2.8125 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import, division, print_function
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 5 11:40:26 2018
@author: rachael
"""
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 6 12:03:20 2017
@author: rachael
Create a dummy gsd file with 4 molecules of 17 beads each in 6 snapshots
Used to check... | true |
1b68b44fe2da75e3da68558be3a57da31f714acd | propublica/django-collaborative | /django_models_from_csv/test/test_csv.py | UTF-8 | 398 | 2.546875 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from django_models_from_csv.utils.csv import (
extract_key_from_csv_url
)
class FetchCSVTestCase(TestCase):
def setUp(self):
self.csv_url = "https://docs.google.com/spreadsheets/d/18I8_so8_lCWEQLZ8LsBfOgz_SRRSIokZ06duc/edit?usp=sharing"
def test_can_extract_key_f... | true |
f31684651e9ebbb99d6fb6d4968deffdeb42c5a0 | CSP-HHS-McNeal/4_2-prisoners_dilemma | /prisoners_dilemma.py | UTF-8 | 19,291 | 3.34375 | 3 | [] | no_license | from __future__ import print_function
#####
# Hi from Megan
=======
#
# Computer Science and Software Engineering
# PLTW AP CS Principles
# (c)2014 Project Lead The Way, Inc.
#
# Activity 1.3.9 Tools for Collaboration
# Project 1.3.10 Collaborating on a Project
#
# To run a tournament, execute this file.
# Place e... | true |
a8a58462fb1f76ec2748a1e9778a715fa194e6f9 | lllarzoomayz/rpi | /gpio/motor.py | UTF-8 | 132 | 2.671875 | 3 | [] | no_license | from gpiozero import Motor
from gpiozero import LED
led = LED(2)
motor = Motor(20, 21)
while True:
led.on()
motor.forward()
| true |
62871e5fc926a930ab1c2bf9454676e2f05a31b5 | ShantanuJamble/AWS_Multiplayer | /AWSTools/s3Downloader.py | UTF-8 | 2,456 | 2.625 | 3 | [] | no_license | import boto3
import os
class S3Downloader(object):
@staticmethod
def GetFileList(bucket, folder_path, region='us-west-1'):
file_list = []
try:
s3resource = boto3.resource('s3', region_name=region)
s3Bucket = s3resource.Bucket(bucket)
for obj in s3Bucket.obj... | true |
e2f3596505bb737d3dfe3dc6228e4ba2dede749c | shmiman/CTB_preprocessing | /preprocessing/dcm2niix.py | UTF-8 | 1,599 | 2.65625 | 3 | [] | no_license | # Import necessary dcm2niix python wrapper
import dicom2nifti
import dicom2nifti.settings as settings
# Set settings for conversion
settings.enable_resampling()
settings.set_resample_spline_interpolation_order(1)
settings.set_resample_padding(-3024)
dicom2nifti.settings.disable_validate_orthogonal()
# Get directory o... | true |
389b6ca08c26e9ddfca4c067314a669da286f6a2 | johnwmillr/You2Stems | /you2stems/you2stems.py | UTF-8 | 5,255 | 3 | 3 | [] | no_license | """
You2Stems
John W. Miller
2020
"""
import os
import warnings
from datetime import datetime
import youtube_dl
from spleeter.separator import Separator
warnings.filterwarnings('ignore')
class Logger(object):
def debug(self, msg):
pass
def warning(self, msg):
pass
def error(self, msg)... | true |
d4ace6448769fe9af32dee80b79d16dbb7931849 | walid-creator/api_touratour | /serveur/service/service_jeux.py | UTF-8 | 640 | 2.578125 | 3 | [] | no_license | from abstract_jeu import AbstractJeu
from dao.classe_jeu_dao import JeuDao
class ServiceJeux:
@staticmethod
def get_all_monstres_from_db():
"""
Récupère tous les jeux et leurs caractéristiques en base
:return: une liste de jeux
:rtype: list of AbstractJeu
"""
r... | true |
576fd416e171885ea5dc8e05fefdce94fe74f23b | mtrejo0/coding_interviews | /kth_smallest_binary.py | UTF-8 | 1,013 | 3.734375 | 4 | [] | no_license |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def kth_smallest(self, node, k):
sorted = self.recurse(node)
return sorted[k-1]
def recurse(self, node, order=[]):
left =... | true |
5ce81a90704b9f9d0f936146158b145d93db519e | hpcaitech/ColossalAI | /colossalai/zero/gemini/memory_tracer/memory_monitor.py | UTF-8 | 3,980 | 2.78125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | permissive | import json
from abc import abstractmethod
from concurrent.futures import ThreadPoolExecutor
from time import sleep, time
import torch
from colossalai.utils import colo_device_memory_used, get_current_device
class MemoryMonitor:
"""Base class for all types of memory monitor.
All monitors should have a list ... | true |
deea6c5edde8504c1b930385cfe012af6f8c4e10 | sreesoumya/Python_proj | /WebCrawler/WebCrawler/src/file_text.py | UTF-8 | 1,688 | 2.8125 | 3 | [] | no_license | '''
Created on Mar 24, 2014
@author: soumyasreekumar
'''
import urllib
from urllib.request import urlopen
from html.parser import HTMLParser
import re
import time
import random
def main():
i=0
f = open('input.txt','r')
myList =[]
for line in f.readlines() :
myList.append(line)
... | true |
ef61ccb15e8de19a64c8b49b84d0386a72017633 | Aijaz12550/python | /args_kwargs/main.py | UTF-8 | 165 | 2.515625 | 3 | [] | no_license | import logging
logging.basicConfig(level=logging.INFO)
def func(*args, **kwargs):
logging.info("args",args, "===",kwargs)
func(1,2,3,4,5, name="aijaz")
| true |
d9744cdf905dcdaff1be3d2ea2fd901ae4383a9c | Hamdi-Limam/PythonTraining | /day2/courses/functions.py | UTF-8 | 2,322 | 4.90625 | 5 | [] | no_license | # A function is a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function can return data as a result.
# Below are few reason why you want to create a function:
# 1.Reusable code
# 2.Seperating the concern. What I mean here is you want to make your code such ... | true |
2dc33f96cc439e6b91a7629971d0eb09255512f2 | tsumansapkota/Experimentals | /NN_Func_Approx/Dimension_Encoding_MLP/Transformer_Mixer/transformers_lib3_dev.py | UTF-8 | 14,466 | 2.765625 | 3 | [] | no_license | import torch
import torch.nn as nn
import numpy as np
#############################################################################
#############################################################################
class ResMlpBlock(nn.Module):
def __init__(self, input_dim, hidden_layers_ratio=[2], dropout=0.0, ... | true |
4fc2631e81527a259293fdfc13bd2791eddfc5a2 | HyrumB/cookie | /cookie.py | UTF-8 | 619 | 3.203125 | 3 | [] | no_license | import sys
variables = {}
def getValue(v1):
if v1 in variables:
return variables[v1]
return int(v1)
def processLine(line):
tokens = line.split(" ")
# Case: var = add()
if len(tokens) == 3 and tokens[2] == "add()":
variables[tokens[0]] = getValue("_1") + getValue("_2")
... | true |
23be9bb43f1fcbc1efe5002284e0184faef54297 | rapid-snail/SocialLinks | /test/test_login.py | UTF-8 | 3,975 | 3.03125 | 3 | [] | no_license | import pytest
error_map = {
"empty_login": "Login is not given.",
"short_login": "Login is too short for now.",
"not_email_or_phone": "Please enter correct email address or phone.",
"incorrect_login_or_password": "Login or password is incorrect!",
"empty_password": "Password is not given.",
"s... | true |
7820f1bb5b8deefdd01871948d93f3534f63639c | msarahan/chaco | /chaco/grid_data_source.py | UTF-8 | 5,089 | 3.234375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | """ Defines the GridDataSource class.
"""
# Major library imports
from numpy import array
# Enthougth library imports
from traits.api import Constant, Instance, Tuple
# Chaco imports
from abstract_data_source import AbstractDataSource
from array_data_source import ArrayDataSource
from base import SortOrderTrait
cl... | true |
3fb184e4e9d99b4f64cb0b57b331e3d79613a784 | eggsyy/LearnPython | /LearningPython/PartialFunc_pra.py | UTF-8 | 434 | 3.234375 | 3 | [] | no_license | import functools
print int('123456')
print int('123456', base=8)
print int('123456', 16)
def int2(x, base=2):
return int(x, base)
print int2('100000')
print int2('10010100')
int22 = functools.partial(int, base=2)
print int22('100000')
print int22('1010101')
print int2('100000', base=10)
print int22('100000', ... | true |
3bb4692f79fb2565fceed66b58a54ae295a51821 | makendi19841/Master-Thesis-Project | /Performance_analysis/pearson_correlation.py | UTF-8 | 1,863 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 12:26:11 2020
@author: amos
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import pearsonr
from scipy.stats import spearmanr
def r_squared_Lumen (y_ref, y_pred):
# calculate the Pearson's correlation: R2
r_... | true |
cb211da87488aca8850eabf65c1cf6bdc25495e5 | mortenwehlast/ml_ops | /src/utils/utils.py | UTF-8 | 1,602 | 2.609375 | 3 | [] | no_license | import os
from pathlib import Path
import numpy as np
import torch
from src.data.make_dataset import load_mnist
from src.models.model import Classifier
def load_model(path=None):
ROOT = str(Path(__file__).parent.parent.parent)
if path:
try:
model = torch.load(Path)
except Except... | true |
745c2c3f19a86674592908739c7ad9e34cdc5e9b | aleiadevore/holbertonschool-higher_level_programming | /0x03-python-data_structures/3-print_reversed_list_integer.py | UTF-8 | 197 | 3.625 | 4 | [] | no_license | #!/usr/bin/python3
def print_reversed_list_integer(my_list=[]):
if my_list:
size = len(my_list)
for i in range(size - 1, -1, -1):
print("{:d}".format(my_list[i]))
| true |
c80f01d0def45f6a3160e2400e8ab375fdfd725d | Leputa/Leetcode | /python/隔山打牛.py | UTF-8 | 1,397 | 3.59375 | 4 | [] | no_license |
def damage(enemies):
cnt = 0
pos = 1
while (pos <= len(enemies)):
while (enemies[pos-1] > 0 and (2 * pos - 1 < len(enemies) and enemies[2 * pos - 1] > 0) and (2 * pos < len(enemies) and enemies[2 * pos] > 0)):
enemies[pos-1] -= 1
if 2 * pos - 1 < len(enemies):
... | true |
d2cbd096001a098d11fbd0412bff977ecdc57fd8 | 162/cspython | /student.py | UTF-8 | 1,000 | 2.921875 | 3 | [] | no_license | class Student():
def __init__(self, name, all_sem_n, tasks):
self.name = name
self.total_points = 0
self.total_penalty = 0
self.tasks = [[0 for i in range(tasks[j])] for j in range(all_sem_n)]
def process(self, n_sem, n_task, result):
if result.name == self.name:
... | true |
69c799ff9b4a2f042f6451856e646d4fd44e556f | wattaihei/ProgrammingContest | /AtCoder/ABC-D/169probD.py | UTF-8 | 769 | 3.3125 | 3 | [] | no_license | import sys
input = sys.stdin.readline
import math
# 素因数分解、辞書で返すやつ
# mathをimportする
def prime(n):
factor = {}
tmp = int(math.sqrt(n)) + 1
for num in range(2, tmp):
while n % num == 0:
n //= num
if not num in factor.keys():
factor[num] = 1
else:
... | true |
a4bdc4b65b68d9eee9ef4a881eaee2b4e391919b | kobeomseok95/codingTest | /boj/gold/3665_4.py | UTF-8 | 1,484 | 3.125 | 3 | [] | no_license | from sys import stdin
read = lambda : stdin.readline().strip()
for _ in range(int(read())):
n = int(read())
team = list(map(int, read().split()))
graph = [[False for _ in range(n + 1)] for _ in range(n + 1)]
indegree = [0 for _ in range(n + 1)]
for i in range(n):
for j in range(i + 1, n):
... | true |
8e72cf11fb68946b81c0c882a24f1f07c8bc7390 | tituvely/django_lectures | /django_lectures/string.py | UTF-8 | 391 | 4.15625 | 4 | [] | no_license | # STRINGS
mystring = 'abcdefg'
print(mystring[-1])
print(mystring[2:])
print(mystring[:6])
print(mystring[3:5])
print(mystring[::2])
mystring = "Hello world"
x = mystring.split()
print(x)
x = mystring.split('o')
print(x)
x = "Insert another string here {}, {}".format("dog", "cat")
print(x)
x = "In... | true |
c4f9bef26d31021c527bebd0b298bfa0fc039aed | medxkh/instagram-scraper | /insta_scraper.py | UTF-8 | 1,598 | 2.875 | 3 | [] | no_license | from selenium import webdriver
import time, urllib.request, requests, os
# launch Chrome and navigate to Instagram page
driver = webdriver.Chrome()
driver.get("https://www.instagram.com/funnywhimsical/")
# scroll to the bottom of the page
lenOfPage = driver.execute_script("window.scrollTo(0, document.body.scrollHeight)... | true |
2adcc94b0f3a3aa9895f6b12b05ae772e4b93440 | derekzhou2015/StudyPython | /Exception/Try.py | UTF-8 | 697 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'a test class'
__author__ = 'Kerwin'
from functools import reduce
import logging
def str2num(s):
try:
return int(s)
except:
raise ValueError("%s can't covert to type of int." % s)
def calc(exp):
ss = exp.split('+')
ns = map(str2num, ss)... | true |
5e2a5dcf6b985112ef8e91ff31e8416a797260f2 | suyeon0610/python | /FileIO/file_io_write.py | UTF-8 | 1,862 | 3.953125 | 4 | [] | no_license |
'''
* 파일 입/출력
- 프로그램이 생성한 정보를 좀 더 오래 저장할 때는 파일에 기억해야 함
- 메모리는 속도는 빠르지만 전원이 끊어지면 정보를 잃어버릴 수 있기 때문에,
하드디스트에 저장해야 데이터를 오래 보관할 수 있음
- 파일은 정보를 저장하는 기본 단위이며 문서, 이미지, 멀티미디어 자료도
모두 파일 형태로 보관 할 수 있음
- 파이썬에서는 파일 입/출력을 할 때 open()이라는 함수 사용
ex) open('파일 경로', 모드)
- 파일 경로는 입/출력 대상의 파일 경로 (디렉터리 경로 포함시킴)
- 모드는 읽기, 쓰기, 추가 등 무엇... | true |
9b7fde9fdf38c3eb43cdea77f10a6a6b5f61244f | WouterThys/LedController | /LedController/GuiShapes/SupaCircle.py | UTF-8 | 1,656 | 3.171875 | 3 | [] | no_license |
class MyCircle(object):
def __init__(self, x, y, r, text="", name=None):
self.x = x
self.y = y
self.r = r
self.coords = (x-r, y-r, x+r, y+r)
self.text = text
self.name = name
self.item = None
self.pwm_color = None
self.canvas = None
def ... | true |
f3451ef4a047fd57024784c1edb86521ec25d940 | yorkLiu/Pagoda | /PyPa/simplePa.py | UTF-8 | 557 | 2.765625 | 3 | [] | no_license | import urllib
import re
def getHtml(url):
page = urllib.urlopen(url)
htmlContent = page.read()
return htmlContent
def getImage(html):
reg = '<img src="?\'?([^"\'>]*.jpg)'
imgReg = re.compile(reg)
imglist = re.findall(imgReg, html)
idx =0
filename="/Users/yongliu/Downloads/getimages/%s... | true |
ea69bd17f5b2670f2fe906258caadf26b6dd5652 | nwolniak/SudokuSolver | /App/GUI/AlgorithmChoice.py | UTF-8 | 1,229 | 3.03125 | 3 | [] | no_license | from kivy.uix.stacklayout import StackLayout
from kivy.uix.button import Button
class AlgorithmChoice(StackLayout):
def __init__(self, my_options, **kw):
super(AlgorithmChoice, self).__init__(**kw)
self.my_options = my_options
self.size_hint = (1.0, 1.0)
self.pos_hint = {"... | true |
e54079f0b891f048adfe4aa7a01e0374dcee79c6 | ampaire/store-manager_endpoints | /app/deleteentry.py | UTF-8 | 1,323 | 2.9375 | 3 | [] | no_license | from flask import Flask, jsonify, request,abort
from datetime import date
app = Flask(__name__)
entries = [
{
'id_': 1,
'date': 28/7/2018,
'Topic': "My Birthday!",
'Contents': "I had actually forgotten all about this day being my birthday..." +
"I got out of my room and all... | true |
d410de061b6abe7239f146992e62b3e9e3343023 | 1798317135/note | /python/python线程,进程,协程/GIL全局解释器锁.py | UTF-8 | 945 | 2.796875 | 3 | [] | no_license | # GIL是python解释器Cpython,为了保证多线程之间资源共享的安全问题,
# 给多线程添的一把互斥锁
#
# 一个进程有一个GIL 当线程运行的时候必须获得这个锁,
# GIL 可以保证在一个进程的多个线程,在一个时间片段内,只有一个线程在运行
#
#
# 这个GIL锁也会释放,
# 1.0 当在I/O操作时 引起的阻塞的时候,系统回暂时释放GIL锁,但是执行完毕后,回从新获得GIL
# 2.0 在计算密集型任务时,当计时器达到一定阈值的时候,当前线程回释放GIL锁,
# 可以查看和设置设个阈值
import sys
sys.setcheckinterval(1)
print(s... | true |
d03700233226c425e9187be1682858751afdfc32 | Google-Health/genomics-research | /nonlinear-covariate-gwas/metrics.py | UTF-8 | 5,433 | 2.984375 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright 2021 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2... | true |
765a8b28eae28004b66f91b0eafaccc6c533b778 | brpo01/test-1 | /lonecalculator.py | UTF-8 | 6,120 | 3.59375 | 4 | [] | no_license | print("welcome to Lapo mfbank")
rate = float(input("what is your company's rate? "))
rate_frac = rate
principal = float(input("please enter the amount you want N"))
print("you requested %f" %principal)
if (0 < rate_frac <= 5) and (principal <= 200000):
time = int(input("For how many years? "))
timeInYears = (time ... | true |
a2f1838d957072f8e6ffb547a9707492dc622633 | yoosl/EntrySystem | /tools/layuiPage.py | UTF-8 | 110 | 2.59375 | 3 | [] | no_license | def paginator(data, current_page, limit):
return data[limit * (current_page - 1): current_page * limit]
| true |
00b9b9cd864c8d08dadda5e93e10098740d9022d | jeansyo/Python | /04.funciones_centigrados_Farenheit.py | UTF-8 | 882 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 11 23:13:32 2020
@author: DELL.E5430.SSD
"""
import datetime
def centigrados_farenheit(c):
c = (c*9/5)+32
return c
print('\n\tCENTIGRADOS A FARENHEIT\n')
ahora = datetime.datetime.now()
print(ahora.strftime('%d/%m/%Y %H:%M:%S'))
print()
temperatura = float(in... | true |
ce279c75382c241a931ae7742d555628aeddbf7c | AlexandrZhytenko/taskCoreValue | /simpe_solution.py | UTF-8 | 1,484 | 3.296875 | 3 | [] | no_license | from draw_graph import G
def find_path(graph=G, start="start", end="end", path=[]):
path = path + [start]
if start == end:
return path
for node in graph[start]:
if node not in path:
newpath = find_path(graph=G, start=node, end="finish", path=path)
if newpath:
... | true |
b7a5131cc46bffa0a4b04ffce7eeb2e1407fafef | daniel-reich/ubiquitous-fiesta | /wPMgjmQMoCwm3G6mt_2.py | UTF-8 | 89 | 2.578125 | 3 | [] | no_license |
def upload_count(dates, month):
return sum(date.startswith(month) for date in dates)
| true |
03342627fe67b3d5f2fa0dc53f7cde8f18caf226 | ViktorShvachuk/pytest_checkout | /system/checkout.py | UTF-8 | 1,166 | 3.65625 | 4 | [] | no_license | class Checkout:
class Discount:
def __init__(self, number_of_items, price):
self.number_of_items = number_of_items
self.price = price
def __init__(self):
self.discounts = {}
self.items_prices = {}
self.items = {}
self.total = 0
def add_discou... | true |
25d9aba98816566cf1e650fbbb78d0dc5b66a4b2 | EHOTIK911/Inform-EGE | /24/24_11.py | UTF-8 | 290 | 3.171875 | 3 | [] | no_license | f = open("24_11.txt")
s = f.readline()
count = [s[0]]
count_final = []
for i in range(len(s) - 1):
if s[i] < s[i+1]:
count.append(s[i+1])
if len(count) > len(count_final):
count_final = count
else:
count = [s[i+1]]
print("".join(count_final))
| true |
2bf33370c6c923144b65440a0aedde4cb0a11153 | vivianzhu88/learning-python | /PythonRaspberryPi/listtostring.py | UTF-8 | 227 | 3.5 | 4 | [] | no_license | days_week = 'Monday Tuesdy Wednesday Thursday Friday Saturday Sunday'
days_week_list = days_week.split()
print (days_week_list)
y = days_week_list.index('Friday')
print (y)
days_week_list[y] = 'Saturday'
print (days_week_list)
| true |
8eef702ce9a491686b1d84a0e8eea1fcd3f17490 | chanbiao0816/demo | /base/imtool.py | UTF-8 | 1,268 | 3.125 | 3 | [] | no_license | # coding=utf-8
"""
!/usr/bin/env python
@Company : 元王有限元科技
@Author : 陈彪
@Time : 2018/1/2 18:04
@File : imtool.py
@Function:
"""
from pylab import *
from PIL import Image
def im_resize(im, sz):
"""使用 PIL 对象重新定义图像数组的大小"""
pil_im = Image.fromarray(uint8(im))
return array(pil_im.resize(sz))
def his... | true |
f353d2b06b0a54219d8e05a3201abc1b4df00512 | gregueiras/advent-of-code | /2021/15/script.py | UTF-8 | 1,852 | 3.015625 | 3 | [
"MIT"
] | permissive | from pathlib import Path
from math import inf
path = Path(__file__).parent / "./test_input.txt"
points = {}
def print_board(maxX, maxY):
for y in range(maxY + 1):
for x in range(maxX + 1):
print(points[(x, y)], end="")
print("")
y = 0
with open(path) as fp:
Lines = fp.readline... | true |
f0fa25f11070750cd5f99b1c2281e7e7039ad296 | kran9910/OBSoft-Internship | /Anghami's API.py | UTF-8 | 3,816 | 3.171875 | 3 | [] | no_license | import requests
import json
token = 'e716d094ce581cdc684d02f8'
#Getters to fetch Data from the Anghami API using my user's token
def get_song(song_id):
url = ' https://bus.anghami.com/public/song/data?song_id=' + str(song_id)
r=requests.get(
str(url),
headers={'xat': 'interns','xath'... | true |
f574c209de95db02b29e60dacfcb25a5b3afd85b | gekkeboy94/gevpro-week2 | /country.py | UTF-8 | 258 | 3.421875 | 3 | [] | no_license | import sys
class Country:
def __init__(self,country):
self.country = country
def __str__(self):
return "Hello from {0}".format(self.country)
def main():
countryname = Country("Holland")
print(countryname)
if __name__ == "__main__":
main()
| true |
777865c1bc7743ea99b41e915a0f6d13c45015bd | captainsn/CapitalOneDataModeling | /SandipNirmel_AirBNBProject.py | UTF-8 | 1,914 | 3.125 | 3 | [] | no_license |
# coding: utf-8
# In[138]:
#Author: Sandip Nirmel
import matplotlib.pyplot as plt
import csv
import geoplotlib
from geoplotlib.utils import read_csv
import numpy as np
import pandas as pd
import re
# In[189]:
listings = pd.read_csv('listings.csv')
listings2 = pd.read_csv('listings2.csv')
for item in price_col:
... | true |
a68d30cd7cdf5158cdf55f566fb8e113aecd276f | jedzej/tietopythontraining-basic | /students/stachowska_agata/lesson_06_dicts_tuples_sets_args_kwargs/guess_number.py | UTF-8 | 540 | 3.078125 | 3 | [] | no_license | n = int(input())
answer = ''
yes_set = set()
no_set = set()
guess_set = set()
numbers = set(range(1, n + 1))
while True:
try:
guess_set = {int(i) for i in input().split(' ')}
except ValueError:
print(' '.join(str(i) for i in (list(yes_set.difference(no_set)))))
break
answer = inp... | true |
cd78e9bca103744df60253dc4469ff89c2d214de | mmkvdev/leetcode | /Problems/Find All Numbers Disappeared in an Array/Submissions/findNum.py | UTF-8 | 390 | 3.015625 | 3 | [] | no_license | class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
duplicateFilter = []
for i in nums:
i = abs(i)
if nums[i-1] > 0:
nums[i-1] *= -1
for j in range(len(nums)):
if(nums[j] > 0):
duplic... | true |
ea24d40d5e24af5a1c0f83f238bd0ddb417d84ab | nakimera/Python-Practice | /indefinite.py | UTF-8 | 119 | 3.21875 | 3 | [] | no_license | done=False
while not done:
entry=eval(input())
if entry==999:
done=True
else:
print(entry)
| true |
f2a36df2f284aaa6eed34fa4176db2a8a3f0f7f5 | HieuChuoi/nguyenminhhieu-fundamental-c4e25 | /session3/list.py | UTF-8 | 549 | 3.859375 | 4 | [] | no_license | # item1 = "Bun dau mam tom"
# item2 = "Pho"
# item3 = "Banh my sot vang"
# item4 = "Lau"
# items = [] #empty list
# print(items)
# print(type(items))
# items = ["Bun dau mam tom"]
# print(items)
items = ["Bun dau mam tom","Pho", "Banh My", "Lau",]
# print(items)
# items.append("Banh my sot vang") #insert
# print(ite... | true |
83da0d3b5a9ecf1adb767e02d6965c3287da3873 | D-Wtnbe/Django-myapp | /dummy.py | UTF-8 | 901 | 3.046875 | 3 | [] | no_license | import os
import sys
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myapp.settings')
import django
django.setup()
from django.contrib.auth.models import User
from faker import Faker
fake = Faker()
def populate(N=5):
for i in range(N):
fake_username = fake.user_name()
fake_name = fake.name().sp... | true |
0077c96ab1b0051ace233ab39db055b1b1a911df | texasraj/Trading-Strategy-label-prediciton | /afazzone_677_hw_2.py | UTF-8 | 31,868 | 3.5625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 00:37:45 2020
@author: alf11
"""
import pandas as pd
import numpy as np
import matplotlib . pyplot as plt
from matplotlib . ticker import MaxNLocator
import seaborn as sns
# Import CSV
FDX_data = pd.read_csv("FDX.csv")
SPY_data = pd.read_csv("SPY.cs... | true |
e008c8106a4575b4ad671bc8f89b5745fb9df4af | Artimbocca/python | /demos/05-functions/06_defaultarguments.py | UTF-8 | 175 | 2.84375 | 3 | [] | no_license | def testDefaultArgs(arg1='default1', arg2='default2'):
"""A function with default arguments.
"""
print ('arg1:', arg1)
print ('arg2:', arg2)
testDefaultArgs() | true |
4031f069f738acba97e3a7c5e38175f37cc6d5cc | fsundstedt/Pandas-Practice-07-20-2020 | /python-script.py | UTF-8 | 1,825 | 2.921875 | 3 | [] | no_license | import psycopg2
from psycopg2 import Error
from dotenv import load_dotenv
load_dotenv()
import os
import numpy as np
import pandas as pd
# env info
env_host = os.getenv("DB_HOST")
env_name = os.getenv("DB_NAME")
env_user = os.getenv("DB_USER")
env_password = os.getenv("DB_PASSWORD")
read_file = './test_data.xlsx'
... | true |
00eac9112695db2e7de44b07f39b71315ebd6e7e | MichaelCurrin/twitterverse | /app/utils/stream.py | UTF-8 | 1,696 | 3.453125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Stream utility.
Test streaming API using command-line arguments list of input terms.
Such as words, phrases, hashtags or handles. Tweets are streamed live
and printed but not stored.
See this project's docs for the AND / OR rules of stream searches.
"""
import os
import sys
sys.path.insert(... | true |
d1bf6ed85b08ace4d465f57259822de1c7285271 | abhishek20111/healthy-app | /guess.py | UTF-8 | 557 | 3.03125 | 3 | [] | no_license | # n=23
# ta=8
# att=8
# while(True):
# att-=1
# u_input=int(input("\n enter the no"))
# if u_input<n and att>0:
# print("try again with high value")
# print("remain guess",att)
# elif u_input>n and att>0:
# print("too low")
# print("no of guess",att)
# continue
# ... | true |
89471471238c342673888d3aa064e649e5d94135 | SarahFellows/BrennanLooms | /brennan_looms/brennanlooms_app/views.py | UTF-8 | 3,304 | 3 | 3 | [] | no_license | from django.shortcuts import render
from django.http.response import HttpResponse
from django.http import JsonResponse
# import Json
from .models import *
# Create your views here.
def brennanlooms_app(request):
#renders the home page
return render(request, 'brennanlooms_app/index.html')
def about_pag... | true |
d8729904d3f0ca9fa373be127aa2db3a2637c619 | SethCommichaux/Rosalind_Problems | /ImplementMotifEnumeration.py | UTF-8 | 1,327 | 2.96875 | 3 | [] | no_license | f = open('Rosalind.txt')
sequences = []
for i,j in enumerate(f): ## first we collect sequences from file into a list
if i == 0:
j = j.strip().split()
kmer = int(j[0])
mismatches = int(j[1])
else:
j = j.strip().split()
sequences.append(j)
def Neighbors(Pattern,d): ## generates the d-neighborhood of the pro... | true |
9c3c24d281ca87ebdbc223e0b40628a890131840 | AdnanHaiderAD/Hadoop | /mapper_wdseq.py | UTF-8 | 486 | 3.296875 | 3 | [] | no_license | #! /usr/bin/python
import sys
for line in sys.stdin:
#removing non-alphanumeric characters
line= ' '.join(word for word in line.split() if word.isalnum())
wordlist= line.split()#using the white space chacracter to segment the string into a list of words
for index,word in enumerate(wordlist):
if index < len(word... | true |
ea5d222a83295d2cc6dbb660007e78d7d199ca87 | chenwenxiao/DOI | /utils/data/image_utils.py | UTF-8 | 6,526 | 2.828125 | 3 | [
"MIT"
] | permissive | import tempfile
from typing import *
import imageio
import numpy as np
from .types import ArrayInfo
__all__ = ['image_array_to_rgb', 'make_images_grid', 'save_image_to_file']
def _check_images_channel(images: np.ndarray,
channel_last: Optional[bool] = None,
requi... | true |
23b6dd73cc897d104df47e7d4134c0cb5a069ef2 | noahstrobel/GIS-Programming-ArcPy2 | /Strobel_Noah_ArcPy2Script.py | UTF-8 | 3,303 | 3.5625 | 4 | [] | no_license | # Name: Noah Strobel
# Class: GISc-450
# Created: 3/25/2021
# Purpose: This program examines shapefiles from the Corvallis GDB and prints the name, feature type, number
# of records, and then assigns them a new name based on the feature type and number of features (<= 1000 and >= 1001)
# It then creates a fo... | true |
63d20f502a56a2d45b649aed6a87a1cbabb7406a | isrdoc/smartninja-jinja | /main.py | UTF-8 | 466 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template
from datetime import datetime
app = Flask(__name__)
@app.route('/')
def index():
title = "Mainpage"
time_now = datetime.now()
people = ["Janko", "Metka", "Jure"]
return render_template("index.html", title=title, time_now=time_now, people=people)
@app.route(... | true |
374a7d53ae6b91d960d42273006ee21fb70be11b | motegikeita/brickpi3_open | /unicorn/commander.py | UTF-8 | 673 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 音声コマンド受け渡しプロセス
# Node-REDのexecノードに仕込み、メインプログラムに制御コマンドを送る
#
from socket import socket, AF_INET, SOCK_STREAM
import sys
COMMANDER_HOST = 'localhost'
COMMANDER_PORT = 51000
def voice_command_send(cmd):
while True:
try:
sock = socket(AF_INET, SO... | true |
a6afaba6a8752556e3c19a55c73adc21c8988a5f | lly102799-git/python-cookbook | /第3章 数字、日期和时间/3.1 对数值进行取整/fix_num.py | UTF-8 | 2,199 | 4.3125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
@project: Python Cookbook
@date: 2020-11-10 17:51
@author: Li Luyao
"""
# 将浮点数取整到固定的小数位:roundn(value, ndigits)
x = 1234.5678
print(round(x, 3))
print(round(x,-1))
# 取整和格式化
print(format(x, '.2f'))
print('Value is {:.2f}'.format(x))
# 浮点数精度的问题:浮点数天生的误差
a = 2.1
b = 4.3
print(a+b) # Return: 6... | true |
fe90e3ccdc5c0649d64d9e0a1a654258ff1ce19f | sodamodo/ac_transit | /compose/locations/store_locations.py | UTF-8 | 4,542 | 2.59375 | 3 | [] | no_license | import requests
import psycopg2
from google.transit import gtfs_realtime_pb2
from database import Vehicles, engine
from sqlalchemy.orm import sessionmaker
from time import sleep, time
from datetime import datetime
import logging
def loop():
print("abt to try")
try:
truth = True
while (truth):
... | true |
54dc53548c15df38a94b9b431f5e56f1afb01c31 | alsaadii98/GIZ_TASK1_IP_CLASSIFIER | /main.py | UTF-8 | 1,579 | 3.296875 | 3 | [] | no_license | import sys
class Solution:
def __init__(self) -> None:
# To get the IP address
ip = input("Enter the ip: ")
ip_range = ip.split("/")
first_ip = ip_range[0].split(".")
first_ints = [eval(i) for i in first_ip]
second_ip = int(ip_range[1])
class_type = "None"
... | true |
ffd0e8779b4d7b1f7daa440f111cd516360d0c5f | darshan-raul/Python-CLI-for-AWS | /packages/aws_services/IAM/iam.py | UTF-8 | 4,529 | 2.703125 | 3 | [
"MIT"
] | permissive |
"""
This module will be utilized for using the AWS IAM related tasks of the package
"""
import boto3
import botocore
from packages.utlities.colored import coloredtext
from packages.utlities.progressbar import progressbar
iam = boto3.client('iam')
def getusers(show):
"""
This function is used to get t... | true |
7e4c146970772a0e5d29548036368225ec9ea8b8 | gilz1407/Mopy | /PerformanceTests/Managers/DataDriven.py | UTF-8 | 1,347 | 3.34375 | 3 | [] | no_license | import csv
from threading import Lock
class Singleton(type):
_instances = {}
lastCsvfile = ""
def __call__(cls, *args, **kwargs):
if len(args) == 0:
csvfileName = Singleton.lastCsvfile
else:
csvfileName = args[0]
if cls not in cls._instances or csvfileName ... | true |
0afc77850181fae7ad0813a14c0b1e78554ead34 | Aasthaengg/IBMdataset | /Python_codes/p02697/s855859499.py | UTF-8 | 941 | 3.5 | 4 | [] | no_license | N, M = map(int, input().split())
#N人の参加者から、M組選ぶ
#これをNセット実施。
#組合わせの距離が重複しなければ、成立
#参加者を半分に分け、
#前半を距離奇数、後半を距離偶数にする
#参加者を半分に分ける
div_point=int((N/2))
#前半グループを奇数にする
if div_point%2==0:
div_point-=1
#後半グループは更に半分に分ける
re_point=div_point+int((N-div_point)/2)
#組を作る
i=0 #初期化
while 1<div_point-i*2 and i<re_point and i<M:#前半... | true |
96465ecb6186519927a41f8cb2ae9e50ce6b9a03 | itsdanielg/CSE-337-Scripting-Languages | /HW 1/q2.py | UTF-8 | 2,997 | 3.078125 | 3 | [] | no_license | # Daniel Garcia
# SBU ID: 111157499
# Homework 1
# Question 2
import csv
import time
import os
import statistics
def dd():
fileFolder = os.path.dirname(os.path.abspath(__file__))
csvFile = os.path.join(fileFolder, 'prices_sample.csv')
with open(csvFile, 'r') as csv_file:
csvReader = csv.reader(c... | true |
8d755bc5a85dbfb3c32ddb5329630d1c40b45011 | MrHamdulay/csc3-capstone | /examples/data/Assignment_1/gndvah001/question2.py | UTF-8 | 341 | 3.875 | 4 | [] | no_license | x=input("Enter the hours:\n")
y=input("Enter the minutes:\n")
z=input("Enter the seconds:\n")
x=eval(x)
y=eval(y)
z=eval(z)
if (x<0 or x>23):
print("Your time is invalid.")
elif (y<0 or y>59):
print("Your time is invalid.")
elif (z<0 or z>59):
print("Your time is invalid.")
else:
print("... | true |
f3ee08edcf83cfa77f5fdb95efaad7bfc14fb8b4 | thestrawberryqueen/python | /2_intermediate/chapter11/practice/number_mystery_1.py | UTF-8 | 528 | 4.625 | 5 | [
"MIT"
] | permissive | # Number Mystery 1
# Write a function called num_mystery that takes in 3 integers.
# The function should calculate the sum of the 3 integers and
# the difference between the largest integer and the smallest integer.
# The function should return the product of these two integers you calculated.
#
# Hint: You may f... | true |
f0b0f9f3453cda1459192393c4af29ef2c644e5e | jerryfeng007/pythonCodes | /monitor/获取页面所有的新闻标题.py | UTF-8 | 404 | 2.578125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
# 备注:只抓取了当天从0点开始的所有标题,即:未点击“加载更多”
url = 'http://finance.jrj.com.cn/yaowen'
r = requests.get(url).text
# print(r)
soup = BeautifulSoup(r, 'html.parser')
b = soup.find_all('b')
with open('存储新闻标题.txt', 'w') as f:
for bb in b:
if bb.a:
f.write(bb.a.t... | true |
7ea724f3b980fcb1566d0a9b08c992de12c728f5 | mossprescott/pynand | /computer.py | UTF-8 | 14,351 | 2.53125 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
"""Run the full computer with display and keyboard connected via pygame.
The program to run must be in the form of Hack assembly (.asm) or VM opcodes (a directory
of .vm files) and is specified by sys.argv[1].
The `codegen` simulator is used unless --vector is used.
$ ./computer.py examples/B... | true |
63b57e9b249d8613a8e2ff3ff8bc4f000437b140 | JacobSampson/mls_scraper | /mls_listings_scraper.py | UTF-8 | 2,202 | 2.859375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def scrape_listings(url):
headers = {
'accept':
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'en-US,en;q=0.8',
'upgrade-insec... | true |
291e7c8210296de8fb82fefd9102d51099b4ea6c | DavCisco/Export-Webex-Teams-users | /ListUsers_v2.0.py | UTF-8 | 9,829 | 2.71875 | 3 | [
"MIT"
] | permissive | # Webex Teams Tools: Export to .CSV to track active/pending users and post in Teams spaces
#
# Davide Grandis (dgrandis@cisco.com)
# version 1.0 - 09/12/2018
# version 2.0 - 25/04/2019
# New in v2.0:
# - ini file to retrieve: org_id, admin access token, post to Teams (bot): bot access token
# - BOT for posting int... | true |
60a7e0007cc3a7875af6064704033bbf06873ebb | brandontrabucco/playground | /playground/loggers/tensorboard_logger.py | UTF-8 | 1,925 | 2.84375 | 3 | [
"MIT"
] | permissive | """Author: Brandon Trabucco, Copyright 2019, MIT License"""
from playground.loggers.logger import Logger
import tensorflow as tf
class TensorboardInterface(Logger):
def __init__(
self,
replay_buffer,
logging_dir,
):
# create a separate tensor board logging thread
sel... | true |
6b8f00d3956ee687eb130f8a954f1bb9c7df310b | PageLib/ws | /ws/docs/model.py | UTF-8 | 762 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from datetime import datetime
from sqlalchemy import Column, CHAR, String, DateTime, ForeignKey, Float, Integer
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Document(Base):
"""Class for the stored documents"""
__tablename__ = 'document'
... | true |
8e70b7d0b1c895a29a233e498163dca65302c45e | IEP/submissions | /IdeaFuse 2014/ps13p56.py | UTF-8 | 633 | 3.15625 | 3 | [] | no_license | #!/bin/python
import sys
f = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin
def read(mode=2,handle=f):
inp = handle.readline().strip()
if mode == 0: return inp
if mode == 1: return inp.split()
if mode == 2: return list(map(int,inp.split()))
def path(x):
d = [x]
x -= 1
while x >= 1:
... | true |
4704e7e1aba55842f59bb3d33d09f2d37648a9d8 | dgitj/Big-Data-Twitter | /sentiment_pos_neg.py | UTF-8 | 2,483 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
from pymongo import MongoClient
import matplotlib.pyplot as plt
from collections import Counter
import numpy as np
import operator
from textblob import TextBlob
import re
from twython import Twython
from PIL import Image
from wordcloud import WordCloud, STOPWORD... | true |
c8e9aa461d589a8e1edd7150a1a5956db0718382 | AdamShechter9/sorting_algorithms_py | /bubblesortPy/bubble_sort.py | UTF-8 | 1,056 | 4.125 | 4 | [] | no_license | # Implementing a simple bubble sort algorithm.
# Adam Shechter
# Coding Dojo
from random import randint
from datetime import datetime
x = [3, 12, 11, 7, 6, 10, 4, 8, 2, 13, 9, 1]
def bubble_sort(inlist):
unsorted = True
print "sorting this list"
print inlist
while unsorted:
unsorted = False... | true |
49dc0535879b310c6eda2ccd7c0a1abd6aee55c0 | ketankotwal/test_repo | /PythonTest/nodewatch.py | UTF-8 | 2,115 | 2.5625 | 3 | [] | no_license | import time
from kazoo.client import KazooClient
import hashlib
from kazoo.recipe.watchers import DataWatch
class NodeWatch:
global second_zk
global nodepath, nodepath_hash
global nodewatch
#nodewatch = NodeWatch()
nodepath = "/zookeeper/quota/test3"
nodepath_hash = "/zoo... | true |
99ca356a9d6ba89a4911718d7a1f265b649c0ce0 | rshekhovtsov/sdsj-2018 | /pipeline_prototype/estimator.py | UTF-8 | 2,702 | 2.859375 | 3 | [] | no_license | import time
from sklearn.metrics import mean_squared_error, roc_auc_score
from utils import *
MIN_NUMBER = 1e-10 #small number to prevent division by zero
NEG_MEAN_SQUARED_ERROR = 'neg_mean_squared_error'
class Estimator():
__estimator = None
def __init__(self, estimator):
self.__estimator = est... | true |
5b69516228124a7acfaa640ed95b6a9429432107 | le717/linescan.py | /src/linescan.py | UTF-8 | 3,953 | 3.390625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""Effortlessly read a text file using counting numbers.
Created 2013-2018 Caleb Ely
<https://CodeTri.net>
Licensed under The MIT License
<http://opensource.org/licenses/MIT/>
"""
import locale
__all__ = ("show_errors", "scan")
LINESCAN_OPTIONS = {
"enable_exceptio... | true |
88b9c154e3efdc0303033529ba426aebf080df4f | morshedmasud/52-problem-solution-by-Subeen-python- | /problem-22/solution-22.py | UTF-8 | 456 | 3.671875 | 4 | [] | no_license | import math
# Taking value of 't' from user for test case
t = int(input())
x = 0
while x < t:
# Taking input from user for number range
m, n = map(int, input().split())
count = 0
for i in range(m, n+1):
if i > 1:
for j in range(2, i):
if i % j == 0:
... | true |
114bbc941a737333dd1ad8a2aa301251dccf18e5 | samoooop/ReinforcementLearningPlayground | /airraid.py | UTF-8 | 3,179 | 2.53125 | 3 | [] | no_license | import gym
import gym_rle
import time
import matplotlib.pyplot as plt
from keras.models import Sequential, load_model
from keras.layers import Dense, Activation, Convolution2D, Flatten, Dropout
import numpy as np
import time
def prep(img):
# down sample image
img = img[30:-60,:,]
img = img[::2,::2,]
im... | true |