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 |
|---|---|---|---|---|---|---|
scrapy/http/request/__init__.py | joybhallaa/scrapy | 1 | 700 | """
This module implements the Request class which is used to represent HTTP
requests in Scrapy.
See documentation in docs/topics/request-response.rst
"""
from w3lib.url import safe_url_string
from scrapy.http.headers import Headers
from scrapy.utils.python import to_bytes
from scrapy.utils.trackref import object_ref... | 2.640625 | 3 |
game.py | akaeme/BlackJackBot | 0 | 701 | <filename>game.py
#encoding: utf8
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__license__ = "GPL"
__version__ = "0.1"
import copy
import card
from shoe import Shoe
from dealer import Dealer
from player import Player
BET_MULTIPLIER = 2
class Game(object):
class Rules():
def __init__(self, shoe_size=4, min... | 3.5625 | 4 |
loops/for/for3.py | camipozas/python-exercises | 0 | 702 | # Escribir un programa que muestre la sumatoria de todos los múltiplos de 7 encontrados entre el 0 y el 100.
# Summing all the multiples of 7 from 0 to 100.
total = 0
for i in range(101):
if i % 7 == 0:
total = total+i
print("Sumatoria de los múltiplos de 7:", total)
| 3.953125 | 4 |
lib/TWCManager/Status/HASSStatus.py | Saftwerk/TWCManager | 1 | 703 | # HomeAssistant Status Output
# Publishes the provided sensor key and value pair to a HomeAssistant instance
import logging
import time
from ww import f
logger = logging.getLogger(__name__.rsplit(".")[-1])
class HASSStatus:
import threading
import requests
apiKey = None
config = None
configCo... | 2.3125 | 2 |
Archive/routes/home_routes.py | taycurran/TwitOff | 0 | 704 |
from flask import Blueprint, jsonify, request, render_template
home_routes = Blueprint("home_routes", __name__)
@home_routes.route("/")
def index():
users = User.query.all()
return render_template('base.html', title='Home',
users=users)
@home_routes.route("/about")
def a... | 2.578125 | 3 |
intent/scripts/classification/ctn_to_classifier.py | rgeorgi/intent | 3 | 705 | <reponame>rgeorgi/intent<filename>intent/scripts/classification/ctn_to_classifier.py
from argparse import ArgumentParser
from collections import defaultdict
import glob
import os
import pickle
from random import shuffle, seed
import sys
from tempfile import mkdtemp
import shutil
import logging
root_logger = logging.ge... | 2.125 | 2 |
watchdog/back-end/v0.3.0/watchdog/app/resource/video.py | Havana3351/Low-cost-remote-monitor | 18 | 706 | <gh_stars>10-100
from flask_restful import Resource
from flask import Response
import os
import cv2
picturecounter = 1 # 防止过多记录的标识
class Video(Resource):
#如果方法为get 调用该方法
def get(self):
global picturecounter
# username = (request.get_json())['username']
# db = pymysql.connect("rm-2z... | 2.6875 | 3 |
codes/ambfix.py | valgur/LEOGPS | 0 | 707 | <reponame>valgur/LEOGPS
#!/usr/bin/env python3
'''
###############################################################################
###############################################################################
## ##
## _ ___ ___ ___ __... | 2.703125 | 3 |
summarizer/test_summarizer.py | bmcilw1/text-summary | 0 | 708 | <filename>summarizer/test_summarizer.py
from summarizer.summarizer import summarize
def test_summarize_whenPassedEmptyString_ReturnsEmpty():
assert summarize("") == "" | 2.109375 | 2 |
XORCipher/XOREncrypt.py | KarthikGandrala/DataEncryption | 1 | 709 | <reponame>KarthikGandrala/DataEncryption
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Function to encrypt message using key is defined
def encrypt(msg, key):
# Defining empty strings and counters
hexadecimal = ''
iteration = 0
# Running for loop in the range of MSG and comparing the BITS... | 4.34375 | 4 |
02-Use-functions/21-Opening_a_file/secret_message.py | francisrod01/udacity_python_foundations | 0 | 710 | <reponame>francisrod01/udacity_python_foundations<filename>02-Use-functions/21-Opening_a_file/secret_message.py
#!/usr/bin/python3
import os
import random
def rename_files(path):
file_list = os.listdir(path)
print(file_list)
for file_name in file_list:
# Remove numbers from filename.
# n... | 4.125 | 4 |
xarray/core/variable.py | timgates42/xarray | 0 | 711 | import copy
import functools
import itertools
import numbers
import warnings
from collections import defaultdict
from datetime import timedelta
from distutils.version import LooseVersion
from typing import (
Any,
Dict,
Hashable,
Mapping,
Optional,
Sequence,
Tuple,
TypeVar,
Union,
)
... | 2.140625 | 2 |
codeforces.com/1186A/solution.py | zubtsov/competitive-programming | 0 | 712 | number_of_participants, number_of_pens, number_of_notebooks = map(int, input().split())
if number_of_pens >= number_of_participants and number_of_notebooks >= number_of_participants:
print('Yes')
else:
print('No')
| 3.75 | 4 |
DLA/__main__.py | StanczakDominik/DLA | 0 | 713 | <reponame>StanczakDominik/DLA
from DLA import main_single
d = main_single(1, gotosize=[1e4, 5e4])
d.plot_particles()
d.plot_mass_distribution()
| 1.757813 | 2 |
pyamf/tests/test_util.py | bulutistan/Py3AMF | 42 | 714 | # -*- coding: utf-8 -*-
#
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Tests for AMF utilities.
@since: 0.1.0
"""
import unittest
from datetime import datetime
from io import BytesIO
import pyamf
from pyamf import util
from pyamf.tests.util import replace_dict
PosInf = 1e300000
NegInf = -... | 2.4375 | 2 |
e-valuator.py | keocol/e-valuator | 0 | 715 | <filename>e-valuator.py
import dns.resolver
import sys
import colorama
import platform
from colorama import init, Fore, Back, Style
import re
# pip install -r requirements.txt (colorama)
os = platform.platform()
if os.find('Windows')!= (-1):
init(convert=True)
print("""
███████╗░░░░░░██╗░░░██╗... | 2.421875 | 2 |
api/server.py | qh73xe/HowAboutNatume | 0 | 716 | <reponame>qh73xe/HowAboutNatume
# -*- coding: utf-8 -*
"""トルネードを使用した ask.api を作成します."""
from json import dumps
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.options import parse_command_line
from tornado.web import Application, RequestHandler
from tornado.options import defi... | 2.71875 | 3 |
proxy/http/chunk_parser.py | GDGSNF/proxy.py | 0 | 717 | <filename>proxy/http/chunk_parser.py
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by <NAME> and contributors.
... | 2.6875 | 3 |
nova/pci/stats.py | 10088/nova | 0 | 718 | # Copyright (c) 2013 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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/li... | 1.726563 | 2 |
Use.py | Codingprivacy/Multiple-Rename | 2 | 719 | import multiple
multiple.rename("C:/Users/Username/Desktop",'new_name',33,'.exe')
"""this above lines renames all the files of the folder Desktop to 'new_name' and
count starts from 33 to further (we can also provide 1 to start it from 1) and
extension is given '.exe'
hence the files will be renamed like :
1. new_n... | 3.34375 | 3 |
ReadSymLink.py | ohel/pyorbital-gizmod-tweaks | 0 | 720 | import os
def readlinkabs(l):
"""
Return an absolute path for the destination
of a symlink
"""
if not (os.path.islink(l)):
return None
p = os.readlink(l)
if os.path.isabs(p):
return p
return os.path.join(os.path.dirname(l), p)
| 2.890625 | 3 |
examples/capture_circular.py | IanTBlack/picamera2 | 71 | 721 | <filename>examples/capture_circular.py<gh_stars>10-100
#!/usr/bin/python3
import time
import numpy as np
from picamera2.encoders import H264Encoder
from picamera2.outputs import CircularOutput
from picamera2 import Picamera2
lsize = (320, 240)
picam2 = Picamera2()
video_config = picam2.video_configuration(main={"siz... | 2.828125 | 3 |
Bio/NeuralNetwork/Gene/Pattern.py | barendt/biopython | 3 | 722 | """Generic functionality useful for all gene representations.
This module contains classes which can be used for all the different
types of patterns available for representing gene information (ie. motifs,
signatures and schemas). These are the general classes which should be
handle any of the different specific patte... | 3.34375 | 3 |
neslter/parsing/nut/__init__.py | WHOIGit/nes-lter-ims | 3 | 723 | <gh_stars>1-10
from .nut import parse_nut, format_nut, merge_nut_bottles
| 1.0625 | 1 |
legtool/tabs/servo_tab.py | jpieper/legtool | 10 | 724 | # Copyright 2014 <NAME>, <EMAIL>.
#
# 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 writ... | 2.28125 | 2 |
epsilon/juice.py | twisted/epsilon | 4 | 725 | # -*- test-case-name: epsilon.test.test_juice -*-
# Copyright 2005 Divmod, Inc. See LICENSE file for details
import warnings, pprint
import keyword
import io
import six
from twisted.internet.main import CONNECTION_LOST
from twisted.internet.defer import Deferred, maybeDeferred, fail
from twisted.internet.protocol im... | 2.28125 | 2 |
bonsai3/simulator_client.py | kirillpol-ms/bonsai3-py | 0 | 726 | <gh_stars>0
"""
Client for simulator requests
"""
__copyright__ = "Copyright 2020, Microsoft Corp."
# pyright: strict
from random import uniform
import time
from typing import Union
import jsons
import requests
from .exceptions import RetryTimeoutError, ServiceError
from .logger import Logger
from .simulator_protoc... | 2.015625 | 2 |
perturbed_images_generation_multiProcess.py | gwxie/Synthesize-Distorted-Image-and-Its-Control-Points | 8 | 727 | '''
<NAME>
set up :2020-1-9
intergrate img and label into one file
-- fiducial1024_v1
'''
import argparse
import sys, os
import pickle
import random
import collections
import json
import numpy as np
import scipy.io as io
import scipy.misc as m
import matplotlib.pyplot as plt
import glob
import math
import time
impo... | 1.867188 | 2 |
tweet_evaluator.py | tw-ddis/Gnip-Tweet-Evaluation | 3 | 728 | #!/usr/bin/env python
import argparse
import logging
try:
import ujson as json
except ImportError:
import json
import sys
import datetime
import os
import importlib
from gnip_tweet_evaluation import analysis,output
"""
Perform audience and/or conversation analysis on a set of Tweets.
"""
logger = logging.g... | 2.8125 | 3 |
app.py | admiral-aokiji/whatsapp-bot | 0 | 729 | <gh_stars>0
from flask import Flask, request
import os
from twilio.twiml.messaging_response import MessagingResponse
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
chrome_options.add_argument("--headless")
chrome_options.add... | 2.453125 | 2 |
nflfastpy/errors.py | hchaozhe/nflfastpy | 47 | 730 | """
Custom exceptions for nflfastpy module
"""
class SeasonNotFoundError(Exception):
pass | 1.59375 | 2 |
assignment1/cs231n/classifiers/neural_net.py | zeevikal/CS231n-spring2018 | 0 | 731 | from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network. The net has an input dimension
of N, a hidden layer dimension of H, and performs classification over C
classes.
We train the network... | 4.21875 | 4 |
dynamic_setting/tests/test_models.py | koralarts/django-dynamic-settings | 2 | 732 | from django.test import TestCase
from dynamic_setting.models import Setting
class SettingTestCase(TestCase):
def _create_setting(self, name, **kwargs):
return Setting.objects.create(name=name, **kwargs)
def test_create_setting(self):
""" Test Creating a new Setting. """
name = 'T... | 2.828125 | 3 |
homeassistant/components/zamg/weather.py | MrDelik/core | 30,023 | 733 | """Sensor for data from Austrian Zentralanstalt für Meteorologie."""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.components.weather import (
ATTR_WEATHER_HUMIDITY,
ATTR_WEATHER_PRESSURE,
ATTR_WEATHER_TEMPERATURE,
ATTR_WEATHER_WIND_BEARING,
ATTR_WE... | 2.203125 | 2 |
rasa/model.py | martasls/rasa | 0 | 734 | import copy
import glob
import hashlib
import logging
import os
import shutil
from subprocess import CalledProcessError, DEVNULL, check_output # skipcq:BAN-B404
import tempfile
import typing
from pathlib import Path
from typing import Any, Text, Tuple, Union, Optional, List, Dict, NamedTuple
from packaging import ver... | 1.851563 | 2 |
algorithmic_trading/backester_framework_test.py | CatalaniCD/quantitative_finance | 1 | 735 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 16 11:20:01 2021
@author: q
GOAL : develop a backtester from a .py framework / library
# installation :
pip install backtesting
# Documentation
Index :
- Manuals
- Tutorials
- Example Strategies
- FAQ
... | 2.15625 | 2 |
Sec_10_expr_lambdas_fun_integradas/f_generators.py | PauloAlexSilva/Python | 0 | 736 | <gh_stars>0
""""
Generator Expression
Em aulas anteriores foi abordado:
- List Comprehension;
- Dictionary Comprehension;
- Set Comprehension.
Não foi abordado:
- Tuple Comprehension ... porque elas se chamam Generators
nomes = ['Carlos', 'Camila', 'Carla', 'Cristiana', 'Cristina', 'Vanessa']
print(... | 3.78125 | 4 |
python/ordenacao.py | valdirsjr/learning.data | 0 | 737 | numero1 = int(input("Digite o primeiro número: "))
numero2 = int(input("Digite o segundo número: "))
numero3 = int(input("Digite o terceiro número: "))
if (numero1 < numero2 and numero2 < numero3):
print("crescente")
else:
print("não está em ordem crescente") | 4.15625 | 4 |
_sources/5-extra/opg-parameters-sneeuwvlok_solution.py | kooi/ippt-od | 1 | 738 | <reponame>kooi/ippt-od
import turtle
tina = turtle.Turtle()
tina.shape("turtle")
tina.speed(10)
def parallellogram(lengte):
for i in range(2):
tina.forward(lengte)
tina.right(60)
tina.forward(lengte)
tina.right(120)
def sneeuwvlok(lengte, num):
for i in range(num):
para... | 3.3125 | 3 |
nikola/plugins/task_render_listings.py | servalproject/nikola | 1 | 739 | # Copyright (c) 2012 <NAME> y otros.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish,
# ... | 1.914063 | 2 |
sdk/python/pulumi_azure_native/storage/storage_account_static_website.py | sebtelko/pulumi-azure-native | 0 | 740 | <reponame>sebtelko/pulumi-azure-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, ... | 1.71875 | 2 |
python/example_code/s3/s3-python-example-get-bucket-policy.py | onehitcombo/aws-doc-sdk-examples | 3 | 741 | <gh_stars>1-10
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.... | 1.976563 | 2 |
lang/py/aingle/test/gen_interop_data.py | AIngleLab/aae | 0 | 742 | <reponame>AIngleLab/aae
#!/usr/bin/env python3
##
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Li... | 1.65625 | 2 |
data_io/util/value_blob_erosion.py | Rekrau/PyGreentea | 0 | 743 | import numpy as np
from scipy import ndimage
def erode_value_blobs(array, steps=1, values_to_ignore=tuple(), new_value=0):
unique_values = list(np.unique(array))
all_entries_to_keep = np.zeros(shape=array.shape, dtype=np.bool)
for unique_value in unique_values:
entries_of_this_value = array == uni... | 2.65625 | 3 |
astropy/units/tests/test_logarithmic.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 3 | 744 | # coding: utf-8
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Test the Logarithmic Units and Quantities
"""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
from ...extern import six
from ...extern.six.moves import zip
import pickle... | 2.140625 | 2 |
djconnectwise/tests/mocks.py | kti-sam/django-connectwise | 0 | 745 | <reponame>kti-sam/django-connectwise
import os
from mock import patch
from datetime import datetime, date, time
import json
import responses
from . import fixtures
from django.utils import timezone
CW_MEMBER_IMAGE_FILENAME = 'AnonymousMember.png'
def create_mock_call(method_name, return_value, side_effect=None):
... | 2.125 | 2 |
visual_odometry/visual_odometry.py | vineeths96/Visual-Odometry | 2 | 746 | <reponame>vineeths96/Visual-Odometry<filename>visual_odometry/visual_odometry.py<gh_stars>1-10
from .monovideoodometry import MonoVideoOdometry
from .parameters import *
def visual_odometry(
image_path="./input/sequences/10/image_0/",
pose_path="./input/poses/10.txt",
fivepoint=False,
):
"""
Plots... | 2.8125 | 3 |
tf-2-data-parallelism/src/utils.py | Amirosimani/amazon-sagemaker-script-mode | 144 | 747 | import os
import numpy as np
import tensorflow as tf
def get_train_data(train_dir, batch_size):
train_images = np.load(os.path.join(train_dir, 'train_images.npy'))
train_labels = np.load(os.path.join(train_dir, 'train_labels.npy'))
print('train_images', train_images.shape, 'train_labels', train_labels.sha... | 2.6875 | 3 |
scripts/run_rbf_comparison_car_air_top5.py | CaptainCandy/influence-release | 0 | 748 | <filename>scripts/run_rbf_comparison_car_air_top5.py
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 19 16:26:35 2019
@author: Administrator
"""
# Forked from run_rbf_comparison.py
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicod... | 1.867188 | 2 |
data/external/repositories_2to3/145085/kaggle_Microsoft_Malware-master/kaggle_Microsoft_malware_small/find_4g.py | Keesiu/meta-kaggle | 0 | 749 | import sys
import pickle
##########################################################
# usage
# pypy find_4g.py xid_train.p ../../data/train
# xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify
# the order of samples in traing data
# ../../data/train is the path of original train data
####... | 2.296875 | 2 |
src/domain/enums/__init__.py | Antonio-Gabriel/easepay_backend | 1 | 750 | from .months import Months
from .sizes import Size | 1.140625 | 1 |
pygments/lexers/trafficscript.py | blu-base/pygments | 1 | 751 | <reponame>blu-base/pygments<filename>pygments/lexers/trafficscript.py<gh_stars>1-10
"""
pygments.lexers.trafficscript
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for RiverBed's TrafficScript (RTS) language.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for d... | 1.851563 | 2 |
pandas/tests/indexes/test_common.py | dimithras/pandas | 1 | 752 | """
Collection of tests asserting things that should be true for
any index subclass. Makes use of the `indices` fixture defined
in pandas/tests/indexes/conftest.py.
"""
import re
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas.core.dtypes.common import is_period_dtype, needs_i8_conv... | 2.46875 | 2 |
tests/test_dynamics.py | leasanchez/BiorbdOptim | 34 | 753 | <filename>tests/test_dynamics.py
import pytest
import numpy as np
from casadi import MX, SX
import biorbd_casadi as biorbd
from bioptim.dynamics.configure_problem import ConfigureProblem
from bioptim.dynamics.dynamics_functions import DynamicsFunctions
from bioptim.interfaces.biorbd_interface import BiorbdInterface
fr... | 2.09375 | 2 |
polyaxon/event_manager/event_manager.py | elyase/polyaxon | 0 | 754 | from hestia.manager_interface import ManagerInterface
from event_manager import event_actions
class EventManager(ManagerInterface):
def _get_state_data(self, event): # pylint:disable=arguments-differ
return event.event_type, event
def subscribe(self, event): # pylint:disable=arguments-differ
... | 2.5625 | 3 |
test_f_login_andy.py | KotoLLC/peacenik-tests | 0 | 755 | from helpers import *
def test_f_login_andy():
url = "http://central.orbits.local/rpc.AuthService/Login"
raw_payload = {"name": "andy","password": "<PASSWORD>"}
payload = json.dumps(raw_payload)
headers = {'Content-Type': 'application/json'}
# convert dict to json by json.dumps() for bod... | 2.75 | 3 |
docker/src/clawpack-5.3.1/riemann/src/shallow_1D_py.py | ian-r-rose/visualization | 11 | 756 | <reponame>ian-r-rose/visualization
#!/usr/bin/env python
# encoding: utf-8
r"""
Riemann solvers for the shallow water equations.
The available solvers are:
* Roe - Use Roe averages to caluclate the solution to the Riemann problem
* HLL - Use a HLL solver
* Exact - Use a newton iteration to calculate the exact s... | 3.0625 | 3 |
nuitka/Constants.py | juanfra684/Nuitka | 1 | 757 | # Copyright 2020, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 1.976563 | 2 |
functions/predictionLambda/botocore/endpoint.py | chriscoombs/aws-comparing-algorithms-performance-mlops-cdk | 40 | 758 | # Copyright (c) 2012-2013 <NAME> http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.... | 2.09375 | 2 |
week2/Assignment2Answer.py | RayshineRen/Introduction_to_Data_Science_in_Python | 1 | 759 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 21:56:15 2020
@author: Ray
@email: <EMAIL>
@wechat: RayTing0305
"""
'''
Question 1
Write a function called proportion_of_education which returns the proportion of children in the dataset who had a mother with the education levels equal to les... | 3.875 | 4 |
backup/26.py | accordinglyto/dferte | 0 | 760 | from numpy import genfromtxt
import matplotlib.pyplot as plt
import mpl_finance
import numpy as np
import uuid
import matplotlib
# Input your csv file here with historical data
ad = genfromtxt(f"../financial_data/SM.csv", delimiter=",", dtype=str)
def convolve_sma(array, period):
return np.convolve(array, np.on... | 2.6875 | 3 |
streams/readers/arff_reader.py | JanSurft/tornado | 103 | 761 | """
The Tornado Framework
By <NAME>
University of Ottawa, Ontario, Canada
E-mail: apesaran -at- uottawa -dot- ca / alipsgh -at- gmail -dot- com
"""
import re
from data_structures.attribute import Attribute
from dictionary.tornado_dictionary import TornadoDic
class ARFFReader:
"""This class is used... | 3.140625 | 3 |
Experimente/Experiment ID 8/run-cifar10-v7.py | MichaelSchwabe/conv-ebnas-abgabe | 6 | 762 | from __future__ import print_function
from keras.datasets import mnist
from keras.datasets import cifar10
from keras.utils.np_utils import to_categorical
import numpy as np
from keras import backend as K
from evolution import Evolution
from genome_handler import GenomeHandler
import tensorflow as tf
#import mlflow.kera... | 2.28125 | 2 |
CarModel.py | JaredFG/Multiagentes-Unity | 0 | 763 | '''
Autores:<NAME> A01749381
<NAME> A01751192
<NAME> A01379868
<NAME> A01749375
'''
from random import random
from mesa.visualization.modules import CanvasGrid
from mesa.visualiza... | 2.28125 | 2 |
qcodes/widgets/display.py | nulinspiratie/Qcodes | 2 | 764 | <gh_stars>1-10
"""Helper for adding content stored in a file to a jupyter notebook."""
import os
from pkg_resources import resource_string
from IPython.display import display, Javascript, HTML
# Originally I implemented this using regular open() and read(), so it
# could use relative paths from the importing file.
#
... | 3.046875 | 3 |
hubcontrol.py | smr99/lego-hub-tk | 16 | 765 | <reponame>smr99/lego-hub-tk<filename>hubcontrol.py
#! /usr/bin/python3
import base64
from data.ProgramHubLogger import ProgramHubLogger
from datetime import datetime
import logging
import os
import sys
from ui.MotionSensor import MotionSensorWidget
from ui.PositionStatus import PositionStatusWidget
from ui.DevicePortW... | 2.15625 | 2 |
To-D0-App-main/base/views.py | shagun-agrawal/To-Do-App | 1 | 766 | from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy
from django.contrib.auth.views import LoginView
from .models impor... | 2.171875 | 2 |
tests/unit_tests/test_nn/test_converters/test_tensorflow/test_Dropout.py | samysweb/dnnv | 5 | 767 | <filename>tests/unit_tests/test_nn/test_converters/test_tensorflow/test_Dropout.py
import numpy as np
from dnnv.nn.converters.tensorflow import *
from dnnv.nn.operations import *
TOL = 1e-6
def test_Dropout_consts():
x = np.array([3, 4]).astype(np.float32)
op = Dropout(x)
tf_op = TensorflowConverter().... | 2.453125 | 2 |
smarts/zoo/worker.py | idsc-frazzoli/SMARTS | 554 | 768 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | 1.734375 | 2 |
week2/problems/problem2.py | Nburkhal/mit-cs250 | 0 | 769 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Now write a program that calculates the minimum fixed monthly payment needed
in order pay off a credit card balance within 12 months.
By a fixed monthly payment, we mean a single number which does not change each month,
but instead is a constant amount that will be ... | 4.65625 | 5 |
leetcode_python/Sort/sort-characters-by-frequency.py | yennanliu/CS_basics | 18 | 770 | # V0
import collections
class Solution(object):
def frequencySort(self, s):
count = collections.Counter(s)
count_dict = dict(count)
count_tuple_sorted = sorted(count_dict.items(), key=lambda kv : -kv[1])
res = ''
for item in count_tuple_sorted:
res += item[0] * it... | 3.609375 | 4 |
eval/scripts/human/html_gen.py | chateval/chatevalv2 | 5 | 771 | <reponame>chateval/chatevalv2
"""Stores all the helper functions that generate html"""
import random
def generate_2choice_html(example):
'''Makes html for ranking form for the specified row index.
Returns the HTML for a table of radio buttons used for ranking,
as well as a count of the total number of radio ... | 3.4375 | 3 |
python3_module_template/subproject/myexample.py | sdpython/python_project_template | 0 | 772 | <filename>python3_module_template/subproject/myexample.py
# -*- coding: utf-8 -*-
"""
@file
@brief This the documentation of this module (myexampleb).
"""
class myclass:
"""
This is the documentation for this class.
**example with a sphinx directives**
It works everywhere in the documentation.
... | 2.578125 | 3 |
simulation/dataset_G_1q_X_Z_N1.py | eperrier/QDataSet | 42 | 773 | <reponame>eperrier/QDataSet
##############################################
"""
This module generate a dataset
"""
##############################################
# preample
import numpy as np
from utilites import Pauli_operators, simulate, CheckNoise
################################################
# meta par... | 2 | 2 |
configs/mmdet/detection/detection_tensorrt_static-300x300.py | zhiqwang/mmdeploy | 746 | 774 | <reponame>zhiqwang/mmdeploy
_base_ = ['../_base_/base_tensorrt_static-300x300.py']
| 1.054688 | 1 |
user_service/user_service/api.py | Ziang-Lu/Flask-Blog | 0 | 775 | <filename>user_service/user_service/api.py
# -*- coding: utf-8 -*-
"""
API definition module.
"""
from flask import Blueprint
from flask_restful import Api
from .resources.user import UserAuth, UserItem, UserList, UserFollow
# Create an API-related blueprint
api_bp = Blueprint(name='api', import_name=__name__)
api... | 2.40625 | 2 |
advanced/itertools_funcs.py | ariannasg/python3-essential-training | 1 | 776 | <reponame>ariannasg/python3-essential-training
#!usr/bin/env python3
import itertools
# itertools is a module that's not technically a set of built-in functions but
# it is part of the standard library that comes with python.
# it's useful for for creating and using iterators.
def main():
print('some infinite ite... | 4.65625 | 5 |
aula 05/model/Pessoa.py | Azenha/AlgProg2 | 0 | 777 | <gh_stars>0
class Pessoa:
def __init__(self, codigo, nome, endereco, telefone):
self.__codigo = int(codigo)
self.nome = str(nome)
self._endereco = str(endereco)
self.__telefone = str(telefone)
def imprimeNome(self):
print(f"Você pode chamar essa pessoa de {self.nome}.")
... | 3.109375 | 3 |
examples/plain_text_response.py | lukefx/stardust | 2 | 778 | <filename>examples/plain_text_response.py
from starlette.responses import PlainTextResponse
async def serve(req):
return PlainTextResponse("Hello World!")
| 1.828125 | 2 |
pypyrus_logbook/logger.py | t3eHawk/pypyrus_logbook | 0 | 779 | <filename>pypyrus_logbook/logger.py<gh_stars>0
import atexit
import datetime as dt
import os
import platform
import pypyrus_logbook as logbook
import sys
import time
import traceback
from .conf import all_loggers
from .formatter import Formatter
from .header import Header
from .output import Root
from .record import R... | 2.875 | 3 |
darling_ansible/python_venv/lib/python3.7/site-packages/oci/object_storage/transfer/constants.py | revnav/sandbox | 0 | 780 | # coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 0.886719 | 1 |
scraper/news/spiders/millardayo.py | ZendaInnocent/news-api | 3 | 781 | <filename>scraper/news/spiders/millardayo.py
# Spider for MillardAyo.com
import scrapy
from bs4 import BeautifulSoup
class MillardAyoSpider(scrapy.Spider):
name = 'millardayo'
allowed_urls = ['www.millardayo.com']
start_urls = [
'https://millardayo.com',
]
def parse(self, response, **kw... | 3 | 3 |
sdks/python/apache_beam/runners/portability/expansion_service_test.py | stephenoken/beam | 3 | 782 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 1.6875 | 2 |
db.py | RunnerPro/RunnerProApi | 0 | 783 | <reponame>RunnerPro/RunnerProApi
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from settings import DB_URI
Session = sessionmaker(autocommit=False, autoflush=False, bind=create_engine(DB_URI))
session = scoped_session(Session)
| 1.953125 | 2 |
python/tvm/contrib/nvcc.py | ntanhbk44/tvm | 0 | 784 | <filename>python/tvm/contrib/nvcc.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version... | 2.140625 | 2 |
calc/history/calculations.py | dhruvshah1996/Project3 | 0 | 785 | """Calculation history Class"""
from calc.calculations.addition import Addition
from calc.calculations.subtraction import Subtraction
from calc.calculations.multiplication import Multiplication
from calc.calculations.division import Division
class Calculations:
"""Calculations class manages the history of calculati... | 3.78125 | 4 |
Python/17 - 081 - extraindo dados de uma lista.py | matheusguerreiro/python | 0 | 786 | <gh_stars>0
# Aula 17 (Listas (Parte 1))
valores = []
while True:
valor = int(input('Digite um Valor ou -1 para Finalizar: '))
if valor < 0:
print('\nFinalizando...')
break
else:
valores.append(valor)
print(f'Foram digitados {len(valores)} números')
valores.sort(reverse=True)
print... | 3.9375 | 4 |
yekpay/migrations/0014_auto_20181120_1453.py | maryam-afzp/django-yekpay | 3 | 787 | <filename>yekpay/migrations/0014_auto_20181120_1453.py
# Generated by Django 2.0.9 on 2018-11-20 11:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settin... | 1.578125 | 2 |
polus-cell-nuclei-segmentation/src/dsb2018_topcoders/albu/src/pytorch_zoo/inplace_abn/modules/__init__.py | nishaq503/polus-plugins-dl | 0 | 788 | from .bn import ABN, InPlaceABN, InPlaceABNWrapper, InPlaceABNSync, InPlaceABNSyncWrapper
from .misc import GlobalAvgPool2d
from .residual import IdentityResidualBlock
from .dense import DenseModule
| 0.992188 | 1 |
python/pyarrow/tests/test_compute.py | kylebrandt/arrow | 0 | 789 | <reponame>kylebrandt/arrow
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... | 1.546875 | 2 |
python/sdk/client/api/log_api.py | ashwinath/merlin | 0 | 790 | # coding: utf-8
"""
Merlin
API Guide for accessing Merlin's model management, deployment, and serving functionalities # noqa: E501
OpenAPI spec version: 0.7.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
... | 1.789063 | 2 |
openmdao/solvers/nonlinear/nonlinear_block_jac.py | bollwyvl/OpenMDAO | 0 | 791 | """Define the NonlinearBlockJac class."""
from openmdao.recorders.recording_iteration_stack import Recording
from openmdao.solvers.solver import NonlinearSolver
from openmdao.utils.mpi import multi_proc_fail_check
class NonlinearBlockJac(NonlinearSolver):
"""
Nonlinear block Jacobi solver.
"""
SOLVER... | 2.484375 | 2 |
tensorflow/contrib/data/python/kernel_tests/optimization/map_and_filter_fusion_test.py | Smokrow/tensorflow | 1 | 792 | <filename>tensorflow/contrib/data/python/kernel_tests/optimization/map_and_filter_fusion_test.py
# Copyright 2018 The TensorFlow Authors. 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... | 1.960938 | 2 |
meerk40t/lihuiyu/lihuiyuemulator.py | jpirnay/meerk40t | 0 | 793 | <reponame>jpirnay/meerk40t<gh_stars>0
from meerk40t.core.cutcode import CutCode, RawCut
from meerk40t.core.parameters import Parameters
from meerk40t.core.units import UNITS_PER_MIL
from meerk40t.kernel import Module
from meerk40t.numpath import Numpath
from meerk40t.svgelements import Color
class LihuiyuEmulator(Mod... | 2.125 | 2 |
tencentcloud/dbbrain/v20210527/models.py | lleiyyang/tencentcloud-sdk-python | 465 | 794 | # -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | 2.34375 | 2 |
oauth/provider.py | giuseppe/quay | 2,027 | 795 | <filename>oauth/provider.py<gh_stars>1000+
# Ported to Python 3
# Originally from https://github.com/DeprecatedCode/oauth2lib/blob/d161b010f8a596826050a09e5e94d59443cc12d9/oauth2lib/provider.py
import json
import logging
from requests import Response
from io import StringIO
try:
from werkzeug.exceptions import Un... | 3 | 3 |
main.py | TomHacker/ImageCluster | 10 | 796 | <reponame>TomHacker/ImageCluster
from model import ImageCluster
m=ImageCluster(
base_model='vgg16',#your feature map extractor model
resorted_img_folder='resorted_data',#the folder for clustered images
cluster_algo='kmeans',#cluster algorithm
base_img_folder='data',
maxK=150,#the max k num is 30, wh... | 2.859375 | 3 |
tests/dummies.py | arvindmuralie77/gradsflow | 253 | 797 | # Copyright (c) 2021 GradsFlow. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 2.328125 | 2 |
JumpscaleCore/tools/executor/ExecutorSerial.py | gneumann333/jumpscaleX_core | 1 | 798 | <reponame>gneumann333/jumpscaleX_core
from Jumpscale import j
JSBASE = j.baseclasses.object
from .ExecutorBase import *
import serial
class ExecutorSerial(ExecutorBase):
"""
This executor is primary made to communicate with devices (routers, switch, ...) over
console cable but you can use underlaying me... | 2.9375 | 3 |
melisa/utils/snowflake.py | MelisaDev/melisa | 5 | 799 | # Copyright MelisaDev 2022 - Present
# Full MIT License can be found in `LICENSE.txt` at the project root.
from __future__ import annotations
class Snowflake(int):
"""
Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs).
These IDs are guaranteed to be unique across all... | 2.421875 | 2 |