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/swmmtoolbox/swmmtoolbox.py | timcera/swmmtoolbox | 9 | 51900 | # -*- coding: utf-8 -*-
# Example package with a console entry point
"""Reads and formats data from the SWMM 5 output file."""
from __future__ import absolute_import, print_function
import copy
import datetime
import os
import struct
import sys
import warnings
from builtins import object, range, str, zip
import mand... | 2.203125 | 2 |
web/blog/comments/urls.py | BumagniyPacket/django-blog | 2 | 51901 | <reponame>BumagniyPacket/django-blog
from django.conf.urls import url
from .views import CommentAddView, CommentApproveView, CommentDeleteView
urlpatterns = [
url(r'^(?P<pk>\d+)/delete$', CommentDeleteView.as_view(), name='delete'),
url(r'^(?P<pk>\d+)/approve$', CommentApproveView.as_view(), name='approve'),
... | 1.960938 | 2 |
parser/team29/Analizador/AST.py | susanliss/tytus | 0 | 51902 | from graphviz import Digraph
from Nodo import Nodo
dot = Digraph(comment='AST')
#dot.render('test-output/round-table.gv', view=True) # doctest: +SKIP
#'test-output/round-table.gv.jpg'
class AST:
def __init__(self):
self.count = 0
print("constructor")
def defineTreeNodes(self, root):
... | 2.671875 | 3 |
test/tree/test_bst.py | KentWangYQ/py-algorithms | 5 | 51903 | # -*- coding: utf-8 -*-
import unittest
from source.tree import bst
""" demo tree
7
/ \
5 8
/ \ \
2 6 9
"""
demo_tree = bst.BSTree(keys=[7, 5, 2, 6, 8, 9])
class BSTTest(unittest.TestCase):
"""
二叉搜索树测试
"""
def test_insert_node(self):
"""
插入... | 4.125 | 4 |
django-APIs/table_cleaning/urls.py | Henler/ReBridge_data_cloud | 0 | 51904 | <reponame>Henler/ReBridge_data_cloud<filename>django-APIs/table_cleaning/urls.py<gh_stars>0
from django.urls import path
from django.conf.urls import include
from django.conf import settings
from django.conf.urls.static import static
from rest_framework import routers
from . import views
router = routers.DefaultRoute... | 1.890625 | 2 |
dashboard/dash_app.py | CNC-lathe/digital-dashboard | 0 | 51905 | <reponame>CNC-lathe/digital-dashboard
from typing import Any, Dict, List, Optional
import copy
from dash.dependencies import Input, Output
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import flask
import threading
import zmq
from lf_utils.c... | 2.234375 | 2 |
plugins/sitemap.py | eigenfoo/cryptics | 9 | 51906 | from datasette import hookimpl
from datasette.utils.asgi import Response
ROBOTS_TXT = """
Sitemap: https://cryptics.eigenfoo.xyz/sitemap.xml
""".strip()
SITEMAP_XML = """
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url><loc>https://cryptics.eigenfoo.xyz/data... | 2.265625 | 2 |
f5cli/config/__init__.py | f5devcentral/f5-cli | 13 | 51907 | <reponame>f5devcentral/f5-cli<filename>f5cli/config/__init__.py
"""Configuration module for the CLI """
from .core import ConfigurationClient
from .auth import AuthConfigurationClient
__all__ = [
'AuthConfigurationClient',
'ConfigurationClient'
]
| 1.398438 | 1 |
Solutions/Python/No zeros for heros(8 kyu).py | collenirwin/Codewars-Solutions | 0 | 51908 | <gh_stars>0
def no_boring_zeros(n):
return int(str(n).strip("0")) if n != 0 else n | 2.953125 | 3 |
tests/test_logo.py | theosech/ec | 290 | 51909 | import unittest
class TestLogoMain(unittest.TestCase):
def test_imports(self):
try:
from dreamcoder.domains.logo.main import (
animateSolutions,
dreamFromGrammar,
list_options,
outputDreams,
enumerateDreams,
... | 2.515625 | 3 |
hscommon/cocoa/inter.py | hsoft/currency_server | 0 | 51910 | # Created By: <NAME>
# Created On: 2010-02-06
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_... | 2.203125 | 2 |
examples/rl_ppo/train.py | Sirui-Xu/Arena | 1 | 51911 | <gh_stars>1-10
from functools import partial
import argparse
import os.path as osp
import sys
sys.path.append(osp.dirname(osp.dirname(osp.dirname(osp.abspath(__file__)))))
from arena import Arena, Wrapper
#from examples.rl_ppo.utils.mpi_tools import mpi_fork, mpi_avg, proc_id, mpi_statistics_scalar, num_procs
from exa... | 1.8125 | 2 |
week12/api/serializers.py | yestemir/web | 0 | 51912 | <reponame>yestemir/web<filename>week12/api/serializers.py
from rest_framework import serializers
from api.models import Company
class CompanySerializer(serializers.Serializer):
id = serializers.IntegerField(read_only=True)
name = serializers.CharField()
def create(self, validated_data):
category ... | 2.484375 | 2 |
SignIn.py | Oumourin/Im-Fine-Thank-You | 0 | 51913 | <reponame>Oumourin/Im-Fine-Thank-You
import requests
import random
from bs4 import BeautifulSoup
import PushMessage
import LoadConfig
# 登录页面URL
get_url = "http://39.98.190.134:81/Report/Reported"
# 登录请求URL
sign_up_url = "http://39.98.190.134:81/Account/Login"
# 申请短信验证码URL
mobile_phone_code_url = "http://172.16.17.3... | 2.515625 | 3 |
Week_4/7.22-7.30_Show&Tell/data_load.py | EricZhu-42/NJU_NLP_SummerCamp_2019 | 1 | 51914 | <reponame>EricZhu-42/NJU_NLP_SummerCamp_2019
import os
import pickle
import nltk
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
from PIL import Image
from process import Vocabulary
from pycocotools.coco import COCO
class CocoTrainset(data.Dataset):
def __init__(self, root... | 2.734375 | 3 |
pymagicc/core.py | openclimatedata/pymagicc | 25 | 51915 | import shutil
import subprocess # nosec # have to use subprocess
import warnings
from collections import Counter
from copy import deepcopy
from os import listdir, makedirs
from os.path import abspath, basename, dirname, exists, isfile, join
from subprocess import PIPE # nosec # have to use subprocess
from tempfile im... | 2.1875 | 2 |
5408Project/DBMS_Software/Serverless/vectorB00870639.py | AparnaVivekanandan18/Distributed-DBMS | 1 | 51916 | import json
import json
import boto3
import re
import json
import collections
import os
import pandas as pd
import csv
from csv import writer
# boto3 S3 initialization
s3_client = boto3.client("s3")
import numpy as np
def lambda_handler(event, context):
# TODO implement
bucketname = 'sourcedatab00870639'
... | 2.609375 | 3 |
z2/part2/interactive/jm/random_fuzzy_arrows_1/609933792.py | kozakusek/ipp-2020-testy | 1 | 51917 | <gh_stars>1-10
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 609933792
"""
"""
random actions, total chaos
"""
board = gamma_new(8, 5, 5, 9)
... | 2.140625 | 2 |
sshsysmon/drivers/ssh.py | zix99/sshsysmon | 46 | 51918 | from lib.plugins import Driver
import os
from paramiko import SSHClient, RSAKey, AutoAddPolicy
from io import StringIO
class Ssh(Driver):
DEFAULT_KEY_PATH = "~/.ssh/id_rsa"
def __init__(self, host, username='root', password = None, key = None, port = 22, path = "/proc"):
Driver.__init__(self)
self._host = host
... | 2.4375 | 2 |
Exercicios/ex029.py | sleepinhoo/Python | 0 | 51919 | # aplicador de multa
# kilometragem: 80km
# valor por kilomretro excedido: 7.00
print("OPA meu jovem, cuidado com a velocidade!")
km = float(input("Ovo ter que conferir se vc passou da velocidade, me informe o a kilometragem por favor: "))
vl = km - 80.0
if vl < 1.0 :
print("Tá limpo meu rei, pode passar.")
else... | 3.8125 | 4 |
python/src/hackerrank/2020/military_time.py | ccampo133/coding-challenges | 0 | 51920 | def timeConversion(s):
ampm = s[-2:]
hr = s[:2]
if ampm == 'AM':
return s[:-2] if hr != '12' else '00' + s[2:-2]
return s[:-2] if hr == '12' else str(int(s[:2]) + 12) + s[2:-2]
if __name__ == '__main__':
s1 = '07:05:45PM'
assert timeConversion(s1) == '19:05:45'
s2 = '07:05:45AM'
... | 3.65625 | 4 |
lizard/fof.py | pec27/lizard | 1 | 51921 | """
Friends-of-Friends (FOF) for N-body simulations
<NAME> - Oct 2016
"""
from __future__ import absolute_import, print_function
from lizard.periodic import pad_unitcube
from scipy.spatial import Delaunay
from scipy.sparse import csr_matrix, csgraph
from numpy import square, flatnonzero, ones, zeros_like, cumsum, con... | 2.53125 | 3 |
common_utils/ml_utils/resume/resume.py | cm107/common_utils | 0 | 51922 | from logger import logger
from ...file_utils import file_exists, dir_exists
from ...path_utils import get_newest_filepath
from ...prompt_utils import weights_scratch_prompt, weights_newest_prompt
class ResumeWeightsChecker:
def __init__(self, resume: bool, resume_path: str=None, weights_save_dir: str=None, weights... | 2.59375 | 3 |
BHL/build_parquet.py | iDigBio/guoda-datasets | 6 | 51923 | from __future__ import print_function
import os
import sys
from pyspark import SparkContext, SQLContext
import pyspark.sql.functions as sql
import pyspark.sql.types as types
import unicodecsv
from dateutil.parser import parse
sc = SparkContext(appName="BHLParquet")
sqlContext = SQLContext(sc)
def as_int(s):
retu... | 2.5625 | 3 |
hostlist.py | kingchang/vspherefdw | 1 | 51924 | """
CREATE FOREIGN TABLE hostlist (name text,
cluster text,
connstate text,
maintenance boolean,
cpuusage int,
cpuoverall int,
... | 2.109375 | 2 |
Packs/Ansible_Powered_Integrations/Integrations/Linux/Linux.py | diCagri/content | 799 | 51925 | <reponame>diCagri/content
import json
import traceback
from typing import Dict, cast
import ansible_runner
import demistomock as demisto # noqa: F401
import ssh_agent_setup
from CommonServerPython import * # noqa: F401
# Dict to Markdown Converter adapted from https://github.com/PolBaladas/torsimany/
def dict2md(j... | 2.515625 | 3 |
setup/provisioning_lambda.py | aws-samples/amazon-qldb-streaming-amazon-elasticsearch-sample-python | 7 | 51926 | # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# 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 wit... | 1.914063 | 2 |
StatsUtils/Stochastic.py | gakshaygupta/DerivativePricer | 0 | 51927 | import numpy as np
from numpy.core.fromnumeric import size
class BrownionPathGen:
def __init__(self, NumPaths, Maturity):
self.NumPaths = NumPaths
self.Maturity = Maturity # this is in days
# this is not optimal lets make a matrix of the std normal and then perform the operation to
# ch... | 3.203125 | 3 |
resistics/transfunc.py | resistics/resistics | 38 | 51928 | """
Module defining transfer functions
"""
from typing import List, Optional, Dict, Any, Union
from pydantic import validator, constr
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from resistics.common import Metadata
class Component(Metadata):
"""
Data class ... | 3.03125 | 3 |
mmfewshot/classification/datasets/tiered_imagenet.py | BIGWangYuDong/mmfewshot | 376 | 51929 | <reponame>BIGWangYuDong/mmfewshot<gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import pickle
import warnings
from typing import Dict, List, Optional, Sequence, Union
import mmcv
import numpy as np
from mmcls.datasets.builder import DATASETS
from typing_extensions import Liter... | 1.890625 | 2 |
archive/management/commands/backload_is.py | pastpages/savemy.news | 19 | 51930 | <gh_stars>10-100
from django.core.management.base import BaseCommand
import time
import logging
from archive import tasks
from archive.models import Clip
logger = logging.getLogger(__name__)
class Command(BaseCommand):
def handle(self, *args, **options):
clip_list = Clip.objects.all().order_by("?")
... | 2.140625 | 2 |
A3C/trainer/a3c/train_curiosity.py | sadeqa/Super-Mario-Bros-RL | 72 | 51931 | <gh_stars>10-100
import os
import time
from collections import deque
import csv
import numpy as np
import cv2
from itertools import count
from gym import wrappers
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from models.actor_critic import ActorCritic
f... | 2.09375 | 2 |
petridish/utils/sessinit.py | Bhaskers-Blu-Org2/petridishnn | 121 | 51932 | <reponame>Bhaskers-Blu-Org2/petridishnn
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import numpy as np
import tensorflow as tf
import six
from tensorpack.utils import logger
from tensorpack.tfutils.common import (
get_op_tensor_name, get_global_step_var)
from tensorpack.tfut... | 2.203125 | 2 |
app.py | Surumerf/stock_bottle | 0 | 51933 | <reponame>Surumerf/stock_bottle<gh_stars>0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# pylint: skip-file
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import datetime as dt
from dateutil.relativedelta import relativedelta
from bottle import Bottle, template, request, s... | 2.34375 | 2 |
setup.py | puppriss/pytaxize | 0 | 51934 | import codecs
from setuptools import setup
from setuptools import find_packages
with codecs.open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
with codecs.open('Changelog.rst', 'r', 'utf-8') as f:
changes = f.read()
long_description = '\n\n' + readme + '\n\n' + changes
setup(
name='pytaxize',
versi... | 1.328125 | 1 |
src/dl/models/decoders/residual/block.py | okunator/Dippa | 13 | 51935 | <filename>src/dl/models/decoders/residual/block.py
import torch
import torch.nn as nn
from ...modules import ResidualConvBlockPreact, ResidualConvBlock
class MultiBlockResidual(nn.ModuleDict):
def __init__(
self,
in_channels: int,
out_channels: int,
same_padding: b... | 2.9375 | 3 |
app/ko.py | embian-inc/Appium-Python-Console | 8 | 51936 | <filename>app/ko.py
#-*- coding: utf-8 -*-
# Code Interact Banner
APC_BANNER = u"""
************************************************************************************************************
* *
* Appium의 Pytho... | 1.8125 | 2 |
isic/core/models/collection.py | ImageMarkup/isic | 0 | 51937 | from typing import Optional
from django.contrib.auth.models import User
from django.db import models
from django.db.models.aggregates import Count
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.urls import reverse
from django_extensions.db.models import TimeStampedMo... | 2.203125 | 2 |
keynet/version.py | visym/keynet | 13 | 51938 | <gh_stars>10-100
MAJOR = 0
MINOR = 2
RELEASE = 4
VERSION = '%d.%d.%d' % (MAJOR, MINOR, RELEASE)
def at_least_version(versionstring):
"""Is versionstring='X.Y.Z' at least the current version?"""
(major, minor, release) = versionstring.split('.')
return at_least_major_version(major) and at_least_minor_versi... | 3.203125 | 3 |
nnunet/evaluation/shape_check_for_eval_test.py | hasukmin12/nnUNet_MDD_UNet_with_Semi_Supervised | 3 | 51939 | <reponame>hasukmin12/nnUNet_MDD_UNet_with_Semi_Supervised
import nibabel as nib
import os
folder_with_gt = '/data/sukmin/nnUNet_raw_data_base/nnUNet_raw_data/Task120_Ureter/labelsTs'
folder_with_pred = '/data/sukmin/inf_2_GT'
GT_list = next(os.walk(folder_with_gt))[2]
GT_list.sort()
print(GT_list)
pred_list = next(o... | 2.265625 | 2 |
app/controllers/auth_controller.py | abdulfataiaka/iexapp | 0 | 51940 | from config.db import db
from app.models.user import User
from app.models.wallet import Wallet
from app.helpers.helper import Helper
from flask import Blueprint, request, jsonify
from app.middlewares.validator_middleware import ValidatorMiddleware
bp = Blueprint('auth', __name__, url_prefix='/auth')
@bp.route('/log... | 2.296875 | 2 |
multimodal_models/ShowAndTellTensorflow/model.py | akhilagrawal1001/model-zoo | 43 | 51941 | from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, LSTM, Embedding
from tensorflow.keras.optimizers import RMSprop
from datagen import *
# Defining the layers to be used in the model
transfer_values_input = Input(shape=(2048,), name='transfer_values_input')
decoder_transfer_map... | 3.046875 | 3 |
egs/ots_use_libri_asr001_003/s5/local/prepare_lm.py | chizhang0814/kaldi | 0 | 51942 | import os
appen_lexicon_file = '/data/USE_ASR001/USE_ASR001/TABLE/LEXICON.TBL'
vocab_file='../data/local/lm/vocab.txt'
if not os.path.exists('../data/local/lm'):
os.mkdir('../data/local/lm')
fid = open(appen_lexicon_file)
all_lines = fid.readlines()
fid.close()
fid = open(vocab_file,'w')
for ln in all_lines:
... | 2.390625 | 2 |
pyston/tools/test_optimize.py | mananpal1997/pyston | 2,441 | 51943 | <filename>pyston/tools/test_optimize.py
import ctypes
import os
import subprocess
import sys
if __name__ == "__main__":
filename = os.path.abspath(sys.argv[1])
funcnames = sys.argv[2:]
if not funcnames:
print("Usage: python test_optimize.py FILENAME FUNCNAME+")
sys.exit(1)
os.chdir(os.... | 2.21875 | 2 |
core/analysis/identification/filesize/file_size.py | iAbdullahMughal/d-scan | 6 | 51944 | __author__ = '<NAME>'
__website__ = 'https://www.iabdullahmughal.com'
__twitter__ = '@iabdullahmughal'
import os
class FileSize:
def __init__(self, file_path):
self.__file_path__ = file_path
# https://stackoverflow.com/questions/2104080/how-to-check-file-size-in-python
@staticmethod
def __co... | 3.09375 | 3 |
notifications/management/commands/notification_sender.py | bogdanoniga/django-notification-sender | 1 | 51945 | import json
import logging
import time
from pathlib import Path
from django.core.mail import EmailMultiAlternatives, get_connection
from django.core.management import BaseCommand
from slack_sdk import WebClient, errors
from database_locks import locked
from notifications.models import Notification, Subscription
from ... | 2.09375 | 2 |
openre/agent/client/action/deploy.py | openre/openre | 0 | 51946 | # -*- coding: utf-8 -*-
from openre.agent.decorators import action
import logging
from openre.agent.client.helpers import Net
@action(namespace='client')
def deploy(agent):
logging.debug('Run Net')
config = agent.net_config
if not config:
raise ValueError('No net config')
net = None
try:
... | 2.125 | 2 |
src/mylib/hello.py | buzzjmd/try-travis | 0 | 51947 | # -*- coding: utf-8 -*-
"""Hello module."""
import platform
import sys
def get_hello():
system = platform.system()
py_version = sys.version_info.major
if system == "Windows":
if py_version < 3:
return "Hello Windows, I'm Python2 or earlier!"
else:
return "Hello W... | 3.578125 | 4 |
source_code/central_monitor/alerts/admin.py | Doctor-Venom/Cyber-Oracle | 0 | 51948 | <filename>source_code/central_monitor/alerts/admin.py<gh_stars>0
from django.contrib import admin
from .models import Alert
# Register your models here.
admin.site.register(Alert)
| 1.242188 | 1 |
kerashistoryplot/data.py | ig248/livehistoryplot | 1 | 51949 | def get_metrics(history):
plot_metrics = [
k for k in history.keys()
if k not in ['epoch', 'batches'] and not k.startswith('val_')
]
return plot_metrics
def get_metric_vs_epoch(history, metric, batches=True):
data = []
val_metric = f'val_{metric}'
for key in [metric, val_metric... | 2.8125 | 3 |
pagapp/admin_panel/forms.py | eugeneandrienko/PyArtistsGallery | 0 | 51950 | <gh_stars>0
"""Set of forms which using in admin panel.
List of forms:
ChangePasswordForm -- providing form for password change.
AddAlbumForm -- providing form for adding new album.
UploadForm -- providing form for uploading new pictures.
CommonSettingsForm -- providing form for changing common settings.
"""
import r... | 3.046875 | 3 |
choreo/multirq/defaults.py | Mizzlr/triton | 3 | 51951 | DEFAULT_JOB_CLASS = 'choreo.multirq.job.Job'
DEFAULT_QUEUE_CLASS = 'choreo.multirq.Queue'
DEFAULT_WORKER_CLASS = 'choreo.retry.RetryWorker'
DEFAULT_CONNECTION_CLASS = 'redis.StrictRedis'
DEFAULT_WORKER_TTL = 420
DEFAULT_RESULT_TTL = 500
| 0.996094 | 1 |
web_api/api/urls.py | IoT-BA/project_noe-backend | 2 | 51952 | <reponame>IoT-BA/project_noe-backend<filename>web_api/api/urls.py<gh_stars>1-10
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index),
url(r'^gws/?$', views.gws_list),
url(r'^gw/info/([0-9a-zA-Z]+)/?$', views.gw_info),
url(r'^gw/update/?$', views.gw_update),
... | 1.992188 | 2 |
tests/form/test_form_validation.py | warownia1/Slivca | 5 | 51953 | <reponame>warownia1/Slivca<gh_stars>1-10
from nose.tools import assert_is_none, assert_equal, assert_list_equal, \
assert_true, assert_false
from werkzeug.datastructures import MultiDict
from slivka.server.forms.fields import *
from slivka.server.forms.form import BaseForm
class TestCleanedValues:
class Dumm... | 2.25 | 2 |
test/test_e2r2.py | dariusarnold/quadpy | 0 | 51954 | import numpy
import pytest
import orthopy
import quadpy
from helpers import check_degree_ortho
schemes = [
quadpy.e2r2.haegemans_piessens_a(),
quadpy.e2r2.haegemans_piessens_b(),
quadpy.e2r2.rabinowitz_richter_1(),
quadpy.e2r2.rabinowitz_richter_2(),
quadpy.e2r2.rabinowitz_richter_3(),
quadpy.... | 2.0625 | 2 |
src/test_lcis.py | manoldonev/algo-challenges | 0 | 51955 |
import unittest
from lcis import find_lcis_length
class LCISTests(unittest.TestCase):
"""Tests for longest continuous increasing subsequence challenge."""
def test_case_1(self):
self.assertEqual(find_lcis_length([1, 3, 5, 4, 7]), 3)
def test_case_2(self):
self.assertEqual(find_lcis_len... | 3.34375 | 3 |
test/test-356-getei.py | Cam2337/snap-python | 242 | 51956 | import snap
Graph = snap.GenFull(snap.PNEANet, 10)
Src = 1
Dst = 2
EI = Graph.GetEI(Src,Dst)
EId = EI.GetId()
print(EId, Graph.GetEI(Src,Dst).GetId())
print(Graph.GetEI(Src,Dst).GetSrcNId(), Graph.GetEI(Src,Dst).GetDstNId())
print(Graph.GetEI(EId).GetSrcNId(), Graph.GetEI(EId).GetDstNId())
if EId != Graph.GetEI(Src,Ds... | 2.40625 | 2 |
test_1E.py | cai-yuqing/IA-flood-risk-129 | 0 | 51957 | from floodsystem.station import MonitoringStation
from floodsystem.geo import rivers_by_station_number
def test_rivers_by_station_number():
"""Test for Task1E functions"""
#create 4 test stations
station_id = "Test station_id"
measure_id = "Test measure_id"
label = "Test station"
coord = (0.0,... | 3.1875 | 3 |
showdown/apps.py | sunshinejen/boardgameshowdown- | 0 | 51958 | <reponame>sunshinejen/boardgameshowdown-
from django.apps import AppConfig
class ShowdownConfig(AppConfig):
name = 'showdown'
| 1.046875 | 1 |
restclients/test/canvas/accounts.py | uw-it-cte/uw-restclients | 0 | 51959 | <filename>restclients/test/canvas/accounts.py
from django.test import TestCase
from django.conf import settings
from restclients.canvas.accounts import Accounts as Canvas
from restclients.exceptions import DataFailureException
class CanvasTestAccounts(TestCase):
def test_account(self):
with self.settings(... | 2.359375 | 2 |
src/logic/screen.py | michel-cf/pynfinitton | 0 | 51960 | import logging
import os
from typing import Dict, Optional, List
import libinfinitton
from . import tasks
class Screen:
logger = logging.getLogger(__name__)
def __init__(self, task_list: Dict[str, tasks.BaseTask], name: str, config: dict = None):
self._task_list = task_list
self.name = nam... | 2.578125 | 3 |
startup/users/30-user-Subh.py | mrakitin/profile_collection-smi | 0 | 51961 | <gh_stars>0
#Aligam GiSAXS sample
#
def align_gisaxs_height_subh( rang = 0.3, point = 31 ,der=False ):
det_exposure_time(0.5)
sample_id(user_name='test', sample_name='test')
yield from bp.rel_scan([pil1M,pil1mroi1,pil1mroi2], piezo.y, -rang, rang, point)
ps(de... | 1.992188 | 2 |
ricecooker/classes/questions.py | radinamatic/ricecooker | 0 | 51962 | <reponame>radinamatic/ricecooker
# Question models for exercises
import uuid
import json
import re
import copy
import sys
from bs4 import BeautifulSoup
from le_utils.constants import content_kinds,file_formats, format_presets, licenses, exercises
from .. import config
from ..exceptions import UnknownQuestionTypeError,... | 2.515625 | 3 |
automon/tests/integrations/test_elasticsearch.py | TheShellLand/automonisaur | 2 | 51963 | import unittest
from automon.integrations.elasticsearch.config import ElasticsearchConfig, SnapshotBot, JVMBot
from automon.integrations.elasticsearch.client import ElasticsearchClient
from automon.integrations.elasticsearch.cleanup import Cleanup
from automon.integrations.elasticsearch.metrics import Metric, MetricTi... | 2.25 | 2 |
Tests/tx_test/tx_test.py | despargy/Shade | 3 | 51964 | <filename>Tests/tx_test/tx_test.py
from multiprocessing import Process
import time, os, threading
def start_tx(name):
os.system('python3 {name}'.format(name=name))
def kill_tx(name):
temp_filename = 'tmp_pid'
os.system('ps -ef | grep {name} > {temp_filename}'.format(name=name,temp_filename=temp_filename))... | 2.734375 | 3 |
spath/__init__.py | dimatura/spath.py | 0 | 51965 | # -*- coding: utf-8 -*-
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.5'
from .spath import Path
| 1.140625 | 1 |
report.py | daed5/bobby_boy | 67 | 51966 | <gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
import config
import subprocess
def edit(filename):
process = subprocess.Popen([config.edit_cmdline, filename])
def make(items,
categories,
filename,
datetime,
receipt_sum,
calculated_sum,
... | 2.796875 | 3 |
src/interpreter/functions/find.py | b-Development-Team/b-star | 1 | 51967 | <reponame>b-Development-Team/b-star
# TODO: Give better variable names
# TODO: Make v3 and v4 optional arguments
def find(v1, v2, v3, v4):
return v1.index(v2, v3, v4)
| 1.46875 | 1 |
fn_cloud_foundry/fn_cloud_foundry/components/fn_cloud_foundry_create_app.py | nickpartner-goahead/resilient-community-apps | 65 | 51968 | # -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
"""Function implementation"""
import json
import logging
from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
from fn_cloud_foundry.util.cloud_foundry_api import IBMCloudFoundryAP... | 2.046875 | 2 |
Python3-Learn/rotate_list.py | nikhiljain-413/Hacktoberfest2021_beginner | 65 | 51969 | <filename>Python3-Learn/rotate_list.py
# AUTHOR: prm1999
# Python3 Concept: Rotate the word in the list.
# GITHUB: https://github.com/prm1999
# Function
def rotate(arr, n):
n = len(arr)
i = 1
x = arr[n - 1]
for i in range(n - 1, 0, -1):
arr[i] = arr[i - 1]
arr[0] = x
return arr
#m... | 4.40625 | 4 |
tests/test_validators.py | life4/vaa | 5 | 51970 | import pytest
from .validators.pre import prevalidators
from .validators.post import postvalidators
validators = prevalidators + postvalidators
@pytest.mark.parametrize('validator', validators)
def test_valid(validator):
data = {
'name': 'Oleg',
'mail': '<EMAIL>',
'count': 20,
}
... | 2.59375 | 3 |
tests/sanscript_cli/test_app.py | vipranarayan14/indic_transliteration | 15 | 51971 | from typer.testing import CliRunner
from indic_transliteration.sanscript_cli import app
runner = CliRunner()
test_input = "rAmAyaNa"
expected_output = "rāmāyaṇa"
def test_argument_input():
result = runner.invoke(app, ["--from", "hk", "--to", "iast", test_input])
assert result.exit_code == 0
assert expe... | 2.71875 | 3 |
src/cobald/daemon/runners/trio_runner.py | thoto/cobald | 7 | 51972 | import trio
from functools import partial
from .base_runner import BaseRunner
from .async_tools import raise_return, AsyncExecution
class TrioRunner(BaseRunner):
"""Runner for coroutines with :py:mod:`trio`"""
flavour = trio
def __init__(self):
self._nursery = None
super().__init__()
... | 2.390625 | 2 |
thulac/character/CBNGramFeature.py | yangzhiye/NLPCC2017-task3 | 25 | 51973 | #coding = utf-8
# from ..base import Dat
import time
import array
class CBNGramFeature:
SENTENCE_BOUNDARY = '#'
SEPERATOR = "_"
maxLength = 0
uniBases = []
biBases = []
datSize = []
dat = []
values = {}
def __init__(self, myDat, model):
self.SEPERATOR = ' '
self.da... | 2.375 | 2 |
daily_mail_and_nbc.py | V5NEXT/ScrappingWebPages | 0 | 51974 | <gh_stars>0
# -*- coding: utf-8 -*-
"""daily_mail and NBC.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1mt9Lo5KApXqCdNN_57OCej3pT9_vVBRP
"""
#importing requests
import requests
#importing BeautifulSoup for scrapping templates
from bs4 import ... | 2.6875 | 3 |
openstates/openstates-master/openstates/ks/legislators.py | Jgorsick/Advocacy_Angular | 0 | 51975 | from billy.scrape.legislators import LegislatorScraper, Legislator
from openstates.utils import LXMLMixin
from . import ksapi
import json
import scrapelib
class KSLegislatorScraper(LegislatorScraper, LXMLMixin):
jurisdiction = 'ks'
def scrape(self, term, chambers):
content = json.loads(self.get(ksap... | 2.75 | 3 |
mission/constants/teagle.py | cuauv/software | 70 | 51976 | from mission.constants.missions import Gate, Path
from conf.vehicle import is_mainsub
HYDROPHONES_PINGER_DEPTH = 3.0
NONSURFACE_MIN_DEPTH = 0.6
# gate = Gate(
# depth=1.0,
# initial_approach_target_percent_of_screen=.45,
# gate_width_threshold=0.4,
# pre_spin_charge_dist=16 if is_mainsub else 12,
# ... | 2.1875 | 2 |
setup.py | zbloss/hourly-price-prediction | 0 | 51977 | from os import path
from setuptools import find_packages, setup
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
with open(path.join(this_directory, "LICENSE"), encoding="utf-8") as f:
license_ = f.read... | 1.640625 | 2 |
util/Instruction.py | F-Stuckmann/PATARA | 2 | 51978 | import copy
import warnings
from Constants import TARGET_REGISTER, RAND_VALUE, FOCUS_REGISTER, ADDRESS, OPERAND_TYPE, OPERANDS, ISSUE_SLOT
from util.Processor import Processor
class Instruction:
def __init__(self, assembly: str, mutable=True):
# set default enabled features
self.isRandValueRando... | 2.46875 | 2 |
kiestze_django/kiestze_django/settings.py | oSoc18/kiest_ze | 3 | 51979 | """
Django settings for kiestze_django project.
Generated by 'django-admin startproject' using Django 2.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
impor... | 1.820313 | 2 |
snap_seg.py | unrealdever/CarlaScript | 0 | 51980 | import carla
import random
import time
from tqdm import tqdm
client = carla.Client('localhost', 2000)
client.set_timeout(2.0)
for mid, map_name in enumerate(client.get_available_maps()):
world = client.load_world(map_name)
blueprint_library = world.get_blueprint_library()
print('load map', map_name)
... | 2.328125 | 2 |
src/python/src/pythonic/iterator/sorted_iter.py | showerMuggle/klose911.github.io | 1 | 51981 | <filename>src/python/src/pythonic/iterator/sorted_iter.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
#Filename: soreted_iter.py
colors = [ 'red', 'green', 'blue', 'yellow' ]
for color in sorted(colors):
print (color)
# >>> blue
# green
# red
# yellow
for color in sorted(colors, reverse=True):
... | 4.1875 | 4 |
examples/starFISH.py | tlambert03/image-demos | 0 | 51982 | """
Displays FISH data, raw and deconvolved, with spots detected using starFISH
"""
from skimage.io import imread
import numpy as np
from napari import Viewer, gui_qt
raw = imread('data-njs/smFISH/raw.tif')
deconvolved = imread('data-njs/smFISH/deconvolved.tif')
spots = np.loadtxt('data-njs/smFISH/spots.csv', delimit... | 2.71875 | 3 |
clans_cells/apps.py | Red-Teapot/bbyaworld.com-django | 1 | 51983 | from django.apps import AppConfig
class ClansCellsConfig(AppConfig):
name = 'clans_cells'
| 0.933594 | 1 |
src/python/examples/decorator.py | pierfied/apollo | 14 | 51984 | <gh_stars>10-100
#!/usr/bin/env python
from __future__ import print_function
def printstuff(fun):
def fun_that_prints(*args, **kwargs):
print("calling %s" % fun.__name__)
fun(*args, **kwargs)
print("done with %s." % fun.__name__)
return fun_that_prints
def myfunction():
print("MY... | 2.875 | 3 |
actors/pyco.py | pog87/PYDOJO | 0 | 51985 | from pydojo import *
from gobo import Gobo
class Pyco(Actor):
def setup(self):
self.touched_gobo = False
self.setx(100)
self.testtimer = Timer(2000)
self.rotate('flip')
def update(self):
if key(RIGHT):
self.point(90)
self.forward(10)
if... | 3.21875 | 3 |
RadiAIDD/Backend/__init__.py | jo-mueller/RadiAide | 0 | 51986 | <filename>RadiAIDD/Backend/__init__.py
# -*- coding: utf-8 -*-
from .UI import ressources_rc
| 1.046875 | 1 |
plotting-tools/plot_samples_multiple.py | larsgeb/hmc-documentation | 0 | 51987 | import glob
import numpy as np
import random as random
import matplotlib.pylab as pylab
import matplotlib.pyplot as plt
import locale
import decimal
def drange(x, y, jump):
while x < y:
yield float(x)
x = x + float(decimal.Decimal(jump))
# ========================================================... | 2.890625 | 3 |
guardaPaisesLineas.py | juaseso/sinf_desarrollos | 0 | 51988 | import shelve
shelfFile = shelve.open('mydata')
file = open('allCountries.txt')
print('Dividiendo el fichero en un array de líneas')
lineas = file.readlines()
print('OK')
shelfFile['arraylineas'] = lineas
shelfFile.close()
| 2.828125 | 3 |
build/lib/OutputFileTester/ProgramTester.py | connorfuhrman/OutputFileTester | 0 | 51989 | <gh_stars>0
# Defines a class to test a program's output file(s) for ECE 275 @ The University of Arizona
# with optional functionality to compile the program
import os, shutil, subprocess, difflib, re
from pprint import pprint
import pytest
class ProgramTester:
def __init__(self, executable_name):
# Set ... | 2.828125 | 3 |
src/main1.py | yamap55/python_import_sample | 0 | 51990 | import b
def get_str():
return f"123_{b.get_hoge()}_456" # 123_hoge_456
if __name__ == "__main__":
print(get_str())
| 2.109375 | 2 |
#Ejercicio 2.py | carlospuigserver/Recursividad | 0 | 51991 | <filename>#Ejercicio 2.py
#Ejercicio 2
palabra=input ("Escribe una palabra y vamos a analizar si es polindroma o no: ")
p=len(palabra)
capicua=""
while p>0:
p=p-1
capicua=capicua+palabra[p] #Concateno las letras una por una y las guardo
if palabra ==capicua:
print("La palabra escogida es polindroma"... | 3.75 | 4 |
shlibvischeck/common/process.py | yugr/ShlibVisibilityChecker | 27 | 51992 | # The MIT License (MIT)
#
# Copyright (c) 2020-2022 <NAME>
#
# Use of this source code is governed by The MIT License (MIT)
# that can be found in the LICENSE.txt file.
"""
APIs for handling processes
"""
import subprocess
from shlibvischeck.common.error import error
__all__ = ['run', 'is_runnable']
def run(cmd,... | 2.09375 | 2 |
helloworld.py | joefroh/l2python | 0 | 51993 | <filename>helloworld.py
print("Hello World")
# The basics
name = "joey"
age = 27
print(name + str(age))
testList = [0,1,2]
testList.append(3)
testList.append(4)
for member in testList:
print(member)
for index,member in enumerate(testList):
print("Index: " + str(index) + " item: " + str(member))
# List Com... | 4.09375 | 4 |
Strategy.py | irigi/SpaceCombat | 0 | 51994 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun May 20 13:05:03 2018
@author: irigi
"""
import math
import numpy as np
import abc
import pyximport; pyximport.install()
from Physics import ShipCtrl
class DNN(object):
def __init__(self):
self.w1 = np.random.rand(7,7)
self.w2 = np.random.rand... | 2.71875 | 3 |
tests/other_models.py | BottleJia/Redis-astra | 87 | 51995 | from astra import models
import redis
db = redis.StrictRedis(host='127.0.0.1', decode_responses=True)
class SiteColorModel(models.Model):
color = models.CharField()
def get_db(self):
return db
| 2.40625 | 2 |
recip/validate/ValidatorFactory.py | anthonybuckle/Reciprocity-Core | 0 | 51996 | from recip.validate.types.Block import Block
from recip.validate.types.Tx import Tx
from recip.validate import ValidatorType
def getInstance(vType):
'''Validator Types'''
if ValidatorType.BLOCK == vType:
return Block()
elif ValidatorType.TX == vType:
return Tx() | 2.296875 | 2 |
train.py | autonomousvision/campari | 21 | 51997 | <gh_stars>10-100
import torch
from os.path import join
from os import makedirs
import tqdm
import numpy as np
from torch.utils.tensorboard import SummaryWriter
import argparse
from gan_training import config, data, checkpoint
from gan_training.utils import to8b, log_and_print
from torchvision.utils import save_image
im... | 1.953125 | 2 |
endgame/exposure_via_resource_policies/common.py | vikrum/endgame | 224 | 51998 | from abc import ABCMeta, abstractmethod
import json
import logging
import copy
import boto3
import botocore
from botocore.exceptions import ClientError
from endgame.shared.response_message import ResponseMessage
from endgame.shared.list_resources_response import ListResourcesResponse
from endgame.shared.response_messag... | 1.796875 | 2 |
ski_trip.py | GYosifov88/Python-Basics | 0 | 51999 | <reponame>GYosifov88/Python-Basics<gh_stars>0
days = int(input())
type_of_room = input()
feedback = input()
price = 0
nights = days - 1
if type_of_room == 'room for one person':
price = 18
cost = nights * price
elif type_of_room == 'apartment':
price = 25
cost = nights * price
if days < 10:
... | 4.03125 | 4 |