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 |
|---|---|---|---|---|---|---|
torchpq/transform/PCA.py | mhamilton723/TorchPQ | 103 | 34800 | <filename>torchpq/transform/PCA.py
import torch
import numpy as np
from ..CustomModule import CustomModule
class PCA(CustomModule):
def __init__(self, n_components):
"""
Principle Component Analysis (PCA)
n_components: int
number of principle components
"""
super(PCA, self).__init__()
... | 2.84375 | 3 |
Written test problems/mi2.py | maiwen/Target-Offer | 0 | 34801 | <filename>Written test problems/mi2.py
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 20 20:17:52 2018
@author: Administrator
最优分割
时间限制:C/C++语言 1000MS;其他语言 3000MS
内存限制:C/C++语言 65536KB;其他语言 589824KB
题目描述:
依次给出n个正整数A1,A2,… ,An,将这n个数分割成m段,每一段内的所有数的和记为这一段的权重, m段权重的最大值记为本次分割的权重。问所有分割方案中分割权重的最小值是多少?
输入
第一行依次给... | 3.15625 | 3 |
Test3/Pandas.py | leejw51/BumblebeeNet | 0 | 34802 | <reponame>leejw51/BumblebeeNet
import pandas as pd
data = {'name':['john', 'anna', 'peter', 'linda'],
'location': [ 'new york', 'paris', 'berlin', 'london'],
'age': [24, 13, 53, 33]}
data_pandas = pd.DataFrame(data)
print(data_pandas)
| 3.359375 | 3 |
organizer/admin.py | siddeshlc8/Software-Engineering-Project | 4 | 34803 | from django.contrib import admin
# Register your models here.
from .models import Organizer
admin.site.register(Organizer) | 1.304688 | 1 |
pyts/multivariate/transformation/multivariate.py | jmrichardson/pyts | 1 | 34804 | """Utility class for multivariate time series transformation."""
# Author: <NAME> <<EMAIL>>
# License: BSD-3-Clause
import numpy as np
from scipy.sparse import csr_matrix, hstack
from sklearn.base import BaseEstimator, TransformerMixin, clone
from sklearn.utils.validation import check_is_fitted
from ..utils import ch... | 2.6875 | 3 |
application/__init__.py | thec0sm0s/Quick-Notes | 1 | 34805 | <filename>application/__init__.py
from flask import Flask
from flask_cors import CORS
from flask_bcrypt import Bcrypt
bcrypt = Bcrypt()
def get_app(configs=None):
from . import api
from . import resource
app = Flask(__name__)
app.config.from_object(configs)
_cors = CORS(app, supports_credentia... | 2.171875 | 2 |
src/bgfactory/components/pango_helpers.py | avolny/board-game-factory | 5 | 34806 | from bgfactory.components.constants import HALIGN_LEFT, HALIGN_CENTER, HALIGN_RIGHT
import pangocffi as pango
PANGO_SCALE = 1024
def convert_to_pango_align(halign):
if halign == HALIGN_LEFT:
return pango.Alignment.LEFT
elif halign == HALIGN_CENTER:
return pango.Alignment.CENTER
elif hali... | 2.578125 | 3 |
electrum_gui/common/provider/chains/bch/__init__.py | BixinKey/electrum | 12 | 34807 | from electrum_gui.common.provider.chains.bch.provider import BCHProvider
from electrum_gui.common.provider.chains.btc.clients.blockbook import BlockBook
| 1.109375 | 1 |
modules/SenseHatDisplay/app/DisplayManager.py | J0F3/FaceOff | 0 | 34808 | <filename>modules/SenseHatDisplay/app/DisplayManager.py
import sense_hat
from sense_hat import SenseHat
import time
from enum import Enum
from datetime import datetime
import json
class Colors(Enum):
Green = (0, 255, 0)
Yellow = (255, 255, 0)
Blue = (0, 0, 255)
Red = (255, 0, 0)
White = (255,255,25... | 2.609375 | 3 |
tbcnn/tbcnn.py | Aetf/tensorflow-tbcnn | 34 | 34809 | <reponame>Aetf/tensorflow-tbcnn<filename>tbcnn/tbcnn.py
from __future__ import absolute_import, division, print_function
import os
import logging
from timeit import default_timer
import numpy as np
import tensorflow as tf
import tensorflow_fold as td
from . import apputil
from . import data
from . import embedding
f... | 2.203125 | 2 |
core/lib/constant.py | UsterNes/OnlineSchemaChange | 0 | 34810 | <reponame>UsterNes/OnlineSchemaChange
"""
Copyright (c) 2017-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same direc... | 1 | 1 |
panel_view.py | kylebebak/SublimeLinter | 0 | 34811 | from functools import partial
from itertools import chain
import os
import sublime
import sublime_plugin
import textwrap
from .lint import elect, events, persist, util
if False:
from typing import (
Any, Dict, Iterable, List, Optional, Set, Tuple,
Union
)
from mypy_extensions import Typed... | 2.078125 | 2 |
core/numpy_dataset.py | paulviallard/NeurIPS21-PB-Robustness | 0 | 34812 | <filename>core/numpy_dataset.py
# Author: <NAME>
#
# This file is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
# Note: The source code of this file is based on [1]
from re import sub
from torch.utils.data import Dataset
import torch
import numpy as np
import copy
... | 2.421875 | 2 |
tests/test_datetime.py | mamh-mixed/loguru | 0 | 34813 | import datetime
import re
import sys
import freezegun
import pytest
from loguru import logger
if sys.version_info < (3, 6):
UTC_NAME = "UTC+00:00"
else:
UTC_NAME = "UTC"
@pytest.mark.parametrize(
"time_format, date, timezone, expected",
[
(
"%Y-%m-%d %H-%M-%S %f %Z %z",
... | 2.4375 | 2 |
utilities.py | ayush14029/go | 2 | 34814 | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import LogisticRegression
import pdb
from sklearn.metrics import *
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.preproces... | 2.859375 | 3 |
CodeForces/football.py | Snehakri022/Competitive-Programming-Solutions | 40 | 34815 | <filename>CodeForces/football.py<gh_stars>10-100
n = str(input())
if("0000000" in n):
print("YES")
elif("1111111" in n):
print("YES")
else:
print("NO")
| 3.34375 | 3 |
gt-custom-keypoint/server/processing/sagemaker-gt-postprocess.py | tyohei/amazon-sagemaker-examples-jp | 0 | 34816 | <filename>gt-custom-keypoint/server/processing/sagemaker-gt-postprocess.py
# Copyright 2018 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 a... | 1.898438 | 2 |
mi/dataset/parser/test/test_sio_eng_sio.py | rmanoni/mi-dataset | 1 | 34817 | <reponame>rmanoni/mi-dataset<filename>mi/dataset/parser/test/test_sio_eng_sio.py
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_sio_eng_sio_mule
@file marine-integrations/mi/dataset/parser/test/test_sio_eng_sio_mule.py
@author <NAME>
@brief Test code for a sio_eng_sio_mule data parser
"""
from nose.pl... | 1.898438 | 2 |
pybaselines/utils.py | abdelq/pybaselines | 0 | 34818 | # -*- coding: utf-8 -*-
"""Helper functions for pybaselines.
Created on March 5, 2021
@author: <NAME>
"""
import numpy as np
# the minimum positive float values such that a + _MIN_FLOAT != a
_MIN_FLOAT = np.finfo(float).eps
def relative_difference(old, new, norm_order=None):
"""
Calculates the relative d... | 3.40625 | 3 |
ants/color_subprocess.py | threexc/SiGPyC | 4 | 34819 | import sys
import os
import subprocess
import time
import threading
class Popen(object):
"""
Starts the subprocess with colorful output
Arguments:
command: The command
prefix: The prefix to print before every line
color: The color escape code
"""
def ... | 3.0625 | 3 |
api/routes/user_router.py | cgiroux86/TeamInterview | 1 | 34820 | from flask import Blueprint, request, jsonify
from api.models.user_model import User, UserPasswords, db
from flask_bcrypt import Bcrypt
user_bp = Blueprint('user_bp', __name__)
def validate_register_fields(req):
data = req.get_json(silent=True)
fields = ['first_name', 'last_name', 'email', 'password']
for... | 2.734375 | 3 |
image/apps.py | DaleProctor/tscharts | 16 | 34821 | from __future__ import unicode_literals
from django.apps import AppConfig
class ImageConfig(AppConfig):
name = 'image'
| 1.273438 | 1 |
pysatSeasons/__init__.py | pysat/pysatSeasons | 1 | 34822 | <gh_stars>1-10
"""
pysatSeasons is a pysat module that provides
the interface to perform seasonal analysis on
data managed by pysat. These analysis methods
are independent of instrument type.
Main Features
-------------
- Seasonal averaging routine for 1D and 2D data.
- Occurrence probability routines, daily or by or... | 2.71875 | 3 |
ATTACKS/python-botnet/Client.py | sofiafernandezmoreno/tfm_ddos_demo | 3 | 34823 | import subprocess
import threading
import time
import socket
import os, sys, random
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = '127.0.0.1'
port = 9998
s.connect((host, port))
def ddos(*args):
def dos(*args):
... | 2.484375 | 2 |
neml/axisym.py | ajey091/neml | 6 | 34824 | <reponame>ajey091/neml
import numpy as np
import numpy.linalg as la
import scipy.linalg as sla
import scipy.linalg.lapack as lapack
from numpy.polynomial.legendre import leggauss as lgg
import scipy.optimize as opt
from neml import arbbar
from neml.math import nemlmath
from functools import partial
def generate_thic... | 2.546875 | 3 |
helper.py | jayanthv86/okta_oauth | 0 | 34825 | from functools import wraps
from base64 import b64encode
from jose import jwt
from flask import Flask, jsonify, request, _app_ctx_stack, json
import requests
ALGORITHMS = ["RS256"]
SCOPES = 'username' # Custom scopes that you want to pass as part of the request when requesting access token
AUTH_SERVER_ID = 'YOUR_OKTA_... | 2.8125 | 3 |
Ch10/test/singly_circular_list_dictionary_test.py | Ryuichi-Sasaki/CLRS | 0 | 34826 | <reponame>Ryuichi-Sasaki/CLRS
import unittest
import sys
sys.path.append("../src/")
from singly_circular_list_dictionary import SinglyLinkedDictionary
from singly_circular_list_dictionary import Item
class TestSinglyLinkedDictionary(unittest.TestCase):
def test_insert_search(self):
d = SinglyLinkedDiction... | 2.6875 | 3 |
pywikibot/page.py | shizhao/pywikibot-core | 0 | 34827 | <filename>pywikibot/page.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Objects representing various types of MediaWiki pages.
"""
#
# (C) Pywikipedia bot team, 2008-2013
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id: 215b643496a981463dbb6c2efc37c1fc0cfbec6d $'
import pywikibot
from pywikibot im... | 2.84375 | 3 |
scratch.py | stevoWinke1/python | 0 | 34828 | <reponame>stevoWinke1/python
list = ['a','b','c']
print(list)
| 3.234375 | 3 |
src/human_play.py | rajko-z/nine-mans-morris-python | 1 | 34829 | <reponame>rajko-z/nine-mans-morris-python
from copy import deepcopy
import heuristic_state_functions as h
import global_config as g
import pretty_print as pp
from state import State
import main
def human_play_mill(state):
old_state_board = deepcopy(state.board)
print()
pp.print_table(state.board)
br = 0
possibi... | 3.3125 | 3 |
Practise/Python/Collections/collections.Counter().py | FurkhanShaikh/HackerRank-My-Solutions | 0 | 34830 | #problem link : https://www.hackerrank.com/challenges/collections-counter/problem
# Enter your code here. Read input from STDIN. Print output to STDOUT
from collections import Counter
X = int(raw_input())
sizes = map(int,raw_input().split())
cust = int(raw_input())
desired =[]
for i in range(cust):
temp = map(int,... | 3.46875 | 3 |
homecam.py | stigmarl/flask-homecam | 0 | 34831 | from app import create_app, db
app = create_app()
@app.shell_context_processor
def make_shell_context():
return {'app': app, 'db': db}
| 1.734375 | 2 |
dtargs.py | petedmarsh/dtargs | 0 | 34832 | <reponame>petedmarsh/dtargs
# -*- coding: utf-8 -*-
import argparse
import pytz
from datetime import datetime
class DateType(object):
"""Factory for creating datetime.date object types
Instances of DateType are typically passed as type= arguments to the
ArgumentParser add_argument() method.
:param ... | 3.515625 | 4 |
pykeops/numpy/lazytensor/LazyTensor.py | Rama27SepIBM/keops | 1 | 34833 | import numpy as np
from pykeops.common.lazy_tensor import GenericLazyTensor
from pykeops.numpy.utils import numpytools
# Convenient aliases:
def Var(x_or_ind, dim=None, cat=None):
if dim is None:
# init via data: we assume x_or_ind is data
return LazyTensor(x_or_ind, axis=cat)
else:
... | 2.984375 | 3 |
src/legUp_v2.py | mjaquiery/legUp | 0 | 34834 | <reponame>mjaquiery/legUp
"""
Updated on Sun Feb 25 15:26 2018
- tkinter library used to enable file selection dialogues for loading data and saving output
- options now specified with a dialogue box rather than a command line
Created on Thu Feb 06 17:29:27 2015
This program takes csv files containing voltage readings... | 3.125 | 3 |
clismo/sim/client_server_model.py | jmorgadov/clismo | 2 | 34835 | <reponame>jmorgadov/clismo
from queue import PriorityQueue
from typing import Callable, List
class Server:
def __init__(self, func: Callable, cost: float = 1.0):
self.func = func
self.cost = cost
class ClientServerModel:
def __init__(
self,
arrival_func: Callable,
ser... | 3.234375 | 3 |
genoome/color_aliases/admin.py | jiivan/genoomy | 0 | 34836 | from django.contrib import admin
from .models import ColorAlias
admin.site.register(ColorAlias)
| 1.28125 | 1 |
app/gql/__init__.py | yoshiya0503/flask-graphQL-example | 0 | 34837 | #! /usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
schema object
schema
"""
__author__ = '<NAME> <<EMAIL>>'
__version__ = '1.0.0'
__date__ = '2019-12-02'
import graphene
from app.gql.query import Query
from app.gql.mutation import Mutation
schema = graphene.Schema(query=Query, mutation=Mutation)
| 1.984375 | 2 |
tests/test_operands.py | cu2/aldebaran | 4 | 34838 | <reponame>cu2/aldebaran<gh_stars>1-10
import unittest
from unittest.mock import Mock
from instructions.operands import (
Operand, OpLen, OpType,
get_operand_opcode, parse_operand_buffer,
get_operand_value, set_operand_value,
_get_reference_address, _get_opbyte,
_get_register_code_by_name, _get_regi... | 2.515625 | 3 |
event_loop/cancel_task.py | lishulongVI/Ilhabela | 0 | 34839 | # -*- coding: utf-8 -*-
"""
@contact: <EMAIL>
@time: 2019/3/25 下午9:43
"""
import asyncio
async def consume():
print('start consume...')
await asyncio.sleep(10)
print('end consume...')
if __name__ == '__main__':
tasks = [consume() for i in range(10)]
loop = asyncio.get_event_loop()
try:
... | 2.828125 | 3 |
testTF.py | acsstudios/assgnopts | 1 | 34840 | <filename>testTF.py
# Importing required libraries
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.preprocessing.text import Tokenizer
# List of sample sentences that we want to tokenize
sentences = ['I love my dog',
'I love my cat',
'you love my dog!',
... | 3.28125 | 3 |
harjoitustyo/src/ui/views/menu_view.py | ronituohino/ohte-harjoitustyo | 0 | 34841 | <gh_stars>0
import os
from os.path import isfile, join
import pygame
from ui.view import View
from ui.components.button import Button
from ui.components.text import render, blit, text
from ui.components.box import box
from services.menu import Menu
class MenuView(View):
"""Luokka päävalikkonäkymälle
Attribut... | 2.65625 | 3 |
Study/interesting_program/test.py | pynickle/awesome-python-tools | 21 | 34842 | <reponame>pynickle/awesome-python-tools
"""
Copyright: Copyright (c) 2019
License : WTFPL License
owner : pynickle
title : amazing-python study projects
description : projects for studying python
"""
import sys
import io
import unittest
import importlib
def stub_stdin(testcase_inst, inputs):
stdin = sys.stdin
... | 2.859375 | 3 |
ssl_joystick_operation/scripts/joystick_node.py | SSL-Roots/CON-SAI | 28 | 34843 | #!/usr/bin/env python
import rospy
import socket
import math
from std_msgs.msg import String
from std_msgs.msg import Time
from std_msgs.msg import UInt8
from std_msgs.msg import UInt32
from sensor_msgs.msg import Joy
from consai_msgs.msg import robot_commands
import topic_tools.srv
# import ssl_refbox.msg
class Bu... | 2.3125 | 2 |
pythontutorials/Udacity/CS101/Lesson 02 - Problem Set/Q6-Bodacious Udacity.py | JoseALermaIII/python-tutorials | 2 | 34844 | <filename>pythontutorials/Udacity/CS101/Lesson 02 - Problem Set/Q6-Bodacious Udacity.py
# Given the variables s and t defined as:
s = 'udacity'
t = 'bodacious'
# write Python code that prints out udacious
# without using any quote characters in
# your code.
print s[0] + t[2:]
| 3.921875 | 4 |
datasets/classification.py | billhhh/model-quantization-1 | 66 | 34845 | <reponame>billhhh/model-quantization-1
import torch
import torchvision
import torchvision.transforms as transforms
import torchvision.datasets as datasets
import os
import numpy as np
from PIL import Image, ImageFile
class Lighting(object):
"""Lighting noise(AlexNet - style PCA - based noise)"""
def __init__(... | 2.59375 | 3 |
selection.py | JOkendo/PythonPrograms | 0 | 34846 | marks = 70
if num > 50:
print("pass!") | 2.203125 | 2 |
examples/src/main/python/python_example.py | bensenberner/spline-spark-agent | 65 | 34847 | <gh_stars>10-100
#
# Copyright 2017 ABSA Group Limited
#
# 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... | 1.679688 | 2 |
scribedb/__init__.py | Decathlon/scribedb | 3 | 34848 | <reponame>Decathlon/scribedb
"""
scribeDB is a light tool which compares data at schema level.
Let us say we have two schemas deployed inside PostgreSQL
and Oracle RDBs.
A minimal usage example:
#
"""
from . import oracle, postgres, rdbms, scribedb
__version__ = '0.1.0'
__all__ = ['__version__', 'oracle', 'postgres... | 1.46875 | 1 |
src/bot/xlparser/settings/config.py | delvinru/schedule | 2 | 34849 | '''
Переменные настройки для parser.
'''
link_MireaSchedule = "https://www.mirea.ru/schedule/"
links_file = "links.txt"
first_september = [2021, 9, 1]
first_january = [2022, 1, 1]
semestr_start = [2021, 8, 30] # День отсчета начала семестра
block_tags = { # Список тегов, которые не будут обрабатыватся
"Коллед... | 2.765625 | 3 |
referals/platforms/crowdtangle.py | jakobbaek/link_collector | 0 | 34850 | import random
import requests
import time
class Crowdtangle:
def __init__(self,api_tokens=[]):
self.api_tokens = api_tokens
self.apiBaseUrl = "https://api.crowdtangle.com/ce/"
self.chromeAppVersion = "3.0.3"
self.userAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KH... | 2.84375 | 3 |
data/studio21_generated/introductory/4495/starter_code.py | vijaykumawat256/Prompt-Summarization | 0 | 34851 | def am_I_afraid(day,num):
| 0.988281 | 1 |
src/AgentSPL/train.py | Yulv-git/Awesome-Ultrasound-Standard-Plane-Detection | 1 | 34852 | <gh_stars>1-10
#!/usr/bin/env python
# coding=utf-8
'''
Author: <NAME> / Yulv
Email: <EMAIL>
Date: 2022-03-20 18:17:37
Motto: Entities should not be multiplied unnecessarily.
LastEditors: <NAME>
LastEditTime: 2022-04-03 17:16:14
FilePath: /Awesome-Ultrasound-Standard-Plane-Detection/src/AgentSPL/train.py
Desc... | 1.851563 | 2 |
tests/batch/base_parse_replication_stream_test.py | ywlianghang/mysql_streamer | 419 | 34853 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp Inc.
#
# 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 a... | 1.5 | 2 |
build.py | sijad/iran-cities | 14 | 34854 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
# see: https://en.wikipedia.org/wiki/ISO_3166-2:IR
PROVINCE_MAP = {
u'آذربایجان شرقی': 1,
u'آذربایجان غربی': 2,
u'اردبیل': 3,
u'اصفهان': 4,
u'ایلام': 5,
u'بوشهر': 6,
u'تهران': 7,
u'چهار محال و بختیاری': 8,
u'خوزستان': 10,
... | 2.8125 | 3 |
57 - Square root convergents/converg.py | jamtot/PyProjectEuler | 0 | 34855 | <filename>57 - Square root convergents/converg.py
"""
3 7 17 41 99 239 577 1393 n = 2n(i-1(previous)) + n(i-2(num before previous))
- - -- -- -- --- --- ----
2 5 12 29 70 169 408 985 (same as above, next number is 2 times previous plus
the number before that)
"""
def nextexp(expansions... | 3.796875 | 4 |
src/__init__.py | chompomonim/python-graphql-example | 0 | 34856 | from sanic import Sanic
from sanic.response import json, text
from sanic_graphql import GraphQLView
from api import schema, setup
app = Sanic()
@app.route("/")
async def root(request):
return text("Welcome! Call me via POST with graphql query in body.")
@app.route("/", methods=['POST'])
async def post_root(req... | 2.328125 | 2 |
swarmdjango/core/models/Heading.py | YCP-Swarm-Robotics-Capstone-2020-2021/swarm-website-backend | 0 | 34857 | <reponame>YCP-Swarm-Robotics-Capstone-2020-2021/swarm-website-backend
from django.db import models
from core.models import Change
class Heading(models.Model):
title = models.TextField()
text = models.TextField()
subHeadings = models.ManyToManyField('self', blank=True)
log = models.ManyToManyField('Cha... | 2.25 | 2 |
iaso/api/algorithms.py | ekhalilbsq/iaso | 29 | 34858 | from rest_framework import viewsets, permissions, serializers
from rest_framework.response import Response
from iaso.models import MatchingAlgorithm
from .common import HasPermission
class AlgorithmsSerializer(serializers.ModelSerializer):
class Meta:
model = MatchingAlgorithm
fields = ["id", "na... | 2.21875 | 2 |
lib/googlecloudsdk/command_lib/run/printers/k8s_object_printer_util.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | 34859 | <filename>lib/googlecloudsdk/command_lib/run/printers/k8s_object_printer_util.py
# -*- coding: utf-8 -*- #
# Copyright 2019 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 t... | 2.28125 | 2 |
codility/lessons/1-iterations/test_binary_gap.py | phacic/dsa-py | 0 | 34860 | <filename>codility/lessons/1-iterations/test_binary_gap.py
import pytest
from binary_gap import solution
@pytest.mark.parametrize("value, expected", [(9, 2), (529, 4), (15, 0), (32, 0)])
def test_gaps(value, expected):
assert solution(value) == expected
| 3 | 3 |
IntroProPython/IntroProPython - exercicios/capitulo 07/exercicio-07-02.py | SweydAbdul/estudos-python | 0 | 34861 | <filename>IntroProPython/IntroProPython - exercicios/capitulo 07/exercicio-07-02.py
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: <NAME>
# Editora Novatec (c) 2010-2017
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250... | 4.03125 | 4 |
tests/pup/sensors/ultrasonic_lights.py | cschlack/pybricks-micropython | 115 | 34862 | # SPDX-License-Identifier: MIT
# Copyright (c) 2020 The Pybricks Authors
"""
Hardware Module: 1
Description: This tests the lights on the Ultrasonic Sensor. No external
sensors are used to verify that it works.
"""
from pybricks.pupdevices import UltrasonicSensor
from pybricks.parameters import Port
from pybricks.to... | 2.859375 | 3 |
sites/newbrandx/rankx/admin.py | jackytu/newbrandx | 0 | 34863 | <reponame>jackytu/newbrandx<filename>sites/newbrandx/rankx/admin.py
from django.contrib import admin
# Register your models here.
from .models import Milk
from .models import Brand
from .models import Company
admin.site.register(Milk)
admin.site.register(Brand)
admin.site.register(Company)
| 1.40625 | 1 |
class.py | adadesions/python_class | 0 | 34864 | <reponame>adadesions/python_class<gh_stars>0
"""
class lesson
""" | 1.117188 | 1 |
Paddle_ChineseBert/PaddleNLP/paddlenlp/transformers/chinesebert/tokenizer.py | jiaqianjing/ChineseBERT-Paddle | 1 | 34865 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : tokenzier.py
@Time : 2021/09/11 16:00:04
@Author : <NAME>
@Version : 1.0
@Contact : <EMAIL>
@Desc : None
'''
import json
import os
from typing import List
import numpy as np
from pypinyin import Style, pinyin
from .. import BasicTokeniz... | 2.5625 | 3 |
train.py | w86763777/pytorch-simple-yolov3 | 0 | 34866 | <gh_stars>0
import os
import argparse
from collections import defaultdict
import torch
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.multiprocessing import Process
from tqdm import trange
from tensorboardX import SummaryWriter
from pycocotools.coco import COCO... | 1.703125 | 2 |
progress.py | zzeleznick/config | 0 | 34867 | <gh_stars>0
#!/usr/bin/env python
# coding=UTF-8
import sys
from blessings import Terminal
import time
import numpy as np
import argparse
# import subprocess;
# subprocess.call(["printf", "\033c"]);
def process_input():
out = None
args = sys.argv[1:]
if args:
out = args[0]
return out
def main(... | 2.78125 | 3 |
misc/jarvis-dsc-bot/challenge/bot.py | PWrWhiteHats/BtS-CTF-Challenges-03-2021 | 7 | 34868 | # bot.py
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
from time import sleep
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
try:
with open('/app/flag.txt', 'r') as r:
FLAG = r.read().strip()
except FileNotFoundError:
FLAG = os.getenv('FLAG', 'bts{tmpflag}... | 2.421875 | 2 |
google/ads/google_ads/v4/proto/services/campaign_bid_modifier_service_pb2_grpc.py | arammaliachi/google-ads-python | 1 | 34869 | <filename>google/ads/google_ads/v4/proto/services/campaign_bid_modifier_service_pb2_grpc.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v4.proto.resources import campaign_bid_modifier_pb2 as google_dot_ads_dot_googleads__v4_dot_proto_dot_resources_dot_ca... | 1.6875 | 2 |
readthedocs/oauth/models.py | adrianmugnoz/Documentacion-universidades | 1 | 34870 | <filename>readthedocs/oauth/models.py
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
class GithubOrganization(models.Model):
# Auto fields
pub_date = models.DateTimeField(_('Publication date'), auto_now_add=True)
modified_da... | 2.28125 | 2 |
hg_agent_forwarder/forwarder.py | hostedgraphite/hg-agent-forwarder | 0 | 34871 | <reponame>hostedgraphite/hg-agent-forwarder<filename>hg_agent_forwarder/forwarder.py<gh_stars>0
import threading
import Queue
import os
import logging
import json
import time
import random
import requests
import multitail2
import errno
import tempfile
from requests.auth import HTTPBasicAuth
from utils import Datapoint
... | 2.453125 | 2 |
kutana/__main__.py | ekonda/kutana | 69 | 34872 | from .cli import run
run()
| 0.976563 | 1 |
Chapter9_FormatDetection/pr9_3_1.py | SeventeenChen/Python_Speech_SZY | 7 | 34873 | #
# pr9_3_1
from audiolazy import lazy_lpc
from scipy.signal import lfilter, find_peaks
from LPC import LPC
from Universal import *
if __name__ == '__main__':
filename = 'snn27.wav'
speech = Speech()
x, fs = speech.audioread(filename, None) # read one frame data
u = lfilter(b=np.array([1, -0.99]), a=1, x=x) # ... | 2.609375 | 3 |
FP - Fundamentals Of Programming/bank-accounts-manager/tests.py | p0licat/university | 2 | 34874 | <reponame>p0licat/university
from methods import *
'''
This file contains the test functions of every function defined in methods.py, which is imported.
This file is imported by the main file ( application.py )
'''
def sort_transactions_test(list_of_transactions):
list_of_transactions = [['7', '120', 'out', 'first... | 3.53125 | 4 |
darshan-util/pydarshan/darshan/error.py | gaocegege/darshan | 0 | 34875 | """ Darshan Error classes and functions. """
class DarshanBaseError(Exception):
"""
Base exception class for Darshan errors in Python.
"""
pass
class DarshanVersionError(NotImplementedError):
"""
Raised when using a feature which is not provided by libdarshanutil.
"""
min_version = ... | 2.78125 | 3 |
etl_e2e/census_etl/dfxml/python/dfxml/fiwalk.py | thinkmoore/das | 35 | 34876 | #!/usr/bin/env python
# This software was developed in whole or in part by employees of the
# Federal Government in the course of their official duties, and with
# other Federal assistance. Pursuant to title 17 Section 105 of the
# United States Code portions of this software authored by Federal
# employees are not su... | 2.203125 | 2 |
backend/tests/test_response.py | PolyCortex/polydodo | 13 | 34877 | <filename>backend/tests/test_response.py
"""
Not tested as they seemed obvious:
- "SleepTime": 31045, // Total amount of time sleeping including nocturnal awakenings (sleepOffset - sleepOnset)
- "WASO": 3932, // Total amount of time passed in nocturnal awakenings. It is the total time passed in non-wake stage
... | 2.40625 | 2 |
ver_colores.py | maltenzo/surrendeador | 0 | 34878 | <gh_stars>0
import mouse
import keyboard
from PIL import Image
import pyscreenshot
from time import sleep
import os
def ver():
while True:
img = pyscreenshot.grab()
width, height = img.size
pixel_values = list(img.getdata())
print (pixel_values[width*mouse.get_position()[1]+mouse.get_posi... | 2.65625 | 3 |
src/train.py | 2212221352/Multimodal-Transformer | 0 | 34879 | <gh_stars>0
import torch
from torch import nn
import sys
from src import models
from src import ctc
from src.utils import *
import torch.optim as optim
import numpy as np
import time
from torch.optim.lr_scheduler import ReduceLROnPlateau
import os
import pickle
from sklearn.metrics import classification_report
from sk... | 1.984375 | 2 |
datawin-parse.py | BlackLotus/ogme | 0 | 34880 | <gh_stars>0
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import os, sys
import binascii
import struct
import StringIO
# chunk names are 4 bytes long
# not quite sure how long the header is but I guess 8 bytes for now :>
# actually it's not really a header but the first chunk
# 4 bytes for the name (FORM) and 4 bytes for... | 3.0625 | 3 |
Diena_1_4_thonny/d2_u2_d11.py | edzya/Python_RTU_08_20 | 8 | 34881 | <filename>Diena_1_4_thonny/d2_u2_d11.py
try:
width=float(input("Ieraksti savas istabas platumu (metros): "))
height=float(input("Ieraksti savas istabas augstumu (metros): "))
length=float(input("Ieraksti savas istabas garumu (metros): "))
capacity=round(width*height*length, 2)
print(f"Tavas istabas ... | 3.25 | 3 |
javaStringHashCollision.py | VivekYadav7272/hash_code_collisions | 0 | 34882 | # Program to check how effective is Java's String's Hash Collision
# for generating hash codes for Indian Phone No.s
import random
from pprint import pprint
SAMPLE_SPACE = 10000
def genJavaHashCode(phone: str) -> int:
"""
s[0]*31^(n-1) + s[1]*31^(n-2) + … + s[n-1]
where :
s[i] – is the it... | 3.890625 | 4 |
arrhenuis/termodyn.py | xtotdam/leipzig-report | 0 | 34883 | <reponame>xtotdam/leipzig-report<filename>arrhenuis/termodyn.py<gh_stars>0
from arrhenius import stringify
"""
This script generates cool table with termodynamic parameters, taken from 'termodyn-acid.data.txt' and 'termodyn-anion.data.txt'
"""
head = '''
\\begin{center}
\\begin{tabular}{ x{1cm} x{2cm} x{2cm... | 2.609375 | 3 |
functree/tree.py | yutayamate/functree-ng | 17 | 34884 | <reponame>yutayamate/functree-ng
#!/usr/bin/env python3
import re, copy, urllib.request, urllib.parse, argparse, json
import networkx as nx
KEGG_DOWNLOAD_HTEXT_ENDPOINT = 'http://www.genome.jp/kegg-bin/download_htext?'
EXCLUDES = ['Global and overview maps', 'Drug Development', 'Chemical structure transformation maps'... | 2.625 | 3 |
app/config.py | dogukangungordi/cinetify-Movie | 0 | 34885 | import os
TWO_WEEKS = 1209600
SECRET_KEY = os.getenv('SECRET_KEY', None)
assert SECRET_KEY
TOKEN_EXPIRES = TWO_WEEKS
DATABASE_URL = os.getenv(
'DATABASE_URL',
'postgres://postgres@{0}:5432/postgres'.format(os.getenv('DB_PORT_5432_TCP_ADDR', None)))
assert DATABASE_URL
REDIS_HOST = os.getenv('REDIS_HOST', ... | 1.867188 | 2 |
2020/day02/password_philosopy.py | rycmak/advent-of-code | 1 | 34886 | file = open("input.txt", "r")
num_valid = 0
for line in file:
# policy = part before colon
policy = line.strip().split(":")[0]
# get min/max number allowed for given letter
min_max = policy.split(" ")[0]
letter = policy.split(" ")[1]
min = int(min_max.split("-")[0])
max = int(min_max.split("-")[1])
... | 4.03125 | 4 |
tools/config_setting.py | JBoRu/IMN-Pytorch-implement | 1 | 34887 | <reponame>JBoRu/IMN-Pytorch-implement
import argparse
import logging
import numpy as np
def Parse_Arguments():
parser = argparse.ArgumentParser()
# argument related to datasets and data preprocessing
parser.add_argument("--domain", dest="domain", type=str, metavar='<str>', default='res', help="dom... | 2.71875 | 3 |
data_loader.py | franpena-kth/learning-deep-learning | 0 | 34888 | <gh_stars>0
import h5py
import numpy
import sklearn
import sklearn.datasets
from matplotlib import pyplot
def load_dataset():
data_dir = '/Users/fpena/Courses/Coursera-Deep-Learning/Assignments/datasets/'
train_dataset = h5py.File(data_dir + 'train_catvnoncat.h5', "r")
train_set_x_orig = numpy.array(trai... | 2.984375 | 3 |
landmarkrest/field_predictor/field_models/TwoDigitYear.py | inferlink/landmark-rest | 0 | 34889 | from BaseModel import BaseModel
class TwoDigitYear(BaseModel):
def __init__(self):
super(TwoDigitYear, self).__init__()
def generate_confidence(self, preceding_stripes, slot_values, following_stripes):
# only care about ints for this model, so strip out anything that isn't
valid_valu... | 3.265625 | 3 |
compressor.py | kunliu7/compress_2RDM | 0 | 34890 | import numpy as np
class Compressor():
def __init__(self,
num_particles: int, num_spin_orbitals: int, rdm_ideal=None) -> None:
self.num_particles = num_particles
self.num_spin_orbitals = num_spin_orbitals
self.rdm_ideal = rdm_ideal
pass
def compress(self, rdm):
... | 2.765625 | 3 |
Lib/site-packages/node/tests/test_lifecycle.py | Dr8Ninja/ShareSpace | 11 | 34891 | <filename>Lib/site-packages/node/tests/test_lifecycle.py<gh_stars>10-100
from node.behaviors import Attributes
from node.behaviors import AttributesLifecycle
from node.behaviors import DefaultInit
from node.behaviors import DictStorage
from node.behaviors import Lifecycle
from node.behaviors import NodeAttributes
from ... | 2.046875 | 2 |
sources/t08/t08ej02.py | workready/pythonbasic | 0 | 34892 | class Empleado(object):
"Clase para definir a un empleado"
def __init__(self, nombre, email):
self.nombre = nombre
self.email = email
def getNombre(self):
return self.nombre
jorge = Empleado("Jorge", "<EMAIL>")
jorge.guapo = "Por supuesto"
# Probando hasattr, getattr, setattr
pri... | 3.90625 | 4 |
utils/label_smoothing.py | wdjose/keyword-transformer | 9 | 34893 | import torch
from torch import nn
# LabelSmoothingLoss from: https://github.com/dreamgonfly/transformer-pytorch/blob/master/losses.py
# License: https://github.com/dreamgonfly/transformer-pytorch/blob/master/LICENSE
class LabelSmoothingLoss(nn.Module):
def __init__(self, classes, smoothing=0.0):
super(Labe... | 2.484375 | 2 |
lib/west_tools/westpa/reweight/__init__.py | ajoshpratt/westpa | 1 | 34894 | # Copyright (C) 2017 <NAME> and <NAME>
#
# This file is part of WESTPA.
#
# WESTPA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... | 1.4375 | 1 |
platforms/m3/programming/mbus_message.py | lab11/M-ulator | 19 | 34895 | <filename>platforms/m3/programming/mbus_message.py
#!/usr/bin/python
import sys
import logging
from m3_common import m3_common
#m3_common.configure_root_logger()
#logger = logging.getLogger(__name__)
from m3_logging import get_logger
logger = get_logger(__name__)
class mbus_message_generator(m3_common):
TITLE ... | 2.15625 | 2 |
test/test_nn/test_distribution/test_gaussian.py | brunomaga/PRML | 11,017 | 34896 | import unittest
import numpy as np
import prml.nn as nn
class TestGaussian(unittest.TestCase):
def test_gaussian_draw_forward(self):
mu = nn.array(0)
sigma = nn.softplus(nn.array(-1))
gaussian = nn.Gaussian(mu, sigma)
sample = []
for _ in range(1000):
sample.ap... | 2.875 | 3 |
monsterapi/migrations/0023_check.py | merenor/momeback | 1 | 34897 | # Generated by Django 2.1.3 on 2018-11-24 13:52
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('monsterapi', '0022_auto_20181123_2339'),
]
operations = [
migrations.CreateMod... | 1.796875 | 2 |
pypy/interpreter/pyparser/test/samples/snippet_generator.py | camillobruni/pygirl | 12 | 34898 | <filename>pypy/interpreter/pyparser/test/samples/snippet_generator.py
def f(n):
for i in range(n):
yield n
| 1.539063 | 2 |
api_module/___init__.py | miscdec/tk-auto-study | 0 | 34899 | from . import main_api
__all__=[
"main_api"
] | 1.03125 | 1 |