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 |
|---|---|---|---|---|---|---|
idManager/view/authentication_view.py | lgarciasbr/idm-api | 2 | 19400 | <filename>idManager/view/authentication_view.py
from flask import jsonify
def auth_login(http_status_code, message, token):
view = jsonify({'status_code': http_status_code, 'message': message, '_token': token})
return view
def auth_is_valid(http_status_code, message, token):
view = jsonify({'status_cod... | 2.40625 | 2 |
setup.py | TheSriram/deuce | 0 | 19401 | <reponame>TheSriram/deuce
# -*- coding: utf-8 -*-
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
REQUIRES = ['six', 'pecan', 'setuptools >= 1.1.6',
'cassandra-driver', 'pymongo']
... | 1.34375 | 1 |
script.py | rahulkmr1/heroku-python-script | 0 | 19402 | import telepot
import time
import requests
from bs4 import BeautifulSoup as bs
import cPickle
import csv
RAHUL_ID = 931906767
# You can leave this bit out if you're using a paid PythonAnywhere account
# proxy_url = "http://proxy.server:3128"
# telepot.api._pools = {
# 'default': urllib3.ProxyManager(proxy_url=pro... | 2.28125 | 2 |
examples/4-tensorflow-mnist/tensorflow_mnist/train.py | awcchungster/baklava | 3 | 19403 | """
Train
=====
Defines functions which train models and write model artifacts to disk.
"""
from __future__ import print_function
import os
import tempfile
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow_mnist import model, paths
def train(path):
"""
Train... | 3.640625 | 4 |
google/cloud/binaryauthorization/v1/binaryauthorization-v1-py/google/cloud/binaryauthorization_v1/types/resources.py | googleapis/googleapis-gen | 7 | 19404 | # -*- coding: utf-8 -*-
# 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 applicable law or... | 1.445313 | 1 |
builtinPlugins/plugin_spending.py | jscherer26/Icarra | 1 | 19405 | <gh_stars>1-10
# Copyright (c) 2006-2010, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list o... | 1.445313 | 1 |
pyro_examples/dpgmm_full.py | hanyas/pyro_examples | 1 | 19406 | <reponame>hanyas/pyro_examples
import torch
from torch.distributions import Gamma
import torch.nn.functional as F
import matplotlib.pyplot as plt
from tqdm import tqdm
from pyro.distributions import *
import pyro
from pyro.optim import Adam
from pyro.infer import SVI, Trace_ELBO, Predictive
assert pyro.__version__... | 2.28125 | 2 |
calplus/tests/unit/v1/test_utils.py | nghiadt16/CALplus | 0 | 19407 | <reponame>nghiadt16/CALplus
from calplus.tests import base
from calplus.v1 import utils
class TestUtils(base.TestCase):
"""docstring for TestUtils"""
def setUp(self):
super(TestUtils, self).setUp()
def test_get_all_driver(self):
drivers = utils.get_all_driver()
self.assertEqual(... | 2.25 | 2 |
luna_pathology/cli/load_slide.py | msk-mind-apps/luna-pathology | 0 | 19408 |
# General imports
import os, json, logging
import click
from pathlib import Path
import yaml
# From common
from luna_core.common.custom_logger import init_logger
from luna_core.common.DataStore import DataStore_v2
from luna_core.common.Node import Node
from luna_core.common.config import C... | 2.09375 | 2 |
classifiers/CornerDetector.py | Vivek2018/OSM_Building-Detection-Custom-Repo | 0 | 19409 | import numpy as np
import cv2
from matplotlib import pyplot as plt
image = cv2.imread('champaigneditedcompressed.png')
kernel = np.ones((20, 20), np.float32) / 25
img = cv2.filter2D(image, -1, kernel)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
corners = cv2.goodFeaturesToTrack(gray,10,0.01,10)
corners = np.int0(cor... | 3.390625 | 3 |
ECUSimulation/io_processing/surveillance_handler.py | arturmrowca/IVNS | 0 | 19410 | '''
Created on 12 Jun, 2015
@author: artur.mrowca
'''
from enum import Enum
from PyQt5.Qt import QObject
from PyQt5 import QtCore
from tools.ecu_logging import ECULogger
import copy
class AbstractInputHandler(QObject):
publish_infos_sig = QtCore.pyqtSignal(list)
def __init__(self):
... | 2.203125 | 2 |
breadp/checks/pid.py | tgweber/breadp | 0 | 19411 | ################################################################################
# Copyright: <NAME> 2019
#
# Apache 2.0 License
#
# This file contains all code related to pid check objects
#
################################################################################
import re
import requests
from breadp.checks ... | 2.4375 | 2 |
tests/infrastructure/persistence/test_holiday_dynamo_repository.py | gabrielleandro0801/holidays-importer | 0 | 19412 | from unittest import TestCase
from src.domain.holiday import Holiday
import src.infrastructure.persistence.holiday_dynamo_repository as repository
HOLIDAY = Holiday(
date='2021-12-25',
name='Natal',
category='NATIONAL'
)
class TestHolidayDynamoRepository(TestCase):
def test_holiday_must_be_dict_when... | 2.78125 | 3 |
src/models/Models.py | nbrutti/uol-export | 0 | 19413 | <filename>src/models/Models.py
from config.defs import *
import peewee
db = peewee.SqliteDatabase(DATABASE_NAME)
class BaseModel(peewee.Model):
class Meta:
database = db
class Partida(BaseModel):
id_time_casa = peewee.CharField()
id_time_visitante = peewee.CharField()
time_casa = peewee.CharField()
tim... | 2.5 | 2 |
stubs.min/System/Windows/Media/Animation_parts/AnimationException.py | ricardyn/ironpython-stubs | 1 | 19414 | <reponame>ricardyn/ironpython-stubs
class AnimationException(SystemException,ISerializable,_Exception):
""" The exception that is thrown when an error occurs while animating a property. """
def add_SerializeObjectState(self,*args):
""" add_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializatio... | 2.234375 | 2 |
quantnn/__init__.py | simonpf/qrnn | 0 | 19415 | <filename>quantnn/__init__.py
r"""
=======
quantnn
=======
The quantnn package provides functionality for probabilistic modeling and prediction
using deep neural networks.
The two main features of the quantnn package are implemented by the
:py:class:`~quantnn.qrnn.QRNN` and :py:class:`~quantnn.qrnn.DRNN` classes, whi... | 2.453125 | 2 |
habitat_baselines/motion_planning/robot_target.py | srama2512/habitat-api | 355 | 19416 | <filename>habitat_baselines/motion_planning/robot_target.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import attr
import magnum as mn
import numpy as np
@attr.s... | 2.328125 | 2 |
leetcode/445.Add_Two_Numbers_II/python/add_two_numbers_v1.py | realXuJiang/research_algorithms | 1 | 19417 | <filename>leetcode/445.Add_Two_Numbers_II/python/add_two_numbers_v1.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class TwoNumbers(object):
@staticmethod
def builderListNode(nums):
if nums is not None:
... | 3.828125 | 4 |
recsys/util/feature_helper.py | manazhao/tf_recsys | 1 | 19418 | import logging
import tensorflow as tf
import recsys.util.proto.config_pb2 as config
def int64_feature(val):
return tf.train.Feature(int64_list = tf.train.Int64List(value=[val]))
def int64_list_feature(val_list):
return tf.train.Feature(int64_list = tf.train.Int64List(value=val_list))
def bytes_feature(val):... | 2.53125 | 3 |
components/handlers/star_modules.py | nus-mtp/another-cs-study-planner | 1 | 19419 | '''
This module handles starring of modules.
'''
import web
from app import RENDER
from components import model, session
class StarModule(object):
'''
Class handles starring and unstarring of modules.
'''
def GET(self):
'''
This function is called when /starModule is acce... | 2.71875 | 3 |
src/features/smarterdb.py | cnr-ibba/SMARTER-database | 0 | 19420 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 16:21:35 2021
@author: <NAME> <<EMAIL>>
"""
import os
import logging
import pathlib
import pycountry
import mongoengine
from enum import Enum
from typing import Union
from pymongo import database, ReturnDocument
from dotenv import find_dotenv,... | 2.265625 | 2 |
test/utils/multi_objective/test_box_decomposition.py | SamuelMarks/botorch | 2 | 19421 | #! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import torch
from botorch.exceptions.errors import BotorchError, BotorchTensorDime... | 2.03125 | 2 |
tests/pyupgrade_test.py | sloria/pyupgrade | 0 | 19422 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import ast
import sys
import pytest
from pyupgrade import _fix_dict_set
from pyupgrade import _fix_escape_sequences
from pyupgrade import _fix_format_literals
from pyupgrade import _fix_fstrings
from py... | 2.1875 | 2 |
Preprocessing/preprocessing.py | nadineazhalia/CSH4H3-TEXT-MINING | 0 | 19423 | <gh_stars>0
file_berita = open("berita.txt", "r")
berita = file_berita.read()
berita = berita.split()
berita = [x.lower() for x in berita]
berita = list(set(berita))
berita = sorted(berita)
print (berita) | 3.46875 | 3 |
demo_scripts/charts/bar_chart_index_translator_demo.py | webclinic017/qf-lib | 198 | 19424 | <filename>demo_scripts/charts/bar_chart_index_translator_demo.py
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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 th... | 2.640625 | 3 |
tests/request/test_parameter_invalid.py | Colin-b/pyxelrest | 7 | 19425 | import pytest
from responses import RequestsMock
from tests import loader
def test_parameter_cannot_be_parsed(responses: RequestsMock, tmpdir):
responses.add(
responses.GET,
url="http://test/",
json={
"swagger": "2.0",
"paths": {
"/test": {
... | 2.5 | 2 |
src/yookassa_payout/domain/response/__init__.py | yoomoney/yookassa-payout-sdk-python | 5 | 19426 | """Package for YooKassa Payout API Python Client Library."""
| 1.039063 | 1 |
tests/integration/test_entry_point.py | jacksmith15/delfino | 0 | 19427 | <reponame>jacksmith15/delfino
import toml
from delfino.constants import ENTRY_POINT, PYPROJECT_TOML_FILENAME
from delfino.models.pyproject_toml import PyprojectToml
from tests.constants import PROJECT_ROOT
class TestEntrypointConstant:
@staticmethod
def should_match_entrypoint_in_pyproject_toml():
fi... | 2.109375 | 2 |
gamble/gamble.py | lookma/simple-coin-gamble | 0 | 19428 | from random import randint
from typing import Callable, List, Optional
class Coin:
"""Simulates a coin."""
def __init__(self) -> None:
self.__head = False
self.__toss_count = 0
self.__head_count = 0
def toss(self) -> None:
"""Toss a coin."""
r = randint(1, 2)
... | 3.84375 | 4 |
roomai/games/__init__.py | tonyxxq/RoomAI | 1 | 19429 | <reponame>tonyxxq/RoomAI
#!/bin/python
| 0.9375 | 1 |
config.py | SevenMoGod/movenet.pytorch | 87 | 19430 | <filename>config.py
"""
@Fire
https://github.com/fire717
"""
cfg = {
##### Global Setting
'GPU_ID': '0',
"num_workers":8,
"random_seed":42,
"cfg_verbose":True,
"save_dir": "output/",
"num_classes": 17,
"width_mult":1.0,
"img_size": 192,
##### Train Setting
'img_path... | 1.773438 | 2 |
uart.py | WRansohoff/nmigen_uart_test | 0 | 19431 | <reponame>WRansohoff/nmigen_uart_test
from nmigen import *
from nmigen.back.pysim import *
# Function to calculate a clock divider which creates the
# desired output frequency from a given input frequency.
# Verifies that the divider is a positive integer, and that
# the resulting signal doesn't deviate more than expe... | 3.265625 | 3 |
edk2basetools/FMMT/core/GuidTools.py | YuweiChen1110/edk2-basetools | 0 | 19432 | ## @file
# This file is used to define the FMMT dependent external tool management class.
#
# Copyright (c) 2021-, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import glob
import logging
import os
import shutil
import sys
import tempfile
import uuid
from edk2basetools.FM... | 2.15625 | 2 |
python/tests/test_tree_intersection.py | Yonatan1P/data-structures-and-algorithms | 1 | 19433 | <filename>python/tests/test_tree_intersection.py
from challenges.tree_intersection.tree_intersection import find_intersection
from challenges.tree.tree import BinarySearchTree
def test_find_intersection():
tree1 = BinarySearchTree()
tree1.add(1)
tree1.add(2)
tree1.add(3)
tree1.add(4)
tree1.add(... | 3.75 | 4 |
setup.py | rif/imgdup | 14 | 19434 | from setuptools import setup, find_packages
setup(
name = "imgdup",
version = "1.3",
packages = find_packages(),
scripts = ['imgdup.py'],
install_requires = ['pillow>=2.8.1'],
# metadata for upload to PyPI
author = "<NAME>",
author_email = "<EMAIL>",
description = "Visual similarity... | 1.492188 | 1 |
exercicio13.py | LuizHps18/infosatc-lp-avaliativo-01 | 0 | 19435 | k = float(input("Digite uma distância em quilometros: "))
m = k / 1.61
print("A distância digitada é de {} quilometros, essa distância convertida é {:.2f} milhas" .format(k,m)) | 3.671875 | 4 |
rcs/wiki/urls.py | ShuffleBox/django-rcsfield | 0 | 19436 | from django.conf.urls.defaults import *
urlpatterns = patterns('rcs.wiki.views',
url(r'^((?:[A-Z]+[a-z]+){2,})/$', 'page', {}, name="wiki_page"),
url(r'^((?:[A-Z]+[a-z]+){2,})/edit/$', 'edit', {}, name="wiki_edit"),
url(r'^((?:[A-Z]+[a-z]+){2,})/attachments/$', 'attachments', {}, name="wiki_attachments"),
... | 1.671875 | 2 |
sample 1/main.py | RezaFirouzii/multi-choice_correction_opencv | 1 | 19437 | <gh_stars>1-10
import cv2 as cv
import numpy as np
import pandas as pd
import heapq
def sort_contours_horizontally(contours):
dic = {}
for contour in contours:
x_points = contour[:, :, 0]
dic[min(x_points)[0]] = contour
dic = dict(sorted(dic.items()))
return dic.values()
def sort... | 2.640625 | 3 |
a-practical-introduction-to-python-programming-brian-heinold/chapter-08/exercise-07.py | elarabyelaidy19/awesome-reading | 31 | 19438 | # 7. Write a program that estimates the average number of drawings it takes before the user’s
# numbers are picked in a lottery that consists of correctly picking six different numbers that
# are between 1 and 10. To do this, run a loop 1000 times that randomly generates a set of
# user numbers and simulates drawings u... | 3.921875 | 4 |
humfrey/update/utils.py | ox-it/humfrey | 6 | 19439 | from django.conf import settings
from django.utils.importlib import import_module
from humfrey.update.transform.base import Transform
def get_transforms():
try:
return get_transforms._cache
except AttributeError:
pass
transforms = {'__builtins__': {}}
for class_path in settings.UPDATE... | 2.125 | 2 |
flask/model/device_model.py | Dev-Jahn/cms | 0 | 19440 | from .db_base import db, env
class Device(db.Model):
__tablename__ = 'device'
id = db.Column(db.Integer, primary_key=True)
if env == 'development':
model = db.Column(db.String(16, 'utf8mb4_unicode_ci'))
serial = db.Column(db.String(20, 'utf8mb4_unicode_ci'))
company_id =... | 2.15625 | 2 |
pytests/tuqquery/tuq_tokens.py | ramalingam-cb/testrunner | 0 | 19441 | from lib.remote.remote_util import RemoteMachineShellConnection
from pytests.tuqquery.tuq import QueryTests
class TokenTests(QueryTests):
def setUp(self):
if not self._testMethodName == 'suite_setUp':
self.skip_buckets_handle = True
super(TokenTests, self).setUp()
self.n1ql_port... | 2.234375 | 2 |
src/python/autotransform/input/empty.py | nathro/AutoTransform | 11 | 19442 | <filename>src/python/autotransform/input/empty.py<gh_stars>10-100
# AutoTransform
# Large scale, component based code modification library
#
# Licensed under the MIT License <http://opensource.org/licenses/MIT>
# SPDX-License-Identifier: MIT
# Copyright (c) 2022-present <NAME> <http://github.com/nathro>
# @black_forma... | 2.96875 | 3 |
snowplow_tracker/tracker.py | jackwilliamson/snowplow-python-tracker | 0 | 19443 | <gh_stars>0
"""
tracker.py
Copyright (c) 2013-2014 Snowplow Analytics Ltd. All rights reserved.
This program is licensed to you under the Apache License Version 2.0,
and you may not use this file except in compliance with the Apache License
Version 2.0. You may obtain a copy of the Apache License ... | 1.453125 | 1 |
src/oic/oauth2/util.py | alanbuxey/pyoidc | 290 | 19444 | import logging
from http import cookiejar as http_cookiejar
from http.cookiejar import http2time # type: ignore
from typing import Any # noqa
from typing import Dict # noqa
from urllib.parse import parse_qs
from urllib.parse import urlsplit
from urllib.parse import urlunsplit
from oic.exception import UnSupported
f... | 2.25 | 2 |
main.py | aditya02acharya/TypingAgent | 5 | 19445 | <reponame>aditya02acharya/TypingAgent<filename>main.py
import sys
import yaml
import numpy
import random
import logging
import argparse
from os import path, makedirs
from datetime import datetime
from src.finger_proxy.proxy_agent import ProxyAgent
from src.utilities.logging_config_manager import setup_logging
from sr... | 2.25 | 2 |
examples/chain.py | yeeliu01/pyrfa | 33 | 19446 | #!/usr/bin/python
#
# Decoding a legacy chain ric
#
import pyrfa
p = pyrfa.Pyrfa()
p.createConfigDb("./pyrfa.cfg")
p.acquireSession("Session1")
p.createOMMConsumer()
p.login()
p.directoryRequest()
p.dictionaryRequest()
p.setInteractionType("snapshot")
def snapshotRequest(chainRIC):
p.marketPriceRequest(chainRIC)
... | 2.078125 | 2 |
hard-gists/749857/snippet.py | jjhenkel/dockerizeme | 21 | 19447 | <gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-
# launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
# launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist
from twisted.internet import reactor, stdio, defer
from twisted.internet.protocol import Protocol, Factory
from twi... | 1.9375 | 2 |
research/Issue2/utils.py | johnklee/ff_crawler | 0 | 19448 | import requests as reqlib
import os
import re
import random
import time
import pickle
import abc
import hashlib
import threading
from urllib.parse import urlparse
from purifier import TEAgent
from purifier.logb import getLogger
from enum import IntEnum
from typing import Tuple, List, Dict, Optional
cl... | 2.421875 | 2 |
Python-CPU/monitor.py | cwd0204/Python | 1 | 19449 | <reponame>cwd0204/Python
# CPU实时监控
# 作者:Charles
# 公众号:Charles的皮卡丘
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
import psutil as p
POINTS = 300
fig, ax = plt.subplots()
ax.set_ylim([0, 100])
ax.set_xlim([0, POINTS])
ax.set_autoscale_on(False)
ax.set_xticks([])
ax.set_yticks(range(0, 1... | 3.0625 | 3 |
leaderboards/api_views.py | bfrederix/django-improv | 1 | 19450 | <filename>leaderboards/api_views.py<gh_stars>1-10
import datetime
from rest_framework import viewsets
from rest_framework.response import Response
from leaderboards import LEADERBOARD_MAX_PER_PAGE
from leaderboards.models import LeaderboardEntry, Medal, LeaderboardSpan
from leaderboards.serializers import (Leaderboard... | 2.4375 | 2 |
pyaz/sql/instance_pool/__init__.py | py-az-cli/py-az-cli | 0 | 19451 | <gh_stars>0
from ... pyaz_utils import _call_az
def show(name, resource_group):
'''
Get the details for an instance pool.
Required Parameters:
- name -- Instance Pool Name
- resource_group -- Name of resource group. You can configure the default group using `az configure --defaults group=<name>`
... | 2.84375 | 3 |
exercicios/ex090.py | Siqueira-Vinicius/Python | 0 | 19452 | <filename>exercicios/ex090.py
aluno = {}
aluno['nome'] = str(input('Digite o nome do aluno: '))
aluno['media'] = float(input('Digite a média desse aluno: '))
if aluno['media'] >= 5:
aluno['situação'] = '\033[32mAprovado\033[m'
else:
aluno['situação'] = '\033[31mReprovado\033[m'
for k, v in aluno.items():
pr... | 3.625 | 4 |
cntr_div_train_test_images.py | globalgood-ag/treecover | 0 | 19453 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 6 10:57:41 2019
Creates train and test splits at the IMAGE LEVEL to prep for thumbnail extraction in countr_cnn_1
@author: smcguire
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
## read dataframe of unique images w... | 2.21875 | 2 |
SUAVE/SUAVE-2.5.0/trunk/SUAVE/Attributes/Propellants/Aviation_Gasoline.py | Vinicius-Tanigawa/Undergraduate-Research-Project | 0 | 19454 | ## @ingroup Attributes-Propellants
# Aviation_Gasoline.py
#
# Created: Unk 2013, SUAVE TEAM
# Modified: Apr 2015, SUAVE TEAM
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
from .Propellant import Propellant... | 2.140625 | 2 |
write_grok/write_grok.py | namedyangfan/Python_practice | 0 | 19455 | <gh_stars>0
import os, glob, shutil
class Write_grok():
def __init__(self, grok_name, grok_directory):
''' modify a given grok file'''
self.grok_directory = grok_directory
self.grok_path = os.path.join(grok_directory,grok_name)
if not os.path.exists(self.grok_path):
prin... | 2.71875 | 3 |
src/tfi/publish.py | ajbouh/tfi | 160 | 19456 | import decimal
import hashlib
import json
import requests
import tempfile
import uuid
import os
from tqdm import tqdm
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
def sha256_for_file(f, buf_size=65536):
pos = f.tell()
dgst = hashlib.sha256()
while True:
data = f.read(bu... | 2.421875 | 2 |
skeema/intermediate/compiler/class_builder.py | HeadHaus/Skeema | 0 | 19457 | from __future__ import annotations
import sys
from skeema.intermediate.compiler.parser import Parser
from skeema import ModelMeta
from skeema import util
def private(name):
return f'_{name}'
class ClassBuilder:
"""
ClassBuilder
"""
@staticmethod
def set_class_module(klass, module_name: st... | 2.453125 | 2 |
problems/csp/single/LabeledDice.py | xcsp3team/pycsp3 | 28 | 19458 | """
From http://jimorlin.wordpress.com/2009/02/17/colored-letters-labeled-dice-a-logic-puzzle/
There are 13 words as follows: buoy, cave, celt, flub, fork, hemp, judy, junk, limn, quip, swag, visa.
There are 24 different letters that appear in the 13 words.
The question is: can one assign the 24 letters to 4 different ... | 3.5625 | 4 |
lib/JumpScale/tools/cuisine/solutions/CuisineCockpit.py | Jumpscale/jumpscale_core8 | 8 | 19459 | <filename>lib/JumpScale/tools/cuisine/solutions/CuisineCockpit.py
from JumpScale import j
base = j.tools.cuisine._getBaseClass()
class CuisineCockpit(base):
def __init__(self, executor, cuisine):
self._executor = executor
self._cuisine = cuisine
def configure(self):
C = """
... | 1.921875 | 2 |
examples/finetune-bert/02-BERT-sst2-DeepSpeed.py | ceshine/pytorch-helper-bot | 10 | 19460 | <reponame>ceshine/pytorch-helper-bot
""" Finetuning BERT using DeepSpeed's ZeRO-Offload
"""
import json
import dataclasses
from pathlib import Path
from functools import partial
import nlp
import torch
import typer
import deepspeed
import numpy as np
from transformers import BertTokenizerFast
from transformers import ... | 2.21875 | 2 |
examples/images/autoencoder.py | jjpalacio/tflearn | 10,882 | 19461 | # -*- coding: utf-8 -*-
""" Auto Encoder Example.
Using an auto encoder on MNIST handwritten digits.
References:
<NAME>, <NAME>, <NAME>, and <NAME>. "Gradient-based
learning applied to document recognition." Proceedings of the IEEE,
86(11):2278-2324, November 1998.
Links:
[MNIST Dataset] http://yann... | 3.703125 | 4 |
secureaws/secureaws.py | paliwalvimal/aws-secure-account | 1 | 19462 | """
## ## ## ## ##
## ## ##
## ## ##
## ## ## ## ## ##
## ##
## ##
##
AUTHOR = <NAME> <<EMAIL>>
"""
import sys
import boto3
import click
import threading
from botocore.exceptions import ClientError
from secureaws import checkaws
from secureaws ... | 2.03125 | 2 |
python/examples/find_similar.py | yupbank/euclidesdb | 0 | 19463 | <reponame>yupbank/euclidesdb<filename>python/examples/find_similar.py
import sys
import argparse
import euclides
from PIL import Image
import numpy as np
from torchvision.transforms import functional as F
def run_main():
parser = argparse.ArgumentParser(description='Find similar images in EuclidesDB.')
par... | 2.953125 | 3 |
gunpowder/nodes/renumber_connected_components.py | trivoldus28/gunpowder | 43 | 19464 | <reponame>trivoldus28/gunpowder
from .batch_filter import BatchFilter
from gunpowder.ext import malis
class RenumberConnectedComponents(BatchFilter):
'''Find connected components of the same value, and replace each component
with a new label.
Args:
labels (:class:`ArrayKey`):
The lab... | 2.515625 | 3 |
project/main/migrations/0003_auto_20200504_1852.py | Leeoku/MovieCrud | 0 | 19465 | # Generated by Django 3.0.4 on 2020-05-04 18:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0002_auto_20200323_0327'),
]
operations = [
migrations.AlterField(
model_name='movieentry',
name='date_watch... | 1.46875 | 1 |
LR/lr/model/resource_data_monitor/incoming_copy_handler.py | LearningRegistry/LearningRegistry | 26 | 19466 | import logging
import couchdb
from collections import deque
from threading import Thread
from pylons import config
from lr.lib import SpecValidationException, helpers as h
from lr.lib.couch_change_monitor import BaseChangeHandler
from lr.model import ResourceDataModel
from couchdb import ResourceConflict
from lr.lib.re... | 2.140625 | 2 |
proxyclient/m1n1/fw/asc/base.py | EricRabil/m1n1 | 1 | 19467 | # SPDX-License-Identifier: MIT
from ...utils import *
# System endpoints
def msg_handler(message, regtype=None):
def f(x):
x.is_message = True
x.message = message
x.regtype = regtype
return x
return f
class ASCMessage1(Register64):
EP = 7, 0
class ASCBaseEndpoint:
BAS... | 2.171875 | 2 |
misc/redirector.py | ktan2020/tooling | 0 | 19468 | import SimpleHTTPServer
import SocketServer
import sys
from optparse import OptionParser
class myHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
print self.path
self.send_response(301)
new_path = 'http://%s%s'%(o.ip, self.path)
self.send_header('Location', new_path)... | 3.171875 | 3 |
alert/getinfo/model/configdata.py | xwwwb/genshin_task-resin-expedition_alert | 2 | 19469 | from typing import List, Literal
import pydantic
class ConfigData(pydantic.BaseModel):
UID: str
COOKIE:str
SCKEY:str
SCTKEY:str
BARK_KEY:str
BARK_GROUP:str
BARK_ICON:str
BARK_ARCHIVE:str
WW_ID: str
WW_APP_SECRET: str
WW_APP_USERID: str
WW_APP_AGENTID: str
WW_BOT_KEY... | 2.171875 | 2 |
src/cli.py | stefantaubert/tacotron | 0 | 19470 | import os
from argparse import ArgumentParser
from pathlib import Path
from general_utils import split_hparams_string, split_int_set_str
# from tacotron.app.eval_checkpoints import eval_checkpoints
from tacotron.app import (DEFAULT_MAX_DECODER_STEPS, continue_train, infer,
plot_embeddings, t... | 2.171875 | 2 |
apps/hello/uploadHandler.py | tenqaz/tornado_learning | 11 | 19471 | # -*- coding: utf-8 -*-
"""
@author: Jim
@project: tornado_learning
@time: 2019/8/20 14:48
@desc:
上传文件
"""
from __future__ import annotations
from tornado_learning.handler import BaseHandler
import os
import uuid
import aiofiles
class UploadHandler(BaseHandler):
async def post(self):
ret_data = {}... | 2.171875 | 2 |
mathgrid_app/main.py | logiflo/mathgrid | 0 | 19472 | """Main module
"""
# Standard library imports
import string
# Third party imports
import numpy as np
import justpy as jp
import pandas as pd
START_INDEX: int = 1
END_INDEX: int = 20
GRID_OPTIONS = """
{
class: 'ag-theme-alpine',
defaultColDef: {
filter: true,
sortable: false,
resizab... | 2.84375 | 3 |
tests/test_linked_queue.py | dataloudlabs/dloud-ads | 0 | 19473 | """ Unit tests for linked_queue.LinkedQueue """
from dloud_ads import linked_queue
def test_dummy():
""" Test definition"""
the_queue = linked_queue.LinkedQueue()
assert the_queue.is_empty()
assert not the_queue
the_queue.enqueue(2)
assert not the_queue.is_empty()
assert len(the_queue) ... | 3.609375 | 4 |
setup.py | AnacletoLAB/grape | 6 | 19474 | import os
import re
# To use a consistent encoding
from codecs import open as copen
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with copen(path.join(here, 'README.rst'), encoding='utf-8') as f:
long... | 2.0625 | 2 |
pyLMS7002Soapy/LMS7002_BIAS.py | Surfndez/pyLMS7002Soapy | 46 | 19475 | <reponame>Surfndez/pyLMS7002Soapy<gh_stars>10-100
#***************************************************************
#* Name: LMS7002_BIAS.py
#* Purpose: Class implementing LMS7002 BIAS functions
#* Author: <NAME> ()
#* Created: 2016-11-14
#* Copyright: <NAME> (limemicro.com)
#* License:
#********************... | 2.5 | 2 |
NorthernLights/shapes/BaseShape.py | jgillick/coffeetable-programs | 0 | 19476 | <reponame>jgillick/coffeetable-programs<filename>NorthernLights/shapes/BaseShape.py<gh_stars>0
import time
# Colors
RED = (1,0,0)
YELLOW = (1,1,0)
GREEN = (0,1,0)
CYAN = (0,1,1)
BLUE = (0,0,1)
PURPLE = (1,0,1)
class BaseShape:
# A list of instance attribute names, which are animatable objects
animatab... | 2.890625 | 3 |
WD/Cwiczenia/rzymskie.py | galursa/UWM | 1 | 19477 | <filename>WD/Cwiczenia/rzymskie.py
rzymskie={'I':1,'II':2,'III':3,'IV':4,'V':5,'VI':6,'VII':7,'VIII':8}
print(rzymskie)
print('Jeden element slownika: \n')
print(rzymskie['I'])
| 2.703125 | 3 |
otoku.py | gitmori/WebTools | 0 | 19478 | <reponame>gitmori/WebTools<filename>otoku.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from config.site_url import SiteUrl
from urllib.request import urlopen
from lxml.html import fromstring
from random import randint
from time import sleep
# 余分な改行や文字列を削除し文字列に変換する関数
def conv(arg):
arg = [item.strip().replace(... | 2.609375 | 3 |
falcon/util/net.py | jopereira/horus-tracer | 21 | 19479 | import ctypes
import ctypes.util
libc = ctypes.CDLL(ctypes.util.find_library('c'))
# Get network device's name
def if_indextoname (index):
if not isinstance (index, int):
raise TypeError ('Index must be an integer.')
libc.if_indextoname.argtypes = [ctypes.c_uint32, ctypes.c_char_p]
libc.if_indexto... | 2.828125 | 3 |
CKY_Parser/BackupGrammer.py | Deekshantiiitd/NLP-2019 | 0 | 19480 | import nltk,re,codecs
from nltk.tokenize import word_tokenize,sent_tokenize
from backNode import BackNode
from nltk import Tree
def trace_tree(trace):
if trace.left==None and trace.right==None:
return str(trace.root)+" "+str(trace.word)
return "("+str(trace.root)+"("+str(trace_tree(trace.left))+")"+" "+"("+str... | 2.75 | 3 |
mullvad_python/__init__.py | linusg/mullpy | 12 | 19481 | """Initialization package."""
from .api import Mullpy
from .banner import banner
__all__ = ['Mullpy', 'banner']
__version__ = '0.3.1'
| 1.109375 | 1 |
tests/init.py | Animenosekai/yuno | 1 | 19482 | <filename>tests/init.py
import inspect
import pathlib
import sys
import yuno
# CONSTANTS
TEST_OBJECT = {
"a": 1,
"b": 2,
"c": 3,
"test_dict": {
"a": 1,
"b": 2,
"c": 3
},
"float": 1.1,
"int": 1,
"test_list": [1, 2, 3],
"null": None,
"string": "test",
... | 2.03125 | 2 |
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/cli.py | go-choppy/choppy-cookiecutter-pypackage | 2 | 19483 | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""
{{cookiecutter.project_slug}}.cli
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{{ cookiecutter.project_short_description }}
:copyright: © 2019 by the Choppy Team.
:license: AGPLv3+, see LICENSE for more details.
"""
"""Console script for {{cookiecutter.proje... | 1.96875 | 2 |
test/classes/test_players.py | teamvolik/teamvolik | 6 | 19484 | <filename>test/classes/test_players.py
import unittest
import src.classes.player as player
class PlayersTest(unittest.TestCase):
def test_to_string(self):
self.assertTrue(str(player.Player()) == "Player(id=-1, name=UNDEFINED, is_adm=False, games=0, pitch=0.0, hold=0.0, passing=0.0, movement=0.0, attackin... | 3.59375 | 4 |
src/asphalt/core/concurrent.py | agronholm/asphalt | 226 | 19485 | from __future__ import annotations
__all__ = ("executor",)
import inspect
import sys
from asyncio import get_running_loop
from concurrent.futures import Executor
from functools import partial, wraps
from typing import Awaitable, Callable, TypeVar, overload
from asphalt.core import Context
if sys.version_info >= (3,... | 2.578125 | 3 |
src/templates/rsc/year_test.py | bradunov/shkola | 2 | 19486 | import jinja2
page = {}
page['title'] = 'Shkola'
page['item_path'] = '../src/'
page['google_signin_client_id'] = ""
page['google_site_verification'] = ""
page['button'] = {
'width' : '137px',
'height' : '140px',
'font_size' : '111px',
'margin' : '10px',
'choices' : []
}
page['button']['choices... | 2.1875 | 2 |
merganser/conflict_prediction.py | ualberta-smr/merganser | 6 | 19487 |
import logging
import json
import glob
import pandas as pd
import multiprocessing
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics... | 2.265625 | 2 |
lib/wx_lib.py | liveonnet/p3_server | 0 | 19488 | <reponame>liveonnet/p3_server
# -*- coding: utf-8 -*-
import time
import json
import random
import string
import asyncio
import aiohttp
from aiohttp.resolver import AsyncResolver
from hashlib import md5
from urllib.parse import quote
#-#from operator import itemgetter
#-#from itertools import chain
#-#from cStringIO i... | 1.703125 | 2 |
django_fuzzytest/management/commands/fuzzytest.py | creotiv/django-fuzzytest | 8 | 19489 | # coding: utf-8
from __future__ import unicode_literals
import time
import logging
import traceback
from optparse import make_option
import json
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django_fuzzytest.runner import FuzzyRunner
logger = logging.getLogge... | 2.078125 | 2 |
save_sim/maker.py | jrbourbeau/composition | 0 | 19490 | <filename>save_sim/maker.py
#!/usr/bin/env python
import glob
import re
import os
import argparse
import time
import getpass
import composition.support_functions.paths as paths
import composition.support_functions.simfunctions as simfunctions
from composition.support_functions.checkdir import checkdir
def get_argdic... | 2.28125 | 2 |
xlsxwriter_tables/xlsxwriter_tables.py | johncmacy/xlsxwriter-tables | 0 | 19491 | from typing import Union
class ExcelTable:
def _get_column(self, column_name:str, column_props:Union[dict, str]) -> dict:
'''
Defaults to the title-cased `column_name`:
my_favorite_color: 'My Favorite Color'
For acronyms, abbreviations, provide the correct capitalization in t... | 3.265625 | 3 |
teachers_toolkit/grading_system/migrations/0003_auto_20180706_1923.py | luiscberrocal/teachers_toolkit | 0 | 19492 | # Generated by Django 2.0.7 on 2018-07-06 19:23
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('grading_system', '0002_student_email'),
]
operations = [
migrations.RenameField(
model_name='... | 1.585938 | 2 |
sdk/python/pulumi_google_native/vmmigration/v1alpha1/outputs.py | AaronFriel/pulumi-google-native | 44 | 19493 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 1.585938 | 2 |
tests/test_utils.py | yoshikyoto/django-filter-0.14 | 0 | 19494 | <gh_stars>0
import unittest
import django
from django.test import TestCase
from django.db import models
from django.db.models.constants import LOOKUP_SEP
from django_filters.utils import get_model_field, resolve_field
from django_filters.exceptions import FieldLookupError
from .models import User
from .models impor... | 2.640625 | 3 |
agc/agc007/agc007a.py | c-yan/atcoder | 1 | 19495 | H, W = map(int, input().split())
A = [input() for _ in range(H)]
if H + W - 1 == sum(a.count('#') for a in A):
print('Possible')
else:
print('Impossible')
| 3.390625 | 3 |
relfs/relfs/fuse/mount_root.py | matus-chochlik/various | 1 | 19496 | # coding=utf-8
#------------------------------------------------------------------------------#
import os
import time
import fuse
import errno
from .item import RelFuseItem
from .static_dir import StaticDirectory
#------------------------------------------------------------------------------#
class MountRoot(RelFuseIte... | 2.21875 | 2 |
clip_onnx/clip_converter.py | EmbarkStudios/CLIP-ONNX | 0 | 19497 | <reponame>EmbarkStudios/CLIP-ONNX
import torch
import onnx
from torch import nn
from onnxruntime.quantization import quantize_qat, quantize_dynamic, QuantType
from .utils import Textual, DEFAULT_EXPORT
class clip_converter(nn.Module):
def __init__(self, model, visual_path: str = "clip_visual.onnx",
... | 1.976563 | 2 |
electrum/gui/kivy/uix/dialogs/add_token_dialog.py | VIPSTARCOIN-electrum/electrum-vips | 2 | 19498 | <gh_stars>1-10
from datetime import datetime
from kivy.app import App
from kivy.factory import Factory
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.uix.button import Button
from electrum.gui.kivy.i18n import _
from electrum.bitcoin import Token
from electrum.util import parse_token_URI, Inval... | 2.3125 | 2 |
statey/syms/encoders.py | cfeenstra67/statey | 4 | 19499 | <gh_stars>1-10
import abc
import base64
from datetime import date, datetime
import dataclasses as dc
from typing import Type as PyType, Any, Dict, Optional
import marshmallow as ma
import pickle
import pluggy
import statey as st
from statey.syms import types, utils, Object
class Encoder(abc.ABC):
"""
An en... | 2.484375 | 2 |