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 |
|---|---|---|---|---|---|---|
src/django_idom/config.py | idom-team/django-idom | 82 | 32700 | <reponame>idom-team/django-idom<filename>src/django_idom/config.py
from typing import Dict
from django.conf import settings
from django.core.cache import DEFAULT_CACHE_ALIAS
from idom.core.proto import ComponentConstructor
IDOM_REGISTERED_COMPONENTS: Dict[str, ComponentConstructor] = {}
IDOM_BASE_URL = getattr(sett... | 1.796875 | 2 |
ox_herd/core/plugins/awstools_plugin/forms.py | empower-capital/ox_herd | 1 | 32701 | """Forms for ox_herd commands.
"""
from wtforms import StringField
from ox_herd.core.plugins import base
class BackupForm(base.GenericOxForm):
"""Use this form to enter parameters for a new backup job.
"""
bucket_name = StringField(
'bucket_name', [], description=(
'Name of AWS bucke... | 2.5625 | 3 |
rpiRobot/test/dexterity/infrastructure/test_electromagnetGPIO.py | olgam4/design3 | 0 | 32702 | <filename>rpiRobot/test/dexterity/infrastructure/test_electromagnetGPIO.py
from unittest import TestCase
from unittest.mock import patch, Mock, DEFAULT, call
from dexterity.infrastructure.electromagnetGPIO import ElectromagnetGPIO
class TestElectromagnetGPIO(TestCase):
def setUp(self) -> None:
led_patche... | 2.578125 | 3 |
cog/__init__.py | uniphil/cog | 158 | 32703 | <filename>cog/__init__.py
def cog():
return "Cog is alive."
| 1.859375 | 2 |
app_folder/schemas/api.py | Nuznhy/day-f-hack | 2 | 32704 | from pydantic import BaseModel
class ReadyResponse(BaseModel):
status: str
| 1.640625 | 2 |
bots/rand/rand.py | markmelnic/IS-Project | 51 | 32705 | <filename>bots/rand/rand.py
"""
RandomBot -- A simple strategy: enumerates all legal moves, and picks one
uniformly at random.
"""
# Import the API objects
from api import State
import random
class Bot:
def __init__(self):
pass
def get_move(self, state):
# type: (State) -> tuple[int, int]
... | 4.125 | 4 |
storeAdjust/models.py | FreeGodCode/store | 0 | 32706 | <gh_stars>0
import datetime
from django.db import models
class TransferRequest(models.Model):
"""转库申请单"""
STR_STATUS_CHOICES = (
(0, '草稿'),
(1, '已审批')
)
id = models.AutoField(primary_key=True)
str_identify = models.CharField(max_length=15, verbose_name='转库申请单编号')
str_serial = m... | 2.0625 | 2 |
auctions/context_processors/footer_ctx.py | AH-SALAH/CS50W-commerce | 0 | 32707 | <gh_stars>0
from auctions.models import Category, Listing
from django.utils.timezone import now as tz_now
def footer_ctx(request):
listings = Listing.objects.filter(is_active=True, published_date__lte=tz_now(),
expiry_date__gt=tz_now())[:5]
categories = Category.objects... | 1.984375 | 2 |
sga/operators.py | ggarrett13/genetic-algorithm-example | 1 | 32708 | import numpy as np
import operator
# TODO: Make Mutation Operator.
class TerminationCriteria:
@staticmethod
def _convergence_check(convergence_ratio, population_fitness):
if abs((np.max(population_fitness) - np.mean(population_fitness)) / np.mean(
population_fitness)) <= convergence_... | 2.9375 | 3 |
validation/__init__.py | pauloubuntu/ocr-processing-service | 22 | 32709 | <gh_stars>10-100
__author__ = 'paulo.rodenas'
| 1.171875 | 1 |
setup.py | gabeabrams/niu | 0 | 32710 | from distutils.core import setup
setup(
name = 'niu',
packages = ['niu'],
version = '0.2',
description = 'A grouping and pairing library',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/gabeabrams/niu',
download_url = 'https://github.com/gabeabrams/niu/archive/0.1.tar.gz',
key... | 1.03125 | 1 |
etherscan/stats.py | adamzhang1987/py-etherscan-api | 458 | 32711 | from .client import Client
class Stats(Client):
def __init__(self, api_key='YourApiKeyToken'):
Client.__init__(self, address='', api_key=api_key)
self.url_dict[self.MODULE] = 'stats'
def get_total_ether_supply(self):
self.url_dict[self.ACTION] = 'ethsupply'
self.build_url()
... | 2.609375 | 3 |
hidrocomp/graphics/gantt.py | clebsonpy/HydroComp | 4 | 32712 | <reponame>clebsonpy/HydroComp
import pandas as pd
import numpy as np
import calendar
import datetime
import plotly as py
import plotly.graph_objs as go
class Gantt(object):
def __init__(self, data):
self.data = data
def get_gantt(self, df, less, index):
color = 0
n = 1
for ... | 2.765625 | 3 |
solid/recources/lab_drafts/01_SRP/books.py | BoyanPeychinov/object_oriented_programming | 0 | 32713 | <reponame>BoyanPeychinov/object_oriented_programming
class Book:
def __init__(self, title, author, location):
self.title = title
self.author = author
self.location = location
self.page = 0
def turn_page(self, page):
self.page = page
| 3.296875 | 3 |
scripts/clues_ancient_samples.py | ekirving/mesoneo_paper | 0 | 32714 | <reponame>ekirving/mesoneo_paper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, University of Copenhagen"
__email__ = "<EMAIL>"
__license__ = "MIT"
import os
import sys
from math import log
import click
import pysam
import yaml
sys.path.append(os.getcwd())
from... | 2 | 2 |
auth/app.py | Celeo/GETIN-HR | 0 | 32715 | import logging
from datetime import timedelta
from flask import Flask, render_template, redirect, request, url_for, flash
from flask_login import LoginManager, login_user, logout_user, current_user
from preston.crest import Preston as CREST
from preston.xmlapi import Preston as XMLAPI
from auth.shared import db, evea... | 2.03125 | 2 |
setup.py | cathalmccabe/IIoT-SPYN | 1 | 32716 | <gh_stars>1-10
# Copyright (c) 2018, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# ... | 1.164063 | 1 |
eth2/beacon/tools/builder/initializer.py | Jwomers/trinity | 0 | 32717 | <reponame>Jwomers/trinity
from typing import (
Dict,
Sequence,
Tuple,
Type,
)
from eth2.beacon.on_startup import (
get_genesis_block,
get_initial_beacon_state,
)
from eth2.beacon.state_machines.configs import BeaconConfig
from eth2.beacon.types.blocks import (
BaseBeaconBlock,
)
from eth2... | 1.984375 | 2 |
settings.py | oogles/django-goodies | 2 | 32718 | # Minimal settings file to allow the running of tests, execution of migrations,
# and several other useful management commands.
SECRET_KEY = '<KEY>' # nosec
# Needs to point to something to allow tests to perform url resolving. The file
# doesn't actually need to contain any urls (but does need to define "urlpattern... | 1.9375 | 2 |
SimpleSign.py | wanzhiguo/mininero | 182 | 32719 | import MiniNero
import ed25519
import binascii
import PaperWallet
import cherrypy
import os
import time
import bitmonerod
import SimpleXMR2
import SimpleServer
message = "send0d000114545737471em2WCg9QKxRxbo6S3xKF2K4UDvdu6hMc"
message = "send0d0114545747771em2WCg9QKxRxbo6S3xKF2K4UDvdu6hMc"
sec = raw_input("sec?")
print... | 2.046875 | 2 |
lib/logger.py | amkolhar/JamaAutomation | 0 | 32720 | <gh_stars>0
# <NAME> (atharv)
import logging
import warnings
warnings.filterwarnings("ignore")
jamalogger = logging.getLogger("JAMALIB")
jamalogger.setLevel(logging.DEBUG)
handle = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s',
... | 2.171875 | 2 |
src/common/download.py | Nut-Guo/adv | 2 | 32721 | <filename>src/common/download.py
import os
import requests
import logging
from tqdm import tqdm as tq
import zipfile
import tarfile
def download_file(url: str, path: str, verbose: bool = False) -> None:
"""
Download file with progressbar
Usage:
download_file('http://web4host.net/5MB.zip')
"""... | 3.171875 | 3 |
vedasal/criteria/losses/builder.py | Kuro96/vedasal | 2 | 32722 | from vedacore.misc import registry, build_from_cfg
def build_loss(cfg):
loss = build_from_cfg(cfg, registry, 'loss')
return loss
| 1.84375 | 2 |
django_rest_scaffold/management/commands/create-model.py | regisec/django-rest-scaffold | 0 | 32723 | # -*- coding: UTF-8 -*-
"""
Created by <NAME> <<EMAIL>> on 19/06/2016.
"""
import os
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from django_rest_scaffold.settings import DJANGO_REST_SCAFFOLD_SETTINGS as SETTINGS
class Command(BaseCommand):
help = 'Creates ... | 2.203125 | 2 |
social_api/urls.py | muhfajar/social_api | 0 | 32724 | <gh_stars>0
"""social_api URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='... | 2.375 | 2 |
src/meta_memcache/base/connection_pool.py | RevenueCat/meta-memcache-py | 0 | 32725 | <gh_stars>0
import itertools
import logging
import socket
import time
from collections import deque
from contextlib import contextmanager
from typing import Callable, Deque, Generator, NamedTuple, Optional
from meta_memcache.base.memcache_socket import MemcacheSocket
from meta_memcache.errors import MemcacheServerErro... | 2.25 | 2 |
src/derl/tracker.py | tpiekarski/derl | 10 | 32726 | #
# derl: CLI Utility for searching for dead URLs <https://github.com/tpiekarski/derl>
# ---
# Copyright 2020 <NAME> <<EMAIL>>
#
from time import perf_counter
from derl.model.stats import Stats
class Singleton(type):
_instances = {}
def __call__(cls: "Singleton", *args: tuple, **kwargs: dict) -> "Tracker":... | 2.515625 | 3 |
class/lect/Lect-06/shuffle.py | MikenzieAlasca/F21-1010 | 5 | 32727 | import random
import copy
rr = random.Random ( 22 )
def readNameList(fn):
f = open(fn,"r")
if f == None:
print ( f"Invalid file {fn} - failed to open" )
return None
dt = f.readlines()
f.close()
for i in range (len(dt)):
s = dt[i].rstrip()
dt[i] = s
return dt
... | 3.359375 | 3 |
step_impl/http.py | WorldHealthOrganization/ddcc-gateway-api-tests | 0 | 32728 | <reponame>WorldHealthOrganization/ddcc-gateway-api-tests<filename>step_impl/http.py
# ---license-start
# eu-digital-green-certificates / dgc-api-tests
# ---
# Copyright (C) 2021 T-Systems International GmbH and all other contributors
# ---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not ... | 2.109375 | 2 |
celligner2/surgery/trvae.py | broadinstitute/celligner2 | 0 | 32729 | import numpy as np
import torch
import anndata
from celligner2.othermodels.trvae.trvae import trVAE
from celligner2.trainers.trvae.unsupervised import trVAETrainer
def trvae_operate(
network: trVAE,
data: anndata,
condition_key: str = None,
size_factor_key: str = None,
n_epoch... | 2.390625 | 2 |
helpers/connections.py | cheak1974/remi-app-template | 12 | 32730 | import datetime
import remi
import core.globals
connected_clients = {} # Dict with key=session id of App Instance and value=ws_client.client_address of App Instance
connected_clients['number'] = 0 # Special Dict Field for amount of active connections
client_route_url_to... | 2.28125 | 2 |
tests/api/endpoints/admin/test_two_factor_auth.py | weimens/seahub | 420 | 32731 | <reponame>weimens/seahub
import os
import pytest
from django.urls import reverse
from seahub.options.models import (UserOptions, KEY_FORCE_2FA, VAL_FORCE_2FA)
from seahub.test_utils import BaseTestCase
from seahub.two_factor.models import TOTPDevice, devices_for_user
TRAVIS = 'TRAVIS' in os.environ
@pytest.mark.ski... | 2.21875 | 2 |
saucenao/http.py | DaRealFreak/saucenao | 30 | 32732 | <reponame>DaRealFreak/saucenao
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
from saucenao.exceptions import *
PREVIOUS_STATUS_CODE = None
STATUS_CODE_OK = 1
STATUS_CODE_SKIP = 2
STATUS_CODE_REPEAT = 3
def verify_status_code(request_response: requests.Response) -> tuple:
"""Verify the status code ... | 3.046875 | 3 |
dialogue/sinodoju.py | jeanlucancey/pronunciamento | 0 | 32733 | import time
from os import system
from django.http import HttpResponse
from django.template import Context, loader
from django.views.decorators.csrf import csrf_exempt # Pour des formulaires POST libres
from jla_utils.utils import Fichier
from .models import ElementDialogue
class Tunnel:
def __init__(self, long... | 2.09375 | 2 |
tools/python/boutiques/tests/test_bids.py | shots47s/boutiques | 54 | 32734 | #!/usr/bin/env python
from unittest import TestCase
from boutiques.bosh import bosh
from boutiques.bids import validate_bids
from boutiques import __file__ as bofile
from jsonschema.exceptions import ValidationError
from boutiques.validator import DescriptorValidationError
import os.path as op
import simplejson as jso... | 2.6875 | 3 |
libs/yowsup/yowsup/yowsup/layers/protocol_receipts/protocolentities/test_receipt_outgoing.py | akshitpradhan/TomHack | 22 | 32735 | <gh_stars>10-100
from yowsup.layers.protocol_receipts.protocolentities import OutgoingReceiptProtocolEntity
from yowsup.structs.protocolentity import ProtocolEntityTest
import unittest
class OutgoingReceiptProtocolEntityTest(ProtocolEntityTest, unittest.TestCase):
def setUp(self):
self.ProtocolEntity = Out... | 1.726563 | 2 |
empire/server/modules/powershell/situational_awareness/network/get_sql_server_info.py | awsmhacks/Empire | 0 | 32736 | from __future__ import print_function
import pathlib
from builtins import object, str
from typing import Dict
from empire.server.common import helpers
from empire.server.common.module_models import PydanticModule
from empire.server.utils import data_util
from empire.server.utils.module_util import handle_error_messag... | 2.3125 | 2 |
gameplay/urls.py | Urosh91/TicTacToe | 0 | 32737 | <gh_stars>0
from django.urls import path
from .views import game_detail, make_move
urlpatterns = [
path(r'detail/<int:id>/', game_detail, name="gameplay_detail"),
path(r'make_move/<int:id>', make_move, name="gameplay_make_move")
]
| 1.59375 | 2 |
setup.py | Bonifatius94/sc2sim | 0 | 32738 | <gh_stars>0
from setuptools import setup
def load_pip_dependency_list():
with open('./requirements.txt', 'r', encoding='utf-8') as file:
return file.read().splitlines()
def load_readme_desc():
with open("README.md", "r", encoding="utf-8") as readme_file:
return readme_file.read()
setup(
n... | 1.710938 | 2 |
2016/24/air_duct_spelunking.py | GeoffRiley/AdventOfCode | 2 | 32739 | from collections import defaultdict
from itertools import permutations
import networkx as nx
def air_duct_spelunking(inp, part1=True):
max_y = len(inp)
max_x = max(len(line) for line in inp)
grid = defaultdict(lambda: '#')
numbers = defaultdict(lambda: '')
route_list = defaultdict(lambda: 0)
... | 3.046875 | 3 |
src/bo4e/com/angebotsteil.py | bo4e/BO4E-python | 1 | 32740 | <reponame>bo4e/BO4E-python<filename>src/bo4e/com/angebotsteil.py
"""
Contains Angebotsteil class
and corresponding marshmallow schema for de-/serialization
"""
from typing import List, Optional
import attr
from marshmallow import fields
from bo4e.bo.marktlokation import Marktlokation, MarktlokationSchema
from bo4e.c... | 2.109375 | 2 |
lib/kb_kaiju/Utils/OutputBuilder.py | mclark58/kb_kaiju | 0 | 32741 | <filename>lib/kb_kaiju/Utils/OutputBuilder.py
import os
import shutil
import ast
import sys
import time
import re
from datetime import datetime as dt
import pytz
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import random
from random import shuffle
from biokbase.workspace.cl... | 2.21875 | 2 |
Gds/src/fprime_gds/wxgui/tools/PexpectRunnerConsolGUI.py | hunterpaulson/fprime | 0 | 32742 | <reponame>hunterpaulson/fprime
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version May 29 2018)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###################################################... | 1.65625 | 2 |
web/openerp/addons/base/tests/test_ir_actions.py | diogocs1/comps | 1 | 32743 | import unittest2
from openerp.osv.orm import except_orm
import openerp.tests.common as common
from openerp.tools import mute_logger
class TestServerActionsBase(common.TransactionCase):
def setUp(self):
super(TestServerActionsBase, self).setUp()
cr, uid = self.cr, self.uid
# Models
... | 2.140625 | 2 |
linchpin/provision/filter_plugins/duplicateattr.py | seandst/linchpin | 0 | 32744 | #!/usr/bin/env python
import os
import sys
import abc
import StringIO
from ansible import errors
def duplicateattr(output, attr, dattr):
new_output = []
for group in output:
if attr in group:
new_group = group
new_group[dattr] = group[attr]
new_output.append(new_grou... | 2.765625 | 3 |
memory.py | Bl41r/gb-emulator-python | 0 | 32745 | """Gameboy memory.
Cartridge
---------
[0000-3FFF] Cartridge ROM, bank 0: The first 16,384 bytes of the cartridge program are always available at this point in the memory map. Special circumstances apply:
[0000-00FF] BIOS: When the CPU starts up, PC starts at 0000h, which is the start of the 256-byte GameBoy BIOS code... | 2.765625 | 3 |
elstruct/reader/_orca4/surface.py | sjklipp/elstruct | 0 | 32746 | <gh_stars>0
""" gradient and hessian readers
"""
import numpy
import autoread as ar
import autoparse.pattern as app
def gradient(output_string):
""" read gradient from the output string
"""
grad = ar.matrix.read(
output_string,
start_ptt=app.padded(app.NEWLINE).join([
app.padde... | 2.875 | 3 |
Language/Parser/lr1_item.py | Chains99/Battlefield-Simulator | 0 | 32747 | <reponame>Chains99/Battlefield-Simulator
from Language.Grammar.grammar import Production, Symbol, Terminal
class LR1Item:
def __init__(self, production: Production, dot_index: int, lookahead: Terminal = None):
self._repr = ''
self.production = production
self.dot_index = dot_index
... | 2.84375 | 3 |
example/0_Basic_usage_of_the_library/python_feapder/1_quick_start/1_quick_start.py | RecluseXU/learning_spider | 38 | 32748 | # -*- coding: utf-8 -*-
"""
Created on 2021-03-11 18:53:58
---------
@summary:
抓糗事百科的案例
---------
@author: Administrator
"""
import feapder
class Spider(feapder.AirSpider):
def start_requests(self):
for page_num in range(1, 2):
url = "https://www.qiushibaike.com/8hr/page/{}/".format(page_... | 2.703125 | 3 |
Python3-GUI/Turtle01_Motion.py | anliven/L-Python | 0 | 32749 | <reponame>anliven/L-Python<gh_stars>0
# coding=utf-8
import turtle
t = turtle.Turtle()
t.goto(-50, 0)
for j in range(3):
t.forward(180)
t.right(120)
t.reset() # 清空窗口,重置turtle状态为起始状态
t2 = turtle.Turtle()
t2.speed(50)
for i in range(5):
t2.forward(150)
t2.right(144)
turtle.exitonclick(... | 3.875 | 4 |
backend/core/MlDiagnosis/ML_models/heartAttackPrediction/testDeploy.py | arc-arnob/Reddit-Clone | 0 | 32750 | <reponame>arc-arnob/Reddit-Clone
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 13 10:26:55 2021
@author: hp
"""
import importlib
import prediction
import numpy as np
dataframe_instance = []
msg = ["marital status","age","hypertension","heart","glucose"]
for i in range(13):
read = (float(input()))
dataframe_i... | 2.953125 | 3 |
lib/signtest.py | Laurancy-Dorian/DrawTheTableau | 0 | 32751 | import signal
import os
import time
def receive_signal(signum, stack):
print 'Received:', signum
signal.signal(signal.SIGUSR1, receive_signal)
signal.signal(signal.SIGUSR2, receive_signal)
signal.signal(signal.SIGINT, receive_signal)
print 'My PID is:', os.getpid()
while True:
print 'Waiting...'
time.sl... | 2.359375 | 2 |
maskfirst/masker.py | xianpf/CenterMask | 0 | 32752 | <reponame>xianpf/CenterMask<filename>maskfirst/masker.py
import torch
import torch.nn.functional as F
from maskrcnn_benchmark.structures.bounding_box import BoxList
# the next two functions should be merged inside Masker
# but are kept here for the moment while we need them
# temporarily gor paste_mask_in_image
def ex... | 2.21875 | 2 |
certbot-ventilator/tests/conftest.py | gerrito333/letsencrypt-cert-manager | 2 | 32753 | """Fixtures for tests."""
import json
import boto3
from moto import mock_dynamodb2
import pytest
from fixtures import LambdaContextMock
import payloads
@pytest.fixture
def event():
"""Return parsed event."""
with open('tests/payloads/success.json') as json_data:
return json.load(json_data)
@pytest... | 2.171875 | 2 |
smarc_bt/src/bt_actions.py | svbhat/smarc_missions | 0 | 32754 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# <NAME> (<EMAIL>)
import py_trees as pt
import py_trees_ros as ptr
import time
import numpy as np
import rospy
import tf
import actionlib
# from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from smarc_msgs.msg import GotoWaypointAction, Got... | 2 | 2 |
back-end/src/handler/common/image.py | gfxcc/san11-platform | 2 | 32755 | from __future__ import annotations
import logging
import os
import os.path
from ..util import gcs
logger = logging.getLogger(os.path.basename(__file__))
class Image:
def __init__(self, url) -> None:
self.url = url
def __str__(self) -> str:
return self.url
def delete(self):
gcs... | 2.375 | 2 |
diofant/tests/utilities/test_misc.py | rajkk1/diofant | 57 | 32756 | from diofant.utilities.decorator import no_attrs_in_subclass
__all__ = ()
def test_no_attrs_in_subclass():
class A:
x = 'test'
A.x = no_attrs_in_subclass(A, A.x)
class B(A):
pass
assert hasattr(A, 'x') is True
assert hasattr(B, 'x') is False
| 3.0625 | 3 |
ccc_client/app_repo/cli/upload_image.py | ohsu-comp-bio/ccc_client | 0 | 32757 | import argparse
from ccc_client.app_repo.AppRepoRunner import AppRepoRunner
from ccc_client.utils import print_API_response
def run(args):
runner = AppRepoRunner(args.host, args.port, args.authToken)
r = runner.upload_image(args.imageBlob, args.imageName, args.imageTag)
print_API_response(r)
if args... | 2.5625 | 3 |
src/simulation/entity.py | rah/optimal-search | 0 | 32758 | class Entity(object):
'''
An entity has:
- energy
- position(x,y)
- size(length, width)
An entity may have a parent entity
An entity may have child entities
'''
def __init__(
self,
p,
parent=None,
children=None):
... | 3.59375 | 4 |
utils/__init__.py | Lolik-Bolik/The-production-cells-formation-problem | 5 | 32759 | <reponame>Lolik-Bolik/The-production-cells-formation-problem
from .dataloader import CellsProductionData | 1.007813 | 1 |
create-kickstart.py | ulzeraj/autobond-autoraid-kickstarter | 0 | 32760 | #!/usr/bin/python2.6
#-*- coding: utf-8 -*-
import signal
import subprocess
from glob import glob
from os import listdir
from os.path import basename, dirname
label = 'CentOS_6.9_Final'
def listifaces():
ethernet = []
for iface in listdir('/sys/class/net/'):
if iface != 'lo':
ethernet.app... | 2.28125 | 2 |
src/kalman_filter.py | Ashwin-Rajesh/Kalman_filter_carla | 1 | 32761 | <filename>src/kalman_filter.py
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | 1.867188 | 2 |
fileMover.py | ioawnen/fileMover2 | 0 | 32762 | <filename>fileMover.py
import re
import sre_constants
from fileIO import *
from moveTasks import MoveTasks, MoveTaskIface
import logging
def get_matching_files(move_task: MoveTaskIface) -> list:
matches = []
try:
pattern = re.compile(move_task.filename_regex)
for root, dirs, files in get_all... | 2.65625 | 3 |
ckan_cloud_operator/drivers/kubectl/driver.py | MuhammadIsmailShahzad/ckan-cloud-operator | 14 | 32763 | from ckan_cloud_operator import kubectl
def get(what, *args, required=True, namespace=None, get_cmd=None, **kwargs):
return kubectl.get(what, *args, required=required, namespace=namespace, get_cmd=get_cmd, **kwargs)
| 1.828125 | 2 |
wafextras/lyx2tex.py | tjhunter/phd-thesis-tjhunter | 1 | 32764 | """ Converts some lyx files to the latex format.
Note: everything in the file is thrown away until a section or the workd "stopskip" is found.
This way, all the preamble added by lyx is removed.
"""
from waflib import Logs
from waflib import TaskGen,Task
from waflib import Utils
from waflib.Configure import conf
def ... | 2.546875 | 3 |
monero_glue/xmr/core/pycompat.py | ph4r05/monero-agent | 20 | 32765 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>, ph4r05, 2018
import operator
import sys
# Useful for very coarse version differentiation.
PY3 = sys.version_info[0] == 3
if PY3:
indexbytes = operator.getitem
intlist2bytes = bytes
int2byte = operator.methodcaller("to_bytes", 1, "big")
else... | 2.96875 | 3 |
train.py | liaojh1998/RNW | 0 | 32766 | import os.path as osp
from argparse import ArgumentParser
from mmcv import Config
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from torch.utils.data import DataLoader
from datasets import build_dataset
from models import MODELS
import torch
def parse... | 2.21875 | 2 |
Audio_record_and_classifier_framework/helpers.py | stanFurrer/Multimodal-solution-for-grasp-stability-prediction | 0 | 32767 | """ This Script contain the different function used in the framework
part1. Data processing
part2. Prediction and analisys
part3. Plotting
"""
import numpy as np
import librosa
import matplotlib.pyplot as plt
from sklearn import metrics
import os
import pickle
import time
import struct
""" Data processing """
def g... | 2.6875 | 3 |
pdfimage/jb2.py | MatthewDaws/PDFImage | 3 | 32768 | """
jb2.py
~~~~~~
Use JBIG2, and an external compressor, for black and white images.
"""
import os, sys, subprocess, struct, zipfile, random
from . import pdf_image
from . import pdf_write
from . import pdf
import PIL.Image as _PILImage
_default_jbig2_exe = os.path.join(os.path.abspath(".."), "agl-jbig2enc", "jbig2.... | 2.8125 | 3 |
python/mpopt/ct/cmdline/jug.py | vislearn/libmpopt | 1 | 32769 | #!/usr/bin/env python3
import argparse
import sys
from mpopt import ct, utils
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='ct_jug', description='Optimizer for *.jug cell tracking models.')
parser.add_argument('-B', '--batch-size', type=int, default=ct.DEFAULT_BATCH_SIZE)
parser.add_... | 2.1875 | 2 |
setup.py | CybercentreCanada/assemblyline-v4-p2compat | 0 | 32770 | import os
from setuptools import setup, find_packages
# For development and local builds use this version number, but for real builds replace it
# with the tag found in the environment
package_version = "4.0.0.dev0"
if 'BITBUCKET_TAG' in os.environ:
package_version = os.environ['BITBUCKET_TAG'].lstrip('v')
elif '... | 1.53125 | 2 |
Arrays and Strings/LongestSubstringWithoutRepeating.py | dileeppandey/hello-interview | 0 | 32771 | <filename>Arrays and Strings/LongestSubstringWithoutRepeating.py<gh_stars>0
"""
https://leetcode.com/problems/longest-substring-without-repeating-characters/
Given a string, find the length of the longest substring without repeating characters.
"""
class Solution:
def lengthOfLongestSubstring(self, s):
... | 3.65625 | 4 |
core/src/trezor/messages/TxAck.py | Kayuii/trezor-crypto | 0 | 32772 | <reponame>Kayuii/trezor-crypto
# Automatically generated by pb2py
# fmt: off
import protobuf as p
from .TransactionType import TransactionType
class TxAck(p.MessageType):
MESSAGE_WIRE_TYPE = 22
def __init__(
self,
tx: TransactionType = None,
) -> None:
self.tx = tx
@classmet... | 2.125 | 2 |
balrog/__main__.py | samhorsfield96/ggCaller | 15 | 32773 | import os
import tarfile
import time
import pickle
import numpy as np
from Bio.Seq import Seq
from scipy.special import expit
from scipy.special import logit
import torch
import torch.nn.functional as F
""" Get directories for model and seengenes """
module_dir = os.path.dirname(os.path.realpath(__file__))
model_dir ... | 1.929688 | 2 |
toal/annotators/AbstractAnnotator.py | Bhaskers-Blu-Org1/text-oriented-active-learning | 4 | 32774 | import abc
class AbstractAnnotator(abc.ABC):
@abc.abstractmethod
def annotate(self, unlab_index, unlabeled):
raise NotImplementedError() | 3.03125 | 3 |
code/HHV2020_07/Adafruit_Trinket_Neopixel_Strip_Cycle/main.py | gowenrw/BSidesDFW_2020_HHV | 0 | 32775 | <filename>code/HHV2020_07/Adafruit_Trinket_Neopixel_Strip_Cycle/main.py
import board, time
import neopixel
# Define Neopixels
LED7_PIN = board.D0 # pin that the NeoPixel is connected to
# Most Neopixels have a color order of GRB or GRBW some use RGB
LED7_ORDER = neopixel.GRB # pixel color channel order
# Create NeoP... | 3.328125 | 3 |
abc/abc163/abc163c-1.py | c-yan/atcoder | 1 | 32776 | <reponame>c-yan/atcoder<filename>abc/abc163/abc163c-1.py
N = int(input())
A = list(map(int, input().split()))
d = {}
for i in range(N - 1):
if A[i] in d:
d[A[i]].append(i + 2)
else:
d[A[i]] = [i + 2]
for i in range(1, N + 1):
if i in d:
print(len(d[i]))
else:
print(0)
| 2.90625 | 3 |
cross_correlation.py | sbargy/cross-correlation | 0 | 32777 | #!/usr/bin/env python3
# system imports
import argparse
import sys
# obspy imports
from obspy.clients.fdsn import Client
from obspy import read, read_inventory, UTCDateTime
from scipy import signal
from obspy.signal.cross_correlation import correlate, xcorr_max
from obspy.clients.fdsn.header import FDSNNoDataExceptio... | 2.359375 | 2 |
djcloudbridge/serializers.py | almahmoud/djcloudbridge | 0 | 32778 | import urllib
from cloudbridge.cloud.interfaces.resources import TrafficDirection
from rest_auth.serializers import UserDetailsSerializer
from rest_framework import serializers
from rest_framework.reverse import reverse
from . import models
from . import view_helpers
from .drf_helpers import CustomHyperlinkedIdenti... | 2.078125 | 2 |
what_apps/mooncalendar/admin.py | SlashRoot/WHAT | 0 | 32779 | <reponame>SlashRoot/WHAT
from what_apps.mooncalendar.models import Event
from what_apps.mooncalendar.models import Moon
from django.contrib import admin
class EventAdmin(admin.ModelAdmin):
list_display = 'name',
fieldsets = [
(None, {'fields': ['name']}),
('description', {'fields':['description... | 2.0625 | 2 |
kvdbclient/bigtable/utils.py | seung-lab/KVDbClient | 0 | 32780 | <reponame>seung-lab/KVDbClient<gh_stars>0
from typing import Dict
from typing import Union
from typing import Iterable
from typing import Optional
from datetime import datetime
from datetime import timedelta
import numpy as np
from google.cloud.bigtable.row_data import PartialRowData
from google.cloud.bigtable.row_fil... | 2.421875 | 2 |
Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_LightSensor_cpx.py | joewalk102/Adafruit_Learning_System_Guides | 665 | 32781 | # CircuitPlaygroundExpress_LightSensor
# reads the on-board light sensor and graphs the brighness with NeoPixels
import time
from adafruit_circuitplayground.express import cpx
from simpleio import map_range
cpx.pixels.brightness = 0.05
while True:
# light value remaped to pixel position
peak = map_range(cpx... | 3.125 | 3 |
mpc.py | clovaai/subword-qac | 65 | 32782 | """
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
import os
import sys
import json
import logging
import argparse
import pickle
from tqdm import tqdm
from dataset import read_data, PrefixDataset
from trie import Trie
from metric import calc_rank, calc_partial_rank, mrr_summary, mrl_summary
logging.basicCo... | 2.296875 | 2 |
old_source_code/Experiment 4 Extended Game Convergency/plotHistory.py | prasoonpatidar/multiagentRL-resource-sharing | 0 | 32783 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 18:18:29 2020
@author: xuhuiying
"""
import numpy as np
import matplotlib.pyplot as plt
def plotHistory(history,times,xLabelText,yLabelText,legendText):#画出每个history plot each history
history = np.array(history) #history是二维数组 history is a 2D... | 3.765625 | 4 |
dominion/cards/__init__.py | billletson/dominion | 0 | 32784 | from .constants import *
from .actions import ACTIONS
| 1.164063 | 1 |
VMTranslator.py | Nismirno/n2tVMTranslator | 0 | 32785 | #!/usr/bin/env python
from VMParser import Parser
from VMCodewriter import CodeWriter
from pathlib import Path
import sys
def processDirectory(inputPath):
fileName = str(inputPath.stem)
myWriter = CodeWriter(fileName)
lines = myWriter.initHeader()
for f in inputPath.glob("*.vm"):
lines += proc... | 2.65625 | 3 |
python/package/solution.py | pchtsp/ROADEF2018 | 0 | 32786 | <gh_stars>0
import package.data_input as di
import ete3
import math
import package.instance as inst
import package.params as pm
import numpy as np
import matplotlib
try:
import tkinter
except:
matplotlib.use('Qt5Agg', warn=False, force=True)
import matplotlib.pyplot as plt
import palettable as pal
import pprint... | 2.546875 | 3 |
tests/engine/training/test_fingerprinting.py | fintzd/rasa | 9,701 | 32787 | import inspect
from unittest.mock import Mock
from _pytest.monkeypatch import MonkeyPatch
from rasa.core.policies.ted_policy import TEDPolicy
from rasa.engine.training import fingerprinting
from rasa.nlu.classifiers.diet_classifier import DIETClassifier
from rasa.nlu.selectors.response_selector import ResponseSelector... | 2.0625 | 2 |
smarty/cli_smirky.py | openforcefield/smarty | 10 | 32788 | """
Command-line driver example for SMIRKY.
"""
import sys
import string
import time
from optparse import OptionParser # For parsing of command line arguments
import smarty
from openforcefield.utils import utils
import os
import math
import copy
import re
import numpy
from numpy import random
def main():
# Cre... | 2.796875 | 3 |
zim/plugins/zimclip/tests/__init__.py | stiles69/bin | 0 | 32789 | <reponame>stiles69/bin<filename>zim/plugins/zimclip/tests/__init__.py
# -*- coding: utf-8 -*-
import logging
import os
import sys
import unittest
# FIXME Do some tests
| 1.21875 | 1 |
fastai/classifyAllSnippets.py | jtbr/tv-news-quality | 0 | 32790 | from collections import defaultdict, deque
from datetime import datetime
import pandas as pd
import random
import numpy as np
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from common import Label_DbFields, Synthetic_Category_Group_Names, Other_Synthetic_Group_Names, MultiLabel_Group_... | 2.015625 | 2 |
LDDMM_Python/lddmm_python/modules/io/anim3D.py | tt6746690/lddmm-ot | 48 | 32791 | <reponame>tt6746690/lddmm-ot
# We use a slightly hacked version of the plot.ly js/python library
lddmm_python = __import__(__name__.split('.')[0])
print(lddmm_python)
import lddmm_python.lib.plotly as plotly
import re
from pylab import *
from IPython.html.widgets import interact
from IPython.display import HTML, displ... | 1.960938 | 2 |
driftbase/api/users.py | directivegames/drift-base | 1 | 32792 | <reponame>directivegames/drift-base
import logging
import http.client as http_client
from flask import url_for, g
from flask.views import MethodView
import marshmallow as ma
from flask_smorest import Blueprint, abort
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from drift.core.extensions.urlregistry import ... | 2.03125 | 2 |
xlsx2x.py | KhanShaheb34/xlsx2pdf | 0 | 32793 | import os
import cv2
import jpype
import shutil
import weasyprint
from bs4 import BeautifulSoup
jpype.startJVM()
from asposecells.api import *
def generatePDF(XLSXPath, OutPath):
workbook = Workbook(XLSXPath)
workbook.save(f"sheet.html", SaveFormat.HTML)
with open(f'./sheet_files/sheet001.htm') as f:
... | 2.671875 | 3 |
test/test_one.py | hellhound/pyejdb | 0 | 32794 | #-*- coding: utf8 -*-
# *************************************************************************************************
# Python API for EJDB database library http://ejdb.org
# Copyright (C) 2012-2013 Softmotions Ltd.
#
# This file is part of EJDB.
# EJDB is free software; you can redistribute it and/or modify i... | 1.640625 | 2 |
accounts/urls.py | bekzod-fayzikuloff/djChat | 0 | 32795 | from django.urls import path
from . import views
app_name = 'users'
urlpatterns = [
path('<int:pk>/', views.user_profile, name='user_profile'),
path('messages/<int:pk>/', views.PrivateMessageView.as_view(), name='private_message')
] | 1.726563 | 2 |
vkmz/__main__.py | HegemanLab/VKMZ | 1 | 32796 | #!/usr/bin/env python
def main():
"""Main flow control of vkmz
Read input data into feature objects. Results in dictionaries for samples
and features.
Then, make predictions for features. Features without predictions are removed
by default.
Finally, write results.
"""
from vkmz.ar... | 2.734375 | 3 |
python/problem-080.py | mbuhot/mbuhot-euler-solutions | 1 | 32797 | <reponame>mbuhot/mbuhot-euler-solutions
#! /usr/bin/env python3
from math import sqrt
from decimal import getcontext, Decimal
description = '''
Square root digital expansion
Problem 80
It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such ... | 3.9375 | 4 |
indra/assemblers/tsv/__init__.py | zebulon2/indra | 136 | 32798 | from .assembler import TsvAssembler
| 0.980469 | 1 |
binary_classifiers/KerasLogReg.py | zcikojevic/toxic-language-detection | 1 | 32799 | <filename>binary_classifiers/KerasLogReg.py
from keras.layers import Dense
from keras.models import Sequential
from keras.wrappers.scikit_learn import KerasClassifier
from run_binary_classifier import run
from keras import regularizers
def keras_logreg_model():
model = Sequential()
model.add(Dense(units=1,
... | 2.703125 | 3 |