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 |
|---|---|---|---|---|---|---|
python/wotdbg.py | wanyancan/wot-debugserver | 32 | 11000 | import os.path
import tcprepl
import BigWorld
def echo(s):
'''Send string to client'''
if tcprepl.write_client is not None:
tcprepl.write_client(s)
def exec_file(filename, exec_globals=None):
'''
Execute file
Try to find file named `filename` and execute it. If `exec_globals` is
spec... | 2.875 | 3 |
quicken/_internal/__init__.py | chrahunt/quicken | 3 | 11001 | <gh_stars>1-10
class QuickenError(Exception):
pass
| 1.039063 | 1 |
folderikon/exceptions.py | demberto/FolderIkon | 1 | 11002 | """Exception which are not actually thrown, only their docstrings are used."""
import colorama
import sys
__all__ = [
"Error",
"ParentIsNotAFolderError",
"InvalidURLError",
"ImageFormatNotSupportedError",
"ImageNotSpecifiedError",
"FolderIconAlreadyExistsError",
"DesktopIniError",
"exc... | 2.78125 | 3 |
quickbooks/objects/companycurrency.py | varunbheemaiah/python-quickbooks | 234 | 11003 | <gh_stars>100-1000
from six import python_2_unicode_compatible
from .base import QuickbooksManagedObject, QuickbooksTransactionEntity, Ref, CustomField, MetaData
@python_2_unicode_compatible
class CompanyCurrency(QuickbooksManagedObject, QuickbooksTransactionEntity):
"""
QBO definition: Applicable only for th... | 2.5625 | 3 |
books/migrations/0004_alter_book_category.py | MwinyiMoha/books-service | 0 | 11004 | # Generated by Django 3.2 on 2021-04-10 12:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("books", "0003_auto_20210410_1231")]
operations = [
migrations.AlterField(
model_name="book",
name="category",
field=mod... | 1.71875 | 2 |
syft/execution/placeholder.py | juharris/PySyft | 0 | 11005 | <reponame>juharris/PySyft
from itertools import zip_longest
import syft
from syft.generic.frameworks.hook import hook_args
from syft.generic.abstract.tensor import AbstractTensor
from syft.workers.abstract import AbstractWorker
from syft_proto.execution.v1.placeholder_pb2 import Placeholder as PlaceholderPB
class Pl... | 2.0625 | 2 |
creativeflow/blender/render_main.py | idaho777/creativeflow | 53 | 11006 | """
MAIN STYLING AND RENDERING FILE
Requirements:
------------------------------------------------------------------------------
IMPORTANT! This has only been tested with Blender 2.79 API. We have run this
on Linux and MacOS.
Execution:
------------------------------------------------------------------------------
Th... | 2.03125 | 2 |
atlas/foundations_contrib/src/test/archiving/test_artifact_downloader.py | DeepLearnI/atlas | 296 | 11007 |
from foundations_spec import *
from unittest.mock import call
class TestArtifactDownloader(Spec):
mock_archiver = let_mock()
make_directory_mock = let_patch_mock('os.makedirs')
@let
def source_directory(self):
return self.faker.uri_path()
@let
def download_directory(self):
... | 2.328125 | 2 |
lib/python3.5/functional/test/test_functional.py | mklan/NX-Rom-Market | 21 | 11008 | <filename>lib/python3.5/functional/test/test_functional.py
# pylint: skip-file
import unittest
import array
from collections import namedtuple
from itertools import product
from functional.pipeline import Sequence, is_iterable, _wrap, extend
from functional.transformations import name
from functional import seq, pseq
... | 2.46875 | 2 |
tests/test_git_commit_one_file.py | mubashshirjamal/code | 1,582 | 11009 | <reponame>mubashshirjamal/code
# -*- coding: utf-8 -*-
import os
from vilya.models.project import CodeDoubanProject
from vilya.models import git
from tests.base import TestCase
from tests.utils import mkdtemp
from vilya.libs import gyt
from vilya.libs.permdir import get_repo_root
class TestGit(TestCase):
@pr... | 2.21875 | 2 |
py/desitarget/train/data_preparation/PredCountsFromQLF_ClassModule.py | echaussidon/desitarget | 13 | 11010 | <reponame>echaussidon/desitarget
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import re
import numpy as np
from scipy.interpolate import interp2d
from scipy.interpolate import interp1d
class PredCountsFromQLF_Class():
def __init__(self):
self.QLF_OK = False
self.EFF_OK = False
self.QLF_E... | 1.914063 | 2 |
safe_control_gym/controllers/__init__.py | gokhanalcan/safe-control-gym | 0 | 11011 | """Register controllers.
"""
from safe_control_gym.utils.registration import register
register(id="mpc",
entry_point="safe_control_gym.controllers.mpc.mpc:MPC",
config_entry_point="safe_control_gym.controllers.mpc:mpc.yaml")
register(id="linear_mpc",
entry_point="safe_control_gym.controlle... | 1.429688 | 1 |
tests/plot_profile/test_utils.py | mizeller/plot_profile | 0 | 11012 | """Test module ``plot_profile/utils.py``."""
# Standard library
import logging
# First-party
from plot_profile.utils import count_to_log_level
def test_count_to_log_level():
assert count_to_log_level(0) == logging.ERROR
assert count_to_log_level(1) == logging.WARNING
assert count_to_log_level(2) == loggi... | 2.015625 | 2 |
spider/utilities/util_config.py | YunofHD/PSpider | 0 | 11013 | <reponame>YunofHD/PSpider<gh_stars>0
# _*_ coding: utf-8 _*_
"""
util_config.py by xianhu
"""
__all__ = [
"CONFIG_FETCH_MESSAGE",
"CONFIG_PARSE_MESSAGE",
"CONFIG_MESSAGE_PATTERN",
"CONFIG_URL_LEGAL_PATTERN",
"CONFIG_URL_ILLEGAL_PATTERN",
]
# define the structure of message, used in Fetcher and Pa... | 1.789063 | 2 |
modcma/__main__.py | IOHprofiler/ModularCMAES | 2 | 11014 | """Allows the user to call the library as a cli-module."""
from argparse import ArgumentParser
from .modularcmaes import evaluate_bbob
parser = ArgumentParser(description="Run single function CMAES")
parser.add_argument(
"-f", "--fid", type=int, help="bbob function id", required=False, default=5
)
parser.add_ar... | 2.953125 | 3 |
src/rto/optimization/solvers/de.py | vicrsp/rto | 0 | 11015 | <filename>src/rto/optimization/solvers/de.py
import numpy as np
class DifferentialEvolution:
def __init__(self, lb, ub, mutation_prob=0.5, pop_size=10, max_generations=100, de_type='rand/1/bin', callback=None):
self.lb = np.asarray(lb).reshape(1, -1)
self.ub = np.asarray(ub).reshape(1, -1)
... | 2.671875 | 3 |
openmdao/matrices/csr_matrix.py | onodip/OpenMDAO | 0 | 11016 | """Define the CSRmatrix class."""
import numpy as np
from scipy.sparse import coo_matrix
from six import iteritems
from openmdao.matrices.coo_matrix import COOMatrix
class CSRMatrix(COOMatrix):
"""
Sparse matrix in Compressed Row Storage format.
"""
def _build(self, num_rows, num_cols):
"""... | 2.828125 | 3 |
setup.py | medchemfi/sdfconf | 6 | 11017 | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
with open("src/sdfconf/_version.py", "rt") as vf:
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
for line in vf:
mo = re.search... | 1.78125 | 2 |
stacks/cognito_stack.py | adamdubey/devops-serverless-app-aws-cdk | 0 | 11018 | from aws_cdk import (
aws_cognito as cognito,
aws_iam as iam,
aws_ssm as ssm,
core
)
class CognitoStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
prj_name = self.node.try_get_context("project_name")
... | 2.015625 | 2 |
cloudrail/knowledge/rules/aws/context_aware/s3_bucket_policy_vpc_endpoint_rule.py | my-devops-info/cloudrail-knowledge | 0 | 11019 | <reponame>my-devops-info/cloudrail-knowledge
from typing import Dict, List
from cloudrail.knowledge.context.aws.iam.policy import S3Policy
from cloudrail.knowledge.context.aws.iam.policy_statement import StatementEffect
from cloudrail.knowledge.context.aws.s3.s3_bucket import S3Bucket
from cloudrail.knowledge.context.... | 1.921875 | 2 |
src/gluonts/core/serde/_json.py | PascalIversen/gluon-ts | 1 | 11020 | # Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | 3.40625 | 3 |
run.py | Aisbergg/docker-image-arch-aur-makepkg | 7 | 11021 | <gh_stars>1-10
#!/usr/bin/python3
import argparse
import os
import sys
import re
import shutil
import tempfile
import pwd
import grp
import tarfile
import time
import glob
import urllib.request
from subprocess import Popen, PIPE
import aur
import pacman
local_source_dir = '/makepkg/local_src'
build_dir = os.path.absp... | 2.53125 | 3 |
test/test_schemagen.py | hd23408/nist-schemagen | 1 | 11022 | <reponame>hd23408/nist-schemagen<filename>test/test_schemagen.py
"""Test methods for testing the schemagen package (specifically,
the SchemaGenerator class).
Typical usage example:
python -m unittest
or, to run a single test:
python -m unittest -k test__build_schema
"""
import unittest
import pathlib
import... | 2.59375 | 3 |
core/migrations/0008_auto_20190528_1802.py | peterson-dev/code-snippet-app | 2 | 11023 | <reponame>peterson-dev/code-snippet-app
# Generated by Django 2.2.1 on 2019-05-28 22:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0007_auto_20190523_1740'),
]
operations = [
migrations.RenameField(
model_name='snippet'... | 1.65625 | 2 |
scripts/Biupdownsample/grad_check.py | dongdong93/a2u_matting | 22 | 11024 | import os.path as osp
import sys
import subprocess
subprocess.call(['pip', 'install', 'cvbase'])
import cvbase as cvb
import torch
from torch.autograd import gradcheck
sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from biupdownsample import biupsample_naive, BiupsampleNaive
from biupdownsample import bid... | 2.046875 | 2 |
sunshinectf2020/speedrun/exploit_05.py | nhtri2003gmail/ctf-write-ups | 101 | 11025 | <reponame>nhtri2003gmail/ctf-write-ups<filename>sunshinectf2020/speedrun/exploit_05.py
#!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./chall_05')
if not args.REMOTE:
p = process(binary.path)
else:
p = remote('chal.2020.sunshinectf.org', 30005)
p.sendlineafter('Race, life\'s greatest.\n',... | 2 | 2 |
coderedcms/wagtail_flexible_forms/edit_handlers.py | mikiec84/coderedcms | 9 | 11026 | from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from wagtail.admin.edit_handlers import EditHandler
class FormSubmissionsPanel(EditHandler):
template = "wagtailforms/edit_handlers/form_responses_panel.html"
... | 1.914063 | 2 |
python/elasticache/cache/helper/vpc.py | chejef/aws-cdk-examples-proserve | 6 | 11027 | <reponame>chejef/aws-cdk-examples-proserve<filename>python/elasticache/cache/helper/vpc.py<gh_stars>1-10
from aws_cdk import (
core as cdk,
aws_elasticache as elasticache,
aws_ec2 as ec2,
)
from aws_cdk.core import Tags
from config import config_util as config
def get_vpc(scope: cdk.Construct) -> ec2.Vpc... | 2.40625 | 2 |
src/pyscaffold/extensions/namespace.py | jayvdb/pyscaffold | 2 | 11028 | # -*- coding: utf-8 -*-
"""
Extension that adjust project file tree to include a namespace package.
This extension adds a **namespace** option to
:obj:`~pyscaffold.api.create_project` and provides correct values for the
options **root_pkg** and **namespace_pkg** to the following functions in the
action list.
"""
impo... | 2.3125 | 2 |
tests/solr_tests/tests/test_templatetags.py | speedplane/django-haystack | 1 | 11029 | # encoding: utf-8
from mock import call, patch
from django.template import Template, Context
from django.test import TestCase
from core.models import MockModel
@patch("haystack.templatetags.more_like_this.SearchQuerySet")
class MoreLikeThisTagTestCase(TestCase):
def render(self, template, context):
# Wh... | 2.453125 | 2 |
tests_project/homepage/views/__init__.py | wynnw/django-mako-plus | 79 | 11030 | <filename>tests_project/homepage/views/__init__.py<gh_stars>10-100
from django_mako_plus.converter import ParameterConverter
from django_mako_plus import view_function
from django.http import HttpRequest
class RecordingConverter(ParameterConverter):
'''Converter that also records the converted variables for inspe... | 2.375 | 2 |
jupyterlab_bigquery/jupyterlab_bigquery/__init__.py | shunr/jupyter-extensions | 0 | 11031 | <filename>jupyterlab_bigquery/jupyterlab_bigquery/__init__.py
from notebook.utils import url_path_join
from jupyterlab_bigquery.list_items_handler import handlers
from jupyterlab_bigquery.details_handler import DatasetDetailsHandler, TablePreviewHandler, TableDetailsHandler
from jupyterlab_bigquery.version import VERS... | 2.1875 | 2 |
ios_notifications/migrations/0004_auto_20141105_1515.py | chillbear/django-ios-notifications | 2 | 11032 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_fields.fields
class Migration(migrations.Migration):
dependencies = [
('ios_notifications', '0003_notification_loc_payload'),
]
operations = [
migrations.AlterField(
... | 1.609375 | 2 |
fairseq/tasks/audio_pretraining.py | hwp/fairseq | 4 | 11033 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import editdistance
import os
impo... | 1.859375 | 2 |
caffe-int8-convert-tool-dev.py | daquexian/caffe-int8-convert-tools | 0 | 11034 | <reponame>daquexian/caffe-int8-convert-tools<gh_stars>0
# -*- coding: utf-8 -*-
# SenseNets is pleased to support the open source community by making caffe-int8-convert-tool available.
#
# Copyright (C) 2018 SenseNets Technology Ltd. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you... | 1.773438 | 2 |
example_project/views.py | AKuederle/flask-template-master | 2 | 11035 | """
All your views aka. your template endpoints go here.
There are two ways to create a view.
1. Create a new Subclass inheriting from one of the flask_template_master views
2. Use the view-factory function flask_template_master.views.create_template_endpoint
Each view requires an 1 (and 2 optional) things:
1. An envi... | 3.078125 | 3 |
CustomExceptions.py | DouglasHSS/NeuralNetworks | 0 | 11036 |
class PerceptronError(Exception):
pass
| 1.195313 | 1 |
pytorch_translate/test/test_data.py | dpacgopinath/translate-1 | 0 | 11037 | <filename>pytorch_translate/test/test_data.py<gh_stars>0
#!/usr/bin/env python3
import unittest
import os
from pytorch_translate import data
from pytorch_translate import dictionary
from pytorch_translate.test import utils as test_utils
class TestInMemoryNumpyDataset(unittest.TestCase):
def setUp(self):
... | 2.453125 | 2 |
CompareWHDR.py | Z7Gao/InverseRenderingOfIndoorScene | 171 | 11038 | <filename>CompareWHDR.py
import numpy as np
import sys
import json
import glob
import os.path as osp
import cv2
def compute_whdr(reflectance, judgements, delta=0.1):
points = judgements['intrinsic_points']
comparisons = judgements['intrinsic_comparisons']
id_to_points = {p['id']: p for p in points}
row... | 2.78125 | 3 |
theonionbox/stamp.py | ralphwetzel/theonionbox | 120 | 11039 | __title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '20.2'
__stamp__ = '20200119|095654'
| 0.824219 | 1 |
UnicodeTraps.py | loamhoof/sublime-plugins-dump | 0 | 11040 | import re
from sublime import Region
import sublime_plugin
REPLACEMENTS = {
'\u00a0': ' ', # no-break space
'\u200b': '', # zero-width space
}
class UnicodeTrapsListener(sublime_plugin.EventListener):
@staticmethod
def on_pre_save(view):
view.run_command('unicode_traps')
class UnicodeTrap... | 2.59375 | 3 |
simba/ROI_multiply.py | KonradDanielewski/simba | 172 | 11041 | <filename>simba/ROI_multiply.py
import glob
import pandas as pd
from configparser import ConfigParser
import os
from simba.drop_bp_cords import *
def multiplyFreeHand(inifile, currVid):
_, CurrVidName, ext = get_fn_ext(currVid)
config = ConfigParser()
configFile = str(inifile)
config.read(con... | 2.484375 | 2 |
src/utils/ccxt/fetch_order_book.py | YasunoriMATSUOKA/crypto-asset-easy-management | 0 | 11042 | <filename>src/utils/ccxt/fetch_order_book.py
from logging import getLogger
import traceback
from .get_public_exchange import get_public_exchange
logger = getLogger("__main__").getChild(__name__)
def fetch_order_book(exchange_name, pair):
logger.debug("start")
logger.debug(exchange_name)
logger.debug(pair... | 2.53125 | 3 |
smoke-classifier/detect_fire.py | agnes-yang/firecam | 10 | 11043 | <reponame>agnes-yang/firecam<gh_stars>1-10
# Copyright 2018 The Fuego Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | 1.820313 | 2 |
torch_agents/cogment_verse_torch_agents/third_party/hive/mlp.py | kharyal/cogment-verse | 0 | 11044 | import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
class SimpleMLP(nn.Module):
"""Simple MLP function approximator for Q-Learning."""
def __init__(self, in_dim, out_dim, hidden_units=256, num_hidden_layers=1):
super().__init__()
self.input_layer... | 2.859375 | 3 |
phonenumbers/data/region_AC.py | ayushgoel/FixGoogleContacts | 2 | 11045 | """Auto-generated file, do not edit by hand. AC metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_AC = PhoneMetadata(id='AC', country_code=247, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[2-467]\\d{3}', possible_number_pattern=... | 1.882813 | 2 |
awx/main/migrations/0156_capture_mesh_topology.py | ziegenberg/awx | 1 | 11046 | <reponame>ziegenberg/awx
# Generated by Django 2.2.20 on 2021-12-17 19:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0155_improved_health_check'),
]
operations = [
migrations.AlterField(
... | 1.75 | 2 |
models/dsd/bicubic.py | VinAIResearch/blur-kernel-space-exploring | 93 | 11047 | import torch
from torch import nn
from torch.nn import functional as F
class BicubicDownSample(nn.Module):
def bicubic_kernel(self, x, a=-0.50):
"""
This equation is exactly copied from the website below:
https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html#bicubic
... | 2.703125 | 3 |
control/webapp/__init__.py | doismellburning/control-panel | 1 | 11048 | <gh_stars>1-10
import logging
from flask import Flask
from . import utils, home, member, society, signup, jobs, admin
from .flask_seasurf import SeaSurf
from flask_talisman import Talisman
app = Flask(__name__,
template_folder="../templates",
static_folder="../static")
app.config['CSRF_CHEC... | 1.851563 | 2 |
tests/rules/test_duplicates.py | imbillu/arche | 1 | 11049 | <gh_stars>1-10
import arche.rules.duplicates as duplicates
from arche.rules.result import Level, Outcome
from conftest import create_result
import numpy as np
import pandas as pd
import pytest
unique_inputs = [
({}, {}, {Level.INFO: [(Outcome.SKIPPED,)]}),
(
{"id": ["0", "0", "1"]},
{"unique":... | 2.453125 | 2 |
Question_1.py | Queen-Jonnie/Work | 0 | 11050 | # This is the word list from where the answers for the hangman game will come from.
word_list = [
2015,
"<NAME>",
"Rwanda and Mauritius",
2,
"Dr, <NAME>",
"<NAME>",
"Madagascar",
94,
8,
"Mauritius"
]
# Here we are defining the variables 'Right'(for when they get th... | 4.28125 | 4 |
node-api/get-block-transfers/request.py | Venoox/casper-integrations | 5 | 11051 | <reponame>Venoox/casper-integrations
import json
import os
import pycspr
# A known casper test-net node address.
_NODE_ADDRESS = os.getenv("CASPER_NODE_ADDRESS", "192.168.127.12")
# A known block hash.
_BLOCK_HASH: bytes = bytes.fromhex("c7148e1e2e115d8fba357e04be2073d721847c982dc70d5c36b5f6d3cf66331c")
# A known... | 2.4375 | 2 |
tests/test_util.py | re3turn/twicrawler | 14 | 11052 | import nose2.tools
from typing import Union
from app.util import has_attributes
class SampleClass:
pass
class TestUtil:
@nose2.tools.params(
('SET_VALUE', True),
(None, False),
('NO_ATTRIBUTE', False),
(False, True),
('', True),
(0, True),
)
def test... | 2.828125 | 3 |
commands/data/fusion_data.py | Christ0ph990/Fusion360DevTools | 3 | 11053 | # Copyright 2022 by Autodesk, Inc.
# Permission to use, copy, modify, and distribute this software in object code form
# for any purpose and without fee is hereby granted, provided that the above copyright
# notice appears in all copies and that both that copyright notice and the limited
# warranty and restricted ... | 2.015625 | 2 |
src/config-producer/config_topic.py | DougFigueroa/realde-kafka-assesment | 0 | 11054 | """
This process creates the two kafka topics to be used.
The input-topic with ten partitions and the output-topic with one partition.
Also preloads the kafka cluster with test data (if flag is set to true).
"""
import os
import time
import json
import logging
from confluent_kafka.admin import AdminClient, NewTopic
fro... | 2.734375 | 3 |
deallocate/params.py | jefferycwc/tacker-example-plugin | 0 | 11055 | OS_MA_NFVO_IP = '192.168.1.197'
OS_USER_DOMAIN_NAME = 'Default'
OS_USERNAME = 'admin'
OS_PASSWORD = '<PASSWORD>'
OS_PROJECT_DOMAIN_NAME = 'Default'
OS_PROJECT_NAME = 'admin' | 1.125 | 1 |
anoplura/patterns/body_part.py | rafelafrance/traiter_lice | 0 | 11056 | <gh_stars>0
"""Extract body part annotations."""
import re
import spacy
from traiter.const import COMMA
from traiter.patterns.matcher_patterns import MatcherPatterns
from anoplura.pylib.const import COMMON_PATTERNS
from anoplura.pylib.const import CONJ
from anoplura.pylib.const import MISSING
from anoplura.pylib.cons... | 2.375 | 2 |
Termux-pkg-apt.py | Hironotori/Termux-pkg-apt | 1 | 11057 | #!/usr/bin/python3
import os
import time
import sys
os.system("clear")
print('''\033[91m
CREATED BY Hironotori
''')
def slowprint(s):
for c in s + '\n' :
sys.stdout.write(c)
sys.stdout.flush()
slowprint(''' \033[93m
[1] apt-pkg pip-pip3 [2] apt-pkg python
[3] apt-pkg python2 [4] ... | 2.421875 | 2 |
RFEM/Loads/solidSetLoad.py | DavidNaizheZhou/RFEM_Python_Client | 16 | 11058 | <reponame>DavidNaizheZhou/RFEM_Python_Client<gh_stars>10-100
from RFEM.initModel import Model, clearAtributes, ConvertToDlString
from RFEM.enums import SolidSetLoadType, SolidSetLoadDistribution, SolidSetLoadDirection
class SolidSetLoad():
def __init__(self,
no: int =1,
load_case... | 2.265625 | 2 |
examples_2d/patch.py | 5A5H/PyFEMP | 1 | 11059 | <gh_stars>1-10
# 2D example tensile test
import numpy as np
import matplotlib.pyplot as plt
import PyFEMP
import PyFEMP.elements.Elmt_BaMo_2D as ELEMENT
FEM = PyFEMP.FEM_Simulation(ELEMENT)
n = 4
XI, Elem = PyFEMP.msh_rec([0.0, 0.0], [10.0, 10.0], [n, n], type='Q1')
FEM.Add_Mesh(XI, Elem)
FEM.Add_Material([2100, 0.3... | 2.5 | 2 |
common-patterns/producer_consumer_client.py | kyeett/websockets-examples | 0 | 11060 | <reponame>kyeett/websockets-examples
#!/usr/bin/env python
import asyncio
import websockets
import os
port = int(os.environ.get('PORT', '8765'))
async def hello():
print("Starting client on :%s" % port)
async with websockets.connect('ws://localhost:%s' % port) as websocket:
msg = 'Client msg #1'
... | 3.46875 | 3 |
wagtailflags/forms.py | cfpb/wagtail-flags | 75 | 11061 | <filename>wagtailflags/forms.py
from django import forms
from flags.forms import FlagStateForm as DjangoFlagsFlagStateForm
from flags.models import FlagState
from flags.sources import get_flags
class NewFlagForm(forms.ModelForm):
name = forms.CharField(label="Name", required=True)
def clean_name(self):
... | 2.296875 | 2 |
src/utils/utils.py | GuiYuDaniel/CGC_of_Sn | 0 | 11062 | <reponame>GuiYuDaniel/CGC_of_Sn<filename>src/utils/utils.py
# -*- coding:utf8 -*-
"""
一些其他工具
当需要细化或者函数太多时,应该把其中一些独立出去
"""
import uuid
from enum import Enum, unique
from utils.log import get_logger
logger = get_logger(__name__)
@unique
class PipeTaskStatus(Enum): # 还不够需要写状态机,先用这个凑活一下
"""
name is Status
... | 2.265625 | 2 |
extras/scripts/finish_ci.py | connornishijima/PixieChroma | 20 | 11063 | <reponame>connornishijima/PixieChroma
# This is just for GitHub, and is used to clean up leftover files after
# automatic testing has completed, and generate developer reports about
# anything left undocumented!
# run: "sudo python ./extras/scripts/finish_ci.py"
import os
import sys
os.system("sudo python ./extras/s... | 2.296875 | 2 |
matchingGame.py | VinnieM-3/MemoryGames | 0 | 11064 | import pygame
import random
pygame.init()
pygame.font.init()
class Card(object):
""" The Card Class """
def __init__(self, left, top, width, height,
back_color, front_color, solved_color,
display,
font_color, text_font, value=None):
self._rect = pyg... | 3.578125 | 4 |
darts_search_space/imagenet/rlnas/evolution_search/config.py | megvii-model/RLNAS | 17 | 11065 | import os
class config:
host = 'zhangxuanyang.zhangxuanyang.ws2.hh-c.brainpp.cn'
username = 'admin'
port = 5672
exp_name = os.path.dirname(os.path.abspath(__file__))
exp_name = '-'.join(i for i in exp_name.split(os.path.sep) if i);
test_send_pipe = exp_name + '-test-send_pipe'
test_recv_p... | 1.5625 | 2 |
packages/python/plotly/plotly/graph_objs/layout/geo/_projection.py | eranws/plotly.py | 0 | 11066 | <reponame>eranws/plotly.py<filename>packages/python/plotly/plotly/graph_objs/layout/geo/_projection.py<gh_stars>0
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Projection(_BaseLayoutHierarchyType):
# class properties
# --------------------
... | 2.828125 | 3 |
j3d/string_table.py | blank63/j3dview | 13 | 11067 | from btypes.big_endian import *
cstring_sjis = CString('shift-jis')
class Header(Struct):
string_count = uint16
__padding__ = Padding(2)
class Entry(Struct):
string_hash = uint16
string_offset = uint16
def unsigned_to_signed_byte(b):
return b - 0x100 if b & 0x80 else b
def calculate_hash(s... | 2.6875 | 3 |
deConzSensors.py | peterstadler/deConzSensors | 0 | 11068 | #!/usr/bin/env python3.5
from time import sleep, time
from datetime import datetime, timedelta
from pid.decorator import pidfile
#from subprocess import call
from RPi import GPIO
import requests
import json
#import config
import logging
import signal
import sys
#13: grün
#16: braun
#19: orange
#20: grün
#21: braun
#2... | 2.484375 | 2 |
src/admin.py | kappa243/agh-db-proj | 0 | 11069 | <filename>src/admin.py
from flask import Blueprint, request, render_template, flash, redirect, url_for
from flask_login import login_user, login_required, current_user, logout_user
from models import User
from werkzeug.security import generate_password_hash, check_password_hash
from app import db, login_manager
admin ... | 2.40625 | 2 |
test/lib/test_map.py | oldmantaiter/inferno | 1 | 11070 | import datetime
import types
from nose.tools import eq_
from nose.tools import ok_
from inferno.lib.map import keyset_map
from inferno.lib.rule import InfernoRule
class TestKeysetMap(object):
def setUp(self):
self.data = {
'city': 'toronto',
'country': 'canada',
'pop... | 2.4375 | 2 |
dart/build_rules/internal/pub.bzl | nickclmb/rules_dart | 0 | 11071 | <reponame>nickclmb/rules_dart
# Copyright 2016 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | 1.6875 | 2 |
auror_core/__init__.py | millengustavo/auror-core | 11 | 11072 | <reponame>millengustavo/auror-core<gh_stars>10-100
import copy
import os
class Project(object):
def __init__(self, folder, *jobtypes):
self.jobtypes = jobtypes
self.folder = folder
self.params = []
self.version = 1
def is_v2(self):
self.version = 2
return copy... | 2.609375 | 3 |
app.py | Vaishnavid14/snakegame | 5 | 11073 | <reponame>Vaishnavid14/snakegame<filename>app.py
'''
Purpose: Server responsible for routing
Author: Md. <NAME>
Command to execute: python app.py
'''
from flask import Flask
from flask import render_template
from flask import json
from flask import request
import random
import sys
app = Flask(__nam... | 2.9375 | 3 |
grafana_api/api/__init__.py | sedan07/grafana_api | 0 | 11074 | <filename>grafana_api/api/__init__.py
from .base import Base
from .admin import Admin
from .dashboard import Dashboard
from .datasource import Datasource
from .folder import Folder
from .organisation import Organisation, Organisations
from .search import Search
from .user import User, Users
| 1.070313 | 1 |
shop/views.py | Ayushman-Singh/ecommerce | 1 | 11075 | from shop.forms import UserForm
from django.views import generic
from django.urls import reverse_lazy
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import auth
from .models import Product, Contact, Categ... | 2.0625 | 2 |
SimMuon/GEMDigitizer/python/muonGEMDigi_cff.py | NTrevisani/cmssw | 3 | 11076 | import FWCore.ParameterSet.Config as cms
from SimMuon.GEMDigitizer.muonGEMDigis_cfi import *
from SimMuon.GEMDigitizer.muonGEMPadDigis_cfi import *
from SimMuon.GEMDigitizer.muonGEMPadDigiClusters_cfi import *
muonGEMDigiTask = cms.Task(simMuonGEMDigis, simMuonGEMPadDigis, simMuonGEMPadDigiClusters)
muonGEMDigi = cms... | 1.09375 | 1 |
paas-ce/paas/esb/lib/redis_rate_limit/ratelimit.py | renmcc/bk-PaaS | 767 | 11077 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 2.140625 | 2 |
tela_cadastro_loja_embala.py | lucasHashi/PyQt5-gerenciador-de-vendas-de-comidas | 1 | 11078 | <reponame>lucasHashi/PyQt5-gerenciador-de-vendas-de-comidas
import sys
from PyQt5 import QtCore, QtGui, QtWidgets, uic
import database_receita
import pyqt5_aux
qt_tela_inicial = "telas/tela_cadastro_loja_embala.ui"
Ui_MainWindow, QtBaseClass = uic.loadUiType(qt_tela_inicial)
class MainWindow(QtWidgets.QMainWindow, Ui... | 2.46875 | 2 |
test/test_layers.py | mukeshv0/ParallelWaveGAN | 0 | 11079 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 <NAME>
# MIT License (https://opensource.org/licenses/MIT)
import logging
import numpy as np
import torch
from parallel_wavegan.layers import Conv1d
from parallel_wavegan.layers import Conv1d1x1
from parallel_wavegan.layers import Conv2d
from parallel... | 2.15625 | 2 |
geotrek/tourism/models.py | ker2x/Geotrek-admin | 0 | 11080 | <gh_stars>0
import os
import re
import logging
from django.conf import settings
from django.contrib.gis.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.formats import date_format
from easy_thumbnails.alias import aliases
from easy_thumbnails.exceptions import InvalidImageFor... | 1.820313 | 2 |
Service_Components/Sink/Sink_DataFlow.py | mydata-sdk/mydata-sdk-1.x | 0 | 11081 | <filename>Service_Components/Sink/Sink_DataFlow.py
# -*- coding: utf-8 -*-
from signed_requests.signed_request_auth import SignedRequest
__author__ = 'alpaloma'
from flask import Blueprint, current_app, request
from helpers import Helpers
import requests
from json import dumps, loads
from DetailedHTTPException import ... | 2.140625 | 2 |
Support/Python/tbdata/printing.py | twitchplayskh/open-brush | 0 | 11082 | # Copyright 2020 The Tilt Brush Authors
#
# 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.929688 | 2 |
src/tests/scenarios/Maxwell_Main.py | ian-cooke/basilisk_mag | 0 | 11083 | <reponame>ian-cooke/basilisk_mag<gh_stars>0
''' '''
'''
ISC License
Copyright (c) 2016, Autonomous Vehicle Systems Lab, University of Colorado at Boulder
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notic... | 1.375 | 1 |
generators/map_parallel.py | CodyKochmann/generators | 6 | 11084 | from multiprocessing import Pool
from multiprocessing.pool import ThreadPool
from queue import Queue
from .chunks import chunks
__all__ = 'map_parallel', 'map_multicore', 'map_multithread'
def _pool_map_stream(pool_type, pipe, fn, workers):
assert callable(fn), fn
assert isinstance(workers, int), workers
... | 3.359375 | 3 |
apps/bot/classes/messages/attachments/AudioAttachment.py | Xoma163/Petrovich | 0 | 11085 | <reponame>Xoma163/Petrovich<filename>apps/bot/classes/messages/attachments/AudioAttachment.py<gh_stars>0
from apps.bot.classes.messages.attachments.Attachment import Attachment
class AudioAttachment(Attachment):
TYPE = "audio"
def __init__(self):
super().__init__(self.TYPE)
self.duration = No... | 2.203125 | 2 |
app/models.py | TrigeekSpace/academia-bknd | 0 | 11086 | """ SQLAlchemy database models. """
from datetime import datetime
from depot.fields.sqlalchemy import UploadedFileField
from app import db
from app.util.data import many_to_many, foreign_key
from app.config import TOKEN_LEN
class User(db.Model):
""" User model class. """
id = db.Column(db.Integer(), primary_k... | 2.6875 | 3 |
log.py | GregMorford/testlogging | 0 | 11087 | <filename>log.py<gh_stars>0
import logging
## Logging Configuration ##
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
ch = logging.StreamHandler() # console handler
ch.setLevel(logging.INFO)
fh = logging.FileHandler('logfile.txt')
fh.setLevel(logging.INFO)
fmtr = logging.Formatter('%(asctime)s |... | 3.1875 | 3 |
hackerrank/BetweenTwoSets.py | 0x8b/HackerRank | 3 | 11088 | #!/bin/python3
import os
def getTotalX(a, b):
c = 0
for i in range(max(a), min(b) + 1):
if all([i % d == 0 for d in a]) and all([d % i == 0 for d in b]):
c += 1
return c
if __name__ == "__main__":
f = open(os.environ["OUTPUT_PATH"], "w")
nm = input().spl... | 3.203125 | 3 |
utils.py | LlamaSi/Adaptive-PSGAIL | 10 | 11089 |
import h5py
import numpy as np
import os, pdb
import tensorflow as tf
from rllab.envs.base import EnvSpec
from rllab.envs.normalized_env import normalize as normalize_env
import rllab.misc.logger as logger
from sandbox.rocky.tf.algos.trpo import TRPO
from sandbox.rocky.tf.policies.gaussian_mlp_policy import Gaussian... | 1.414063 | 1 |
setup_py_upgrade.py | asottile/setup-py-upgrade | 87 | 11090 | <reponame>asottile/setup-py-upgrade<filename>setup_py_upgrade.py
import argparse
import ast
import configparser
import io
import os.path
from typing import Any
from typing import Dict
from typing import Optional
from typing import Sequence
METADATA_KEYS = frozenset((
'name', 'version', 'url', 'download_url', 'proj... | 1.835938 | 2 |
main/models/__init__.py | prajnamort/LambdaOJ2 | 2 | 11091 | <gh_stars>1-10
from .user import User, MultiUserUpload
from .problem import Problem, TestData
from .submit import Submit
| 0.976563 | 1 |
2019/tests/test_Advent2019_10.py | davidxbuck/advent2018 | 1 | 11092 | <reponame>davidxbuck/advent2018<gh_stars>1-10
# pytest tests
import numpy as np
from Advent2019_10 import Day10
class TestDay10():
def test_instantiate(self):
test = Day10('../tests/test_Advent2019_10a.txt')
grid = ['.#..#',
'.....',
'#####',
'....#... | 2.71875 | 3 |
Hash Map/448. Find All Numbers Disappeared in an Array.py | xli1110/LC | 2 | 11093 | <reponame>xli1110/LC
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
if len(nums) < 1:
raise Exception("Invalid Array")
n = len(nums)
res = []
s = set()
for x in nums:
s.add(x)
for i in range(1, n + 1):
... | 3.171875 | 3 |
tests/test_demo.py | aaronestrada/flask-restplus-swagger-relative | 3 | 11094 | <gh_stars>1-10
import pytest
from tests.test_application import app
@pytest.fixture
def client():
client = app.test_client()
yield client
def test_hello_resource(client):
"""
Test if it is possible to access to /hello resource
:param client: Test client object
:return:
"""
response =... | 2.484375 | 2 |
01_Introduction to Python/3-functions-and-packages/03_multiple-arguments.py | mohd-faizy/DataScience-With-Python | 5 | 11095 | <filename>01_Introduction to Python/3-functions-and-packages/03_multiple-arguments.py
'''
03 - Multiple arguments
In the previous exercise, the square brackets around imag in the documentation showed us that the
imag argument is optional. But Python also uses a different way to tell users about arguments being
optiona... | 4.6875 | 5 |
Taller_Algoritmos_02/Ejercicio_10.py | Angelio01/algoritmos_programacion- | 0 | 11096 | <reponame>Angelio01/algoritmos_programacion-
"""
Entradas: 3 Valores flotantes que son el valor de diferentes monedas
Chelines autriacos --> float --> x
Dramas griegos --> float --> z
Pesetas --> float --> w
Salidas 4 valores flotantes que es la conversión de las anteriores monedas
Pesetas --> float --> x
Francos... | 3.921875 | 4 |
stardist/stardist_impl/predict_stardist_3d.py | constantinpape/deep-cell | 0 | 11097 | import argparse
import os
from glob import glob
import imageio
from tqdm import tqdm
from csbdeep.utils import normalize
from stardist.models import StarDist3D
def get_image_files(root, image_folder, ext):
# get the image and label mask paths and validate them
image_pattern = os.path.join(root, image_folder... | 2.4375 | 2 |
estacionamientos/forms.py | ShadowManu/SAGE | 0 | 11098 | <reponame>ShadowManu/SAGE<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from estacionamientos.models import Estacionamiento, Reserva, Pago
class EstacionamientosForm(forms.ModelForm):
nombre_duenio = forms.CharField(widget=forms.TextInput(
attrs={'class': 'form-control'... | 2.046875 | 2 |
src/krylov/gmres.py | nschloe/krylov | 36 | 11099 | <gh_stars>10-100
"""
<NAME>, <NAME>,
GMRES: a generalized minimal residual algorithm for solving nonsymmetric linear systems,
SIAM J. Sci. and Stat. Comput., 7(3), 856–869, 1986,
<https://doi.org/10.1137/0907058>.
Other implementations:
<https://petsc.org/release/docs/manualpages/KSP/KSPGMRES.html>
"""
from __future__... | 2.71875 | 3 |