max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
Chapter__7/unittest/test_cap.py | nil1729/python__noob | 0 | 12799951 | import unittest
import cap
class TestCap(unittest.TestCase):
def test_single_word(self):
text = 'python'
result = cap.cap_text(text)
self.assertEquals(result, 'Python')
def test_multiple_word(self):
text = 'python django'
result = cap.cap_text(text)
... | 3.21875 | 3 |
top_secret/_vault.py | trym-inc/top-secret | 0 | 12799952 | from typing import List, Dict, Callable
from .cast_handlers import bool_cast_handler
from .exceptions import CastHandlerMissingError
from .exceptions import SecretMissingError
from .exceptions import SecretSourceMissing
from .secret_sources import BaseSecretSource
from .secret_sources import EnvironmentVariableSecretS... | 2.21875 | 2 |
pycode/demo_km.py | Skielex/InSegt | 6 | 12799953 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Demo showing how km_dict and insegtannotator may be used together for
interactive segmentation.
@author: vand and abda
"""
import sys
import insegtannotator
import skimage.io
import skimage.data
import km_dict
import numpy as np
#%% EXAMPLE 1: glass fibres
## load... | 3.109375 | 3 |
src/eltetrado/analysis.py | tzok/el_tetrado | 0 | 12799954 | <gh_stars>0
import itertools
import logging
import math
import os
import string
import subprocess
import tempfile
from collections import defaultdict, Counter
from dataclasses import dataclass, field
from typing import Dict, Iterable, List, Tuple, Optional, Set
import numpy
from eltetrado.model import Atom3D, Structu... | 1.867188 | 2 |
cubes/__init__.py | lmjohns3/cube-experiment | 0 | 12799955 | from .database import Experiment, Movement, Trial
from . import plots
from . import utils
| 1.023438 | 1 |
tests/test_ndvisummarytimeseries.py | tmilliman/python-vegindex | 11 | 12799956 | <reponame>tmilliman/python-vegindex
# -*- coding: utf-8 -*-
"""
test_ndvisummarytimeseries
--------------------------
Tests for `vegindex.ndvi_summary_timeseries` module.
"""
import os
import numpy as np
from PIL import Image
from pkg_resources import Requirement
from pkg_resources import resource_filename
from veg... | 2.375 | 2 |
GreenPonik_Atlas_Scientific_OEM_i2c/CommonsI2c.py | GreenPonik/GreenPonik_Atlas_Scientific_OEM_i2c | 0 | 12799957 | #! /usr/bin/python3
"""
Description
-----------
Class to communicate with Atlas Scientific OEM sensors in I2C mode.
Atlas Scientific i2c by GreenPonik
Source code is based on Atlas Scientific documentations:
https://www.atlas-scientific.com/files/EC_oem_datasheet.pdf
https://atlas-scientific.com/files/oem_pH_datashe... | 2.875 | 3 |
tools/loadKar.py | hidura/sugelico | 0 | 12799958 |
from datetime import datetime
import os
class core:
def __init__(self, environ = None, location = None):
self.response = None
if environ == None and location == None:
#If the environ and the location are None, no make anything.
self.response = """<h1>Petitio... | 2.90625 | 3 |
IMU/VTK-6.2.0/ThirdParty/Twisted/twisted/scripts/__init__.py | timkrentz/SunTracker | 4 | 12799959 | <filename>IMU/VTK-6.2.0/ThirdParty/Twisted/twisted/scripts/__init__.py
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Subpackage containing the modules that implement the command line tools.
Note that these are imported by top-level scripts which are intended to be
invoked directly... | 1.34375 | 1 |
API/controller/routes.py | GeoscienceAustralia/FSDF-Roads | 1 | 12799960 | from flask import Blueprint, request, Response, render_template
from model.roads import Roads
from pyldapi import ContainerRenderer
import conf
import ast
import folium
print(__name__)
routes = Blueprint('controller', __name__)
DEFAULT_ITEMS_PER_PAGE=50
@routes.route('/', strict_slashes=True)
def home():
return r... | 2.609375 | 3 |
backend/chat/routing.py | CSCI34284/group4_project | 1 | 12799961 | """
Prepared by Backend/Server Team - Sheldon, Martin, Brian, Sarah, Veronica.
"""
from django.urls import re_path
from .consumers import ChatConsumer
# Assign pattern to activate selected websocket
websocket_urlpatterns = [
re_path(r'^ws/chat/(?P<room_name>[^/]+)/$', ChatConsumer),
]
| 1.9375 | 2 |
ebs_snatcher/main.py | Cobliteam/ebs_snatcher | 3 | 12799962 | <reponame>Cobliteam/ebs_snatcher
from __future__ import unicode_literals
from builtins import str, bytes
import argparse
import json
import logging
import random
from . import ebs
logger = logging.getLogger('ebs-snatcher.main')
def get_args(): # pragma: no cover
argp = argparse.ArgumentParser(
'ebs-s... | 2.609375 | 3 |
manager/integration/tests/test_ha.py | JacieChao/longhorn-tests | 0 | 12799963 | import pytest
import common
import time
from common import client, volume_name # NOQA
from common import SIZE, DEV_PATH
from common import check_volume_data, get_self_host_id, get_volume_endpoint
from common import write_volume_random_data
from common import RETRY_COUNTS, RETRY_ITERVAL
@pytest.mark.coretest # NOQ... | 1.945313 | 2 |
neural_cdes/F.py | jb-c/dissertation | 0 | 12799964 | <reponame>jb-c/dissertation<gh_stars>0
import torch
class F(torch.nn.Module):
'''
Defines the neural network denoted f_{\theta} in our neural CDE model
'''
def __init__(self, input_channels, hidden_channels, width = 128):
'''
:param input_channels: the number of input channels in the da... | 3.796875 | 4 |
UD/test.py | Anon-LeoH/UncleDaLearn | 1 | 12799965 | from LinearRegression.HugeScaleLR import hugeScaleLR as hlr
from LinearRegression.GradientDescent import gradientDescent as glr
from LinearRegression.regularization import regularization as rg
import numpy as np
from copy import deepcopy as dp
import random
import math
from Function import *
from Distribution import No... | 2.671875 | 3 |
Ex81.py | ErickTeixeira777/Python-3 | 0 | 12799966 | <filename>Ex81.py
'''Faça um programa que vai ler vários números e colocar em uma lista, depois disso,mostre:
A) Quantos números foram digitados.
B) A Lista de valores, ordenada de forma decrescente.
C) Se o valor 5 foi digitado e está ou não na lista'''
valores = []
while True:
valores.append(int(input('Digite um... | 4.15625 | 4 |
CreateAccount.py | manijamali2003/Nava | 1 | 12799967 | <reponame>manijamali2003/Nava
#!/usr/bin/env python3
import os
import socket, random,hashlib
from Nava import *
HOST = '127.0.0.1' # Standard loopback interface address (localhost)
PORT = 65433 # Port to listen on (non-privileged ports are > 1023)
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
... | 2.609375 | 3 |
diventi/landing/migrations/0009_auto_20180220_0745.py | flavoi/diven | 2 | 12799968 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-02-20 06:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('landing', '0008_remove_featurescover_active'),
]
o... | 1.695313 | 2 |
FAUSTPy/__main__.py | mathandy/faust_python | 25 | 12799969 | import argparse
import numpy as np
import matplotlib.pyplot as plt
from FAUSTPy import *
#######################################################
# set up command line arguments
#######################################################
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--faustfloat',
... | 2.703125 | 3 |
src/schemathesis/runner/impl/__init__.py | gluhar2006/schemathesis | 659 | 12799970 | <gh_stars>100-1000
from .core import BaseRunner
from .solo import SingleThreadASGIRunner, SingleThreadRunner, SingleThreadWSGIRunner
from .threadpool import ThreadPoolASGIRunner, ThreadPoolRunner, ThreadPoolWSGIRunner
| 0.976563 | 1 |
setup.py | sqxccdy/tcp-tunnel | 1 | 12799971 | <gh_stars>1-10
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools import setup, find_packages
import tcp_tunnel
setup(name="tcp-tunnel",
version=tcp_tunnel.VER... | 1.46875 | 1 |
pertemuan_8/7_HTTP_API_With_Sensor/app/forms/_action.py | Muhammad-Yunus/Flask-Web-Development | 0 | 12799972 | <filename>pertemuan_8/7_HTTP_API_With_Sensor/app/forms/_action.py
from . import FlaskForm
from . import SubmitField
class ActionTable(FlaskForm):
activate = SubmitField('Activate')
deactivate = SubmitField('Deactivate')
delete = SubmitField('Delete') | 1.820313 | 2 |
examples/html_test/static/generate.py | bitterfly/kuho | 0 | 12799973 | #!/usr/bin/python3
import os
import sys
import http.server
import socketserver
import socket
import shutil
from base64 import b64encode
from urllib.parse import quote
from os.path import basename, splitext, join, isfile
from collections import defaultdict
from subprocess import run
from distutils.dir_util import copy_... | 2.40625 | 2 |
py_utils/readFile.py | mrrgeresez/my-python-approach | 0 | 12799974 | # -*- coding: utf-8 -*-
"""
Doc: show how to use it
$ python readFile.py data.txt
Show content of data.txt
"""
import sys
if __name__ == "__main__":
with open(sys.argv[1],'r',encoding = 'utf8') as f:
# indicates that the second argument in terminal is to be used
for line in f:
print... | 3.71875 | 4 |
apps/operations/urls.py | bopopescu/diandian_online | 3 | 12799975 | # _*_ coding: utf-8 _*_
__author__ = 'nick'
__date__ = '2019/2/25 18:14'
from django.urls import path
from . import views
app_name = 'operations'
urlpatterns = [
# 用户个人中心
path('user_center_information/', views.UserCenterInformation.as_view(), name='user_center_information'),
# 用户学习的课程
path('user_cen... | 1.8125 | 2 |
utils/ImageProcesser.py | LLRukia/kkrbot | 0 | 12799976 | import os
import re
import uuid
import globals
from PIL import Image, ImageDraw, ImageFont
from utils.Asset import ImageAsset
SPACING = 5
back_regex = re.compile(r'back_([0-9]*)\.jpg')
BACK_PIC_UNIT_WIDTH, BACK_PIC_UNIT_HEIGHT = 140, 130
BACK_PIC_NUM_EACH_LINE = 5
def bg_image_gen(back_number, s):
def half_en_l... | 2.40625 | 2 |
Maths/7. Reverse Integer.py | thewires2/Leetcode | 1 | 12799977 | class Solution:
def reverse(self, x: int) -> int:
f=False
if x<0:
f=True
y=str(abs(x))
y=y[::-1]
x=int(y)
if -2147483648<=x and x<=2147483647:
if f==False:
return x
return -x
return 0
| 3.25 | 3 |
rockpaperscissors.py | tarellmorris/RockPaperScissors | 0 | 12799978 | <filename>rockpaperscissors.py
from random import randint
options = {1: 'ROCK', 2: 'PAPER', 3: 'SCISSORS'}
def cpu_move():
cpu_rand = randint(1, 3)
return cpu_rand
def player_move():
player = input("Choose a move: ('ROCK', 'PAPER', or 'SCISSORS'): ")
# if player.upper() != 'ROCK' or player.upper() !... | 4.1875 | 4 |
src/control_node/control_node/errors.py | tessia-project/tessia-mesh | 5 | 12799979 | # Copyright 2021 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | 1.945313 | 2 |
code/route_betweenness.py | tlarock/shipping | 0 | 12799980 | <gh_stars>0
import numpy as np
import networkx as nx
def route_node_betweenness_from_paths(G, filtered_paths):
'''
Computes route betweenness for nodes starting from set of paths filtered_paths.
Uses G only to get the number of nodes; could be done by iterating
over pairs of nodes in filtered_paths or... | 3.1875 | 3 |
language/python/pocket-primer/CH5 - Files Input and Output/planets.py | pendraic/learn | 0 | 12799981 | <filename>language/python/pocket-primer/CH5 - Files Input and Output/planets.py
# This program prints the names of planets having fewer than ten (10) moons
# Open the file
try:
infile = open ("planets.txt", "r")
# Read (skip over) the header line
s = infile.readline()
# For each planet
for i in r... | 3.921875 | 4 |
runtests.py | tushargoel97/WebAdmin | 0 | 12799982 | <gh_stars>0
from fabric import Connection
class OperationsUtil():
def __init__(self):
self.rootUser="ubuntu20"
self.rootPass="<PASSWORD>!"
self.conn=Connection(host='ubuntu20@10.109.34.222',connect_kwargs={"password": self.rootPass})
def createUser(self, username, password, dirname):
... | 2.453125 | 2 |
src/tfchain/types/PrimitiveTypes.py | GlenDC/threefold-wallet-electron | 0 | 12799983 | <reponame>GlenDC/threefold-wallet-electron
import tfchain.errors as tferrors
import tfchain.polyfill.encoding.base64 as jsbase64
import tfchain.polyfill.encoding.hex as jshex
import tfchain.polyfill.encoding.str as jsstr
import tfchain.polyfill.encoding.decimal as jsdec
import tfchain.polyfill.array as jsarray
from t... | 2.015625 | 2 |
dimensionality_reduction/LDA.py | jonathangouvea/PatternRecognition | 0 | 12799984 | import numpy as np
from numpy import linalg as LA
class LDA():
def __init__(self, dim = 2):
self.dim = dim
self.matrixTransf = None
def fit_transform(self, X, labels):
positive = []
negative = []
for i in range(len(labels)):
if labels[i] == 1:
... | 2.921875 | 3 |
wowgic/wowgic_flask/lib/tweepy/__init__.py | chelladurai89/wowgicbackend2.0 | 0 | 12799985 | # Tweepy
# Copyright 2009-2010 <NAME>
# See LICENSE for details.
"""
Tweepy Twitter API library
"""
__version__ = '3.5.0'
__author__ = '<NAME>'
__license__ = 'MIT'
from tweepy.models import Status, User, DirectMessage, Friendship, SavedSearch, SearchResults, ModelFactory, Category
from tweepy.error import TweepError,... | 2.515625 | 3 |
Section 2 - Data (variables, assignments and expressions)/Breakouts/Breakout 2.1 - Turtle Graphics/Q5 - random walk solution.py | gitjot/python-for-lccs | 10 | 12799986 | <gh_stars>1-10
# Event: LCCS Python Fundamental Skills Workshop
# Date: May 2018
# Author: <NAME>, PDST
# eMail: <EMAIL>
# Purpose: Solution to Q5 page 53
from turtle import *
from random import *
angle = randint(0, 360)
lineLen = randint(50, 100)
left(angle)
forward(lineLen)
angle = randint(0, 360)
l... | 3.34375 | 3 |
QianProj.py | Bachery/sqlova | 0 | 12799987 | from datetime import timedelta
import numpy as np
import pandas as pd
import argparse
import torch
import json
import os
from add_csv import csv_to_sqlite, csv_to_json
from sqlnet.dbengine import DBEngine
from sqlova.utils.utils_wikisql import *
from train import construct_hyper_param, get_models
#### prediction ####... | 2.34375 | 2 |
scalyr_agent/third_party_tls/tlslite/defragmenter.py | zak905/scalyr-agent-2 | 0 | 12799988 | <gh_stars>0
# Copyright (c) 2015, <NAME>
#
# See the LICENSE file for legal information regarding use of this file.
""" Helper package for handling fragmentation of messages """
from __future__ import generators
from .utils.codec import Parser
class Defragmenter(object):
"""
Class for demultiplexing TLS me... | 2.609375 | 3 |
tfx/orchestration/portable/execution_watcher.py | avelez93/tfx | 1,813 | 12799989 | <filename>tfx/orchestration/portable/execution_watcher.py
# Copyright 2021 Google LLC. 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/licen... | 2.03125 | 2 |
main.py | xiangsheng1325/CPGAN | 0 | 12799990 | <filename>main.py
import warnings
import pprint, os, random, torch
from CPGAN.data_utils import *
import numpy as np
from CPGAN.options import *
from CPGAN.train import *
warnings.filterwarnings("ignore")
def get_options():
opt = Options()
opt = opt.initialize()
return opt
def seed_torch(seed=1029):
r... | 2.3125 | 2 |
src/drone_control/mavros/sender.py | Adrien4193/drone_control | 0 | 12799991 | <reponame>Adrien4193/drone_control<gh_stars>0
import rospy
from tf.transformations import quaternion_from_euler
from geometry_msgs.msg import Point, PoseStamped, Quaternion
from mavros_msgs.msg import Thrust
class Sender(object):
def __init__(self):
self._pubs = {}
self._pubs['position']... | 2.3125 | 2 |
introducing-python-answers/chapter10.py | DailyYu/python-study | 1 | 12799992 | <reponame>DailyYu/python-study
# Q1
from datetime import date
now = date.today()
now_string = now.isoformat()
with open('today.txt', 'w') as file:
print(now, file=file)
# Q2
today_string = None
with open('today.txt') as file:
today_string = file.read()
print(today_string)
# Q3
from datetime import datetime... | 3.84375 | 4 |
things.py | racinmat/depth-voxelmap-estimation | 2 | 12799993 | import tensorflow as tf
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from PIL import Image
import Network
import dataset
from Network import BATCH_SIZE
from dataset import DataSet
def output_predict(depths, images, depths_discretized, depths_reconstructed, output_dir):
... | 2.46875 | 2 |
src/python/twitter/pants/tasks/cache_manager.py | wfarner/commons | 1 | 12799994 | # ==================================================================================================
# Copyright 2012 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | 1.78125 | 2 |
configman/tests/test_val_for_json.py | peterbe/configman | 0 | 12799995 | # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Softwa... | 1.507813 | 2 |
Python/Programming Basics/Simple Conditional Statements/09. Password Guess.py | teodoramilcheva/softuni-software-engineering | 0 | 12799996 | <gh_stars>0
a = input()
b = '<PASSWORD>'
if a == b:
print('Welcome')
else:
print('Wrong password!')
| 3.1875 | 3 |
scripts/addons/uvpackmaster2/operator.py | Tilapiatsu/blender-custom_conf | 2 | 12799997 | <gh_stars>1-10
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This pro... | 1.953125 | 2 |
src/data_gen/train_tokenizer.py | spacemanidol/Image2smiles | 6 | 12799998 | <filename>src/data_gen/train_tokenizer.py
import os
import argparse
from tokenizers.decoders import ByteLevel as ByteLevelDecoder
from tokenizers.models import BPE
from tokenizers.normalizers import Lowercase, NFKC, Sequence
from tokenizers.pre_tokenizers import ByteLevel
from tokenizers.trainers import BpeTrainer
fro... | 2.421875 | 2 |
hub/tests/test_models_custom_link.py | yevgenykuz/dev-team-hub | 2 | 12799999 | <reponame>yevgenykuz/dev-team-hub
from django.test import TestCase
from ..models import CustomLink
class CustomLinkModelTests(TestCase):
def setUp(self):
self.custom_link = CustomLink.objects.create(name='Google', url='https://www.google.com', order_id=1)
def test_new_object(self):
self.asse... | 2.546875 | 3 |