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 |
|---|---|---|---|---|---|---|
data_collection.py | amadeusuzx/R2Plus1D-PyTorch | 0 | 49500 | <reponame>amadeusuzx/R2Plus1D-PyTorch
import os
import time
import numpy as np
import cv2
import dlib
import imutils
from imutils import face_utils
import sys
from multiprocessing import Process
from queue import Queue
def recognize(record,j):
lip = record[0][1]
overall_h = int(lip[3]*3)*4
overall_w = ... | 2.40625 | 2 |
train.py | ankitvaibhava/Peak_Stress_in_Microstructures | 0 | 49501 | <reponame>ankitvaibhava/Peak_Stress_in_Microstructures
import numpy as np
import torch
from utils import get_opts
import models
from data_loader import Microstructure_Data_Loader
from trainer import Trainer
SEED = 123
np.random.seed(SEED)
torch.manual_seed(SEED)
torch.cuda.manual_seed(SEED)
torch.cuda.manual_seed_all(... | 2.265625 | 2 |
operator_api/transactor/tasks/process_passive_transfer_finalizations.py | liquidity-network/nocust-hub | 1 | 49502 | <reponame>liquidity-network/nocust-hub
from __future__ import absolute_import, unicode_literals
import logging
from django.conf import settings
from django.db import transaction, IntegrityError
from celery import shared_task
from celery.utils.log import get_task_logger
from contractor.interfaces import LocalViewInte... | 1.828125 | 2 |
lib/x509Support.py | bbockelm/glideinWMS | 0 | 49503 | import sys
import M2Crypto
def extract_DN(fname):
"""
Extract a Distinguished Name from an X.509 proxy.
@type fname: string
@param fname: Filename containing the X.509 proxy
"""
fd = open(fname,"r")
try:
data = fd.read()
finally:
fd.close()
while 1:
try:
... | 3 | 3 |
saxo/Utils.py | ayxue/BaiduSaxoOpenAPI | 0 | 49504 | <gh_stars>0
from collections import namedtuple
class Utils:
def __init__(self):
pass
@staticmethod
def DicToObj(name, dic = {}):
keys = list(dic.keys())
vals = list(dic.values())
Data = namedtuple('data', keys)
return Data._make(vals)
@staticmethod
def DicT... | 3 | 3 |
sasync/errors.py | edsuom/sAsync | 1 | 49505 | # sAsync:
# An enhancement to the SQLAlchemy package that provides persistent
# item-value stores, arrays, and dictionaries, and an access broker for
# conveniently managing database access, table setup, and
# transactions. Everything can be run in an asynchronous fashion using
# the Twisted framework and its deferred ... | 1.78125 | 2 |
All Python Practice - IT 89/Python psets/pset2/ps2a.py | mrouhi13/my-mit-python-practice | 0 | 49506 | #!/usr/bin/python
#----------------------------------------
# Name: ps2a.py
# Coded by <NAME>
# Last Modified: 03/12/2010 , 03:28 PM
# Description: -
#----------------------------------------
def Diophantine() :
'''Program take number of McNuggets from the user and test 0 to N (number of McNuggets) with ... | 4.15625 | 4 |
app.py | yabebalFantaye/DeployBokehStockApp | 0 | 49507 | <reponame>yabebalFantaye/DeployBokehStockApp
from configure import configure_flask, TornadoApplication
from bokeh.server.app import app
from bokeh.server.configure import register_blueprint
from bokeh.server.settings import settings as server_settings
from bokeh.server.utils.plugins import object_page
from flask import... | 1.992188 | 2 |
plato/draw/vispy/Scene.py | hillarypan/plato | 0 | 49508 | <gh_stars>0
import logging
import vispy.io
from .Canvas import Canvas
from ... import draw
import numpy as np
from ..Scene import DEFAULT_DIRECTIONAL_LIGHTS
logger = logging.getLogger(__name__)
def set_orthographic_projection(camera, left, right, bottom, top, near, far):
camera[:] = 0
camera[0, 0] = 2/(right ... | 2.640625 | 3 |
freefly/generate.py | emaballarin/pyminutiae | 0 | 49509 | <reponame>emaballarin/pyminutiae<filename>freefly/generate.py
#!/usr/bin/env python3
import string
import random
import hashlib # sha ~> hashlib.sha1
BASE16 = "0123456789ABCDEF"
BASE30 = "123456789ABCDEFGHJKLMNPQRTVWXY"
def random_string(size=20, chars=string.ascii_uppercase + string.digits):
return "".join((r... | 2.734375 | 3 |
shop/migrations/0034_auto_20180321_1311.py | sumangaire52/dammideal | 0 | 49510 | <filename>shop/migrations/0034_auto_20180321_1311.py
# Generated by Django 2.0.1 on 2018-03-21 07:26
from django.db import migrations
import django_resized.forms
class Migration(migrations.Migration):
dependencies = [
('shop', '0033_auto_20180321_1242'),
]
operations = [
migrations.Alte... | 1.359375 | 1 |
LAB/predictive_keyboard/medical/run_mimic.py | ipavlopoulos/lm | 0 | 49511 | <gh_stars>0
import pandas as pd
from sklearn.model_selection import train_test_split
from markov import models as markov_models
from neural import models as neural_models
from collections import Counter
from scipy.stats import sem
from toolkit import *
# todo: add FLAGS
if __name__ == "main":
use_radiology_only = ... | 2.421875 | 2 |
test/dpt_tests/dpt_1byte_signed_test.py | kistlin/xknx | 1 | 49512 | <filename>test/dpt_tests/dpt_1byte_signed_test.py
"""Unit test for KNX DPT 1 byte relative value objects."""
import pytest
from xknx.dpt import DPTPercentV8, DPTSignedRelativeValue, DPTValue1Count
from xknx.exceptions import ConversionError
class TestDPTRelativeValue:
"""Test class for KNX DPT Relative Value.""... | 2.71875 | 3 |
src/h01_data/vocab.py | devpouya/GeneralizedEasyFirstParser | 0 | 49513 | <gh_stars>0
class Vocab:
# pylint: disable=invalid-name,too-many-instance-attributes
ROOT = '<ROOT>'
SPECIAL_TOKENS = ('<PAD>', '<ROOT>', '<UNK>')
def __init__(self, min_count=None):
self._counts = {}
self._pretrained = set([])
self.min_count = min_count
self.size = 3
... | 2.6875 | 3 |
train_dn_unet.py | zzzqzhou/Dual-Normalization | 12 | 49514 | import os
import random
import datetime
import argparse
import numpy as np
from tqdm import tqdm
from model.unetdsbn import Unet2D
from utils.loss import dice_loss1
from datasets.dataset import Dataset, ToTensor, CreateOnehotLabel
import torch
import torchvision.transforms as tfs
from torch import optim
from torch.op... | 1.929688 | 2 |
endpoint/endpoint.py | BU-NU-CLOUD-SP16/Container-Safety-Determination | 14 | 49515 | <filename>endpoint/endpoint.py
#####################################################################
# File: endpoint.py
# Author: <NAME> <<EMAIL>>
# Desc: Configures a REST API endpoint listening on port configured.
# Captures the notifications sent by Docker registry v2,
# processes them and identifies th... | 2.046875 | 2 |
intrepyd/tests/A7E_requirements.py | bobosoft/intrepyd | 2 | 49516 | <gh_stars>1-10
import intrepyd as ip
import intrepyd.scr
import intrepyd.circuit
import collections
from . import from_fixture_path
class SimulinkCircuit(ip.circuit.Circuit):
def __init__(self, ctx, name):
ip.circuit.Circuit.__init__(self, ctx, name)
def _mk_naked_circuit_impl(self, inputs):
i... | 2.203125 | 2 |
tests/ut/python/dataset/test_flanger.py | PowerOlive/mindspore | 3,200 | 49517 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | 1.90625 | 2 |
tests/feature_extraction/test_user_in_conv_extract.py | hunter-heidenreich/pyconversations | 0 | 49518 | <reponame>hunter-heidenreich/pyconversations<filename>tests/feature_extraction/test_user_in_conv_extract.py
from collections import Counter
from datetime import datetime as dt
import pytest
from pyconversations.convo import Conversation
from pyconversations.feature_extraction.user_in_conv import UserInConvoFeatures a... | 2.34375 | 2 |
workouts/migrations/0009_auto_20180417_0936.py | patcurry/patcurryworks.com | 0 | 49519 | # Generated by Django 2.0.4 on 2018-04-17 07:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workouts', '0008_auto_20180417_0934'),
]
operations = [
migrations.AlterField(
model_name='exercise',
name='exercise... | 1.46875 | 1 |
scienz/covid/the_racial_covid_data_tracker.py | Vibrant-Planet/aorist | 16 | 49520 | from aorist import (
Attribute,
NaturalNumber,
StringIdentifier,
DateString,
POSIXTimestamp,
PositiveFloat,
default_tabular_schema,
RowStruct,
StaticDataTable,
DataSchema,
StorageSetup,
RemoteStorageSetup,
Storage,
RemoteStorage,
RemoteLocation,
CSVEncodin... | 1.539063 | 2 |
beethon/handlers/dummy.py | wblxyxolbkhv/beethon | 6 | 49521 | <reponame>wblxyxolbkhv/beethon
import asyncio
from beethon.handlers.base import Handler
from beethon.messages.base import Request
from beethon.services.base import Service
class DummyHandler(Handler):
"""
This handler only available in same project, without publishing
"""
def __init__(self, service:... | 1.960938 | 2 |
gneiss/regression/_model.py | thermokarst/gneiss | 48 | 49522 | # ----------------------------------------------------------------------------
# Copyright (c) 2016--, gneiss development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ------------------------------------------------... | 2.703125 | 3 |
adventofcode/solutions/y2021/d13.py | andreasbjornstrom/adventofcode-python | 0 | 49523 | '''
Solution for day 13 of the 2021 Advent of Code calendar.
Run it with the command `python -m adventofcode run_solution -y 2021 13` from the project root.
'''
import numpy as np
from adventofcode.types import Solution
def part1(data, exit_on_first_fold=False):
rows = [row for row in data.splitlines() if row an... | 3.765625 | 4 |
test/integration/upload/cli/test_list_areas.py | GPelayo/dcp-cli | 8 | 49524 | <filename>test/integration/upload/cli/test_list_areas.py
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import unittest
from argparse import Namespace
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')) # noqa
sys.path.insert(0, pkg_root) # noqa
import hca
from h... | 2.234375 | 2 |
ensemble/management/commands/seeddata.py | evanlouie/activelearning | 0 | 49525 | """
Test data scaffolding.
Read: https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
"""
import json
from random import randint
from django.core.management.base import BaseCommand, CommandError
from ensemble.models import (
Classification,
Model,
ModelVersion,
MediaFile,
VideoPre... | 2.734375 | 3 |
dashboard/tests/models/test_reward.py | FurSquared/dev-game | 1 | 49526 | <gh_stars>1-10
import pytz
from datetime import timedelta
from django.conf import settings
from django.core.exceptions import ValidationError
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.utils import timezone
from dashboard.models import Token, Reward, CollectedToken, Co... | 2.265625 | 2 |
module1-introduction-to-sql/rpg_queries.py | moviedatascience/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 49527 | import sqlite3 as sql
import pandas as pd
from tabulate import tabulate
connect = sql.connect("rpg_db.sqlite3")
cursor = connect.cursor()
def total_char_count():
""" Total all characters """
print(pd.read_sql_query('''SELECT COUNT(distinct character_id)
FROM charactercreator_character;''', connect))
... | 3.359375 | 3 |
setup.py | wxy6655/pymycobot | 37 | 49528 | # encoding=utf-8
from __future__ import print_function
import sys
PYTHON_VERSION = sys.version_info[:2]
if (2, 7) != PYTHON_VERSION < (3, 5):
print("This mycobot version requires Python2.7, 3.5 or later.")
sys.exit(1)
import setuptools
import textwrap
import pymycobot
try:
long_description = (
op... | 2.546875 | 3 |
tools/eval_proposal_hit_rate.py | h-zcc/ref-nms | 19 | 49529 | import argparse
import pickle
from utils.hit_rate_utils import NewHitRateEvaluator
from utils.constants import EVAL_SPLITS_DICT
from lib.refer import REFER
def threshold_with_confidence(exp_to_proposals, conf):
results = {}
for exp_id, proposals in exp_to_proposals.items():
assert len(proposals) >= 1... | 2.421875 | 2 |
opensearch_stac_adapter/adapter.py | VITObelgium/opensearch-stac-adapter | 0 | 49530 | <filename>opensearch_stac_adapter/adapter.py
import attr
from datetime import datetime
from urllib.parse import urljoin, urlparse
from typing import Optional, List, Union, Dict, Type
from collections import OrderedDict
from pydantic import ValidationError
from starlette.requests import Request
from jsonpath_ng import ... | 1.984375 | 2 |
setup.py | DefaltSimon/OMDbie | 0 | 49531 | <gh_stars>0
# coding=utf-8
from setuptools import setup
with open('requirements.txt') as f:
requirements = f.read().splitlines()
extras = {
"fast": ["ujson>=1.35"],
"requests": ["requests>=2.13.0"]
}
setup(name='OMDbie',
version='1.1.2',
description='Python API wrapper for OMDb',
class... | 1.242188 | 1 |
abc/237/E.py | tonko2/AtCoder | 2 | 49532 | <reponame>tonko2/AtCoder
import sys
import heapq
sys.setrecursionlimit(10 ** 6)
def solve():
def dijkstra(start):
ds = [float('inf')] * N
h = []
ds[start] = 0
heapq.heappush(h, (0, start))
while len(h) > 0:
min_cost, u = heapq.heappop(h)
if min_cost ... | 2.859375 | 3 |
senlinclient/tests/unit/test_utils.py | openstack/python-senlinclient | 20 | 49533 | # 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, software
# distributed unde... | 2.171875 | 2 |
quant/state.py | vincent87lee/alphahunter | 149 | 49534 | # -*- coding:utf-8 -*-
"""
状态信息
Project: alphahunter
Author: HJQuant
Description: Asynchronous driven quantitative trading framework
"""
class State:
STATE_CODE_PARAM_MISS = 1 #交易接口初始化过程缺少参数
STATE_CODE_CONNECT_SUCCESS = 2 #交易接口连接成功
STATE_CODE_CONNECT_FAILED = 3 #交易接口连接失败
STATE_CODE_DISCONN... | 2.5 | 2 |
Course Experiment/Interface Technology Course Exp/Final/Python/main.py | XJDKC/University-Code-Archive | 4 | 49535 | <filename>Course Experiment/Interface Technology Course Exp/Final/Python/main.py
import random
import sys
from time import sleep
import serial
import threading
from PySide2.QtCore import QTimer, SIGNAL, QObject, QEvent
from PySide2.QtGui import QPainter, QColor, QPen, QCloseEvent
from PySide2.QtWidgets import QMainWin... | 2.6875 | 3 |
single_synthetic_comparison.py | wflynny/miseq-analysis | 0 | 49536 | <gh_stars>0
import os
import sys
import csv
import glob
import sqlite3
import numpy as np
import pandas as pd
from itertools import combinations, izip_longest
from utils.wildtype import WILDTYPE_PRO
from utils.mut_freqs import DB_LOCATION
#MUT_PAIRS = ['30-88', '54-82', '73-90', '46-82', '24-74', '35-36', '69-84',
# ... | 2.40625 | 2 |
Inventario/migrations/0001_initial.py | yorlysoro/INCOLARA | 0 | 49537 | <filename>Inventario/migrations/0001_initial.py
# Generated by Django 2.2.13 on 2020-07-08 18:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 1.835938 | 2 |
examples/linear_wake/analysis.py | SaVicente/hipace | 19 | 49538 | <gh_stars>10-100
#! /usr/bin/env python3
# This Python analysis script is part of the code Hipace
#
# It compares the transverse field By with the theoretical value, plots both
# the simulation result and the theory on the same plot, and asserts that the
# difference is small.
#
# To use it, run the simulation and exe... | 2.34375 | 2 |
restcli/utils.py | dustinrohde/restcli | 12 | 49539 | <filename>restcli/utils.py<gh_stars>10-100
from collections import OrderedDict
from collections.abc import Mapping, Sequence
class AttrSeq(Sequence):
"""An immutable sequence that supports dot notation.
Args:
*args: Items to create the sequence from.
"""
def __init__(self, *args):
se... | 3.09375 | 3 |
groups/master/ggd/button.py | awslabs/aws-greengrass-mini-fulfillment | 25 | 49540 | #!/usr/bin/env python
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License is
# located at
# http://aws.amazon.com/apache2.0/
#
# or in t... | 2.21875 | 2 |
backend/algorithms/ls_backend/engine.py | AroMorin/DNNOP | 6 | 49541 | """base class for pool
The pool object will contain the models under optimization.
"""
from .noise import Noise
from .analysis import Analysis
import torch
class Engine(object):
def __init__(self, model, hyper_params):
self.vector = torch.nn.utils.parameters_to_vector(model.parameters())
self.nois... | 2.9375 | 3 |
snakeai/utils/cli.py | mxpoliakov/snake-ai-reinforcement | 0 | 49542 | import argparse
import sys
class HelpOnFailArgumentParser(argparse.ArgumentParser):
"""
Prints help whenever the command-line arguments could not be parsed.
"""
def error(self, message):
sys.stderr.write("Error: %s\n\n" % message)
self.print_help()
sys.exit(2)
| 3.03125 | 3 |
models/secrets.py | thevickypedia/api_file_handler | 2 | 49543 | <filename>models/secrets.py
import getpass
import os
import pwd
from tortoise.models import Model
class Secrets(Model):
"""Looks for the env vars ``USER`` and ``PASSWORD``, requests from the user if unavailable.
>>> Secrets
"""
USERNAME: str = os.environ.get('USER', getpass.getuser() or pwd.getpwu... | 3.015625 | 3 |
src/news/models/__init__.py | thimmy687/tunews | 3 | 49544 | from .newslanguage import NewsLanguage
from .newscategory import NewsCategory
from .newsitem import NewsItem
| 1.046875 | 1 |
pyteleport/tests/_test_teleport_try_w_stack.py | pulkin/pyteleport | 9 | 49545 | <reponame>pulkin/pyteleport<gh_stars>1-10
"""
[True] loop 0
[True] try
[True] teleport
[True] vstack [!<class 'range_iterator'>, !<class 'range_iterator'>]
[True] bstack [122/1, 122/1]
[False] vstack [!<class 'range_iterator'>, !<class 'range_iterator'>]
[False] bstack [122/1, 122/1]
[False] raise
[False] CustomExcepti... | 2.28125 | 2 |
test/test_stopconditions.py | satorchi/pyoperators | 5 | 49546 | from __future__ import division
import itertools
from pyoperators.iterative.stopconditions import StopCondition
from pyoperators.utils.testing import assert_eq, assert_raises
class A():
pass
sc1 = StopCondition(lambda s: s.a > 2, 'a>2')
sc2 = StopCondition(lambda s: s.b > 2, 'b>2')
sc3 = StopCondition(lambda s... | 3.125 | 3 |
w3/python/core/exception.py | Hepheir/Python-HTML-parser | 4 | 49547 | from ctypes import c_ushort
class DOMException(Exception):
"""Exception `DOMException`
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform
(either for logical reasons, because data is lost, or because the implementation has become unstable... | 3.375 | 3 |
libica/openapi/libgds/models/aws_s3_temporary_upload_credentials.py | umccr-illumina/libica | 0 | 49548 | <gh_stars>0
# coding: utf-8
"""
Genomic Data Store Service
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noq... | 1.382813 | 1 |
func_bomb.py | kenteroshima/raspi_bomb_game | 0 | 49549 | <filename>func_bomb.py
import wiringpi as pi
from so1602 import so1602
#Setting 7seg display in i2c#flag
i2c = pi.I2C()
seg = i2c.setup(0x71)#setup a device address
so1602_addr = 0x3c
so1602 = so1602( i2c, so1602_addr )
### 7seg function ###
def seg_reset():
#Clear & display colon#
i2c.write(seg, 0x76)
i2... | 2.734375 | 3 |
playlists/migrations/0006_auto_20210316_2355.py | KibetRonoh/Movie_Zone_-Django | 58 | 49550 | # Generated by Django 3.2b1 on 2021-03-16 23:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('videos', '0012_alter_video_video_id'),
('playlists', '0005_remove_playlist_videos'),
]
operations = [
... | 1.8125 | 2 |
bbp/comps/convert_pacc2bbpacc.py | ZhangHCFJEA/bbp | 28 | 49551 | """
Copyright 2010-2018 University Of Southern California
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... | 2.09375 | 2 |
markdown_generator/pubsFromBib.py | pagutierrez/pagutierrez.github.io | 0 | 49552 | #!/usr/bin/env python
# coding: utf-8
# # Publications markdown generator for academicpages
#
# Takes a set of bibtex of publications and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.... | 2.78125 | 3 |
python/tests/test_client.py | liaoyustudent/antchain-openapi-util-sdk | 0 | 49553 | <reponame>liaoyustudent/antchain-openapi-util-sdk
import unittest
from antchain_alipay_util.client import Client
class TestClient(unittest.TestCase):
def test_get_timestamp(self):
timestamp = Client.get_timestamp()
self.assertEqual(20, len(timestamp))
def test_has_error(self):
... | 2.5625 | 3 |
ProjectSimulator/Labels.py | awzdevelopers/SimulatorOfAWZ | 0 | 49554 | <gh_stars>0
import pygame as py
def TitleOfSim(title,displayGame):
font=py.font.SysFont("B-Zar",25)
text=font.render(title,True,(50,200,155))
displayGame.blit(text,(50,50))
def Messages(title,displayGame):
font=py.font.SysFont("B-Zar",25)
text=font.render(title,True,(50,0,155))
displayGame.bli... | 2.828125 | 3 |
pre-benchmarks/Lisp_interpreter/interpreter/Tests/Test_Interpreter.py | nuprl/retic_performance | 3 | 49555 | <filename>pre-benchmarks/Lisp_interpreter/interpreter/Tests/Test_Interpreter.py<gh_stars>1-10
import pytest
import sys
sys.path.insert(0, '/Users/zeinamigeed/Lisp_interpreter/interpreter/BSL_Expr')
sys.path.insert(0, '/Users/zeinamigeed/Lisp_interpreter/interpreter/Other')
from Variable import Variable
from BSLError ... | 2.359375 | 2 |
Perro/main.py | SebaB29/Python | 0 | 49556 | <gh_stars>0
from os import system
from estado import estado
from mochila import mochila
from tienda import comprar
from alimento import alimentar
from acciones import pasear, jugar, truco, nuevos_trucos, dormir
class Perro:
def __init__(self, energia=100, hambre=100, felicidad=100, experiencia=0):
self.energia = ... | 3.4375 | 3 |
converted.py | Bmillidgework/Misc-Maths | 0 | 49557 | <reponame>Bmillidgework/Misc-Maths<gh_stars>0
from kaffe.tensorflow import Network
class (Network):
def setup(self):
(self.feed('input')
.conv(1, 1, 3, 1, 1, group=3, relu=False, name='data_lab')
.conv(11, 11, 96, 4, 4, padding='VALID', name='conv1')
.max_pool(3, 3, 2... | 2.46875 | 2 |
tartiflette_middleware/middleware.py | daveoconnor/tartiflette-middleware | 0 | 49558 | <reponame>daveoconnor/tartiflette-middleware
class Middleware:
def __init__(self, context_manager, server_middleware):
"""
:param BaseMiddleware Your custom middleware
:param package Middleware from the middleware package
"""
self._service = context_manager
self._midd... | 2.671875 | 3 |
pynex/hello_msg.py | Pixelsuft/pynex | 0 | 49559 | <reponame>Pixelsuft/pynex
import os
import sys
is_already_inited = sys.modules.get('pygame') is not None
hide_msg = os.getenv('PYGAME_HIDE_SUPPORT_PROMPT') is not None
if is_already_inited:
if not hide_msg:
print('pynex integrated')
elif not hide_msg:
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = 'True'
... | 2.578125 | 3 |
MakeCartoonImage.py | scottstewart1234/MakeCartoonImage | 2 | 49560 | <reponame>scottstewart1234/MakeCartoonImage
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 9 10:49:07 2022
@author: <NAME>
License: MIT
"""
import cv2
import numpy as np
import signal
import sys
def sigint_handler(signal, frame):
print ('KeyboardInterrupt. Program Exiting')
vral = ... | 2.484375 | 2 |
tests/util/test_default.py | idomic/ploomber | 0 | 49561 | import os
from pathlib import Path
import pytest
from ploomber.util import default
from ploomber.exceptions import DAGSpecNotFound
@pytest.fixture
def pkg_location():
parent = Path('src', 'package_a')
parent.mkdir(parents=True)
pkg_location = (parent / 'pipeline.yaml')
pkg_location.touch()
retur... | 2.09375 | 2 |
users/migrations/0002_endworker_group.py | heolin123/funcrowd | 0 | 49562 | <filename>users/migrations/0002_endworker_group.py
# Generated by Django 2.0.8 on 2018-12-16 12:59
from django.db import migrations, models
import users.models.utils.utils
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddF... | 1.53125 | 2 |
Squaring Spiral.py | Pallav277/Python_Turtle_Graphics | 0 | 49563 | import turtle
turtle.bgcolor("black")
sq = turtle.Turtle()
sq.speed(20)
sq.color("white")
for i in range(500):
sq.forward(i)
sq.left(91)
| 3.625 | 4 |
routes.py | fndiaz/conferencia | 0 | 49564 | routers = dict(
# base router
BASE=dict(
default_application='projeto',
applications=['projeto', 'admin',]
),
projeto=dict(
default_controller='initial',
default_function='principal',
controllers=['initial', 'manager'],
functions=['home', 'contact', 'about', 'user', '... | 1.835938 | 2 |
Object oriented programming.py | fatimatswanya/fatimaCSC102 | 0 | 49565 | <reponame>fatimatswanya/fatimaCSC102
class Coffee:
coffeecupcounter =0
def __init__(self, themilk, thesugar, thecoffeemate):
self.milk = themilk
self.sugar = thesugar
self.coffeemate = thecoffeemate
Coffee.coffeecupcounter=Coffee.coffeecupcounter+1
print(f'You now have ... | 3.78125 | 4 |
crawl_all_sites.py | VETURISRIRAM/smart-search | 4 | 49566 | """
@author: <NAME>
@title: SmartSearch - An Intelligent Search Engine.
@date: 05/06/2019
"""
import requests
from uuid import uuid4
from bs4 import BeautifulSoup
from urllib.parse import urlsplit
DOMAIN = "uic.edu"
def check_goodness(url):
"""
Function to check if the url is a dead end (pds, doc, docx, etc... | 3.1875 | 3 |
923-3sum-with-multiplicity/923-3sum-with-multiplicity.py | felirox/DS-Algos-Python | 0 | 49567 | class Solution:
def threeSumMulti(self, arr, target):
c = Counter(arr)
ans, M = 0, 10**9 + 7
for i, j in permutations(c, 2):
if i < j < target - i - j:
ans += c[i]*c[j]*c[target - i - j]
for i in c:
if 3*i != target:
ans += c[i... | 3.109375 | 3 |
BaseCollector.py | durcar86/vrops-exporter | 0 | 49568 | from abc import ABC, abstractmethod
import requests
import time
import os
class BaseCollector(ABC):
@abstractmethod
def collect(self):
pass
def get_vcenters(self):
current_iteration = self.get_iteration()
url = "http://localhost:8000/vcenters/{}".format(current_iteration)
... | 3.046875 | 3 |
pip_services3_commons/convert/MapConverter.py | pip-services-python/pip-services-commons-python | 0 | 49569 | # -*- coding: utf-8 -*-
"""
pip_services3_commons.convert.MapConverter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Map conversion utilities
:copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from typing impor... | 3.453125 | 3 |
python/misc/frequencies_map/frequencies_map_test.py | TGITS/programming-workouts | 0 | 49570 | <reponame>TGITS/programming-workouts
import unittest
from frequencies_map import frequencies_map_with_comprehension_from, frequencies_map_with_for_from, frequencies_map_with_map_from, frequencies_map_with_counter_from
class FrequenciesMapWithForTest(unittest.TestCase):
def test_empty_list(self):
self.ass... | 3.09375 | 3 |
Python 3 exercises/44 python answers/Ordem 3) Par Impar.py | Matheus-R-Sena/Python | 2 | 49571 | <reponame>Matheus-R-Sena/Python
n = int(input())
P = [] #pares
I = [] #ímpares
V = [] #Vetor principal
t = 0
for i in range (n):
V.append(int(input()))
for i in range(len(V)): #dividindo o vetor em 2 vetores menores (Par e Impar)
if V[i]%2==0:
P.append(V[i]) #dividindo para par
else:
I.app... | 3 | 3 |
src/spc/__init__.py | whbrewer/spc | 12 | 49572 | <gh_stars>10-100
__author__ = '<NAME>'
__license__ = 'MIT'
| 1.03125 | 1 |
streaming/jobs/twitter-in.py | andrewreece/cs205-final-project | 0 | 49573 |
from kafka import SimpleProducer, KafkaClient
from os.path import expanduser
import requests
from requests_oauthlib import OAuth1
import urllib, datetime, time, json, sys, boto3
import creds # we made this module for importing twitter api creds
client = boto3.client('emr')
s3res = boto3.resource('s3')
bucket_name ... | 2.53125 | 3 |
docs/examples/tutorial/clibraries/queue3.py | johannes-mueller/cython | 6,663 | 49574 | <gh_stars>1000+
from cython.cimports import cqueue
from cython import cast
@cython.cclass
class Queue:
"""A queue class for C integer values.
>>> q = Queue()
>>> q.append(5)
>>> q.peek()
5
>>> q.pop()
5
"""
_c_queue = cython.declare(cython.pointer(cqueue.Queue))
def __cinit__(s... | 2.828125 | 3 |
tests/test_intset.py | popravich/rdbtools3 | 3 | 49575 | import unittest
from rdbtools3.intset import unpack_intset
from rdbtools3.exceptions import RDBValueError
class TestIntset(unittest.TestCase):
def test_3x2bytes(self):
val = (b'\x02\x00\x00\x00' # int size
b'\x03\x00\x00\x00' # set length
b'\x01\x00' # item 1
... | 2.671875 | 3 |
scripts/python/quality_control.py | josegcpa/haemorasis | 0 | 49576 | """
Predicts which tiles are of good quality in WBS.
Usage:
python3 quality_control.py --help
"""
import argparse
from tqdm import tqdm
import tensorflow as tf
from tensorflow import keras
from glob import glob
from quality_net_utilities import *
from image_generator import *
n_channels = 3
if __name__ == "__m... | 2.59375 | 3 |
examples/three_bit_memory.py | FedeClaudi/pyrnn | 4 | 49577 | <filename>examples/three_bit_memory.py
import numpy as np
from numpy import random as rnd
import matplotlib.pyplot as plt
import torch
from myterial import salmon, light_green_dark, indigo_light
from pyrnn._plot import clean_axes
import torch.utils.data as data
import sys
from rich.progress import track
"""
3 bit ... | 3.28125 | 3 |
core/feature/activity/import_model_files.py | MD2Korg/CerebralCortex-DataAnalysis | 1 | 49578 | <filename>core/feature/activity/import_model_files.py
# Copyright (c) 2018, MD2K Center of Excellence
# - <NAME> <<EMAIL>>
# 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 ... | 1.8125 | 2 |
src/stk/molecular/topology_graphs/cof/square.py | stevenbennett96/stk | 0 | 49579 | """
Square
======
"""
import numpy as np
from ..topology_graph import Edge
from .cof import Cof
from .vertices import LinearVertex, NonLinearVertex
class Square(Cof):
"""
Represents a sqaure COF topology graph.
Unoptimized construction
.. moldoc::
import moldoc.molecule as molecule
... | 2.8125 | 3 |
Miscellaneous/List appender.py | TausifAnsari/PyHub | 1 | 49580 | <reponame>TausifAnsari/PyHub<gh_stars>1-10
"""
Program Description :
List appender is a simple program that allows you to append data, either a single word or a sequence of words,
to a list. To stop adding elements, type !quit. It helps create lists easily when the number of elements
is a lot.
"""
def List_appender():... | 3.875 | 4 |
versions/2.0/karma/python/atf-scripts.py | Lituta/dig-alignment | 5 | 49581 | # Scripts for modeling ATF data.
def atf_article_uri(url, post_id):
return get_url_hash(url)+"/"+post_id
def atf_thread_uri(url):
return get_url_hash(url)
test_date = "Wed Feb 11, 2015 10:31 am"
def atf_date_created(date, format="%a %b %d, %Y %I:%M %p"):
"""Put the date in ISO format"""
return iso86... | 2.75 | 3 |
tests/test_model.py | hattya/ayame | 1 | 49582 | #
# test_model
#
# Copyright (c) 2011-2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: MIT
#
import ayame
from ayame import model
from base import AyameTestCase
class ModelTestCase(AyameTestCase):
def test_model(self):
m = model.Model(None)
self.assertIsNone(m.object)
m.object = '... | 2.421875 | 2 |
DataStructuresInPython/tree/BinaryTree.py | rahamath2009/git-github.com-nishant-sethi-HackerRank | 76 | 49583 | '''
Created on Jun 4, 2018
@author: nishant.sethi
'''
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
# Compare the new value with the parent node
if self.data:
if data < self.... | 4.03125 | 4 |
ahserver/server/protocol/__init__.py | ifplusor/ahserver | 1 | 49584 | <reponame>ifplusor/ahserver<gh_stars>1-10
# encoding=utf-8
__all__ = [
"HttpMethod",
"HttpVersion",
"HttpStatus",
"HttpHeader",
"PopularHeaders",
]
from enum import Enum
from ahserver.util.parser import FieldNameEnumParser, IntPairEnumParser
from . import httpheader as HttpHeader
@FieldNameEnu... | 2.484375 | 2 |
examples/HelloAPI/app/__init__.py | neo1218/rest | 3 | 49585 | # coding: utf-8
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from config import config
app = Flask(__name__)
"""
config
-- 'default': DevelopmentConfig
-- 'develop': DevelopmentConfig
-- 'testing': TestingConfig
-- 'production': ProductionConfig
you can... | 2.359375 | 2 |
botc/gamemodes/sectsandviolets/Oracle.py | Xinverse/BOTC-Bot | 1 | 49586 | <filename>botc/gamemodes/sectsandviolets/Oracle.py
"""Contains the Oracle Character class"""
import json
from botc import Character, Townsfolk
from ._utils import SectsAndViolets, SnVRole
with open('botc/gamemodes/sectsandviolets/character_text.json') as json_file:
character_text = json.load(json_file)[SnVRole.or... | 2.890625 | 3 |
Elastic/ElasticPutDocs.py | mvdhoek/DSB-ReSeT | 0 | 49587 | <reponame>mvdhoek/DSB-ReSeT
# A python script to upload safety reports to Elasticsearch
import elasticsearch as es
from elasticsearch import helpers
import logging
import base64
from os import listdir
from os.path import isfile, join
import hashlib
import pandas as pd
# DEFINITIONS -----------------------------------... | 2.28125 | 2 |
tests/test_models.py | wecode12/TheBlog | 0 | 49588 | import unittest
from app.models import User,Posts,Comments,Subscribe
class UserModelTest(unittest.TestCase):
def setUp(self):
self.new_user = User(password = '<PASSWORD>')
def test_password_setter(self):
self.assertTrue(self.new_user.pass_secure is not None)
def test_no_access_pa... | 3.453125 | 3 |
Tools/cvsTool/csvtool.py | codumpython/csv2DB | 0 | 49589 | import csv
import os
class csvReader:
def __init__(self, address) -> None:
self.address = address
self.data = []
def read(self, delimiter=",") -> None:
with open(self.address) as csvfile:
reader = csv.reader(csvfile, delimiter=delimiter)
self.fields = next(read... | 3.65625 | 4 |
Python/Client/RasPi_coms.py | henrymidles/LidarBot | 0 | 49590 | <gh_stars>0
import math
import time
from queue import Queue
HOST = 'raspberrypi' # The server's hostname or IP address
PORT = 65432 # The port used by the server
""" This thread gets data from the socket, parses it, and sends it to the queue to be displayed """
class RasPi_coms():
def __init__(self,... | 3.171875 | 3 |
wechat/content/__init__.py | windskyer/wechat | 1 | 49591 | <gh_stars>1-10
# -*- coding: UTF-8 -*-
import random
import logging
from wechat.content import hitokoto
from wechat.content import iciba
log = logging.getLogger('apscheduler.executors.default')
# 随机选择文库
def get_content(num=0):
if not num:
num = random.randint(0, 2)
if num and num == 1:
conte... | 2.453125 | 2 |
src/main.py | DMinghao/Stock_Trading_Bot | 1 | 49592 | <filename>src/main.py
from utility import util
CONN = util.connectAlpaca()
class algo:
pass
| 1.257813 | 1 |
application.py | dyphen12/vibra | 0 | 49593 | # Made by @dyphen12
from flask import Flask, request
from flask_cors import CORS
from flask_restful import reqparse, abort, Api, Resource
import json
import os
from vibra.api.core import api_version
from vibra.api.users import handler as uhd
app = Flask(__name__)
api = Api(app)
CORS(app)
class Hello(Resource):
... | 2.5 | 2 |
workers/libyear_worker/Libyear.py | ajhenry00/augur | 2 | 49594 | <gh_stars>1-10
from pypi import get_lib_days, get_no_of_releases
from utils import load_requirements, get_requirement_files, get_requirement_name_and_version
class Libyear:
def __init__(self, config={}):
name = "libyear"
def get_libyear(self, path):
requirements = set()
requiremen... | 2.5625 | 3 |
config/urls.py | Tvrsch/my_receipts | 0 | 49595 | from allauth.account.views import confirm_email as confirm_email_view
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path, re_path
from django.views import defaults as default_views
from django.views.generic import TemplateVi... | 1.84375 | 2 |
jyserver/Flask.py | ftrias/jyserver | 10 | 49596 | '''
Module for using jyserver in Flask. This module provides to new
decorators.
Decorators
-----------
* @use
Link an application object to the Flask app
* @task
Helper that wraps a function inside a separate thread so that
it can execute concurrently.
Example
-------------
```html
<p id="time">TIME</... | 3.125 | 3 |
venv/Lib/site-packages/json_tricks/nonp.py | mintzer/pupillometry-rf-back | 145 | 49597 | <reponame>mintzer/pupillometry-rf-back
import warnings
from json import loads as json_loads
from os import fsync
from sys import exc_info
from json_tricks.utils import is_py3, dict_default, gzip_compress, gzip_decompress, JsonTricksDeprecation
from .utils import str_type, NoNumpyException # keep 'unused' imports
from... | 1.429688 | 1 |
notion2pg.py | aaugustin/notion2pg | 6 | 49598 | <filename>notion2pg.py
#!/usr/bin/env python
# Notes on formulas
# -----------------
#
# There are four output types of formulas:
#
# 1. string
# 2. number
# 3. date — never a date range, unlike date properties
# 4. boolean
# Notes on rollups
# ----------------
#
# There are four signatures of rollup functions:
#
# 1... | 2.546875 | 3 |
leo3ltb/scheduler/profiler.py | leoprover/ltb | 0 | 49599 | import pandas as pd
import matplotlib.cm as cm
import numpy as np
import matplotlib.pyplot as plt
def plot(problemVariants, *, zero, outfile, numThreads):
columns = ['Problem', 'NotTriedYet', 'Scheduled', 'Success', 'Timeout', 'Stopped', 'Ended']
colors = ['w', 'tab:purple', 'tab:green', 'tab:orange', 'tab:red... | 2.515625 | 3 |