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 |
|---|---|---|---|---|---|---|
ckan/tests/functional/test_publisher_auth.py | dadosgovbr/ckan | 2 | 27600 | <reponame>dadosgovbr/ckan
import re
from nose.tools import assert_equal
import ckan.model as model
from ckan.lib.create_test_data import CreateTestData
from ckan.logic import NotAuthorized
from ckan.tests import *
from ckan.tests import setup_test_search_index
from base import FunctionalTestCase
from ckan.t... | 1.898438 | 2 |
py/__main__.py | social-learning/data-structures | 2 | 27601 | import src.data_structures.heap
from src.algorithms.misc import powerfulIntegers
class Solution:
def balancedStringSplit(self, s: str) -> int:
bal = 0
stack = []
for c in s:
if c not in stack:
stack.append(c)
else:
stack.pop()
bal += 1
re... | 3.28125 | 3 |
src/EDA/cleanAcceptedLoans.py | simon555/cs109-FinalProject | 2 | 27602 | <reponame>simon555/cs109-FinalProject
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 28 21:56:22 2018
@author: simon
"""
from src.EDA.clean_object import cleanObject
from src.EDA.clean_numeric import cleanNumeric
import pandas as pd
def cleanForDemo(filename):
"""
input : location of the file
output : f... | 2.6875 | 3 |
answers/VanshBaijal/Day 6/Question1.py | arc03/30-DaysOfCode-March-2021 | 22 | 27603 | Candies = [int(x) for x in input("Enter the numbers with space: ").split()]
extraCandies=int(input("Enter the number of extra candies: "))
Output=[ ]
i=0
while(i<len(Candies)):
if(Candies[i]+extraCandies>=max(Candies)):
Output.append("True")
else:
Output.append("False")
i+=1
print(Output)
| 3.859375 | 4 |
i2c/motion_sensor.py | Matrix-Robotics/MatrixControl | 1 | 27604 | class MotionSensor:
"""Get 9Dof data by using MotionSensor.
See [MatrixMotionSensor](https://matrix-robotics.github.io/MatrixMotionSensor/) for more details.
Parameters
----------
i2c_port : int
i2c_port is corresponding with I2C1, I2C2 ... sockets on board.
_dev : class
Matrix... | 2.921875 | 3 |
tests/test_search.py | omaralvarez/trakt.py | 0 | 27605 | <reponame>omaralvarez/trakt.py
from tests.core.helpers import read
from six.moves.urllib_parse import urlparse, parse_qsl
from trakt import Trakt
import responses
def search_callback(request):
url = urlparse(request.url)
query = dict(parse_qsl(url.query))
if 'id' in query and 'id_type' in query:
... | 2.40625 | 2 |
test.py | XiaoyongNI/hybrid-inference | 0 | 27606 | <gh_stars>0
from utils import generic_utils as g_utils
import torch
import evaluation as eval
import torch.nn.functional as F
import losses
from datasets import nclt
from datasets import synthetic
from datasets import lorenz
import numpy as np
from utils import generic_utils as g_utils
import time
def test_kalman(args... | 1.96875 | 2 |
nlt/debug/dataset.py | isabella232/neural-light-transport | 176 | 27607 | <filename>nlt/debug/dataset.py
# Copyright 2020 Google LLC
#
# 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 applicabl... | 2.265625 | 2 |
safirnotification/api.py | byrxiaochun/safir_notification_service | 1 | 27608 | from __future__ import print_function
from flask import Flask
from flask import request
import argparse
import json
import sys
from safirnotification.alarm.alarm_handler import AlarmHandler
from safirnotification.utils import log
from safirnotification.utils.opts import ConfigOpts
LOG = log.get_logger()
Flask.get ... | 2.359375 | 2 |
slack_primitive_cli/command/chat.py | yuji38kwmt/slack-primitive-cli | 0 | 27609 | import logging
import click
import slack_sdk
from slack_primitive_cli.common.utils import TOKEN_ENVVAR, TOKEN_HELP_MESSAGE, set_logger
logger = logging.getLogger(__name__)
@click.command(
name="chat.postMessage", help="Sends a message to a channel. See https://api.slack.com/methods/chat.postMessage "
)
@click.... | 2.453125 | 2 |
codewars/7 kyu/convert-number-to-string.py | sirken/coding-practice | 0 | 27610 | from Test import Test, Test as test
'''
We need a function that can transform a number into a string.
What ways of achieving this do you know?
Examples:
number_to_string(123) /* returns '123' */
number_to_string(999) /* returns '999' */
'''
def number_to_string(num):
return str(num)
test.assert_equals(number_t... | 3.796875 | 4 |
hummingbot/connector/derivative/binance_perpetual/binance_perpetual_utils.py | BGTCapital/hummingbot | 2 | 27611 | <gh_stars>1-10
import os
import socket
from typing import Any, Dict, Optional
import hummingbot.connector.derivative.binance_perpetual.constants as CONSTANTS
from hummingbot.client.config.config_var import ConfigVar
from hummingbot.client.config.config_methods import using_exchange
from hummingbot.core.utils.tracking... | 1.875 | 2 |
Curso Udemy 2022/Curso_Luiz_Otavio/aula_75_ex.py | Matheusfarmaceutico/Exercicios-Python | 0 | 27612 | <reponame>Matheusfarmaceutico/Exercicios-Python
def separador():
print("-="*30)
"""
Considerando duas listas de inteiros ou floats (lista A e lista B)
Some os valores nas listas retornando uma nova lista com os valores somados:
Se uma lista for maior que a outra, a soma só vai considerar o tamanho da
menor.
Exemplo... | 4.21875 | 4 |
Functions_in_Python.py | sichkar-valentyn/Functions_in_Python | 1 | 27613 | <filename>Functions_in_Python.py
# File: Functions_in_Python.py
# Description: Creating functions in Python
# Environment: Spyder IDE in Anaconda environment
#
# MIT License
# Copyright (c) 2018 <NAME>
# github.com/sichkar-valentyn
#
# Reference to:
# [1] <NAME>. Creating functions in Python // GitHub platform [Electro... | 3.984375 | 4 |
jaseci_serv/jaseci_serv/base/admin.py | Gorgeous-Patrick/jaseci | 6 | 27614 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext as _
from jaseci_serv.base import models
class UserAdmin(BaseUserAdmin):
"""
Customized user listing for admin page
"""
ordering = ["time_created"]
list_... | 2.03125 | 2 |
app.py | CoDeRgAnEsh/Rent-flask | 3 | 27615 | <gh_stars>1-10
#!/usr/bin env python
import numpy as np
import pandas as pd
from flask import Flask, abort, jsonify, request
import pickle
# from flask_accept import accept
from flask_cors import CORS
with open('model.pkl', 'rb') as model:
xgb_model = pickle.load(model)
features = ['longitude', 'latitude', 'gym... | 2.4375 | 2 |
deploy.py | NASA-PDS/planetarydata.org | 0 | 27616 | #!/usr/bin/env python
# encoding: utf-8
# Copyright 2014 California Institute of Technology. ALL RIGHTS
# RESERVED. U.S. Government Sponsorship acknowledged.
#
# deploy.py - Deploy the IPDA site into operations
import argparse, sys, logging, os, os.path, re, subprocess, pwd, urllib2, contextlib, tempfile, tarfile, str... | 2.0625 | 2 |
aoc2020/4/d4_2.py | kewbish/ka-algorithms | 0 | 27617 | from re import match
with open("input.txt") as x:
lines = x.read().strip().split("\n\n")
lines = [line.replace("\n", " ") for line in lines]
valid = 0
fields = {
'byr': lambda x: 1920 <= int(x) <= 2002,
'iyr': lambda x: 2010 <= int(x) <= 2020,
'eyr': lambda x: 2020 <= int(x) <= 2030,
... | 3.296875 | 3 |
test_inference.py | ilyes64/DenseNet-TF2 | 0 | 27618 | """Test ImageNet pretrained DenseNet"""
import cv2
import numpy as np
from tensorflow.keras.optimizers import SGD
import tensorflow.keras.backend as K
# We only test DenseNet-121 in this script for demo purpose
from densenet121 import DenseNet
im = cv2.resize(cv2.imread('resources/cat.jpg'), (224, 224)).astype(np.f... | 2.859375 | 3 |
global_id/tests/utils/callers/guid_caller.py | ThePokerFaCcCe/messenger | 0 | 27619 | from django.urls.base import reverse
from rest_framework import status
from global_id.urls import app_name
from core.tests.utils import BaseCaller
from ..creators import create_guid
def guid_detail_url(guid=None):
return reverse(f"{app_name}:guid-detail",
kwargs={'guid': guid or create_guid().... | 2.234375 | 2 |
Neural Network/NNToyFx/python/activations.py | stormy-ua/MachineLearning | 0 | 27620 | <filename>Neural Network/NNToyFx/python/activations.py<gh_stars>0
from simulation import *
def relu(ctx: SimulationContext, x: Connection):
relu1 = ctx.max(x, ctx.variable(0))
return relu1 | 1.945313 | 2 |
dev/umm-exploration-has-calculator.py | fangohr/oommf-python | 7 | 27621 | <reponame>fangohr/oommf-python<filename>dev/umm-exploration-has-calculator.py
class MicromagneticModell:
def __init__(self, name, Ms, calc):
self.name = name
self.Ms = Ms
self.field = None
self.calc = calc
def __str__(self):
return "AbstractMicromagneticModell(name={})".... | 3.015625 | 3 |
Tools/Converters/tetgen2ply.py | dbungert/opensurgsim | 24 | 27622 | <gh_stars>10-100
#!/usr/bin/python
# This file is a part of the OpenSurgSim project.
# Copyright 2012-2015, SimQuest Solutions 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
#
# ht... | 2.4375 | 2 |
movie/App/forms/user.py | caoluyang8/movie | 0 | 27623 | from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from flask_wtf.file import FileAllowed,FileRequired,FileField
from wtforms.validators import DataRequired,Length,EqualTo,Email,ValidationError
from App.models import User
from App.extensions import file
class Regist... | 2.53125 | 3 |
doc/source/user/examples/cleanup-servers.py | noironetworks/shade | 96 | 27624 | <reponame>noironetworks/shade<gh_stars>10-100
import shade
# Initialize and turn on debug logging
shade.simple_logging(debug=True)
for cloud_name, region_name in [
('my-vexxhost', 'ca-ymq-1'),
('my-citycloud', 'Buf1'),
('my-internap', 'ams01')]:
# Initialize cloud
cloud = shade.opensta... | 1.984375 | 2 |
abacus_tpot/tpot_config.py | workforce-data-initiative/tpot-abacus | 1 | 27625 | # eventually we will have a proper config
ANONYMIZATION_THRESHOLD = 10
WAREHOUSE_URI = 'postgres://localhost'
WAGE_RECORD_URI = 'postgres://localhost'
| 1.078125 | 1 |
tileServer/scripts/exportZoomLevels.py | greenhalos/tile-server | 0 | 27626 | <gh_stars>0
#!/usr/bin/env python3
import json
import yaml
result = {}
with open('app/static/greenhalos-style.json') as json_file:
data = json.load(json_file)
for layer in data['layers']:
if 'source-layer' in layer:
minzoom = layer.get('minzoom', 0)
maxzoom = layer.get('maxzoo... | 2.6875 | 3 |
formats/dcc_parser.py | C3RV1/LaytonEditor | 6 | 27627 | # Data and Code Container (DCC) format by Cervi
import typing
def is_int(var):
try:
int(var)
return True
except ValueError:
return False
def is_float(var):
try:
float(var)
return True
except ValueError:
return False
def is_hex(var):
try:
... | 2.78125 | 3 |
flock/__init__.py | fishface60/python-flock | 0 | 27628 | <reponame>fishface60/python-flock
#!/usr/bin/python
# Copyright (c) 2015, <NAME>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS P... | 2.234375 | 2 |
uqtie/UqtStylesheet.py | langrind/UQtie | 0 | 27629 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Class that manages a UQtie application's stylesheet
There are advantages and disadvantages to Qt stylesheets, Qt settings, and
Qt Style. They aren't mutually exclusive, and they don't all play together
either.
This module attempts to make it possible to use a stylesheet w... | 2.9375 | 3 |
clickmodel-experiments/scripts/model/ClickModelExperiment.py | nut-hatch/LOVBench | 0 | 27630 | <filename>clickmodel-experiments/scripts/model/ClickModelExperiment.py
__author__ = 'Anonymous'
import time
import csv
import os.path
import pyclick
from pyclick.utils.YandexRelPredChallengeParser import YandexRelPredChallengeParser
from pyclick.utils.Utils import Utils
from pyclick.click_models.Evaluation import Log... | 2.34375 | 2 |
archive/2016/week5/homework/even.py | YAtOff/python0 | 6 | 27631 | <filename>archive/2016/week5/homework/even.py
"""
Дефинирайте фуннкция `is_even`, която приема число и върща `True` ако числото е
четно и `False` в противен случай.
>>> is_even(4)
True
>>> is_even(5)
False
"""
def is_even(number):
raise Exception('Not implemented')
| 3.484375 | 3 |
piws/views/actions.py | neurospin/piws | 0 | 27632 | ##########################################################################
# NSAp - Copyright (C) CEA, 2013
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########... | 1.664063 | 2 |
events/migrations/0043_remove_premium_restrictions.py | alysivji/GetTogether | 446 | 27633 | # Generated by Django 2.0 on 2018-08-25 14:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("events", "0042_allow_team_without_country")]
operations = [
migrations.RemoveField(model_name="team", name="is_premium"),
migrations.RemoveField(model_name... | 1.484375 | 1 |
examples/Utopia2_planning_single_node_DN/tutorial2.py | AAmedeo/Hypatia | 5 | 27634 | from hypatia import Model,Plotter
#%%
utopia = Model(
path = 'sets',
mode = 'Planning'
)
#%%
#utopia.create_data_excels(
# path = r'parameters'
#)
#%%
utopia.read_input_data(
path = r'parameters'
)
#%%
utopia.run(
solver = 'scipy',
verbosity = True,
)
#%%
utopia.to_csv(path='results')
#%%
#uto... | 2.5 | 2 |
test/com/facebook/buck/parser/testdata/disable_implicit_native_rules/skylark/implicit_in_extension_bzl/extension.bzl | Unknoob/buck | 8,027 | 27635 | <filename>test/com/facebook/buck/parser/testdata/disable_implicit_native_rules/skylark/implicit_in_extension_bzl/extension.bzl
""" Example module """
def java_maker(*args, **kwargs):
""" Make you a java """
java_library(*args, **kwargs)
| 1.382813 | 1 |
backend/config/settings/base.py | r0tii/process-status-viewer | 0 | 27636 | <gh_stars>0
"""
Base settings to build other settings files upon.
"""
from pathlib import Path
import environ
env = environ.Env()
# GENERAL
# -------------------------------------------------------------------------
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
PROJECT_NAME = "process_status_m... | 1.601563 | 2 |
virtual_agent.py | kavimathi26-2001/virtual-agent-built. | 23 | 27637 | <reponame>kavimathi26-2001/virtual-agent-built.
#import all the libraries required
import csv, pickle, numpy as np, os
from sentence_transformers import SentenceTransformer, util
#Virtual Agent Model
class VAModel():
def __init__(self):
self.model = SentenceTransformer("stsb-mpnet-base-v2") #load pretrained... | 2.578125 | 3 |
hyperloglog/hashfunctions.py | mlkra/various-algorithms | 2 | 27638 | from typing import Callable
import hashlib
import zlib
def __common(n: int, h: Callable, digest_size: int, b=0) -> float:
assert b <= digest_size
if b == 0:
return int.from_bytes(h(n.to_bytes(8, "big")).digest(), 'big') / 2**digest_size
else:
return (int.from_bytes(h(n.to_bytes(8, "big")).... | 2.46875 | 2 |
data_loaders/data_loader_interface.py | jennis0/pdf2vtt | 0 | 27639 | import abc
from typing import List
from utils.datatypes import Source
class DataLoaderInterface(object):
@abc.abstractmethod
def get_name() -> str:
'''Returns an internal name for this loader'''
raise NotImplementedError("users must define a name for this loader")
@staticmethod
@abc.... | 3.109375 | 3 |
Learn/30-Days-Of-Code/Day 28/regexdb.py | Adriel-M/HackerRank | 1 | 27640 | <filename>Learn/30-Days-Of-Code/Day 28/regexdb.py
N = int(input().strip())
names = []
for _ in range(N):
name,email = input().strip().split(' ')
name,email = [str(name),str(email)]
if email.endswith("@<EMAIL>"):
names.append(name)
names.sort()
for n in names:
print(n)
| 3.90625 | 4 |
dbglang/dbp.py | thautwarm/dbg-lang | 1 | 27641 | from Ruikowa.ObjectRegex.Node import Ref, AstParser, SeqParser, LiteralParser, CharParser, MetaInfo, DependentAstParser
try:
from .etoken import token
except:
from etoken import token
import re
namespace = globals()
recurSearcher = set()
PrimaryDefList = AstParser([Ref('FieldDef'), SeqParser([LiteralParser(',... | 2.03125 | 2 |
App/components/combEntrada.py | Alexfm101/automata | 0 | 27642 | import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
data_edoSiguiente = [[1, 2, 3, 4],[1, 2, 3, 4],[1, 2, 3, 4],[1, 2, 3, 4],
[1, 2, 3, 4],[1, 2, 3, 4],[1, 2, 3, 4],[1, 2, 3, 4],
[1, 2, 3, 4],[1, 2, 3, 4],[1, 2, 3, 4],[1, 2, 3, 4],
[1, 2, 3, 4],[1... | 2.28125 | 2 |
pythonAlgorithm/datastrcture/Kth Smallest Number in Sorted Matrix.py | Sky-zzt/lintcodePractice | 1 | 27643 | import heapq
class Solution:
"""
@param matrix: a matrix of integers
@param k: An integer
@return: the kth smallest number in the matrix
在一个排序矩阵中找从小到大的第 k 个整数。
排序矩阵的定义为:每一行递增,每一列也递增。
Example
样例 1:
输入:
[
[1 ,5 ,7],
[3 ,7 ,8],
[4 ,8 ,9],
]
k = 4
输出: 5
... | 3.59375 | 4 |
thriftpy2/contrib/aio/transport/framed.py | JonnoFTW/thriftpy2 | 5,079 | 27644 | <filename>thriftpy2/contrib/aio/transport/framed.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import struct
import asyncio
from io import BytesIO
from .base import TAsyncTransportBase, readall
from .buffered import TAsyncBufferedTransport
class TAsyncFramedTransport(TAsyncTransportBase):
"... | 2.40625 | 2 |
test/test-funders.py | yurivict/habanero | 0 | 27645 | <filename>test/test-funders.py
import pytest
import os
import requests
from habanero import exceptions, Crossref
from requests.exceptions import HTTPError
cr = Crossref()
@pytest.mark.vcr
def test_funders():
"funders - basic test"
res = cr.funders(limit=2)
assert dict == res.__class__
assert dict == ... | 2.28125 | 2 |
geomagio/api/ws/algorithms.py | alejandrodelcampillo/geomag-algorithms | 1 | 27646 | <gh_stars>1-10
from fastapi import APIRouter, Depends
from starlette.responses import Response
from ... import TimeseriesFactory
from ...algorithm import DbDtAlgorithm
from .DataApiQuery import DataApiQuery
from .data import format_timeseries, get_data_factory, get_data_query, get_timeseries
router = APIRouter()
@... | 2.40625 | 2 |
lesson3/stage3/src/jvm/udacity/storm/resources/urltext.py | haitanle/storm-twitter | 0 | 27647 | <reponame>haitanle/storm-twitter<gh_stars>0
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, ... | 2.234375 | 2 |
ncl/property.py | MichaelBittencourt/NCL-Generator-API | 1 | 27648 | <filename>ncl/property.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
"""
from ncl.abstractelement import AbstractElement
class Property(AbstractElement):
def __init__(self, name, value=None, externable... | 2.140625 | 2 |
DSTK/Timeseries/recurrence_plots.py | jotterbach/dstk | 12 | 27649 | import _recurrence_map
import numpy as np
def poincare_map(ts, ts2=None, threshold=0.1):
rec_dist = poincare_recurrence_dist(ts, ts2)
return (rec_dist < threshold).astype(int)
def poincare_recurrence_dist(ts, ts2=None):
if ts2 is None:
return _recurrence_map.recurrence_map(ts, ts)
else:
... | 2.9375 | 3 |
preprocess.py | costagreg/mnist-handwritten-ml | 0 | 27650 | import cv2
import math
import numpy as np
import os
import matplotlib.pyplot as plt
from scipy import ndimage
from utils import ValueInvert
# TO-DO: Refactor this with np.nonzero??
def find_center_image(img):
left = 0
right = img.shape[1] - 1
empty_left = True
empty_right = True
for col in rang... | 2.671875 | 3 |
buffer.py | Shahaf-Yamin/CartPole-Policy-Gradients | 0 | 27651 | import numpy as np
from collections import namedtuple, deque
import random
Transition = namedtuple('Transition', ('state', 'action', 'next_state', 'reward', 'not_done'))
class ReplayBuffer(object):
def __init__(self, capacity):
self.memory = deque([], maxlen=capacity)
def push(self, *ar... | 2.609375 | 3 |
benchmarks/secure_data_SDK-benchmarks/bootloader/load_firmware.py | ghsecuritylab/BenchIoT | 22 | 27652 |
from struct import pack, unpack
import binascii
import socket
HOST = '192.168.0.10'
PORT = 1337
BUFF_SIZE = 1024
START_TOKEN = "init"
DONE_TOKEN = "<PASSWORD>"
FAIL_TOKEN = "<PASSWORD>"
def create_test_application(load_addr=0x08002000, size=64*1024):
'''
Creates a test application that simply return... | 2.46875 | 2 |
time/humanize_time.py | liudmil-mitev/experiments | 1 | 27653 | <filename>time/humanize_time.py
#!/usr/bin/env python
INTERVALS = [1, 60, 3600, 86400, 604800, 2419200, 29030400]
NAMES = [('second', 'seconds'),
('minute', 'minutes'),
('hour', 'hours'),
('day', 'days'),
('week', 'weeks'),
('month', 'months'),
('year', '... | 3.796875 | 4 |
fauxfactory/__init__.py | sthirugn/fauxfactory | 0 | 27654 | <filename>fauxfactory/__init__.py
# -*- coding: utf-8 -*-
"""Generate random data for your tests."""
__all__ = (
'gen_alpha',
'gen_alphanumeric',
'gen_boolean',
'gen_choice',
'gen_cjk',
'gen_cyrillic',
'gen_date',
'gen_datetime',
'gen_email',
'gen_html',
'gen_integer',
'... | 2.5 | 2 |
eda.py | justinhchae/app_courts | 4 | 27655 | <gh_stars>1-10
import gc
import pandas as pd
from application.application import Application
from clean_data.maker import Maker
from do_data.config import Columns
from do_data.getter import Reader
from do_data.joiner import Joiner
from do_data.writer import Writer
from do_data.config import Columns
from analyze_data.... | 2.1875 | 2 |
retrieval/hybrid/__init__.py | park-sungmoo/odqa_baseline_code | 67 | 27656 | <gh_stars>10-100
from retrieval.hybrid.hybrid_base import HybridRetrieval, HybridLogisticRetrieval
from retrieval.hybrid.hybrid import TfidfDprBert, AtireBm25DprBert, LogisticTfidfDprBert, LogisticAtireBm25DprBert
| 1.03125 | 1 |
upper_print.py | DazEB2/SimplePyScripts | 117 | 27657 | <reponame>DazEB2/SimplePyScripts<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def upper_print(f):
def wrapper(*args, **kwargs):
f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs)
return wrapper
if __name__ == '__main__':
text = 'hel... | 3.34375 | 3 |
odxtools/units.py | floroks/odxtools | 0 | 27658 | # SPDX-License-Identifier: MIT
# Copyright (c) 2022 MBition GmbH
from dataclasses import dataclass, field
from typing import List, Literal, Optional
from .nameditemlist import NamedItemList
from .utils import read_description_from_odx
UnitGroupCategory = Literal["COUNTRY", "EQUIV-UNITS"]
@dataclass
class PhysicalD... | 3.359375 | 3 |
AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_ttk_textonly.py | CEOALT1/RefindPlusUDK | 2,757 | 27659 | import os
from test import test_support
# Skip this test if _tkinter does not exist.
test_support.import_module('_tkinter')
this_dir = os.path.dirname(os.path.abspath(__file__))
lib_tk_test = os.path.abspath(os.path.join(this_dir, '..', 'lib-tk', 'test'))
with test_support.DirsOnSysPath(lib_tk_test):
i... | 2.234375 | 2 |
app/auth/forms.py | dancan-sandys/Becky_pizza | 0 | 27660 | from flask_wtf import FlaskForm
from wtforms import StringField,BooleanField,PasswordField,SubmitField
from wtforms.validators import Email,Required,EqualTo
from wtforms import ValidationError
from ..models import User
class LoginForm(FlaskForm):
email = StringField("enter your email adress",validators = [Require... | 3.140625 | 3 |
tests/check_predictions.py | WGierke/informatiCup2018 | 0 | 27661 | if __name__ == '__main__':
# Check correct price prediction
price_input_path = 'tests/data/Price_Simple.csv'
price_input = open(price_input_path, 'r').read().splitlines()[0].split(';')
price_prediction = open('price_prediction.csv', 'r').read().splitlines()[0].split(';')
assert price_input == price_... | 3.03125 | 3 |
src/ralph_assets/tests/unit/test_rest_asset_info_per_rack.py | quamilek/ralph_assets | 0 | 27662 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
from django.contrib.auth.models import User
from django.test import TestCase
from rest_framework.test import APIClient
... | 1.898438 | 2 |
ovs/extensions/db/arakoon/arakoon/ArakoonManagement.py | mflu/openvstorage_centos | 1 | 27663 | """
Copyright (2010-2014) INCUBAID BVBA
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, so... | 1.828125 | 2 |
setup.py | THUIR/click_model_for_mobile_search | 10 | 27664 | <gh_stars>1-10
from distutils.core import setup
import glob
from setuptools import setup
def read_md(file_name):
try:
from pypandoc import convert
return convert(file_name, 'rest')
except:
return ''
setup(
name='clickmodels',
version='2.0.0',
author='<NAME>',
packages=... | 1.796875 | 2 |
scripts/extract_user_sudo_privileges.py | worr/sysops-api | 40 | 27665 | #!/usr/bin/python2.6
# (c) [2013] LinkedIn Corp. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable ... | 2.28125 | 2 |
lbworkflow/tests/purchase/models.py | wearypossum4770/django-lb-workflow | 194 | 27666 | from django.db import models
from lbworkflow.models import BaseWFObj
class Purchase(BaseWFObj):
title = models.CharField("Title", max_length=255)
reason = models.CharField("Reason", max_length=255)
def __str__(self):
return self.reason
class Item(models.Model):
purchase = models.ForeignKey... | 2.28125 | 2 |
interface/python/test.py | gaubert/nessDB | 1 | 27667 | <reponame>gaubert/nessDB
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author : KDr2
# BohuTANG @2012
#
import sys
import random
import string
import time
import nessdb
def gen_random_str(len):
return ''.join([random.choice('abcdefghijklmnoprstuvwyxzABCDEFGHIJKLMNOPRSTUVWXYZ') for i in range(len)])
def ness_open(db... | 2.359375 | 2 |
tests/extensions/openapi/test_external_docs.py | JonarsLi/sanic-ext | 14 | 27668 | from sanic import Request, Sanic
from sanic.response import text
from sanic_ext import openapi
from sanic_ext.extensions.openapi.definitions import ExternalDocumentation
from utils import get_spec
def test_external_docs(app: Sanic):
@app.route("/test0")
@openapi.document("http://example.com/more", "Find more... | 2.171875 | 2 |
cube2/server.py | bobssup/kripken | 892 | 27669 | <gh_stars>100-1000
#!/usr/bin/env python
'''
Sets up websocket server support to run the server in one HTML page and the client in another HTML page. Each connects to a websocket server, which we relay together, so the two pages think they are connected to each other (see websocket_bi tests in emscripten).
Instructio... | 2.984375 | 3 |
apps/api/modules/bkdata_aiops.py | qqqqqie/bk-log | 75 | 27670 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... | 1.25 | 1 |
inverse_test.py | Sangbaek/clas12-nflows | 0 | 27671 | <gh_stars>0
import pickle
import matplotlib.pyplot as plt
import matplotlib as mpl
#mpl.use('pdf')
import itertools
import numpy as np
from datetime import datetime
import torch
from torch import nn
from torch import optim
import os
import sys
import pandas as pd
from utils.utilities import meter
from utils import mak... | 1.984375 | 2 |
pytket/pytket/passes/script.py | NewGitter2017/tket | 0 | 27672 | <reponame>NewGitter2017/tket
# Copyright 2019-2021 Cambridge Quantum Computing
#
# 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 re... | 1.539063 | 2 |
terrascript/data/nomad.py | amlodzianowski/python-terrascript | 0 | 27673 | <filename>terrascript/data/nomad.py
# terrascript/data/nomad.py
import terrascript
class nomad_acl_policy(terrascript.Data):
pass
class nomad_acl_token(terrascript.Data):
pass
class nomad_deployments(terrascript.Data):
pass
class nomad_job(terrascript.Data):
pass
class nomad_namespaces(terras... | 1.65625 | 2 |
features/environment.py | mfuhrmann/meshping | 17 | 27674 | <gh_stars>10-100
import json
import threading
from http.server import HTTPServer, BaseHTTPRequestHandler
def before_all(context):
context.peer_queue = None
class DummyPeeringHandler(BaseHTTPRequestHandler):
def do_POST(self):
content_length = int(self.headers['Content-Length'])
... | 2.484375 | 2 |
Modulo 02/exercicios/d041.py | euyag/python-cursoemvideo | 2 | 27675 | print('===== DESAFIO 041 =====')
nascimento = int(input('Digite o ano q vc nasceu: '))
idade = 2021 - nascimento
print(f'vc tem {idade} anos')
if idade <= 9:
print('vc é um nadador mirim')
elif idade > 9 and idade <= 14:
print('vc é um nadador infantil')
elif idade > 14 and idade <= 19:
print('vc é um na... | 4 | 4 |
project/settings/prod/cors.py | danielbraga/hcap | 0 | 27676 | """
django:
https://docs.djangoproject.com/en/3.0/ref/settings/#allowed-hosts
"""
from ..env import env
ALLOWED_HOSTS = env("HCAP__ALLOWED_HOSTS", default=[])
| 1.304688 | 1 |
nt_m.py | kwj1399/ryu_app | 0 | 27677 | '''
FileName:
Author:KWJ(kyson)
UpdateTime:2016/10/10
Introduction:
'''
from __future__ import division
import copy
from operator import attrgetter
from ryu.base import app_manager
from ryu.base.app_manager import lookup_service_brick
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER, DEAD_DISPATC... | 1.929688 | 2 |
euler_01.py | zhou-le/euler | 2 | 27678 | #coding: utf-8
#date: 2018/7/30 19:07
#author: zhou_le
# 求1000以下3和5的倍数之和
print(sum([i for i in range(1000) if i % 3 == 0 or i % 5 == 0])) | 3.625 | 4 |
pandas/_testing/_hypothesis.py | dycloud-chan/pandas | 1 | 27679 | """
Hypothesis data generator helpers.
"""
from datetime import datetime
from hypothesis import strategies as st
from hypothesis.extra.dateutil import timezones as dateutil_timezones
from hypothesis.extra.pytz import timezones as pytz_timezones
from pandas.compat import is_platform_windows
import pandas as pd
from ... | 2.328125 | 2 |
export_readiness/migrations/0058_auto_20190912_1326.py | uktrade/directory-cms | 6 | 27680 | <reponame>uktrade/directory-cms<filename>export_readiness/migrations/0058_auto_20190912_1326.py
# Generated by Django 2.2.4 on 2019-09-12 13:26
from django.db import migrations
INDUSTRY_NAMES = (
'Advanced manufacturing',
'Aerospace',
'Agri-technology',
'Automotive',
'Biotechnology',
'Cleante... | 1.789063 | 2 |
bakery_cli/utils.py | lowks/fontbakery-cli | 1 | 27681 | # coding: utf-8
# Copyright 2013 The Font Bakery 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 re... | 2.0625 | 2 |
src/spaczz/regex/__init__.py | brunobg/spaczz | 153 | 27682 | <reponame>brunobg/spaczz
"""Module for regex components."""
from .regexconfig import RegexConfig
__all__ = ["RegexConfig"]
| 1.171875 | 1 |
imagetagger/imagetagger/annotations/migrations/0006_auto_20170826_1431.py | jbargu/imagetagger | 212 | 27683 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-26 12:31
from __future__ import unicode_literals
import json
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('annotations', '0005_auto_20170826_1424'),
... | 2.203125 | 2 |
process_csv.py | Blue9/llvm-pass-skeleton | 0 | 27684 | import os
import statistics
import sys
def get_mean_std(out_csv):
with open(out_csv) as f:
lines = f.readlines()
tests = dict()
for t in lines[1:]:
t = t.split(",")
test_name = t[0].strip()
opt = float(t[2].strip())
tests[test_name] = tests.get(test_name, list()) + [... | 3.078125 | 3 |
run_cnn.py | tlkh/mini-dlperf | 0 | 27685 | <gh_stars>0
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--rn152", action="store_true", default=False,
help="Train a larger ResNet-152 model instead of ResNet-50")
parser.add_argument("--rn50v2", action="store_true", default=False,
help="Train ResNet-50... | 2.21875 | 2 |
containers/forms.py | timothyjlaurent/shipyard | 1 | 27686 | # Copyright <NAME> and contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 2.03125 | 2 |
2020/01-1.py | matteodelabre/advent-of-code | 1 | 27687 | <filename>2020/01-1.py<gh_stars>1-10
rows = []
try:
while True:
rows.append(int(input()))
except EOFError:
pass
rows.sort()
goal = 2020
l = 0
r = len(rows) - 1
while rows[l] + rows[r] != goal and l < r:
if rows[l] + rows[r] < goal:
l += 1
else:
r -= 1
if rows[l] + rows[r] ==... | 3.109375 | 3 |
castadmin/urls.py | flyinactor91/Rocky-Rollcall | 2 | 27688 | <reponame>flyinactor91/Rocky-Rollcall
"""
Cast admin URL patterns
"""
from django.urls import path
from . import views
_s = '<slug:slug>/'
urlpatterns = [
path(_s, views.cast_admin, name='cast_admin'),
path(_s+'section/new/', views.section_new, name='cast_section_new'),
path(_s+'section/<int:pk>/edit/', ... | 2.265625 | 2 |
asn1tools/version.py | eerimoq/asn1tools | 198 | 27689 | __version__ = '0.159.0'
| 1.0625 | 1 |
tags/ctx.py | NoUMelon/phen-cogs | 1 | 27690 | from redbot.core.commands import Context
class SilentContext(Context):
async def send(self, content: str = None, **kwargs):
pass
| 1.34375 | 1 |
Liver_segmentation/find_and_delete_empty_images.py | 6895mahfuzgit/PyTorch-and-Monai-for-AI-Healthcare-Imaging- | 0 | 27691 | <reponame>6895mahfuzgit/PyTorch-and-Monai-for-AI-Healthcare-Imaging-<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 17 21:33:56 2022
@author: mahfuz
"""
from glob import glob
import nibabel as nif
import numpy as np
input_path_lables = r'C:\Users\mahfu\Desktop\Codes\nifiti_files\lables\*'
imput_labels = ... | 2.25 | 2 |
pax/tasks/tasks/classification.py | epfml/pax | 3 | 27692 | <filename>pax/tasks/tasks/classification.py
from typing import Mapping
import pax.tasks.registry as registry
import regex as re
import torch
from pax.tasks.datasets.api import Batch
from pax.tasks.models.api import Buffers, Model, Params, Tuple
from pax.tasks.tasks.api import Task
DEFAULT_DEVICE = torch.device("cuda... | 2.265625 | 2 |
python/ex103_validacao_dados.py | lucasdiogomartins/curso-em-video | 0 | 27693 | def mostrar(n='', g=''):
if n == '':
n = '<desconhecido>'
if not g.isnumeric():
g = 0
return f'O jogador {n} fez {g} gol(s) no campeonato'
# Main
nome = input('Nome do Jogador: ').title()
gols = input('Número de Gols: ')
print(mostrar(nome, gols))
| 3.78125 | 4 |
tests/integration/boxscore/test_ncaab_boxscore.py | MArtinherz/sportsipy | 221 | 27694 | <reponame>MArtinherz/sportsipy<filename>tests/integration/boxscore/test_ncaab_boxscore.py<gh_stars>100-1000
import mock
import os
import pandas as pd
from datetime import datetime
from flexmock import flexmock
from sportsipy import utils
from sportsipy.constants import HOME
from sportsipy.ncaab.constants import BOXSCOR... | 2.375 | 2 |
tests/test_elasticsearch.py | ankane/python-timeouts | 6 | 27695 | <gh_stars>1-10
from .conftest import TestTimeouts
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import ConnectionError
class TestElasticsearch(TestTimeouts):
def test_connect(self):
with self.raises(ConnectionError):
Elasticsearch([self.connect_url()], timeout=1).cluste... | 2.453125 | 2 |
mediasync/management/commands/syncmedia.py | kennethreitz-archive/django-mediasync | 2 | 27696 | <gh_stars>1-10
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from mediasync.conf import msettings
import mediasync
import time
class Command(BaseCommand):
help = "Sync local media with remote client"
args = '[options]'
requires_model_validation... | 2.1875 | 2 |
coptim/functions/rosenbrock.py | cmazzaanthony/Optimization_Algorithms | 3 | 27697 | <reponame>cmazzaanthony/Optimization_Algorithms
import numpy as np
from coptim.function import Function
class Rosenbrock(Function):
def eval(self, x):
assert len(x) == 2, '2 dimensional input only.'
return 100 * (x[1] - x[0] ** 2) ** 2 + (1 - x[0]) ** 2
def gradient(self, x):
assert ... | 3.046875 | 3 |
http-server.py | itamaro/python-http | 0 | 27698 | #!/usr/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
from os import curdir, sep
PORT_NUMBER = 8080
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','image/png')
self.end_headers()
with o... | 3.0625 | 3 |
lahja/tools/benchmark/typing.py | vaporyproject/lahja | 0 | 27699 | from typing import (
NamedTuple,
)
from lahja import (
BaseEvent,
)
class RawMeasureEntry(NamedTuple):
sent_at: float
received_at: float
class CrunchedMeasureEntry(NamedTuple):
sent_at: float
received_at: float
duration: float
class PerfMeasureEvent(BaseEvent):
def __init__(self,... | 2.3125 | 2 |