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 |
|---|---|---|---|---|---|---|
PytorchRouting/Examples/run_experiments.py | oleksost/RoutingNetworks | 63 | 8700 | <filename>PytorchRouting/Examples/run_experiments.py
"""
This file defines some simple experiments to illustrate how Pytorch-Routing functions.
"""
import numpy as np
import tqdm
import torch
from PytorchRouting.DecisionLayers import REINFORCE, QLearning, SARSA, ActorCritic, GumbelSoftmax, PerTaskAssignment, \
WPL,... | 3.03125 | 3 |
output/models/ms_data/regex/re_g22_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 8701 | from output.models.ms_data.regex.re_g22_xsd.re_g22 import (
Regex,
Doc,
)
__all__ = [
"Regex",
"Doc",
]
| 1.179688 | 1 |
code/image-manipulation.py | rgeirhos/object-recognition | 33 | 8702 | #!/usr/bin/env python
from skimage.color import rgb2gray
from skimage.io import imread, imsave
from scipy.misc import toimage
import numpy as np
import wrapper as wr
###########################################################
# IMAGE IO
###########################################################
def imload_rgb(pa... | 2.65625 | 3 |
students/K33402/Akhmetzhanov Alisher/lr2/main/forms.py | AlishKZ/ITMO_ICT_WebDevelopment_2020-2021 | 0 | 8703 | from django.db.models import fields
from main.models import RoomReservation, UserRoom
from django import forms
from django.core.exceptions import ValidationError
from django.contrib.auth import authenticate, login
from django.contrib.auth import get_user_model
class ReservateRoomForm(forms.Form):
begin_date = for... | 2.0625 | 2 |
emmet-core/emmet/core/vasp/calc_types.py | espottesmith/emmet | 0 | 8704 | <filename>emmet-core/emmet/core/vasp/calc_types.py<gh_stars>0
""" Module to define various calculation types as Enums for VASP """
import datetime
from itertools import groupby, product
from pathlib import Path
from typing import Dict, Iterator, List
import bson
import numpy as np
from monty.json import MSONable
from ... | 2.046875 | 2 |
sensors/__init__.py | dawnos/robotcar-to-rosbag | 0 | 8705 |
from mono_left import MonoLeft
from mono_right import MonoRight
from mono_rear import MonoRear
from stereo_left import StereoLeft
from stereo_right import StereoRight
from stereo_centre import StereoCentre
| 1.140625 | 1 |
models/train_classifier.py | YiWang-Evonne/disaster_response | 0 | 8706 | <filename>models/train_classifier.py
import sys
import pandas as pd
from sqlalchemy import create_engine
import nltk
nltk.download(['punkt', 'wordnet', 'averaged_perceptron_tagger'])
import re
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.metrics import classification_repo... | 2.671875 | 3 |
terra/terra/emails.py | dymaxionlabs/platform | 0 | 8707 | <reponame>dymaxionlabs/platform
import os
from datetime import date
from django.conf import settings
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.utils import translation
from django.utils.translation import ugettext as _
from mailchimp3 import MailChimp
clas... | 2.265625 | 2 |
experimental/attentive_uncertainty/toy_regression/datasets.py | miksu/edward2 | 0 | 8708 | # coding=utf-8
# Copyright 2019 The Edward2 Authors.
#
# 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 o... | 2.546875 | 3 |
critiquebrainz/frontend/views/index.py | shagun6/critiquebrainz | 0 | 8709 | <filename>critiquebrainz/frontend/views/index.py
from flask import Blueprint, render_template
from flask_babel import format_number
import critiquebrainz.db.users as db_users
import critiquebrainz.db.review as db_review
from bs4 import BeautifulSoup
from markdown import markdown
DEFAULT_CACHE_EXPIRATION = 10 * 60 # s... | 2.171875 | 2 |
Enigma/Enigma-master/GBS/gbsHelper.py | Q-Alpha/Hackathon2020 | 12 | 8710 | import strawberryfields as sf
from strawberryfields import ops
from strawberryfields.utils import random_interferometer
from strawberryfields.apps import data, sample, subgraph, plot
import plotly
import networkx as nx
import numpy as np
class GBS:
def __init__(self, samples =[], min_pho = 16, max_pho = 30, subgra... | 2.296875 | 2 |
happy/HappyNodeJoin.py | jenniexie/happy | 0 | 8711 | <reponame>jenniexie/happy
#!/usr/bin/env python
#
# Copyright (c) 2015-2017 Nest Labs, Inc.
# 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
#
# h... | 2.1875 | 2 |
__init__.py | SDRAST/Data_Reduction | 0 | 8712 | # -*- coding: utf-8 -*-
"""
Modules to support data reduction in Python.
The main purpose of the base module ``Data_Reduction`` is to provide a
suplerclass with a good set of attributes and methods to cover all common needs.
The base module is also able to read data from a text file as a ``numpy``
structured array. ... | 3.5 | 4 |
PyGRB/__init__.py | HughPaynter/PyGRB | 0 | 8713 | """
PyGRB.
A GRB light-curve analysis package.
"""
__version__ = "0.0.5"
__author__ = '<NAME>'
from . import backend
from . import fetch
from . import main
from . import postprocess
from . import preprocess
| 0.71875 | 1 |
src/config.py | john9384/PyblogRestAPI | 0 | 8714 | import os
from dotenv import load_dotenv
load_dotenv()
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI')
MAIL_SERVER = 'smtp.gmail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get('EMAIL_USERNAME')
MAIL_P... | 1.851563 | 2 |
Context_Guided_RelRep/train.py | Huda-Hakami/Context-Guided-Relation-Embeddings | 1 | 8715 | import numpy as np
from wordreps import WordReps
from algebra import cosine, normalize
import tensorflow as tf
import random
from dataset import DataSet
import CGRE_Model
from Eval import eval_SemEval
import sklearn.preprocessing
# ============ End Imports ============
class Training():
def __init__(self):
# Compo... | 2.4375 | 2 |
synch_integrate.py | HerculesJack/grtrans | 25 | 8716 | <filename>synch_integrate.py
from radtrans_integrate import radtrans_integrate
from polsynchemis import polsynchemis
import numpy as np
import scipy.integrate
# calculate synchrotron emissivity for given coefficients
def synch_jarho(nu,n,B,T,theta):
if ((np.isscalar(nu)==False) & (np.isscalar(n)==True)):
n... | 2.203125 | 2 |
actions/lib/Template_Parser.py | pjimmybrcd/campus_ztp_nps | 0 | 8717 | <gh_stars>0
"""
Copyright 2016 Brocade Communications Systems, 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 applicable law or... | 2.15625 | 2 |
lca_writer/data/loader.py | line-mind/lca_writer | 1 | 8718 | <reponame>line-mind/lca_writer
import os
__all__ = ['DATA_FOLDER', 'load_data']
DATA_FOLDER = os.path.dirname(os.path.abspath(__file__))
def load_data(name):
"""
Loads an Excel form from the data folder with the specified name.
Parameters
----------
name : str
The name of the form with... | 2.640625 | 3 |
main.py | Dephilia/pipenv-docker-development | 0 | 8719 | var = "Docker"
print(f"Hello {var} world!")
| 1.3125 | 1 |
app/v1/utils/mixins.py | pndemo/yummy-recipes-api | 0 | 8720 | <gh_stars>0
""" Model mixin classes for auth, category and recipe modules """
from app import db
# pylint: disable=C0103
# pylint: disable=E1101
class BaseMixin(object):
""" Define the 'BaseModel' mapped to all database tables. """
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
def sa... | 2.296875 | 2 |
apps/dash-port-analytics/app/ui/tab_map_controls.py | JeroenvdSande/dash-sample-apps | 2,332 | 8721 | <reponame>JeroenvdSande/dash-sample-apps
import dash_core_components as dcc
import dash_html_components as html
from config import strings
def make_tab_port_map_controls(
port_arr: list,
port_val: str,
vessel_types_arr: list,
vessel_type_val: str,
year_arr: list,
year_val: int,
month_arr: ... | 2.71875 | 3 |
subs2srs/gui/state.py | TFarla/subs2srs-cross-platform | 3 | 8722 | <filename>subs2srs/gui/state.py
from typing import List
from subs2srs.core.preview_item import PreviewItem
class StatePreview:
items: List[PreviewItem] = []
inactive_items = set()
def __init__(self):
super().__init__()
self.items = []
self.inactive_items = set()
self.audio... | 2.328125 | 2 |
sync_ends/main.py | nirav1997/sync_ends | 0 | 8723 | <reponame>nirav1997/sync_ends
import sys
sys.path.append("..")
from src.sync_ends_service import SyncEnd
from src.parser import Parser
def main():
# get the arguments from commadn line
parser = Parser()
collection_name, api_key, trigger_interval, slack_channel, slack_token = parser.get_argumenets()
... | 2.109375 | 2 |
graphql_compiler/compiler/workarounds/orientdb_query_execution.py | 0xflotus/graphql-compiler | 0 | 8724 | # Copyright 2018-present Kensho Technologies, LLC.
"""Workarounds for OrientDB scheduler issue that causes poor query planning for certain queries.
For purposes of query planning, the OrientDB query planner ignores "where:" clauses
that hit indexes but do not use the "=" operator. For example, "CONTAINS" can be used t... | 2.015625 | 2 |
traffic_light/core.py | ofalk/cleware-traffic-light | 0 | 8725 | from enum import IntEnum
import functools
import usb.core
import usb.util
from traffic_light.error import TrafficLightError, MultipleTrafficLightsError
BM_REQUEST_TYPE = 0x21
B_REQUEST = 0x09
W_VALUE = 0x200
W_INDEX = 0x00
ID_VENDOR = 0x0d50
ID_PRODUCT = 0x0008
INTERFACE = 0
class Color(IntEnum):
RED = 0x10
... | 2.921875 | 3 |
sdk/cognitivelanguage/azure-ai-language-conversations/samples/async/sample_analyze_orchestration_app_luis_response_async.py | dubiety/azure-sdk-for-python | 1 | 8726 | # coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""
FILE: sample_analyze_orchestration_app_luis_response_async.py
DESCRIPTION:
This sample demonstrates how to analyze user query using an orchestra... | 1.960938 | 2 |
src/sunstruck/schemas/__init__.py | la-mar/sunstruck-api | 3 | 8727 | # flake8: noqa
from schemas.client_credentials import *
from schemas.message import *
from schemas.token import *
from schemas.user import *
| 1.09375 | 1 |
intro/deploy.py | terziev-viktor/SolidityCourse | 0 | 8728 | <gh_stars>0
import json
from web3 import Web3
from solcx import compile_standard, install_solc
with open("./SimpleStorage.sol", "r") as file:
simple_storage_src = file.read()
# install solcx
install_solc("0.8.0")
# compile the source
compiled_sol = compile_standard(
{
"language": "Solidity",
... | 2.1875 | 2 |
noise/extras/meta/protocol/protocol.py | mgp25/noise | 6 | 8729 | <reponame>mgp25/noise
from noise.dh.dh import DH
from noise.cipher.cipher import Cipher
from noise.hash.hash import Hash
from noise.processing.handshakepatterns.handshakepattern import HandshakePattern
from noise.processing.impl.handshakestate import HandshakeState
from noise.processing.impl.symmetricstate import Symm... | 2.359375 | 2 |
info_popup.py | cartazio/SublimeHaskell | 2 | 8730 | import urllib.parse
import webbrowser
import json
from xml.etree import ElementTree
import sublime
import SublimeHaskell.sublime_haskell_common as Common
import SublimeHaskell.internals.utils as Utils
import SublimeHaskell.internals.unicode_opers as UnicodeOpers
import SublimeHaskell.symbols as symbols
import Sublim... | 2.171875 | 2 |
modules/google_home_lights.py | artizanatweb/ghome-assistant | 0 | 8731 | <reponame>artizanatweb/ghome-assistant
#!/usr/bin/env python
# Copyright (C) 2017 Seeed Technology 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/licen... | 2.375 | 2 |
python/modules_packages_libraries/models/animal_kigdom/animals.py | aloa04/practice | 0 | 8732 | class Animal():
edad:int
patas:int
ruido:str
nombre: str
kgComida: float = 0
def __init__(self, edad, patas, ruido, nombre):
self.edad =edad
self.patas = patas
self.ruido = ruido
self.nombre = nombre
def comer(self, alimento):
self.kgComida += alimento... | 3.421875 | 3 |
tensortools/optimize/mncp_hals.py | klmcguir/tensortools | 0 | 8733 | """
Nonnegative CP decomposition by Hierarchical alternating least squares (HALS).
With support for missing data.
"""
import numpy as np
import scipy as sci
from scipy import linalg
from tensortools.operations import unfold, khatri_rao
from tensortools.tensors import KTensor
from tensortools.optimize import FitResult... | 2.5 | 2 |
raredecay/tools/data_tools.py | jonas-eschle/raredecay | 7 | 8734 | """
@author: <NAME> "Mayou36"
DEPRECEATED! USE OTHER MODULES LIKE rd.data, rd.ml, rd.reweight, rd.score and rd.stat
DEPRECEATED!DEPRECEATED!DEPRECEATED!DEPRECEATED!DEPRECEATED!
Contains several tools to convert, load, save and plot data
"""
import warnings
import os
import copy
import pandas as pd
import numpy... | 1.921875 | 2 |
toontown/coghq/boardbothq/BoardOfficeManagerAI.py | LittleNed/toontown-stride | 1 | 8735 | <reponame>LittleNed/toontown-stride<filename>toontown/coghq/boardbothq/BoardOfficeManagerAI.py
from direct.directnotify import DirectNotifyGlobal
import DistributedBoardOfficeAI
from toontown.toonbase import ToontownGlobals
from toontown.coghq.boardbothq import BoardOfficeLayout
from direct.showbase import DirectObject... | 2.15625 | 2 |
ansiblemetrics/utils.py | radon-h2020/AnsibleMetrics | 1 | 8736 | <reponame>radon-h2020/AnsibleMetrics
from typing import Union
def key_value_list(d: Union[dict, list], key=None) -> list:
"""
This function iterates over all the key-value pairs of a dictionary and returns a list of tuple (key, value) where the key contain only primitive value (i.e., no list or dict), e.g., s... | 3.53125 | 4 |
yampy/apis/groups.py | Kunal-Shah-Bose/yam-python | 0 | 8737 | <reponame>Kunal-Shah-Bose/yam-python
from yampy.apis.utils import ArgumentConverter, none_filter, stringify_booleans
from yampy.models import extract_id
class GroupsAPI(object):
"""
Provides an interface for accessing the groups related endpoints of the
Yammer API. You should not instantiate this class d... | 2.953125 | 3 |
phy/gui/actions.py | ycanerol/phy | 118 | 8738 | <filename>phy/gui/actions.py
# -*- coding: utf-8 -*-
"""Actions and snippets."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import inspect
from functools import partial, wraps
import loggin... | 2.359375 | 2 |
PP4E-Examples-1.4/Examples/PP4E/Tools/cleanpyc.py | AngelLiang/PP4E | 0 | 8739 | """
delete all .pyc bytecode files in a directory tree: use the
command line arg as root if given, else current working dir
"""
import os, sys
findonly = False
rootdir = os.getcwd() if len(sys.argv) == 1 else sys.argv[1]
found = removed = 0
for (thisDirLevel, subsHere, filesHere) in os.walk(rootdir):
for filename... | 2.96875 | 3 |
apps.py | louxfaure/sudoc_recouv | 1 | 8740 | <reponame>louxfaure/sudoc_recouv
from django.apps import AppConfig
class SudocRecouvConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'sudoc_recouv'
verbose_name = 'Analyses de recouvrement SUDOC'
| 1.210938 | 1 |
src/states.py | amancevice/terraform-aws-slack-interactive-components | 24 | 8741 | import boto3
from logger import logger
class States:
def __init__(self, boto3_session=None):
self.boto3_session = boto3_session or boto3.Session()
self.client = self.boto3_session.client('stepfunctions')
def fail(self, task_token, error, cause):
params = dict(taskToken=task_token, er... | 2.46875 | 2 |
apps/controllerx/cx_core/type/light_controller.py | clach04/controllerx | 0 | 8742 | from typing import Any, Dict, Optional, Type, Union
from cx_const import Light, PredefinedActionsMapping
from cx_core.color_helper import get_color_wheel
from cx_core.controller import action
from cx_core.feature_support.light import LightSupport
from cx_core.integration import EventData
from cx_core.integration.decon... | 2.640625 | 3 |
kts/core/types.py | konodyuk/kts | 18 | 8743 | from typing import Union
import pandas as pd
from kts.core.frame import KTSFrame
AnyFrame = Union[pd.DataFrame, KTSFrame]
| 1.703125 | 2 |
krispy/mod_user/models.py | jlaura/krispy | 2 | 8744 | <filename>krispy/mod_user/models.py
from app import db
from flask.ext.login import UserMixin
class User(UserMixin, db.Model):
__tablename__ = 'oauth2users'
id = db.Column(db.Integer, primary_key=True)
social_id = db.Column(db.String(64), nullable=False, unique=True)
nickname = db.Column(db.String(64), ... | 2.21875 | 2 |
blog_app/blog/views.py | flxj/Django_blog | 1 | 8745 | <gh_stars>1-10
import markdown
from comments.forms import CommentForm,BookCommentForm,MovieCommentForm
from django.shortcuts import render, get_object_or_404
from.models import Post,Category,Tag, Book,Movie
#from django.http import HttpResponse
from django.views.generic import ListView, DetailView
from django.utils.tex... | 2.484375 | 2 |
src/command_modules/azure-cli-security/azure/cli/command_modules/security/_params.py | jfcoz/azure-cli | 1 | 8746 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1.78125 | 2 |
utils/path_utils.py | kuyu12/pygame_fight_game | 1 | 8747 | import sys
IMAGES_PATH = sys.path[1] + "/Images"
BACKGROUND_IMAGES_PATH = IMAGES_PATH + '/background'
USER_INFO_BACKGROUND_PATH = BACKGROUND_IMAGES_PATH+"/blue_background.jpg"
SPRINT_IMAGE_PATH = IMAGES_PATH + '/sprite'
PROFILE_IMAGES_PATH = IMAGES_PATH + '/profile'
CONFIGURATION_FILES_PATH = sys.path[1] + "/configur... | 1.71875 | 2 |
tests/models/test_transformers.py | Alicegaz/torchok | 8 | 8748 | import unittest
import torch
from parameterized import parameterized
from src.constructor import create_backbone
from src.models.backbones.utils import list_models
from .test_segmentation import example_backbones
def inp(bsize, in_ch, w, h):
return torch.ones(bsize, in_ch, w, h)
class TestBackboneCorrectness(... | 2.359375 | 2 |
aiogram/types/inline_query.py | SvineruS/aiogram | 1 | 8749 | import typing
from . import base
from . import fields
from .inline_query_result import InlineQueryResult
from .location import Location
from .user import User
class InlineQuery(base.TelegramObject):
"""
This object represents an incoming inline query.
When the user sends an empty query, your bot could r... | 2.703125 | 3 |
app/app.py | shaswat01/Disaster_Response_ETL | 0 | 8750 | import nltk
import json
import plotly
import pandas as pd
import plotly.graph_objects as go
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import word_tokenize
nltk.download(['punkt','wordnet'])
from flask import Flask
from flask import render_template, request, jsonify
from plotly.graph_objs import Bar, H... | 2.796875 | 3 |
tools/mo/openvino/tools/mo/front/mxnet/mx_reshape_reverse.py | pazamelin/openvino | 1 | 8751 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.mxnet.mx_reshape_to_reshape import MXReshapeToReshape
from openvino.tools.mo.ops.Reverse import Reverse
from openvino.tools.mo.ops.mxreshape import MXReshape
from openvino.tools.mo.front.c... | 2.265625 | 2 |
Python/Simulation/Numerical_Methods/test_cubic_spline_solve.py | MattMarti/Lambda-Trajectory-Sim | 0 | 8752 | <reponame>MattMarti/Lambda-Trajectory-Sim
import unittest;
import numpy as np;
import scipy as sp;
from cubic_spline_solve import cubic_spline_solve;
from cubic_spline_fun import cubic_spline_fun;
class Test_cubic_spline_solve(unittest.TestCase):
'''
Test_cubicsplineSolve
Test case for the cubic splin... | 3.046875 | 3 |
PassWord.py | IQUBE-X/passGenerator | 1 | 8753 | # PassWord - The Safe Password Generator App!
# importing the tkinter module for GUI
from tkinter import *
# importing the message box widget from tkinter
from tkinter import messagebox
# importing sqlite3 for database
import sqlite3
# importing random for password generation
import random
# creatin... | 4.53125 | 5 |
1805_number_of_different_integers_in_a_string.py | hotternative/leetcode | 0 | 8754 | <filename>1805_number_of_different_integers_in_a_string.py
from string import ascii_lowercase
ts = 'a123bc34d8ef34'
cur = []
res = set()
for c in ts:
if c in ascii_lowercase:
if cur:
s = ''.join(cur)
res.add(int(s))
cur = []
else:
cur.append(c)
else:
if... | 3.484375 | 3 |
app.py | ahmedriaz9908/memeapiiz | 0 | 8755 | from flask import Flask, render_template, jsonify
from reddit_handler import *
app = Flask(__name__)
meme_subreddits = ['izlam']
@app.route('/')
def index():
return render_template('index.html')
@app.route('/meme')
def one_post():
sub = random.choice(meme_subreddits)
re = get_posts(sub... | 2.703125 | 3 |
10_compare_between_main_product_pages.py | e-davydenkova/SeleniumWebDriver_Training | 0 | 8756 | import pytest
from selenium import webdriver
import re
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
wd.get("http://localhost/litecart/en/")
request.addfinalizer(wd.quit)
return wd
# check that product names are identical on the main page and on product page
def test_product_names(driv... | 2.671875 | 3 |
pyrite/llvm.py | iahuang/pyrite | 0 | 8757 | import shutil
from pyrite import fs
from pyrite.command_line import run_command
from pyrite.errors import UserError
from pyrite.globals import Globals
from os.path import join
class LLVMInterface:
_clang_path: str
def __init__(self):
self._clang_path = self._get_clang_path()
def _get_clang_path(s... | 2.375 | 2 |
bag_recursive.py | eduardogerentklein/Algoritmos-Geneticos | 0 | 8758 | maxWeight = 30
value = [15, 7, 10, 5, 8, 17]
weight = [15, 3, 2, 5, 9, 20]
def bag(pos, selected):
# calcula o total
totalValue = 0
pesoTotal = 0
for i in selected:
totalValue += value[i]
pesoTotal += weight[i]
if pesoTotal > maxWeight:
return (0,0)
if pos >= len(weight):
return (totalValue, pesoT... | 3.578125 | 4 |
train.py | MEfeTiryaki/trpo | 2 | 8759 | <reponame>MEfeTiryaki/trpo
import argparse
from itertools import count
import signal
import sys
import os
import time
import numpy as np
import gym
import torch
import torch.autograd as autograd
from torch.autograd import Variable
import scipy.optimize
import matplotlib.pyplot as plt
from value import Value
from p... | 2.09375 | 2 |
task3/task3_xgb_cv.py | meck93/intro_ml | 0 | 8760 |
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.feature_selection import f_classif, SelectKBest
import numpy as np
import pandas as pd
import os
mingw_path = 'C:\\Program Files\\mingw-w64\\x86_64-7.2.0-posix... | 2.84375 | 3 |
discovery-provider/src/queries/get_plays_metrics.py | atticwip/audius-protocol | 429 | 8761 | <gh_stars>100-1000
import logging
import time
from sqlalchemy import func, desc
from src.models import Play
from src.utils import db_session
logger = logging.getLogger(__name__)
def get_plays_metrics(args):
"""
Returns metrics for play counts
Args:
args: dict The parsed args from the request
... | 2.5 | 2 |
CAutomation/settings.py | Rich9rd/CAutomation | 0 | 8762 | """
Django settings for CAutomation project.
Generated by 'django-admin startproject' using Django 3.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pat... | 1.84375 | 2 |
calculators/credit_card_calculator.py | wanderindev/financial-calculator-backend | 2 | 8763 | from .calculator import Calculator
# noinspection PyTypeChecker
class CreditCardCalculator(Calculator):
def __init__(self, **kwargs):
super(CreditCardCalculator, self).__init__(**kwargs)
self.cc_debt = self.get_float(kwargs.get("cc_debt", 0))
self.add_c = self.get_float(kwargs.ge... | 3.125 | 3 |
setup.py | phaustin/MyST-Parser | 0 | 8764 | """myst-parser package setup."""
from importlib import import_module
from setuptools import find_packages, setup
setup(
name="myst-parser",
version=import_module("myst_parser").__version__,
description=(
"An extended commonmark compliant parser, " "with bridges to docutils & sphinx."
),
lo... | 1.601563 | 2 |
python/tests/extractor/refmt.py | kho/cdec | 114 | 8765 | #!/usr/bin/env python
import collections, sys
lines = []
f = collections.defaultdict(int)
fe = collections.defaultdict(lambda: collections.defaultdict(int))
for line in sys.stdin:
tok = [x.strip() for x in line.split('|||')]
count = int(tok[4])
f[tok[1]] += count
fe[tok[1]][tok[2]] += count
lines... | 2.65625 | 3 |
blog/models.py | tomitokko/django-blog-with-astradb | 3 | 8766 | from django.db import models
import uuid
from datetime import datetime
from cassandra.cqlengine import columns
from django_cassandra_engine.models import DjangoCassandraModel
# Create your models here.
class PostModel(DjangoCassandraModel):
id = columns.UUID(primary_key=True, default=uuid.uuid4)
title = column... | 2.5 | 2 |
fedex/services/availability_commitment_service.py | miczone/python-fedex | 0 | 8767 | <filename>fedex/services/availability_commitment_service.py<gh_stars>0
"""
Service Availability and Commitment Module
This package contains the shipping methods defined by Fedex's
ValidationAvailabilityAndCommitmentService WSDL file. Each is encapsulated in a class for
easy access. For more details on each, refer to ... | 2.703125 | 3 |
xverse/transformer/_woe.py | gb-andreygsouza/XuniVerse | 0 | 8768 | import pandas as pd
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
import scipy.stats.stats as stats
import pandas.core.algorithms as algos
#from sklearn.utils.validation import check_is_fitted
from sklearn.utils import check_array
from ..transformer import MonotonicBinning
pd.options.mode... | 2.8125 | 3 |
cupy/linalg/product.py | okapies/cupy | 1 | 8769 | <filename>cupy/linalg/product.py
import numpy
import six
import cupy
from cupy import core
from cupy import internal
from cupy.linalg.solve import inv
from cupy.util import collections_abc
matmul = core.matmul
def dot(a, b, out=None):
"""Returns a dot product of two arrays.
For arrays with more than one ... | 3.28125 | 3 |
fibo.py | aligoren/pyalgo | 22 | 8770 | <filename>fibo.py
def fibo(n):
return n <= 1 or fibo(n-1) + fibo(n-2)
def fibo_main():
for n in range(1,47):
res = fibo(n)
print("%s\t%s" % (n, res))
fibo_main()
# profiling result for 47 numbers
# profile: python -m profile fibo.py
"""
-1273940835 function calls (275 primitive calls) in 18966.707 s... | 3.5 | 4 |
trt_util/common.py | yihui8776/TensorRT-DETR | 0 | 8771 | <filename>trt_util/common.py
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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.... | 2 | 2 |
src/init.py | inpanel/inpanel-desktop | 1 | 8772 | #!/usr/bin/env python3
# -*- coding:utf-8-*-
import tkinter.messagebox
from tkinter import Button, Label, Tk
from utils.functions import set_window_center
from utils.sqlite_helper import DBHelper
from inpanel import App
class InitWindow(Tk):
"""初始化窗口"""
def __init__(self):
Tk.__init__(self)
... | 3.171875 | 3 |
Toolkits/CMake/hunter/packages/sugar/python/sugar/sugar_warnings_wiki_table_generator.py | roscopecoltran/SniperKit-Core | 102 | 8773 | <reponame>roscopecoltran/SniperKit-Core
#!/usr/bin/env python3
# Copyright (c) 2014, <NAME>
# All rights reserved.
"""
* Wiki table for `leathers` C++ project
Expected format:
### Main table
Name | Clang | GCC | MSVC |
-----------------------------|----------|----------|------|
sta... | 2.1875 | 2 |
neutron/plugins/ofagent/agent/ports.py | armando-migliaccio/neutron-1 | 0 | 8774 | # Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 <NAME> <yamamoto at valinux co jp>
# 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
#
# ... | 1.859375 | 2 |
pdf/wechat/step.py | damaainan/html2md | 0 | 8775 | # -*- coding=utf-8 -*-
from zwechathihu.mypdf import GenPdf
from db.mysqlite import simpleToolSql
data=[{"url": "http://mp.weixin.qq.com/s?__biz=MzAxODQxMDM0Mw==&mid=2247484852&idx=1&sn=85b50b8b0470bb4897e517955f4e5002&chksm=9bd7fbbcaca072aa75e2a241064a403fde1e579d57ab846cd8537a54253ceb2c8b93cc3bf38e&scene=21#wechat_... | 2.8125 | 3 |
pipeline/validators/handlers.py | ZhuoZhuoCrayon/bk-nodeman | 31 | 8776 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 1.570313 | 2 |
NumPy/Array Basics/Random Shuffle/tests/test_task.py | jetbrains-academy/Python-Libraries-NumPy | 0 | 8777 | import unittest
import numpy as np
from task import arr, permuted_2d, fully_random
class TestCase(unittest.TestCase):
def test_shape(self):
self.assertEqual((5, 20), arr.shape, msg="Wrong shape of the array 'arr'.")
self.assertEqual((5, 20), permuted_2d.shape, msg="Wrong shape of the array 'permu... | 3.4375 | 3 |
resources/lib/channelui.py | lausitzer/plugin.video.mediathekview | 0 | 8778 | # -*- coding: utf-8 -*-
"""
The channel model UI module
Copyright 2017-2018, <NAME> and <NAME>
SPDX-License-Identifier: MIT
"""
# pylint: disable=import-error
import os
import xbmcgui
import xbmcplugin
import resources.lib.mvutils as mvutils
from resources.lib.channel import Channel
class ChannelUI(Channel):
... | 2.296875 | 2 |
getconf.py | smk762/Dragonhound | 3 | 8779 | #!/usr/bin/env python3
#Credit to @Alright for the RPCs
import re
import os
import requests
import json
import platform
# define function that fetchs rpc creds from .conf
def def_credentials(chain):
operating_system = platform.system()
if operating_system == 'Darwin':
ac_dir = os.environ['HOME'] + '/... | 2.53125 | 3 |
cwr/parser/decoder/dictionary.py | orenyodfat/CWR-DataApi | 37 | 8780 | # -*- coding: utf-8 -*-
from cwr.acknowledgement import AcknowledgementRecord, MessageRecord
from cwr.agreement import AgreementRecord, AgreementTerritoryRecord, \
InterestedPartyForAgreementRecord
from cwr.group import Group, GroupHeader, GroupTrailer
from cwr.info import AdditionalRelatedInfoRecord
from cwr.pars... | 1.789063 | 2 |
prebuilt/twrp_fonts.py | imranpopz/android_bootable_recovery-1 | 95 | 8781 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf8 -*-
import codecs,os,gzip,ctypes,ctypes.util,sys
from struct import *
from PIL import Image, ImageDraw, ImageFont
# ====== Python script to convert TrueTypeFonts to TWRP's .dat format ======
# This script was originally made by https://github.com/suky for his c... | 2.34375 | 2 |
open/users/serializers.py | lawrendran/open | 105 | 8782 | import pytz
from rest_auth.serializers import TokenSerializer
from rest_framework.authtoken.models import Token
from rest_framework.exceptions import ValidationError
from rest_framework.fields import (
CharField,
CurrentUserDefault,
HiddenField,
UUIDField,
ChoiceField,
)
from rest_framework.serializ... | 2.28125 | 2 |
tests/en/test_asr.py | rhasspy/rhasspy-test | 0 | 8783 | """Automated speech recognition tests."""
import os
import sys
import unittest
from pathlib import Path
import requests
from rhasspyhermes.asr import AsrTextCaptured
from rhasspyhermes.nlu import NluIntent
class AsrEnglishTests(unittest.TestCase):
"""Test automated speech recognition (English)"""
def setUp... | 3.296875 | 3 |
speech/melgan/model/multiscale.py | OthmaneJ/deep-tts | 213 | 8784 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .discriminator import Discriminator
from .identity import Identity
class MultiScaleDiscriminator(nn.Module):
def __init__(self):
super(MultiScaleDiscriminator, self).__init__()
self.discriminators = nn.ModuleList(
... | 2.328125 | 2 |
main.py | AntonioLourencos/jogo-da-velha | 10 | 8785 | <gh_stars>1-10
from game import about_button, start_button, play_sound, center_pos
import pygame
WHITE = (255,255,255)
BLACK = (0,0,0)
GREEN = (0, 255, 0)
pygame.init()
pygame.font.init()
pygame.mixer.init()
FONT = pygame.font.Font("assets/font.ttf", 70)
FONT_MIN = pygame.font.Font("assets/font.ttf", 30)
window = p... | 2.875 | 3 |
schedule/views.py | 1donggri/teamProject | 0 | 8786 | from django.shortcuts import render, redirect
from .models import Post
from .forms import ScheduleForm
from django.core.paginator import Paginator
# Create your views here.
def view_schedule(request):
all_posts = Post.objects.all().order_by('pub_date')
page = int(request.GET.get('p', 1))
pagenator = Pagina... | 2.203125 | 2 |
archetype/settings/local_stg.py | kingsdigitallab/archetype-django | 1 | 8787 | <reponame>kingsdigitallab/archetype-django
from .base import * # noqa
CACHE_REDIS_DATABASE = '1'
CACHES['default']['LOCATION'] = '127.0.0.1:6379:' + CACHE_REDIS_DATABASE
INTERNAL_IPS = INTERNAL_IPS + ('', )
ALLOWED_HOSTS = ['']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2... | 1.320313 | 1 |
website/sites/admin.py | vnaskos/Website | 0 | 8788 | <reponame>vnaskos/Website
from django.contrib import admin
# Register your models here.]
from website.sites.models import Post
@admin.register(Post)
class TestAdmin2(admin.ModelAdmin):
pass | 1.515625 | 2 |
mcts.py | korbi98/TicTacToeGo_Zero | 0 | 8789 | <reponame>korbi98/TicTacToeGo_Zero<filename>mcts.py
# Monte Carlo tree search for TicTacToe
import numpy as np
from tictactoe import Tictactoe
import copy
from random import choice
from tree import Node
import time
class MCTS:
'''
Class defining a simple monte carlo tree search algorithm.
Attributes:
... | 3.734375 | 4 |
grimer/metadata.py | pirovc/grimer | 5 | 8790 | import pandas as pd
from pandas.api.types import is_numeric_dtype
from grimer.utils import print_log
class Metadata:
valid_types = ["categorical", "numeric"]
default_type = "categorical"
def __init__(self, metadata_file, samples: list=[]):
# Read metadata and let pandas guess dtypes, index as str... | 2.9375 | 3 |
allennlp/training/metric_tracker.py | MSLars/allennlp | 11,433 | 8791 | from typing import Optional, Dict, Any, List, Union
from allennlp.common.checks import ConfigurationError
class MetricTracker:
"""
This class tracks a metric during training for the dual purposes of early stopping
and for knowing whether the current value is the best so far. It mimics the PyTorch
`st... | 2.6875 | 3 |
authors/apps/profiles/renderers.py | MuhweziDeo/Ah-backend-xmen | 4 | 8792 | from authors.apps.utils.renderers import AppJSONRenderer
import json
from rest_framework.renderers import JSONRenderer
class UserProfileJSONRenderer(AppJSONRenderer):
name = 'profile'
class UserProfileListRenderer(JSONRenderer):
"""
Returns profiles of existing users
"""
charset = 'utf-8'
... | 2.53125 | 3 |
json_analyzer.py | bantenz/NetworkConfigParser | 0 | 8793 | <reponame>bantenz/NetworkConfigParser<gh_stars>0
import json
from deepdiff import DeepDiff
import pprint
def get_json(file_name):
with open(file_name) as json_file:
json_data = json.load(json_file)
return json_data
def compare_json(Hostname, Command, Data1, Data2):
if (Data1 == Data2):
... | 2.921875 | 3 |
fiwareglancesync/sync.py | telefonicaid/fiware-glancesync | 0 | 8794 | <reponame>telefonicaid/fiware-glancesync
#!/usr/bin/env python
# -- encoding: utf-8 --
#
# Copyright 2015-2016 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... | 1.804688 | 2 |
models/object_detection/pytorch/ssd-resnet34/training/cpu/mlperf_logger.py | Pandinosaurus/models-intelai | 0 | 8795 | ### This file is originally from: [mlcommons repo](https://github.com/mlcommons/training/tree/9947bdf21ee3f2488fa4b362eec2ce7deb2ec4dd/single_stage_detector/ssd/mlperf_logger.py)
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may ... | 2.078125 | 2 |
omtk/models/model_avar_surface_lips.py | CDufour909/omtk_unreal | 0 | 8796 | import math
import pymel.core as pymel
from omtk.core.classNode import Node
from omtk.libs import libAttr
from omtk.libs import libRigging
from . import model_avar_surface
class SplitterNode(Node):
"""
A splitter is a node network that take the parameterV that is normally sent through the follicles and
sp... | 2.625 | 3 |
project/server/main/feed.py | dataesr/harvest-theses | 0 | 8797 | <filename>project/server/main/feed.py
import datetime
import os
import pymongo
import requests
from urllib import parse
from urllib.parse import quote_plus
import json
from retry import retry
from bs4 import BeautifulSoup
import math
from project.server.main.logger import get_logger
from project.server.main.utils_swi... | 2.328125 | 2 |
DQM/L1TMonitor/python/L1TGCT_cfi.py | ckamtsikis/cmssw | 852 | 8798 | import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
l1tGct = DQMEDAnalyzer('L1TGCT',
gctCentralJetsSource = cms.InputTag("gctDigis","cenJets"),
gctForwardJetsSource = cms.InputTag("gctDigis","forJets"),
gctTauJetsSource = cms.InputTag("gctDigis","tauJets"),
... | 1.4375 | 1 |
utilities.py | gandhiy/lipMIP | 11 | 8799 | <reponame>gandhiy/lipMIP
""" General all-purpose utilities """
import sys
import torch
import torch.nn.functional as F
import numpy as np
import gurobipy as gb
import matplotlib.pyplot as plt
import io
import contextlib
import tempfile
import time
import re
import pickle
import inspect
import glob
import os
COMPLETE... | 2.046875 | 2 |