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 |
|---|---|---|---|---|---|---|
bvs/background_verification/report/checks_status_report/checks_status_report.py | vhrspvl/vhrs-bvs | 1 | 3400 | # Copyright (c) 2013, VHRS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import (cint, cstr, date_diff, flt, getdate, money_in_words,
nowdate, rounded, today)
from datet... | 2.09375 | 2 |
dataset/dataset.py | TeamOfProfGuo/few_shot_baseline | 0 | 3401 | <filename>dataset/dataset.py
import os
DEFAULT_ROOT = './materials'
datasets_dt = {}
def register(name):
def decorator(cls):
datasets_dt[name] = cls
return cls
return decorator
def make(name, **kwargs):
if kwargs.get('root_path') is None:
kwargs['root_path'] = os.path.join(DEFA... | 2.515625 | 3 |
src/proto_formatter/syntax_parser.py | YiXiaoCuoHuaiFenZi/proto-formatter | 0 | 3402 | from .comment import CommentParser
from .protobuf import Protobuf
from .proto_structures import Syntax
class SyntaxParser():
@classmethod
def parse_and_add(cls, proto_obj: Protobuf, line, top_comment_list):
if proto_obj.syntax is not None:
raise 'multiple syntax detected!'
proto_... | 2.640625 | 3 |
IPL/app/core/views.py | mgp-git/Flask | 0 | 3403 | <reponame>mgp-git/Flask<filename>IPL/app/core/views.py
from flask import render_template, request, Blueprint
core = Blueprint('core', __name__)
@core.route("/", methods=['GET', 'POST'])
def home():
return render_template('home.html')
@core.route("/about")
def about():
return render_template('about.html')
... | 2.0625 | 2 |
tests/test_s3.py | tdilauro/circulation-core | 1 | 3404 | <reponame>tdilauro/circulation-core
# encoding: utf-8
import functools
import os
from urllib.parse import urlsplit
import boto3
import botocore
import pytest
from botocore.exceptions import BotoCoreError, ClientError
from mock import MagicMock
from parameterized import parameterized
from ..mirror import MirrorUploade... | 1.953125 | 2 |
lbry/scripts/set_build.py | vanshdevgan/lbry-sdk | 0 | 3405 | """Set the build version to be 'qa', 'rc', 'release'"""
import sys
import os
import re
import logging
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
log.setLevel(logging.DEBUG)
def get_build_type(travis_tag=None):
if not travis_tag:
return "qa"
log.debug("getting build type for ta... | 2.234375 | 2 |
backend/jenkins/pipelines/ansible/utils/testplan_gen.py | gbl1124/hfrd | 5 | 3406 | <gh_stars>1-10
#!/usr/bin/python
import yaml
import os
import ast
import sys
from collections import OrderedDict
curr_dir = os.getcwd()
work_dir = sys.argv[1]
network_type = sys.argv[2]
testplan_dict = {}
testplan_dict["name"] = "System performance test"
testplan_dict["description"] = "This test is to create as muc... | 1.960938 | 2 |
dblib/test_lib.py | cyber-fighters/dblib | 0 | 3407 | """Collection of tests."""
import pytest
import dblib.lib
f0 = dblib.lib.Finding('CD spook', 'my_PC', 'The CD drive is missing.')
f1 = dblib.lib.Finding('Unplugged', 'my_PC', 'The power cord is unplugged.')
f2 = dblib.lib.Finding('Monitor switched off', 'my_PC', 'The monitor is switched off.')
def test_add_remove(... | 2.78125 | 3 |
src/azure-cli/azure/cli/command_modules/policyinsights/_completers.py | YuanyuanNi/azure-cli | 3,287 | 3408 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1.828125 | 2 |
hordak/migrations/0011_auto_20170225_2222.py | CodeBrew-LTD/django-hordak | 187 | 3409 | <reponame>CodeBrew-LTD/django-hordak
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-25 22:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_smalluuid.models
class Migration(migrations.Migrat... | 1.734375 | 2 |
Bot Telegram.py | devilnotcry77/devil_not_cry | 0 | 3410 | from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
TOKEN = "Token for you bot"
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(command=['start', 'help'])
async def send_welcome(msg: types.Message):
await msg.reply_to_message(f'Добро ... | 2.5625 | 3 |
redactor/utils.py | danlgz/django-wysiwyg-redactor | 0 | 3411 | <reponame>danlgz/django-wysiwyg-redactor<filename>redactor/utils.py
from django.core.exceptions import ImproperlyConfigured
from importlib import import_module
try:
from django.utils.encoding import force_text
except ImportError:
from django.utils.encoding import force_unicode as force_text
from django.utils.f... | 2.21875 | 2 |
timedpid.py | DrGFreeman/PyTools | 1 | 3412 | # timedpid.py
# Source: https://github.com/DrGFreeman/PyTools
#
# MIT License
#
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# 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, in... | 2.078125 | 2 |
pmon/zmq_responder.py | bernd-clemenz/pmon | 1 | 3413 | #
# -*- coding: utf-8-*-
# receives messages via zmq and executes some simple
# operations.
#
# (c) ISC Clemenz & Weinbrecht GmbH 2018
#
import json
import requests
import zmq
import pmon
class ZmqResponder(object):
context = None
socket = None
def __init__(self):
"""
Constructor.
... | 2.453125 | 2 |
test/test_substitute.py | sanskrit/padmini | 1 | 3414 | <filename>test/test_substitute.py
from padmini import operations as op
def test_yatha():
before = ("tAs", "Tas", "Ta", "mip")
after = ("tAm", "tam", "ta", "am")
for i, b in enumerate(before):
assert op.yatha(b, before, after) == after[i]
"""
def test_ti():
assert S.ti("ta", "e") == "te"
... | 3.0625 | 3 |
TVSaffiliations/extractemails_nogui.py | kmhambleton/LSST-TVSSC.github.io | 0 | 3415 | # coding: utf-8
#just prints the emails of members of a group to stdout,
#both primary and secondary members
# run as
# $python extractemails_nogui.py "Tidal Disruption Events"
from __future__ import print_function
'__author__' == '<NAME>, NYU - GitHub: fedhere'
import sys
import pandas as pd
from argparse import Argu... | 3.0625 | 3 |
cogs/owner.py | Obsidian-Development/JDBot | 0 | 3416 | <reponame>Obsidian-Development/JDBot<filename>cogs/owner.py
from discord.ext import commands, menus
import utils
import random , discord, os, importlib, mystbin, typing, aioimgur, functools, tweepy
import traceback, textwrap
from discord.ext.menus.views import ViewMenuPages
class Owner(commands.Cog):
def __init__(se... | 2.234375 | 2 |
tests/input_files/full_sm_UFO/function_library.py | valassi/mg5amc_test | 1 | 3417 | <gh_stars>1-10
# This file is part of the UFO.
#
# This file contains definitions for functions that
# are extensions of the cmath library, and correspond
# either to functions that are in cmath, but inconvenient
# to access from there (e.g. z.conjugate()),
# or functions that are simply not defined.
#
#
from __future... | 2.21875 | 2 |
cli/polyaxon/managers/cli.py | hackerwins/polyaxon | 0 | 3418 | <gh_stars>0
#!/usr/bin/python
#
# Copyright 2019 Polyaxon, Inc.
#
# 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 appl... | 1.742188 | 2 |
duckql/properties/tests/test_null.py | fossabot/duckql-python | 4 | 3419 | import pytest
from duckql.properties import Null
@pytest.fixture(scope="module")
def valid_instance() -> Null:
return Null()
def test_string(valid_instance: Null):
assert str(valid_instance) == 'NULL'
def test_obj(valid_instance: Null):
assert valid_instance.obj == 'properties.Null'
def test_json_p... | 2.484375 | 2 |
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/lib/gobject-introspection/giscanner/codegen.py | sotaoverride/backup | 0 | 3420 | <gh_stars>0
# -*- Mode: Python -*-
# GObject-Introspection - a framework for introspecting GObject libraries
# Copyright (C) 2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foun... | 1.867188 | 2 |
nevergrad/parametrization/utils.py | mehrdad-shokri/nevergrad | 2 | 3421 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import shutil
import tempfile
import subprocess
import typing as tp
from pathlib import Path
from ne... | 2.28125 | 2 |
Section 20/2.Document-transfer_files.py | airbornum/-Complete-Python-Scripting-for-Automation | 18 | 3422 | <gh_stars>10-100
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname='172.16.58.3',username='ec2-user',password='<PASSWORD>',port=22)
sftp_client=ssh.open_sftp()
#sftp_client.get('/home/ec2-user/paramiko_download.txt','paramiko_downloaded_file... | 2.328125 | 2 |
nimlime_core/utils/internal_tools.py | gmpreussner/Varriount.NimLime | 0 | 3423 | # coding=utf-8
"""
Internal tools for NimLime development & testing.
"""
from pprint import pprint
import sublime
try:
from cProfile import Profile
except ImportError:
from profile import Profile
from functools import wraps
from pstats import Stats
try:
from StringIO import StringIO
except ImportError:
... | 1.96875 | 2 |
test/unit/test_monitor.py | dmvieira/driftage | 4 | 3424 | import orjson
from asynctest import TestCase, Mock, patch
from freezegun import freeze_time
from driftage.monitor import Monitor
class TestMonitor(TestCase):
def setUp(self):
self.monitor = Monitor(
"user_test@local", "<PASSWORD>", "identif"
)
def tearDown(self):
self.mo... | 2.328125 | 2 |
examples/todo_advanced/main.py | travisluong/fastarg | 1 | 3425 | <filename>examples/todo_advanced/main.py
import fastarg
import commands.todo as todo
import commands.user as user
app = fastarg.Fastarg(description="productivity app", prog="todo")
@app.command()
def hello_world(name: str):
"""hello world"""
print("hello " + name)
app.add_fastarg(todo.app, name="todo")
app.a... | 2.546875 | 3 |
tests/test_channel.py | rwilhelm/aiormq | 176 | 3426 | import asyncio
import uuid
import pytest
from aiomisc_pytest.pytest_plugin import TCPProxy
import aiormq
async def test_simple(amqp_channel: aiormq.Channel):
await amqp_channel.basic_qos(prefetch_count=1)
assert amqp_channel.number
queue = asyncio.Queue()
deaclare_ok = await amqp_channel.queue_dec... | 2.0625 | 2 |
nitro-python/nssrc/com/citrix/netscaler/nitro/resource/stat/mediaclassification/__init__.py | culbertm/NSttyPython | 2 | 3427 | __all__ = ['mediaclassification_stats'] | 1.09375 | 1 |
balanced_parens.py | joeghodsi/interview-questions | 1 | 3428 | '''
Problem description:
Given a string, determine whether or not the parentheses are balanced
'''
def balanced_parens(str):
'''
runtime: O(n)
space : O(1)
'''
if str is None:
return True
open_count = 0
for char in str:
if char == '(':
open_count += 1
... | 3.96875 | 4 |
plaso/parsers/winreg_plugins/ccleaner.py | pyllyukko/plaso | 1,253 | 3429 | # -*- coding: utf-8 -*-
"""Parser for the CCleaner Registry key."""
import re
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import winreg_parser
from plaso.parsers.winr... | 2.21875 | 2 |
pushpluck/base.py | ejconlon/pushpluck | 0 | 3430 | <reponame>ejconlon/pushpluck
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import Any, TypeVar
X = TypeVar('X')
class Closeable(metaclass=ABCMeta):
@abstractmethod
def close(self) -> None:
""" Close this to free resources and deny further use. """
rais... | 3.078125 | 3 |
test/cuberead/highres/test_default_high_res.py | CAB-LAB/cube-performance-test | 0 | 3431 | import time
import pytest
from test import config
from test.cube_utils import CubeUtils
ITERATIONS_NUM = getattr(config, 'iterations_num', 1)
ROUNDS_NUM = getattr(config, 'rounds_num', 10)
class TestDefaultHighRes:
@pytest.fixture(scope="class", autouse=True)
def cube_default(self):
cube_utils = Cu... | 1.992188 | 2 |
tests/components/test_dialogue_flow.py | dyoshiha/mindmeld | 1 | 3432 | import pytest
from mindmeld.components import Conversation
def assert_reply(directives, templates, *, start_index=0, slots=None):
"""Asserts that the provided directives contain the specified reply
Args:
directives (list[dict[str, dict]]): list of directives returned by application
templates ... | 2.34375 | 2 |
mine/src/main/python/SVM.py | nextzlog/mine | 3 | 3433 | import os,sys
import webbrowser
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.cm as cm
import matplotlib.pylab as plt
from matplotlib import ticker
plt.rcParams['font.family'] = 'monospace'
fig = plt.figure()
rect = fig.add_subplot(111, aspect='equal')
data0 = np.loadtxt('data0.dat', del... | 2.375 | 2 |
sarna/report_generator/scores.py | rsrdesarrollo/sarna | 25 | 3434 | <gh_stars>10-100
from sarna.model.enums import Score, Language
from sarna.report_generator import make_run
from sarna.report_generator.locale_choice import locale_choice
from sarna.report_generator.style import RenderStyle
def score_to_docx(score: Score, style: RenderStyle, lang: Language):
ret = make_run(getattr... | 2.203125 | 2 |
tests/hwsim/test_ap_open.py | waittrue/wireless | 1 | 3435 | # Open mode AP tests
# Copyright (c) 2014, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import struct
import subprocess
import time
import os
import hostapd
import hwsim_utils
from tshark impo... | 2.28125 | 2 |
task_templates/pipelines/python3_pytorch_regression/model_utils.py | andreakropp/datarobot-user-models | 0 | 3436 | <reponame>andreakropp/datarobot-user-models
#!/usr/bin/env python
# coding: utf-8
# pylint: disable-all
from __future__ import absolute_import
from sklearn.preprocessing import LabelEncoder
from pathlib import Path
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.optim as optim
cl... | 2.6875 | 3 |
py/surveysim/weather.py | mlandriau/surveysim | 0 | 3437 | <reponame>mlandriau/surveysim
"""Simulate stochastic observing weather conditions.
The simulated conditions include seeing, transparency and the dome-open fraction.
"""
from __future__ import print_function, division, absolute_import
from datetime import datetime
import numpy as np
import astropy.time
import astrop... | 2.71875 | 3 |
lib/csv_writer.py | takeratta/ga-dev-tools | 2 | 3438 | # coding=utf-8
# Copyright 2015 Google Inc. 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
#
# Unless required by ap... | 2.921875 | 3 |
resdata/TensorFlow/RNN_Prediction/stockPrediction202005201318.py | yuwenxianglong/zhxsh.github.io | 0 | 3439 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
@Project : RNN_Prediction
@Author : <NAME>
@Filename: stockPrediction202005201318.py
@IDE : PyCharm
@Time1 : 2020-05-20 13:18:46
@Time2 : 2020/5/20 13:18
@Month1 : 5月
@Month2 : 五月
"""
import tushare as ts
import tensorflow as tf
import pandas as pd
from sklearn.model_... | 2.703125 | 3 |
src/mushme.py | MuShMe/MuShMe | 1 | 3440 | <filename>src/mushme.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from src import app
import os
import shutil
from flask import Flask, render_template, session, request, flash, url_for, redirect
from Forms import ContactForm, LoginForm, editForm, ReportForm, CommentForm, searchForm, AddPlaylist
from f... | 1.921875 | 2 |
language/labs/drkit/evaluate.py | Xtuden-com/language | 1,199 | 3441 | <gh_stars>1000+
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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
#
# Unl... | 1.898438 | 2 |
tests/adv/test_pop_sfrd.py | jlashner/ares | 10 | 3442 | """
test_pop_models.py
Author: <NAME>
Affiliation: UCLA
Created on: Fri Jul 15 15:23:11 PDT 2016
Description:
"""
import ares
import matplotlib.pyplot as pl
PB = ares.util.ParameterBundle
def test():
# Create a simple population
pars_1 = PB('pop:fcoll') + PB('sed:bpass')
pop_fcoll = ares.population... | 1.890625 | 2 |
venv/lib/python3.7/site-packages/leancloud/engine/utils.py | corgiclub/CorgiBot_telegram | 0 | 3443 | # coding: utf-8
import time
import hashlib
import leancloud
from leancloud._compat import to_bytes
__author__ = 'asaka <<EMAIL>>'
def sign_by_key(timestamp, key):
return hashlib.md5(to_bytes('{0}{1}'.format(timestamp, key))).hexdigest()
| 1.984375 | 2 |
AirplaneLQR/chap4LQR/mavsim_chap4.py | eyler94/ee674AirplaneSim | 1 | 3444 | <filename>AirplaneLQR/chap4LQR/mavsim_chap4.py<gh_stars>1-10
"""
mavsimPy
- Chapter 4 assignment for <NAME>, PUP, 2012
- Update history:
12/27/2018 - RWB
1/17/2019 - RWB
"""
import sys
sys.path.append('..')
import numpy as np
import parameters.simulation_parameters as SIM
from chap2.mav_viewe... | 2.53125 | 3 |
core/self6dpp/tools/ycbv/ycbv_pbr_so_mlBCE_Double_3_merge_train_real_uw_init_results_with_refined_poses_to_json.py | THU-DA-6D-Pose-Group/self6dpp | 33 | 3445 | <gh_stars>10-100
import os.path as osp
import sys
import numpy as np
import mmcv
from tqdm import tqdm
from functools import cmp_to_key
cur_dir = osp.dirname(osp.abspath(__file__))
PROJ_ROOT = osp.normpath(osp.join(cur_dir, "../../../../"))
sys.path.insert(0, PROJ_ROOT)
from lib.pysixd import inout, misc
from lib.util... | 1.695313 | 2 |
tests/test_app/rest_app/rest_app/services/account_service.py | jadbin/guniflask | 12 | 3446 | <filename>tests/test_app/rest_app/rest_app/services/account_service.py
from flask import abort
from guniflask.context import service
from ..config.jwt_config import jwt_manager
@service
class AccountService:
accounts = {
'root': {
'authorities': ['role_admin'],
'password': '<PASSW... | 2.28125 | 2 |
test/library/draft/DataFrames/psahabu/AddSeries.py | jhh67/chapel | 1,602 | 3447 | <gh_stars>1000+
import pandas as pd
I = ["A", "B", "C", "D", "E"]
oneDigit = pd.Series([1, 2, 3, 4, 5], pd.Index(I))
twoDigit = pd.Series([10, 20, 30, 40, 50], pd.Index(I))
print "addends:"
print oneDigit
print twoDigit
print
print "sum:"
print oneDigit + twoDigit
print
I2 = ["A", "B", "C"]
I3 = ["B", "C", "D", "E"... | 3.28125 | 3 |
nelly/parser.py | shawcx/nelly | 0 | 3448 | <gh_stars>0
#
# (c) 2008-2020 <NAME>
#
import sys
import os
import re
import logging
import nelly
from .scanner import Scanner
from .program import Program
from .types import *
class Parser(object):
def __init__(self, include_dirs=[]):
self.include_dirs = include_dirs + [ os.path.join(nelly.root, 'gr... | 2.671875 | 3 |
qcodes/utils/installation_info.py | zhinst/Qcodes | 1 | 3449 | <filename>qcodes/utils/installation_info.py
"""
This module contains helper functions that provide information about how
QCoDeS is installed and about what other packages are installed along with
QCoDeS
"""
import sys
from typing import Dict, List, Optional
import subprocess
import json
import logging
import requiremen... | 2.390625 | 2 |
documents/views.py | brandonrobertz/foia-pdf-processing-system | 0 | 3450 | <reponame>brandonrobertz/foia-pdf-processing-system<filename>documents/views.py
from django.shortcuts import render
from django.http import JsonResponse
from .models import FieldCategory
def fieldname_values(request):
if request.method == "GET":
fieldname = request.GET['fieldname']
query = reques... | 2.34375 | 2 |
tests/test_provider_Mongey_kafka_connect.py | mjuenema/python-terrascript | 507 | 3451 | # tests/test_provider_Mongey_kafka-connect.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:20:11 UTC)
def test_provider_import():
import terrascript.provider.Mongey.kafka_connect
def test_resource_import():
from terrascript.resource.Mongey.kafka_connect import kafka_connect_connector
# T... | 1.867188 | 2 |
application.py | nicholsont/catalog_app | 0 | 3452 | from flask import Flask, render_template, request, redirect, jsonify, g
from flask import url_for, flash, make_response
from flask import session as login_session
from sqlalchemy import create_engine, asc
from sqlalchemy.orm import sessionmaker
from models import Base, Category, Item, User
from oauth2client.client impo... | 2.46875 | 2 |
noo/impl/utils/__init__.py | nooproject/noo | 2 | 3453 | from .echo import echo, set_quiet
from .errors import NooException, cancel
from .store import STORE, FileStore, Store
__all__ = (
"FileStore",
"NooException",
"Store",
"STORE",
"cancel",
"echo",
"set_quiet",
)
| 1.304688 | 1 |
ai2thor/server.py | aliang8/ai2thor | 1 | 3454 | <filename>ai2thor/server.py<gh_stars>1-10
# Copyright Allen Institute for Artificial Intelligence 2017
"""
ai2thor.server
Handles all communication with Unity through a Flask service. Messages
are sent to the controller using a pair of request/response queues.
"""
import json
import logging
import sys
import os
imp... | 2.515625 | 3 |
setup.py | ooreilly/mydocstring | 13 | 3455 | <filename>setup.py
from setuptools import setup
setup(name='mydocstring',
version='0.2.7',
description="""A tool for extracting and converting Google-style docstrings to
plain-text, markdown, and JSON.""",
url='http://github.com/ooreilly/mydocstring',
author="<NAME>",
license='MIT'... | 1.867188 | 2 |
anyser/impls/bson.py | Cologler/anyser-python | 0 | 3456 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2020~2999 - Cologler <<EMAIL>>
# ----------
#
# ----------
import bson
import struct
from ..err import SerializeError
from ..abc import *
from ..core import register_format
@register_format('bson', '.bson')
class BsonSerializer(ISerializer):
format_name = 'bson'
def... | 2.28125 | 2 |
tests/test_config_parser.py | KevinMFong/pyhocon | 424 | 3457 | # -*- encoding: utf-8 -*-
import json
import os
import shutil
import tempfile
from collections import OrderedDict
from datetime import timedelta
from pyparsing import ParseBaseException, ParseException, ParseSyntaxException
import mock
import pytest
from pyhocon import (ConfigFactory, ConfigParser, ConfigSubstitution... | 2.453125 | 2 |
scenario_runner/srunner/scenariomanager/scenario_manager.py | cgeller/WorldOnRails | 447 | 3458 | <reponame>cgeller/WorldOnRails<gh_stars>100-1000
#!/usr/bin/env python
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides the ScenarioManager implementation.
It must not be modified... | 2.671875 | 3 |
edb/schema/referencing.py | disfated/edgedb | 0 | 3459 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | 1.679688 | 2 |
tools.py | Jakuko99/effectb | 1 | 3460 | from calendar import month_name
class Tools:
def __init__(self):
self.output = ""
def formatDate(self, date):
elements = date.split("-")
return f"{elements[2]}. {month_name[int(elements[1])]} {elements[0]}"
def shortenText(self, string, n): #return first n sentences from strin... | 3.34375 | 3 |
Bugscan_exploits-master/exp_list/exp-2307.py | csadsl/poc_exp | 11 | 3461 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#__Author__ = 烽火戏诸侯
#_PlugName_ = Shop7z /admin/lipinadd.asp越权访问
import re
def assign(service, arg):
if service == "shop7z":
return True, arg
def audit(arg):
payload = 'admin/lipinadd.asp'
target = arg + payload
code, head,res, errcode... | 2.09375 | 2 |
homeassistant/components/hue/light.py | dlangerm/core | 5 | 3462 | """Support for the Philips Hue lights."""
from __future__ import annotations
from datetime import timedelta
from functools import partial
import logging
import random
import aiohue
import async_timeout
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_FL... | 2.125 | 2 |
src/ezdxf/math/bulge.py | dmtvanzanten/ezdxf | 0 | 3463 | <gh_stars>0
# Copyright (c) 2018-2021 <NAME>
# License: MIT License
# source: http://www.lee-mac.com/bulgeconversion.html
# source: http://www.afralisp.net/archive/lisp/Bulges1.htm
from typing import Any, TYPE_CHECKING, Tuple
import math
from ezdxf.math import Vec2
if TYPE_CHECKING:
from ezdxf.eztypes import Verte... | 2.984375 | 3 |
Plugins/Aspose.Email Java for Python/tests/ProgrammingEmail/ManageAttachments/ManageAttachments.py | aspose-email/Aspose.Email-for-Java | 24 | 3464 | <gh_stars>10-100
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
#if __name__ == "__main__":
# print "Hello World"
from ProgrammingEmail import ManageAttachments
import jpype
import os.pat... | 1.820313 | 2 |
mypython/keys.py | asmeurer/mypython | 27 | 3465 | from prompt_toolkit.key_binding.bindings.named_commands import (accept_line,
self_insert, backward_delete_char, beginning_of_line)
from prompt_toolkit.key_binding.bindings.basic import if_no_repeat
from prompt_toolkit.key_binding.bindings.basic import load_basic_bindings
from prompt_toolkit.key_binding.bindings.ema... | 1.804688 | 2 |
demand/preday_model_estimation/isg.py | gusugusu1018/simmobility-prod | 50 | 3466 | from biogeme import *
from headers import *
from loglikelihood import *
from statistics import *
from nested import *
#import random
cons_work= Beta('cons for work', 0,-10,10,0)
cons_edu = Beta('cons for education',0,-50,10,0)
cons_shopping = Beta('cons for shopping',0,-10,10,0)
cons_... | 2.171875 | 2 |
HRMS/app/__init__.py | freestyletime/HumanResourceManagement | 1 | 3467 | # 初始化模块
from config import Config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# 数据库操作对象
db = SQLAlchemy()
# 创建app
def create_app():
# flask操作对象
app = Flask(__name__)
# 通过配置文件读取并应用配置
app.config.from_object(Config)
# 初始化数据库
db.init_app(app)
# 员工管理子系统
from app.view i... | 2.703125 | 3 |
listener/src/ethereum_connection.py | NicolasMenendez/oracles-dashboard | 0 | 3468 | <filename>listener/src/ethereum_connection.py<gh_stars>0
import json
import web3
class EthereumConnection():
def __init__(self, url_node):
self._url_node = url_node
self._node_provider = web3.HTTPProvider(self._url_node)
self._w3 = web3.Web3(self._node_provider)
@property
def w3(s... | 2.5 | 2 |
ross/stochastic/st_results.py | JuliaMota/ross | 0 | 3469 | <reponame>JuliaMota/ross<filename>ross/stochastic/st_results.py<gh_stars>0
"""STOCHASTIC ROSS plotting module.
This module returns graphs for each type of analyses in st_rotor_assembly.py.
"""
import numpy as np
from plotly import express as px
from plotly import graph_objects as go
from plotly import io as pio
from p... | 2.203125 | 2 |
code/prisonersDilemma.py | ben9583/PrisonersDilemmaTournament | 1 | 3470 | import os
import itertools
import importlib
import numpy as np
import random
STRATEGY_FOLDER = "exampleStrats"
RESULTS_FILE = "results.txt"
pointsArray = [[1,5],[0,3]] # The i-j-th element of this array is how many points you receive if you do play i, and your opponent does play j.
moveLabels = ["D","C"]
#... | 3.75 | 4 |
json_to_relation/mysqldb.py | paepcke/json_to_relation | 4 | 3471 | # Copyright (c) 2014, Stanford University
# 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, this list of conditions and the ... | 1.625 | 2 |
tools/xkeydump.py | treys/crypto-key-derivation | 29 | 3472 | <reponame>treys/crypto-key-derivation
#!./venv/bin/python
from lib.mbp32 import XKey
from lib.utils import one_line_from_stdin
xkey = XKey.from_xkey(one_line_from_stdin())
print(xkey)
print("Version:", xkey.version)
print("Depth:", xkey.depth)
print("Parent FP:", xkey.parent_fp.hex())
print("Child number:", xkey.chil... | 2.21875 | 2 |
examples/compute_angular_resolution.py | meder411/Tangent-Images | 57 | 3473 | from spherical_distortion.util import *
sample_order = 9 # Input resolution to examine
def ang_fov(s):
print('Spherical Resolution:', s)
for b in range(s):
dim = tangent_image_dim(b, s) # Pixel dimension of tangent image
corners = tangent_image_corners(b, s) # Corners of each tangent image
... | 2.984375 | 3 |
polymath/srdfg/base.py | he-actlab/polymath | 15 | 3474 |
from polymath import UNSET_SHAPE, DEFAULT_SHAPES
import builtins
import operator
from collections import OrderedDict, Mapping, Sequence, deque
import functools
from numbers import Integral, Rational, Real
import contextlib
import traceback
import uuid
import numpy as np
import importlib
from .graph import Graph
from .... | 2.53125 | 3 |
actors/models.py | rngallen/beyond_basics | 0 | 3475 | <gh_stars>0
from django.db import models
from django.utils.translation import ugettext_lazy as _
# Create your models here.
class Actor(models.Model):
name = models.CharField(_("name"), max_length=200)
# if is_star he/she will be directed to hollywood else directed to commercial
is_star = models.BooleanF... | 2.53125 | 3 |
docs/buildscripts/docs.py | cwlalyy/mongo-c-driver | 13 | 3476 | """Build the C client docs.
"""
from __future__ import with_statement
import os
import shutil
import socket
import subprocess
import time
import urllib2
def clean_dir(dir):
try:
shutil.rmtree(dir)
except:
pass
os.makedirs(dir)
def gen_api(dir):
clean_dir(dir)
clean_dir("docs/sourc... | 2.484375 | 2 |
tilegame/render/rs.py | defgsus/thegame | 1 | 3477 | import glm
import math
from lib.opengl import RenderSettings
class GameProjection:
def __init__(self, rs: "GameRenderSettings"):
self.rs = rs
self.scale = 10.
self.rotation_deg = 0.
self.location = glm.vec3(0)
self._stack = []
def projection_matrix_4(self) -> glm.mat... | 2.390625 | 2 |
tools/stats/export_slow_tests.py | stungkit/pytorch | 2 | 3478 | <gh_stars>1-10
#!/usr/bin/env python3
import argparse
import json
import os
import statistics
from collections import defaultdict
from tools.stats.s3_stat_parser import (
get_previous_reports_for_branch,
Report,
Version2Report,
)
from typing import cast, DefaultDict, Dict, List, Any
from urllib.request imp... | 2.25 | 2 |
ml/rl/evaluation/weighted_sequential_doubly_robust_estimator.py | michaeltashman/Horizon | 1 | 3479 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import itertools
import logging
import numpy as np
import scipy as sp
import torch
from ml.rl.evaluation.cpe import CpeEstimate
from ml.rl.evaluation.evaluation_data_page import EvaluationDataPage
logger = logging.getLogg... | 2.015625 | 2 |
LeetCode/2019-08-03-384-Shuffle-an-Array.py | HeRuivio/-Algorithm | 5 | 3480 | # -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2019-08-03 10:48:30
# @Last Modified by: 何睿
# @Last Modified time: 2019-08-03 10:53:15
import copy
import random
from typing import List
class Solution:
def __init__(self, nums: List[int]):
self.shuffle_ = nums
self.orig... | 3.828125 | 4 |
src/wspc/feature_selection.py | shakedna1/wspc_rep | 0 | 3481 | import numpy as np
import sklearn
import pandas as pd
import scipy.spatial.distance as ssd
from scipy.cluster import hierarchy
from scipy.stats import chi2_contingency
from sklearn.base import BaseEstimator
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_extraction.text import CountVectorizer
f... | 2.640625 | 3 |
Python3/PS_scraping_selenium.py | fsj-digital/pages | 5 | 3482 | from bs4 import BeautifulSoup
import requests
import re
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from selenium import webdriver
from seleni... | 3.046875 | 3 |
AppTest/testTCPserver.py | STRATOLOGIC/SpacePyLibrary | 22 | 3483 | #!/usr/bin/env python3
#******************************************************************************
# (C) 2018, <NAME>, Austria *
# *
# The Space Python Library is free software; you can redistribut... | 1.632813 | 2 |
tests/clientlib_test.py | yoavcaspi/pre-commit | 0 | 3484 | <reponame>yoavcaspi/pre-commit
from __future__ import unicode_literals
import logging
import cfgv
import pytest
import pre_commit.constants as C
from pre_commit.clientlib import check_type_tag
from pre_commit.clientlib import CONFIG_HOOK_DICT
from pre_commit.clientlib import CONFIG_REPO_DICT
from pre_commit.clientli... | 1.804688 | 2 |
ikalog/ui/options.py | fetus-hina/IkaLog | 285 | 3485 | <reponame>fetus-hina/IkaLog
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <NAME>
#
# 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:... | 2.03125 | 2 |
setup.py | CyberTKR/Simple-LINELIB | 4 | 3486 | from setuptools import setup, find_packages
with open("README.md", 'r',encoding="utf-8") as f:
long_description = f.read()
setup(
name='LineBot',
version='0.1.0',
description='Simple-LINELIB',
long_description=long_description,
author='<NAME>',
author_email='<EMAIL>',
url='https://gith... | 1.34375 | 1 |
lib/SeparateDriver/CgwshDeviceDriverSetParameterECDB.py | multi-service-fabric/element-manager | 0 | 3487 | <filename>lib/SeparateDriver/CgwshDeviceDriverSetParameterECDB.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
# Filename: CgwshDeviceDriverSetParameterECDB.py
'''
Parameter module for Cgwsh driver configuration
'''
import GlobalModule
from EmCom... | 2.015625 | 2 |
scripts/common_lib/build_lib.py | Bhaskers-Blu-Org1/wc-devops-utilities | 15 | 3488 | <filename>scripts/common_lib/build_lib.py
#!/usr/bin/env python3.6
import os
import subprocess
import json
import argparse
import zipfile
import shutil
import requests
import datetime
import re
import operator
import unicodedata
# global list of error messages to keep track of all error msgs
errorMessages = []
"""
C... | 2.515625 | 3 |
src/static_grasp_kt.py | ivalab/GraspKpNet | 16 | 3489 | <filename>src/static_grasp_kt.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_paths
import os
import json
import cv2
import cv2.aruco as aruco
import numpy as np
import sys
import rospy
from std_msgs.msg import Bool
from std_msgs.msg import... | 1.695313 | 2 |
source/utils/augmentations.py | dovietchinh/multi-task-classification | 0 | 3490 | <reponame>dovietchinh/multi-task-classification<filename>source/utils/augmentations.py<gh_stars>0
import numpy as np
import cv2
import random
def preprocess(img,img_size,padding=True):
"""[summary]
Args:
img (np.ndarray): images
img_size (int,list,tuple): target size. eg: 224 , (224,224) or [... | 2.640625 | 3 |
BaseTools/Source/Python/GenFds/CapsuleData.py | James992927108/uEFI_Edk2_Practice | 6 | 3491 | ## @file
# generate capsule
#
# Copyright (c) 2007-2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found a... | 2.25 | 2 |
CalculatingPi/pi_linear_plot.py | davidmallasen/Hello_MPI | 0 | 3492 | import matplotlib.pyplot as plt
import numpy as np
# Read data
size = []
time = []
with open("pi_linear.txt") as file:
for line in file.readlines():
x, y = line.split(',')
size.append(int(x.strip()))
time.append(float(y.strip()))
# Plot data
fig, ax = plt.subplots()
ax.plot(size, tim... | 2.953125 | 3 |
esque_wire/protocol/structs/api/elect_preferred_leaders_response.py | real-digital/esque-wire | 0 | 3493 | <gh_stars>0
from typing import ClassVar, List, Optional
from ...constants import ApiKey, ErrorCode
from ..base import ResponseData
class PartitionResult:
partition_id: int
error_code: ErrorCode
error_message: Optional[str]
def __init__(self, partition_id: int, error_code: ErrorCode, error_message: ... | 2.359375 | 2 |
tests/stack_test.py | arthurlogilab/py_zipkin | 225 | 3494 | import mock
import pytest
import py_zipkin.storage
@pytest.fixture(autouse=True, scope="module")
def create_zipkin_attrs():
# The following tests all expect _thread_local.zipkin_attrs to exist: if it
# doesn't, mock.patch will fail.
py_zipkin.storage.ThreadLocalStack().get()
def test_get_zipkin_attrs_r... | 2.109375 | 2 |
myapp/processes/plotter.py | cp4cds/cp4cds-wps-template | 0 | 3495 |
from pywps import Process, LiteralInput, ComplexInput, ComplexOutput
from pywps import Format
import logging
LOGGER = logging.getLogger('PYWPS')
import matplotlib
# no X11 server ... must be run first
# https://github.com/matplotlib/matplotlib/issues/3466/
matplotlib.use('Agg')
import matplotlib.pylab as plt
import... | 2.328125 | 2 |
json_schema_checker/composed/__init__.py | zorgulle/json_schema_checker | 0 | 3496 | <filename>json_schema_checker/composed/__init__.py<gh_stars>0
from .composed import List
from .composed import IntList | 1.234375 | 1 |
backend/social_quiz.py | jmigual/socialQuiz | 0 | 3497 | # -*- coding: utf-8 -*-
import json
import os.path
import random
import re
from flask import Flask, send_from_directory
from flask import request, abort
from flaskrun.flaskrun import flask_run
import datab.social_database as db
app = Flask(__name__)
# Regular expression to only accept certain files
fileChecker = r... | 2.578125 | 3 |
astacus/node/snapshotter.py | aiven/astacus | 19 | 3498 | """
Copyright (c) 2020 Aiven Ltd
See LICENSE for details
"""
from astacus.common import magic, utils
from astacus.common.ipc import SnapshotFile, SnapshotHash, SnapshotState
from astacus.common.progress import increase_worth_reporting, Progress
from pathlib import Path
from typing import Optional
import base64
impo... | 2.328125 | 2 |
colcon_gradle/task/gradle/build.py | richiware/colcon-gradle | 0 | 3499 | <filename>colcon_gradle/task/gradle/build.py<gh_stars>0
# Copyright 2018 <NAME>
# Licensed under the Apache License, Version 2.0
from distutils import dir_util
import glob
import os
from pathlib import Path
import shutil
from colcon_core.environment import create_environment_scripts
from colcon_core.logging import co... | 1.976563 | 2 |