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 |
|---|---|---|---|---|---|---|
app/api.py | ethan-homan/f1-lineup-optimization-api | 0 | 12771251 | <gh_stars>0
import logging
from fastapi import APIRouter
from fastapi.encoders import jsonable_encoder
from app.types import UserModelSpec
from app.solver import solve_top_lineups
from app.model_spec import LineupOptimizationModelSpec
gunicorn_error_logger = logging.getLogger("gunicorn.error")
logging.root.handlers.ex... | 2.203125 | 2 |
deeplearning/layers/optimizers.py | cbschaff/nlimb | 12 | 12771252 | """
Defining standard tensorflow optimizers as modules.
"""
import tensorflow as tf
from deeplearning import module
from deeplearning import tf_util as U
class SGD(module.Optimizer):
ninputs = 1
def __init__(self, name, loss, lr=1e-4, momentum=0.0, clip_norm=None):
super().__init__(name, loss)
... | 2.59375 | 3 |
10_File_Handling/01_Files.py | AmanDhimanD/Python_CompleteCode | 2 | 12771253 | f=open('This.txt','r')
# this is Default read mode of file
f=open('This.txt') #open file
# data=f.read()
data=f.read(5) #Starting 5 characters from file
print(data)
f.close() | 3.65625 | 4 |
third/time_Arrow.py | gottaegbert/penter | 13 | 12771254 | # https://github.com/arrow-py/arrow
"""
>>> import arrow
>>> arrow.get('2013-05-11T21:23:58.970460+07:00')
<Arrow [2013-05-11T21:23:58.970460+07:00]>
>>> utc = arrow.utcnow()
>>> utc
<Arrow [2013-05-11T21:23:58.970460+00:00]>
>>> utc = utc.shift(hours=-1)
>>> utc
<Arrow [2013-05-11T20:23:58.970460+00:00]>
>>> local ... | 2.78125 | 3 |
udemy-data-structures-and-algorithms/15-recursion/15.5_factorial_memoization.py | washimimizuku/python-data-structures-and-algorithms | 0 | 12771255 | <filename>udemy-data-structures-and-algorithms/15-recursion/15.5_factorial_memoization.py
# Create cache for known results
factorial_memo = {}
def factorial(k):
if k < 2:
return 1
if not k in factorial_memo:
factorial_memo[k] = k * factorial(k-1)
return factorial_memo[k]
print(factori... | 4 | 4 |
app/mod/mod_utils.py | jacklul/openvr_fsr_app | 0 | 12771256 | <filename>app/mod/mod_utils.py
from pathlib import Path, WindowsPath
from typing import Dict, Optional
import app.mod
from app.app_settings import AppSettings
from app.globals import get_data_dir
from app.mod import BaseModType
from app.util.utils import get_file_hash
def get_mod(manifest, mod_type):
""" Get Mod... | 2.328125 | 2 |
tests/integrated/settings_test.py | BGASM/pyentrez | 0 | 12771257 | <reponame>BGASM/pyentrez<filename>tests/integrated/settings_test.py
import configargparse
import cmdline as cmd
def main() -> None:
"""Command line parsing to determine how pyEntrez should be run.
Check if user is a new user and run functions to set up user directory.
Determine if pyEntrez should be run... | 2.296875 | 2 |
mysocialauth/social_auth_app/apps.py | itssubas/django-social-auth | 0 | 12771258 | <reponame>itssubas/django-social-auth
from django.apps import AppConfig
class SocialAuthAppConfig(AppConfig):
name = 'social_auth_app'
| 1.226563 | 1 |
config.py | volltin/openranwen | 9 | 12771259 | <reponame>volltin/openranwen<filename>config.py
#自行替换
BOTTOKEN="<KEY>"
BOTNAME="ranwengamebot"
#PROXY="socks5h://localhost:1080"
PROXY=""
DEBUG=True
PY=True#py钱
| 1.3125 | 1 |
fonty/models/font/font.py | jamesssooi/font-cli | 12 | 12771260 | '''font.py: Class to manage individual fonts.'''
import os
import codecs
from typing import Dict, Any, Optional
from fontTools.ttLib import TTFont
from fonty.lib.variants import FontAttribute
from fonty.lib.font_name_ids import FONT_NAMEID_FAMILY, FONT_NAMEID_FAMILY_PREFFERED, \
FON... | 2.8125 | 3 |
jupyterlabpymolpysnips/Programming/synch.py | MooersLab/pymolpysnips | 0 | 12771261 | cmd.do('cmd.sync(timeout=1.0,poll=0.05);')
| 1.148438 | 1 |
FVC_Prediction.py | yyren/FVC | 11 | 12771262 | <filename>FVC_Prediction.py
import argparse
from FVC_utils import load_from_pickle, printx, time, path
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
def predictor_series(X_test, clfkit, normalizer=None):
"""Xs_test should be scaled
clfkit is a single-item dict
"""
if normalizer:
... | 2.46875 | 2 |
app/controllers/vote.py | Axtell-io/Axtell | 15 | 12771263 | from flask import g, abort, redirect, url_for
from app.instances import db
from app.models.Post import Post
from app.models.Answer import Answer
from app.models.PostVote import PostVote
from app.models.AnswerVote import AnswerVote
# noinspection PyUnresolvedReferences
import app.routes.post
# noinspection PyUnresolve... | 2.4375 | 2 |
official/vision/beta/projects/yolo/ops/kmeans_anchors_test.py | duncanriach-nvidia/tensorflow-models | 1 | 12771264 | <gh_stars>1-10
# Copyright 2022 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 the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | 2.171875 | 2 |
asynch/proto/progress.py | stdc105/asynch | 0 | 12771265 | from asynch.proto import constants
from asynch.proto.io import BufferedReader
class Progress:
def __init__(self, reader: BufferedReader):
self.rows = 0
self.bytes = 0
self.total_rows = 0
self.written_rows = 0
self.written_bytes = 0
self.reader = reader
async de... | 2.515625 | 3 |
generator.py | FrankWhoee/RS-10 | 0 | 12771266 | from keras.models import load_model
import numpy as np
from encoding import encode
from encoding import decode
model = load_model('Model-0.1.hf')
post_title = input("What do you want to know from u/rogersimon10? \n")
post_title = "What’s the worst thing you’ve eaten out of politeness?"
encoded_title = np.array(encode... | 3.296875 | 3 |
pyspedas/erg/satellite/erg/xep/xep.py | nickssl/pyspedas | 3 | 12771267 | import cdflib
import numpy as np
from pytplot import clip, options, store_data, ylim, zlim
from ..load import load
def xep(trange=['2017-06-01', '2017-06-02'],
datatype='omniflux',
level='l2',
suffix='',
get_support_data=False,
varformat=None,
varnames=[],
down... | 2.765625 | 3 |
users/migrations/0008_remove_user_is_superuser.py | amado-developer/ReadHub-RestfulAPI | 0 | 12771268 | <gh_stars>0
# Generated by Django 3.0.6 on 2020-06-05 02:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20200605_0245'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='is_superus... | 1.40625 | 1 |
cogs/balance.py | Nadro-J/tipbot-v2 | 3 | 12771269 | <filename>cogs/balance.py
import discord
from discord.ext import commands
from utils import rpc_module, mysql_module, parsing, checks
#result_set = database response with parameters from query
#db_bal = nomenclature for result_set["balance"]
#snowflake = snowflake from message context, identical to user in datab... | 2.671875 | 3 |
tests/test_library_matching.py | omigami/matchmsextras | 2 | 12771270 | import os
import sys
import numpy as np
import pytest
from matchms import Spectrum
from spec2vec import Spec2Vec
from spec2vec import SpectrumDocument
path_root = os.path.dirname(os.getcwd())
sys.path.insert(0, os.path.join(path_root, "matchmsextras"))
from matchmsextras.library_search import library_matching
def te... | 2.28125 | 2 |
communicator/services/ivy_service.py | sartography/uva-covid19-testing-communicator | 1 | 12771271 | import csv
import json
from datetime import datetime
from parser import ParserError
import globus_sdk
import pytz
import sentry_sdk
from dateutil import parser
from communicator import app, db
from communicator.errors import CommError
from communicator.models.ivy_file import IvyFile
from communicator.models.sample im... | 2.234375 | 2 |
tests/test_dirichlet.py | BerenMillidge/inferactively | 0 | 12771272 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit Tests
__author__: <NAME>, <NAME>, <NAME>
"""
import os
import sys
import unittest
import numpy as np
from scipy.io import loadmat
sys.path.append(".")
from inferactively.distributions import Categorical, Dirichlet # nopep8
class TestDirichlet(unittest.TestCa... | 2.71875 | 3 |
mundo-2/condicoes/ex039.py | fln99/curso-python | 0 | 12771273 | <filename>mundo-2/condicoes/ex039.py
from datetime import date
ano_atual = date.today().year
print('-+-' * 14)
print('{:^40}'.format('Exército do Python'))
print('Consulte a situação de teu alistamento!')
print('-+-' * 14)
ano_nasc = int(input('Ano de seu nascimento: '))
idade_usuario = ano_atual - ano_nasc
if ida... | 3.8125 | 4 |
tests/test_helpers.py | baurt/sqladmin | 319 | 12771274 | from sqladmin.helpers import secure_filename
def test_secure_filename(monkeypatch):
assert secure_filename("My cool movie.mov") == "My_cool_movie.mov"
assert secure_filename("../../../etc/passwd") == "etc_passwd"
assert (
secure_filename("i contain cool \xfcml\xe4uts.txt")
== "i_contain_co... | 2.34375 | 2 |
test/test_log.py | S3DEV/utils3 | 0 | 12771275 | <gh_stars>0
"""------------------------------------------------------------------------------------------------
Program: test_log
Purpose: Unit test for utils.log
Dependents: utils.log
Developer: <NAME>
Email: <EMAIL>
Use: > cd /package_root/test
> python test_log.py
-----------------... | 2.15625 | 2 |
dswizard/core/model.py | Ennosigaeon/dswizzard | 0 | 12771276 | <filename>dswizard/core/model.py
from __future__ import annotations
import re
from collections import namedtuple
from enum import Enum
from typing import Optional, List, TYPE_CHECKING, Tuple, Union, Any, Dict
import joblib
import numpy as np
import openml
from ConfigSpace import ConfigurationSpace
from ConfigSpace.co... | 1.945313 | 2 |
modeler/api/__init__.py | yngtodd/modeler | 0 | 12771277 | <gh_stars>0
from .node import (
Node, HierarchicalNode
)
from .interaction import Interaction
from .scene import Scene
| 1.148438 | 1 |
erase-by-hist.py | todorokit/tensorflow_cnn_image_sample | 0 | 12771278 | import os, sys, time, re
import cv2
import deeptool
sameImages= []
cachedImages = None
def isSameImage(imghist, checkhist):
ret = cv2.compareHist(imghist, checkhist, 0)
ret2 = cv2.compareHist(imghist, checkhist, 1)
ret3 = cv2.compareHist(imghist, checkhist, 2)
ret4 = cv2.compareHist(imghist, checkhis... | 2.453125 | 2 |
rasa_nlu/tokenizers/yaha_tokenizer.py | hetaomilk123/Rasa_NLU_Chi | 1,304 | 12771279 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 23 14:54:35 2017
@author: user
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from typing import Any
from typing import Dict
from typing import List
... | 2.53125 | 3 |
microcosm_pubsub/chain/__init__.py | Sinon/microcosm-pubsub | 5 | 12771280 | <reponame>Sinon/microcosm-pubsub<filename>microcosm_pubsub/chain/__init__.py
from microcosm_pubsub.chain.chain import Chain # noqa: F401
from microcosm_pubsub.chain.decorators import binds, extracts # noqa: F401
from microcosm_pubsub.chain.statements import ( # noqa: F401
assign,
assign_constant,
assign_... | 1.382813 | 1 |
pyscripts/train_ae.py | udion/mscopy_AE | 0 | 12771281 | from models import *
from utils import *
from tensorboard_logger import configure, log_value
import os
try:
os.makedirs('../train_logs')
except OSError:
pass
vgg19_exc = VGG19_extractor(torchvision.models.vgg19(pretrained=True))
vgg19_exc = vgg19_exc.cuda()
E1 = Encoder(n_res_blocks=10)
D1 = Decoder(n_res_bl... | 2.109375 | 2 |
mcts_a.py | balaz94/adaptive-rl | 0 | 12771282 | import torch
import math
class Node:
def __init__(self, state, probs, value, length, moves, terminal = False):
self.state = state
self.moves = torch.nonzero(moves)
self.P = probs[self.moves].view(-1)
self.P = self.P / self.P.sum()
self.value = value
self.length = len... | 2.765625 | 3 |
CS1_BostonCollege/HW2_CS1/temperature.py | gonzalosc2/LearningPython | 0 | 12771283 | # author: <NAME>
# assigment: Homework #2
# description: contains three functions
# First function:
# Input: temperature value in degrees Centigrade
# Output: temperature value in degrees Fahrenheit
# Second function:
# Input: temperature value in degrees Fahrenheit
# Output: temperature val... | 4.1875 | 4 |
app/models/search.py | adrianruizmora/c-ster | 0 | 12771284 | # Third-party Libraries
from flask_restful import Resource, reqparse
import pyvo
from astropy.io.votable import parse
class Search(Resource):
def __init__(self) -> None:
super().__init__()
self.service = pyvo.dal.TAPService("http://voparis-tap-planeto.obspm.fr/tap")
def get(self, database):
... | 2.6875 | 3 |
plugin.video.rebirth/resources/lib/modules/cache.py | TheWardoctor/wardoctors-repo | 1 | 12771285 | # -*- coding: utf-8 -*-
################################################################################
# | #
# | ______________________________________________________________ #
# | :~8a.`~888a:::::::::::::::88......88:::::::::... | 1.679688 | 2 |
utils/loglikelihood.py | MrHuff/DIF-NLDL | 0 | 12771286 | import torch
from utils.model_utils import *
#Class conditional loglikelihood!
def elbo_recon(prediction,target):
error = (prediction - target).view(prediction.size(0), -1)
error = error ** 2
error = torch.sum(error, dim=-1)
return error
def calculate_ELBO(model,real_images):
with torch.no_grad():... | 2.21875 | 2 |
tests/docs/test_async_constructor.py | adriangb/di | 57 | 12771287 | import pytest
from docs_src.async_constructor import main
@pytest.mark.anyio("asyncio")
async def test_async_constructor() -> None:
await main()
| 1.835938 | 2 |
xyz_to_zmat_orca.py | LIVazquezS/xyz_to_orcaint | 0 | 12771288 | <reponame>LIVazquezS/xyz_to_orcaint
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 28 19:08:50 2021
@author: <NAME>
"""
import argparse
from openbabel import pybel
import os
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser._action_groups.pop()
req... | 2.75 | 3 |
nltkma/test/unit/test_json2csv_corpus.py | aydtmiri/nltk-ma | 0 | 12771289 | <gh_stars>0
# Natural Language Toolkit: Twitter client
#
# Copyright (C) 2001-2021 NLTK Project
# Author: <NAME> <<EMAIL>>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Regression tests for `json2csv()` and `json2csv_entities()` in Twitter
package.
"""
from pathlib import Path
import pytest... | 2.5 | 2 |
src/data_mgmt/helpers/mqtt_pub.py | ammpio/stromm | 1 | 12771290 | <reponame>ammpio/stromm
import logging
from os import getenv, path
import json
import paho.mqtt.client as mqtt
from typing import Dict, List, Optional
import ssl
logger = logging.getLogger(__name__)
MQTT_CLEAN_SESSION = False
MQTT_QOS = 1
MQTT_RETAIN = False
MQTT_CONN_SUCCESS = 0
MQTT_PUB_SUCCESS = 0
# Attempt to se... | 2.296875 | 2 |
data_analysis/visualization/eye_image_annotation.py | vedb/data_analysis | 0 | 12771291 | from glob import glob
import cv2
import os
import sys
import yaml
import matplotlib as mpl
import numpy as np
from skimage.io import imread
import matplotlib.pyplot as plt
from ellipses import LSqEllipse # The code is pulled from https://github.com/bdhammel/least-squares-ellipse-fitting
import time
# This annotation s... | 2.46875 | 2 |
invenio_app_ils/literature/covers_builder.py | NRodriguezcuellar/invenio-app-ils | 41 | 12771292 | <reponame>NRodriguezcuellar/invenio-app-ils<gh_stars>10-100
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018-2020 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Document configuration callbacks."""
from fla... | 1.835938 | 2 |
test/unittests/test_AnimalN.py | mudkipmaster/gwlf-e | 0 | 12771293 | import numpy as np
from VariableUnittest import VariableUnitTest
from gwlfe.Output.AvAnimalNSum import AnimalN
class TestAnimalN(VariableUnitTest):
def test_AnimalN(self):
z = self.z
np.testing.assert_array_almost_equal(
AnimalN.AnimalN_f(z.NYrs, z.NGPctManApp, z.GrazingAnimal_0, z.Nu... | 2.21875 | 2 |
doc/examples/2_seismics/plot_04_koenigsee.py | baender/gimli | 0 | 12771294 | <filename>doc/examples/2_seismics/plot_04_koenigsee.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. _ex:koenigsee:
Field data inversion ("Koenigsee")
==================================
This minimalistic example shows how the Refraction Manager can be used to invert
a field data set. Here, we consider the Koen... | 2.59375 | 3 |
TomographyRNJGeneral.py | GKovanis/Thesis-Project | 0 | 12771295 | import numpy as np
from math import log10
from math import sqrt
import time
import networkx as nx
import matplotlib.pyplot as plt
import pydot
import csv
class Graph(object):
def __init__(self):
self.root = None #root/source node is the start of the graph/tree and multicast source
self.nodes = []
... | 2.78125 | 3 |
tests/test_ytu.py | yaph/ytu | 0 | 12771296 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import ytu
def test_is_youtube():
tests = [
('http://youtu.be/zoLVUxKCWhY', True),
('http://www.youtube.com/watch?v=VvRC0wxM-yM', True),
('http://wwwwwwyoutube.com/watch?v=VvRC0wxM-yM', False),
('http://example.com/zoLVUxKCWhY', False)
... | 2.625 | 3 |
alipay/aop/api/response/AlipayOpenServicemarketCommodityQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 12771297 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenServicemarketCommodityQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenServicemarketCommodityQueryResponse, self).__init__()
self._app_hot... | 1.859375 | 2 |
layerserver/migrations/0019_geojsonlayer_permissions.py | aroiginfraplan/giscube-admin | 5 | 12771298 | <filename>layerserver/migrations/0019_geojsonlayer_permissions.py
# Generated by Django 2.2.11 on 2020-05-06 05:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_depen... | 1.742188 | 2 |
controllers/mobile.py | whanderley/eden | 27 | 12771299 | <filename>controllers/mobile.py
# -*- coding: utf-8 -*-
"""
Mobile Forms - Controllers
"""
module = request.controller
# -----------------------------------------------------------------------------
def forms():
"""
Controller to download a list of available forms
"""
if request.env.request_... | 2.390625 | 2 |
mobile_insight/monitor/dm_collector/__init__.py | unknownhandX/mobileinsight-core | 0 | 12771300 | # -*- coding: utf-8 -*-
__all__ = [
"DMCollector", # P4A: THIS LINE WILL BE DELETED ###
"FormatError",
"DMLogPacket",
"dm_collector_c"
]
from dm_collector import DMCollector # P4A: THIS LINE WILL BE DELETED ###
from dm_endec import DMLogPacket, FormatError
import dm_collector_c
| 1.523438 | 2 |
test/unit/test_adapter.py | NielsZeilemaker/dbt-spark | 0 | 12771301 | import mock
import unittest
import dbt.adapters
import dbt.flags as flags
from pyhive import hive
from dbt.adapters.spark import SparkAdapter
import agate
from .utils import config_from_parts_or_dicts, inject_adapter
class TestSparkAdapter(unittest.TestCase):
def setUp(self):
flags.STRICT_MODE = True
... | 2.1875 | 2 |
sieve_common/k8s_event.py | OmerKahani/sieve | 0 | 12771302 | <filename>sieve_common/k8s_event.py
import json
from typing import Dict, List, Optional, Set, Tuple, Union
from sieve_common.event_delta import diff_event, conflicting_event_payload
from sieve_common.default_config import sieve_config
from controllers import deployment_name
HEAR_READ_FILTER_FLAG = True
ERROR_MSG_FILT... | 1.867188 | 2 |
config/style_transfer_config.py | baishalidutta/Neural-Style | 1 | 12771303 | <reponame>baishalidutta/Neural-Style<filename>config/style_transfer_config.py
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2021 <NAME>"
__license__ = "Apache License 2.0"
__version__ = "0.1"
# import the necessary packages
import os
# define the content layer from which feature maps will be extracted
contentL... | 2.296875 | 2 |
example/example/schema.py | andrenerd/django-multiform-authentication | 7 | 12771304 | from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
ShemaView = get_schema_view(
openapi.Info(
title='Multauth Example API',
default_version='v1',
description='Authentication flow: email, password and passcode (using Google Authenticator... | 1.929688 | 2 |
hardhat/recipes/socat.py | stangelandcl/hardhat | 0 | 12771305 | from .base import GnuRecipe
class SocatRecipe(GnuRecipe):
def __init__(self, *args, **kwargs):
super(SocatRecipe, self).__init__(*args, **kwargs)
self.sha256 = 'ce3efc17e3e544876ebce7cd6c85b3c2' \
'79fda057b2857fcaaf67b9ab8bdaf034'
self.name = 'socat'
self.ve... | 2.078125 | 2 |
app/views.py | Lumiahna/guildbit | 51 | 12771306 | <reponame>Lumiahna/guildbit
import re
from flask import render_template, request, redirect, session, url_for, g, flash, json
from flask_login import login_user, logout_user, current_user
import settings
from app import app, db, lm, oid, cache, babel
from app.controllers.home import HomeView
from app.controllers.serv... | 2.0625 | 2 |
xjson/__init__.py | mikegribov/filedjson | 0 | 12771307 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 4 00:22:32 2020
@author: <NAME>
"""
import os
import copy
from typing import Union, Any
try:
import simplejson as json
except ImportError:
import json
from .plugins.base_file import BaseFilePlugin, _info
from .exceptions.file_exceptions impo... | 2.109375 | 2 |
Dynamic Programming/152. Maximum Product Subarray.py | Wolemercy/leetcode | 0 | 12771308 | <gh_stars>0
# https://leetcode.com/problems/maximum-product-subarray/
class Solution:
def maxProduct(self, nums: List[int]) -> int:
res = nums[0]
maxNum, minNum = 1, 1
for num in nums:
tempMax = num * maxNum
t... | 3.25 | 3 |
recipes/summary/driver_trips.py | svetasmirnova/mysqlcookbook | 1 | 12771309 | #!/usr/bin/python3
# driver_trips.py: summarize miles per driver and show a list for each
# driver of the trips they took.
# Two approaches are demonstrated:
# - Two queries. First query retrieves the summary values, second the
# list entries. Print the list entries, preceding the list for each
# driver with the... | 3.984375 | 4 |
backend/reports/migrations/0001_initial.py | nikhilkutinha/athena | 1 | 12771310 | # Generated by Django 3.1.6 on 2021-02-12 07:40
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Region',... | 1.71875 | 2 |
Data Structures/Arrays/Reverse.py | d3xt3r0/Data-Structures-And-Algorithms | 4 | 12771311 | # Program to reverse an array
def reverseArray(arr : list) :
for i in range(len(arr) // 2) :
arr[i], arr[len(arr)-1-i] = arr[len(arr)-1-i], arr[i]
if __name__ == "__main__":
arr = [1,2,3,4,5,6,7]
reverseArray(arr)
print(arr)
| 4.40625 | 4 |
app/core/filtro.py | taniodev/chat-serv | 0 | 12771312 | from unicodedata import normalize
def normalizar(texto: str) -> str:
"""
Normalize um texto qualquer.
Substitui os caracteres especiais do texto.
Exemplo:
>>> normalizar(' AçúcAR ')
'acucar'
"""
texto = normalize('NFKD', texto)
texto = texto.encode('iso-8859-1', 'ignore').decode(... | 3.609375 | 4 |
main.py | compactcoder/QuickNotepad | 5 | 12771313 | <reponame>compactcoder/QuickNotepad
import os
from tkinter import Tk,ttk, PhotoImage, Menu, Frame, Text, Scrollbar, IntVar,GROOVE, \
StringVar, BooleanVar, Button, END, Label, INSERT, Toplevel, Entry, Checkbutton
import tkinter.filedialog
import tkinter.messagebox
Program_Name = "QuickNotepad"
File_Name = N... | 2.828125 | 3 |
data_structure/heap/max_heap.py | khoadnse/algorithm | 0 | 12771314 | <filename>data_structure/heap/max_heap.py
"""
Max Heap
"""
import unittest
from typing import TypeVar
from data_structure.heap.abstract_heap import AbstractHeap
T = TypeVar('T')
class MaxHeap(AbstractHeap[T]):
def __init__(self, array: list[T], cap: int = 10):
if array:
super().__init__(max... | 3.390625 | 3 |
dash/dashblocks/migrations/0001_initial.py | eHealthAfrica/dash | 0 | 12771315 | <filename>dash/dashblocks/migrations/0001_initial.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_... | 1.828125 | 2 |
4depcheck/cli/dep_check_cli_parser.py | DrGruby/4depcheck | 5 | 12771316 | <reponame>DrGruby/4depcheck
#
# Licensed to 4depcheck under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. 4depcheck licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# no... | 2.1875 | 2 |
smoketests/tests/configless_test.py | erlware-deprecated/sinan | 7 | 12771317 | <reponame>erlware-deprecated/sinan
import unittest
import sin_testing as st
import os
import shutil
import pexpect
class TestConfigless(st.SmokeTest):
# clean the project
@st.sinan("-p ctest_project -n 0.1.0 clean")
def clean_configless(self, child, appdesc):
child.expect(pexpect.EOF)
self... | 2.09375 | 2 |
dismod/utils.py | r0x0d/dismod | 0 | 12771318 | <filename>dismod/utils.py<gh_stars>0
import fnmatch
import os
from typing import Any
from typing import Generator
from typing import List
from typing import Tuple
def collect_files_in_module(filepath: str, ignore_folder: str) -> List[str]:
""" """
matches = []
for root, dirs, filenames in os.walk(filepath... | 2.65625 | 3 |
documentation_multiprocessing/08_reference/01_process_and_exceptions/process_and_exceptions_08_oop_11.py | software-foundations/learning-distributed-systems | 0 | 12771319 | import multiprocessing as mp
import itertools
QUEUE = mp.Queue()
class Routine(mp.Process):
def __init__(self, number: int, *args, **kwargs):
mp.Process.__init__(self, *args, **kwargs)
self.number = number
def target(self, number: int) -> int:
return 2 * number
def run(self):
result = self.target(s... | 3.390625 | 3 |
inverse_covariance/tests/quic_graph_lasso_test.py | aldanor/skggm | 0 | 12771320 | <filename>inverse_covariance/tests/quic_graph_lasso_test.py
import numpy as np
import pytest
from numpy.testing import assert_raises
from numpy.testing import assert_allclose
from sklearn import datasets
from inverse_covariance import (
QuicGraphicalLasso,
QuicGraphicalLassoCV,
QuicGraphicalLassoEBIC,
... | 2.28125 | 2 |
scripts/generate_submit_set.py | imos/icfpc2021 | 4 | 12771321 | import subprocess
import json
def main(set_path):
for (problem_id, line) in enumerate(open(set_path).readlines()):
if line.strip() == "":
continue
problem_id = problem_id + 1
submission_id, globalist_source_problem = line.split(' ')
globalist_source_problem = int(globa... | 2.09375 | 2 |
04_vehicle_detection/functions_detection.py | ifding/self-driving-car | 14 | 12771322 | import cv2
import matplotlib.pyplot as plt
import numpy as np
from functions_feat_extraction import image_to_features
from project_5_utils import stitch_together
def draw_labeled_bounding_boxes(img, labeled_frame, num_objects):
"""
Starting from labeled regions, draw enclosing rectangles in the original colo... | 2.90625 | 3 |
plot/plot.py | naumovda/stokes | 0 | 12771323 | import os
from mpl_toolkits import mplot3d
from matplotlib import cm
import matplotlib.pyplot as plt
import pandas as pd
def plot_3d(data, x, y, z):
ax = plt.axes(projection="3d")
ax.plot_trisurf(df[x], df[y], df[z], cmap=cm.Blues)
ax.set_xticks(df[x].values)
ax.set_yticks(df[y].values)
ax.set_xl... | 2.96875 | 3 |
tests/transformers/test_text_transformers.py | altescy/xsklearn | 0 | 12771324 | <gh_stars>0
from xsklearn.transformers.text_transformers import Lowercase
def test_lowercase() -> None:
inputs = ["HeLLo WoRLD!", "fOO bAr bAz"]
lower = Lowercase()
results = lower.fit_transform(inputs)
assert len(results) == 2
assert results[0] == "hello world!"
assert results[1] == "foo ba... | 3.015625 | 3 |
scatterauth/forms.py | caniko2/django-scatter-auth | 0 | 12771325 | <filename>scatterauth/forms.py
from scatterauth.settings import app_settings
from django import forms
from django.contrib.auth import authenticate, get_user_model
from django.utils.translation import ugettext_lazy as _
class LoginForm(forms.Form):
nonce = forms.CharField(widget=forms.HiddenInput, max_length=12)
... | 2.328125 | 2 |
Python/Football.py | luisgepeto/CodeEvalExamples | 0 | 12771326 | import sys
class TeamsDictionary(object):
def __init__(self):
self.teams = {}
def add_team(self, team, country):
if team not in self.teams:
self.teams[team] = []
self.teams[team].append(country)
def __repr__(self):
repr = ""
for team in sorted(self.teams... | 3.46875 | 3 |
tests/factories/input/definitions/integer_input_definition.py | TheLabbingProject/django_analyses | 1 | 12771327 | from factory import Faker
from factory.django import DjangoModelFactory
class IntegerInputDefinitionFactory(DjangoModelFactory):
key = Faker("pystr", min_chars=3, max_chars=50)
required = Faker("pybool")
description = Faker("sentence")
min_value = Faker("pyint", min_value=-20, max_value=-10)
max_v... | 2.421875 | 2 |
dashboard/dashboard/change_internal_only.py | oneumyvakin/catapult | 4 | 12771328 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provides the web interface for changing internal_only property of a Bot."""
import logging
from google.appengine.api import taskqueue
from google.appeng... | 1.890625 | 2 |
tests/constants.py | raiden-network/raiden-wizard | 9 | 12771329 | <reponame>raiden-network/raiden-wizard
import tempfile
from pathlib import Path
TESTING_TEMP_FOLDER = Path(tempfile.gettempdir()).joinpath("raiden-wizard-testing")
TESTING_KEYSTORE_FOLDER = TESTING_TEMP_FOLDER.joinpath("keystore")
| 1.835938 | 2 |
tests/test_version.py | goalsgame/ueimporter | 0 | 12771330 | import json
import ueimporter.version as version
def test_ueimporter_json_with_tag_will_succeed():
version_dict = {
'GitReleaseTag': '4.27.1-release'
}
assert version.UEImporterJson(
version_dict).git_release_tag == '4.27.1-release'
def test_ueimporter_json_without_key_will_yield_empty_... | 2.484375 | 2 |
Q/questionnaire/tests/tests_unit/tests_views/test_views_legacy.py | ES-DOC/esdoc-questionnaire | 0 | 12771331 | ####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2015 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
####################
__author_... | 2.234375 | 2 |
Second.py | DheerajKN/Python-with-pygame | 1 | 12771332 | s="\t\tHello\n"
print(s.strip())
| 1.953125 | 2 |
data/train/python/89a40e2c776916f399452dad6381942ff0919c6ccontroller.py | harshp8l/deep-learning-lang-detection | 84 | 12771333 | <reponame>harshp8l/deep-learning-lang-detection
import sys
from chimera.core.exceptions import ObjectNotFoundException
_global_private_controller_singleton = None
def ConsoleController ():
global _global_private_controller_singleton
if not _global_private_controller_singleton:
_global_private_cont... | 2.203125 | 2 |
leetcode/35/35.py | yukienomiya/competitive-programming | 0 | 12771334 | class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
s = 0
e = len(nums) - 1
while(s <= e):
m = (s + e) // 2
if (nums[m] < target):
s = m + 1
elif (nums[m] > target):
e = m - 1
else:
return m
return s | 3.6875 | 4 |
piccolo/apps/migrations/commands/forwards.py | teners/piccolo | 0 | 12771335 | <filename>piccolo/apps/migrations/commands/forwards.py
from __future__ import annotations
import sys
import typing as t
from piccolo.apps.migrations.auto import MigrationManager
from piccolo.apps.migrations.commands.base import BaseMigrationManager
from piccolo.apps.migrations.tables import Migration
from piccolo.conf... | 2.09375 | 2 |
matplotlib-tuxing.py | jinghuquan/jing2019-1-7 | 0 | 12771336 | <reponame>jinghuquan/jing2019-1-7
import matplotlib.pyplot as plt
plt.rcParams['font.sans-aerif'] = ['SimHei'] # 用来正常显示中文标签
dete = ['2018/7/21', '2018/7/22', '2018/7/23', '2018/7/24', '2018/7/25', '2018/7/26', '2018/7/21'] | 1.570313 | 2 |
ejercicio1/reducer.py | josefigueirasm/MUEI-ICS-MAP-REDUCE | 0 | 12771337 | #!/usr/bin/env python
import sys
NULL = "-9999.0"
minCheck = 0
for line in sys.stdin:
# remove leading and trailing whitespace
clean_line = line.strip()
# parse the input we got from mapper.py
temp, city = clean_line.split()
# Check if the value is valid and it's the first time it enters
if te... | 3.40625 | 3 |
predict_image.py | blertal/keras_imagenet | 0 | 12771338 | <filename>predict_image.py<gh_stars>0
"""predict_image.py
This script is for testing a trained Keras ImageNet model. The model
could be one of the following 2 formats:
1. tf.keras model (.h5)
2. optimized TensorRT engine (.engine)
Example usage #1:
$ python3 predict_image.py saves/googlenet_bn-model-final.h... | 2.828125 | 3 |
scratch/normalize.py | bemineni/USCIS | 0 | 12771339 | import argparse
import csv
def findCategory(status):
# Received state
if "Fingerprint Fee Was Received" in status:
return 1
elif "Expedite Request Denied" in status:
return 1
elif "Case Was Received" in status:
return 1
elif "Case Was Reopened" in status:
return 1
... | 2.625 | 3 |
demo_sms.py | ZompaSenior/pygsm | 0 | 12771340 | <gh_stars>0
import time
from pygsm import GsmModem
gsm = GsmModem(port = "/dev/ttyUSB0", logger = GsmModem.debug_logger).boot()
print("Waiting for network...")
s = gsm.wait_for_network()
with open("messaggio.txt", "rt") as f:
messaggio = f.read()
with open("lista.csv", "rt") as f:
for i, l in enumerate(f):
... | 2.734375 | 3 |
src/wrangle_data.py | RobBlumberg/DSCI_522_Group_302 | 1 | 12771341 | <gh_stars>1-10
#!/home/dkruszew/anaconda3/bin/python
# -*- coding: utf-8 -*-
# author: <NAME>
# date: 2020-01-21
#
"""This script imports raw .csv files for horse-racing data in Hong Kong from user-defined file-path,
performs pre-preprocessing, merges the files together, and writes them to a user-specified location
o... | 3.234375 | 3 |
src/contrib/change_chunk_names.py | memento42429/metashape-scripts | 40 | 12771342 | <filename>src/contrib/change_chunk_names.py
import Metashape
"""
Metashape Chunk Name Changer Script (v 1.0)
<NAME>, Feb 2021
Usage:
Workflow -> Batch Process -> Add -> Run script
This script changes chunks name refering to the first image name of the chunk.
When the image name include "_", this splits the name and j... | 2.328125 | 2 |
app.py | cjoshi7/covid19-date-selector | 2 | 12771343 | import json
import pandas as pd
import plotly.express as px
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from urllib.request import urlopen
app = dash.Dash(external_stylesheets=[dbc.t... | 2.703125 | 3 |
atividade-3/questao1.py | David-Marcoss/POO1-PYTHON | 0 | 12771344 | <reponame>David-Marcoss/POO1-PYTHON
from datetime import date
class pessoa:
def __init__(self,nome,data,altura):
self._nome = nome
self._data = data
self._altura = altura
def imprimir_dados(self):
print(f"nome:{self._nome}\ndata de nacimento:{self._data}\naltura:{self._altura}... | 3.78125 | 4 |
src/home_finder/settings/seloger.py | nekomamoushi/home-finder | 0 | 12771345 | <filename>src/home_finder/settings/seloger.py
# -*- coding: utf-8 -*-
from pathlib import Path
from home_finder.utils.file import csv_load
INSEE_CODE_CITES_FILENAME = Path(__file__).parent.parent.parent.parent / "res" / "minified-code-postal-code-insee-iledefrance-2015.csv"
class SelogerSettings(object):
SEA... | 2.78125 | 3 |
src/output.py | awsassets/superfish | 0 | 12771346 | <gh_stars>0
def save_in_csv(login, filename="data"):
try:
open(filename+".csv", "a").write(f"{login.ip}, {login.email}, {login.pwd}\n")
except Exception as err:
print(err)
exit(1)
def save_in_text(login, filename="data"):
try:
open(filename+".txt", "a").write(f"Ip:{login.ip} ... | 3.53125 | 4 |
Stream_Learning_CIFAR10_Fig-4b/model_utils.py | justincurl/SynapticMetaplasticityBNN | 17 | 12771347 | <reponame>justincurl/SynapticMetaplasticityBNN<filename>Stream_Learning_CIFAR10_Fig-4b/model_utils.py
import numpy as np
import pandas as pd
import math
import torch
import torchvision
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
from collections import OrderedDict
from datetime im... | 2.359375 | 2 |
pyobs/utils/simulation/telescope.py | pyobs/pyobs-core | 4 | 12771348 | from __future__ import annotations
import threading
import numpy as np
from astropy.coordinates import SkyCoord
import astropy.units as u
from typing import Tuple, List
import random
from pyobs.object import Object
from pyobs.utils.enums import MotionStatus
class SimTelescope(Object):
"""A simulated telescope o... | 2.671875 | 3 |
spider/ip_proxies/ip_proxies/spiders/jiangxianli.py | LZC6244/ip_proxy_pool | 17 | 12771349 | # -*- coding: utf-8 -*-
import random
import scrapy
from scrapy import Request
from ip_proxies.spiders.base import BaseSpider
from ip_proxies.items import IpProxiesItem
from ip_proxies.settings import TEST_URLS, LOG_FILE
class JiangxianliSpider(BaseSpider):
name = 'jiangxianli'
# allowed_domains = ['jiangxian... | 2.5 | 2 |
admin/test/test_acceptance.py | wallnerryan/flocker-profiles | 0 | 12771350 | <reponame>wallnerryan/flocker-profiles
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for ``admin.acceptance``.
"""
from uuid import UUID
from zope.interface.verify import verifyObject
from twisted.trial.unittest import SynchronousTestCase
from ..acceptance import (
IClusterRunner, Manage... | 1.757813 | 2 |