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 |
|---|---|---|---|---|---|---|
nxapi_plumbing/__init__.py | princesethi16/nxapi-plumbing | 8 | 12764951 | from nxapi_plumbing.device import Device
from nxapi_plumbing.api_client import RPCClient, XMLClient
from nxapi_plumbing.errors import (
NXAPIError,
NXAPICommandError,
NXAPIConnectionError,
NXAPIAuthError,
NXAPIPostError,
NXAPIXMLError,
)
__version__ = "0.5.2"
__all__ = (
"Device",
"RPCC... | 1.601563 | 2 |
colosseum/mdps/taxi/taxi.py | MichelangeloConserva/Colosseum | 0 | 12764952 | <filename>colosseum/mdps/taxi/taxi.py
from abc import ABC
from copy import deepcopy
from dataclasses import asdict, dataclass
from enum import IntEnum
from colosseum.utils.random_vars import deterministic, get_dist
try:
from functools import cached_property
except:
from backports.cached_property import cached... | 2.390625 | 2 |
tests/test_bearer_auth.py | neuro-inc/neuro-auth-client | 0 | 12764953 | <gh_stars>0
import pytest
from neuro_auth_client.bearer_auth import BearerAuth
class TestBearerAuth:
def test_decode_unexpected_scheme(self) -> None:
with pytest.raises(ValueError, match="Unexpected authorization scheme"):
BearerAuth.decode("Basic credentials")
@pytest.mark.parametrize("... | 2.3125 | 2 |
attitude/display/cartopy.py | davenquinn/Attitude | 8 | 12764954 | """
Functions to plot data using the `cartopy` library.
These require the `shapely` and `cartopy` libraries to be installed.
CartoPy is sometimes difficult to install.
"""
import numpy as N
from cartopy import crs, feature
from shapely.geometry import Polygon
from ..error.axes import hyperbolic_axes
from ..stereonet i... | 3.078125 | 3 |
python/graph2tensor/model/layers/gin_layer.py | deepest-stack/graph2tensor | 0 | 12764955 | <reponame>deepest-stack/graph2tensor
#!/usr/bin/env python3
import tensorflow as tf
class GINConv(tf.keras.layers.Layer):
r"""
Graph Isomorphism Network layer.
.. math::
h_v^{(k)} = MLP^{(k)}((1+\epsilon^{(k)}) \cdot h_v^{(k-1)}
+ aggr(\{h_u^{(k-1)},{u\in \mathcal{N}(v)}\})
or
... | 2.796875 | 3 |
src/logs/self_monitoring/sfm.py | equardo/dynatrace-aws-log-forwarder | 0 | 12764956 | # Copyright 2021 Dynatrace LLC
#
# 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 t... | 1.726563 | 2 |
infoxlm/src-infoxlm/infoxlm/models/__init__.py | Sanster/unilm | 5,129 | 12764957 | import argparse
import importlib
import os
from fairseq.models import MODEL_REGISTRY, ARCH_MODEL_INV_REGISTRY
# automatically import any Python files in the models/ directory
models_dir = os.path.dirname(__file__)
for file in os.listdir(models_dir):
path = os.path.join(models_dir, file)
if not file.startswith('_... | 2.296875 | 2 |
official/projects/unified_detector/data_conversion/convert.py | Lufeifeina/models | 1 | 12764958 | # Copyright 2022 The TensorFlow 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
#
# Unless required by applica... | 2 | 2 |
henon_arnold/decrypt.py | Xus72/Encriptacion-caotica | 0 | 12764959 | <reponame>Xus72/Encriptacion-caotica<filename>henon_arnold/decrypt.py
import os
import henon_arnold.diffusion as dif
from PIL import ImageTk, Image
import henon_arnold.confusion as con
import henon_arnold.reshape as res
import cv2
import henon_arnold.Image as i
import time
def decrypt(filepath, destination_path, key):... | 2.828125 | 3 |
main/migrations/0018_dmis_reponse_tools.py | IFRCGo/ifrcgo_react | 0 | 12764960 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-28 18:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0017_auto_20161123_2339'),
]
operations = [
migrations.CreateModel(... | 1.632813 | 2 |
tests/test_plants_pineapple.py | nielse63/PiPlanter | 0 | 12764961 | import pyplanter.plants.pineapple
def test_plants_pineapple():
pass
| 0.984375 | 1 |
projectile_motion/__init__.py | trungleduc/projectile-motion | 0 | 12764962 | <filename>projectile_motion/__init__.py
"""CoSApp project Projectile Motion
Projectile Motion Simulation
"""
from ._version import __version__
def find_resources(filename: str = "") -> str:
"""Returns the fullpath of a file in resources folder.
Parameters
----------
filename: str, optional
... | 2.78125 | 3 |
change_name_recurse.py | imoyao/WIKI | 5 | 12764963 | <reponame>imoyao/WIKI
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by Administrator at 2020/12/12 20:48
"""
该脚本会递归替换执行目录下的文件名称
在要批处理的目录的上级运行该脚本
1. 如果没有给定ROOT_PATH,则直接以脚本所在目录为root
2. 否则,以用户给定为准
3. 我们可以给定rename的多个根目录,也可以直接以root为根目录,取决于你的“一级目录”是否很多
"""
import os
import pathlib
import re
current_path = os.path... | 2.4375 | 2 |
mtinkerer/utils.py | Legutier/mtinkerer | 0 | 12764964 | <filename>mtinkerer/utils.py<gh_stars>0
import sys
def dir_slash():
slash = '/'
if 'win' in sys.platform: slash = '\\'
return slash
| 2.078125 | 2 |
hackerrank/Algorithms/Sherlock and The Beast/test.py | ATrain951/01.python-com_Qproject | 4 | 12764965 | <gh_stars>1-10
import io
import unittest
from contextlib import redirect_stdout
import solution
class TestQ(unittest.TestCase):
def test_case_0(self):
text_trap = io.StringIO()
with redirect_stdout(text_trap):
solution.decentNumber(1)
solution.decentNumber(3)
s... | 2.828125 | 3 |
find_center.py | ryanbanderson/volume_measure | 0 | 12764966 | import matplotlib.pyplot as plot
import numpy as np
#Function to get x and y coordinates from the first 10 clicks, then close the image.
def onclick(event):
x.append(event.xdata)
y.append(event.ydata)
print(len(x))
xval = int(event.xdata)
yval = int(event.ydata)
print(str([xval,yval]))
if ... | 3.421875 | 3 |
utils.py | bmwant/wcbot | 0 | 12764967 | import logging
import coloredlogs
FORMAT = '[%(name)s] %(levelname)s:%(message)s'
FORMATTER = logging.Formatter(fmt=FORMAT)
def get_logger(name='default', level=logging.DEBUG, colored=False):
logger = logging.getLogger(name)
logger.propagate = False
logger.setLevel(level)
if not logger.handlers:
... | 2.59375 | 3 |
09_checkpoints.py | psteinb/20220308-dlr-pytorchintro | 1 | 12764968 | ## https://notes.desy.de/s/ljPrespZd#Infrastructure--Cluster-login
import torch
## for the code to work, install torchvision
## $ python -m pip install --user -I --no-deps torchvision
import torchvision
from torchvision import datasets, transforms
## NB: in case torchvision cannot be found inside a jupyter notebook, f... | 2.46875 | 2 |
ntcore/api.py | amorygalili/pynetworktables | 0 | 12764969 | <reponame>amorygalili/pynetworktables
# validated: 2018-11-27 DS 8eafe7f32561 cpp/ntcore_cpp.cpp
from .connection_notifier import ConnectionNotifier
from .dispatcher import Dispatcher
from .ds_client import DsClient
from .entry_notifier import EntryNotifier
from .rpc_server import RpcServer
from .storage import Storag... | 2.234375 | 2 |
src/toncli/modules/utils/func/commands.py | disintar/toncli | 25 | 12764970 | <gh_stars>10-100
import os
import subprocess
import sys
from typing import Optional, List
import yaml
from colorama import Fore, Style
from toncli.modules.utils.system.conf import config_folder, executable, getcwd
from toncli.modules.utils.system.log import logger
from toncli.modules.utils.system.project import migra... | 2.078125 | 2 |
sysinv/sysinv/sysinv/sysinv/openstack/common/keystone_objects.py | Wind-River/starlingx-config | 0 | 12764971 | <gh_stars>0
#
# Copyright (c) 2015 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import datetime
import iso8601
from oslo_log import log
LOG = log.getLogger(__name__)
class Token(object):
def __init__(self, token_data, token_id, region_name):
self.expired = False
self.data =... | 2.375 | 2 |
linear_search.py | gsuryalss/searching | 0 | 12764972 | <gh_stars>0
"""
Linear search is used on a collections of items. It relies on the technique of traversing a list from
start to end by exploring properties of all the elements that are found on the way.
The time complexity of the linear search is O(N) because each element in an array is compared only once.
"""
def li... | 4.09375 | 4 |
src/util/constants.py | radandreicristian/traffic-ode | 2 | 12764973 | METR_LA_DATASET_NAME = 'metr_la'
PEMS_BAY_DATASET_NAME = 'pems_bay'
IN_MEMORY = 'mem'
ON_DISK = 'disk'
| 0.847656 | 1 |
Collision/Collision_BarChart.py | ChairOfStructuralMechanicsTUM/Mechanics_Apps | 11 | 12764974 | from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, Range1d, FuncTickFormatter, FixedTicker
from math import pi, floor
#ColourOptions = ["red","blue","green","black","yellow","purple"]
class Collision_BarChart(object):
def __init__(self, xVals, yVals, colours = None, width=None):
... | 2.84375 | 3 |
EMAlgorithm.py | marinaRupe/FER.BCsThesis | 1 | 12764975 | <gh_stars>1-10
import math
from TaxonomyTree import TaxonomyTree
from threading import Thread
from multiprocessing import Process
class EMAlgorithm:
def __init__(self):
self.taxTree = TaxonomyTree()
self.reads, self.genomes = [], []
self.pi_list, self.delta_list = [], []
self.a_lis... | 2.453125 | 2 |
text processing in python/process_beta.py | TheBrownViking20/DSstuff | 3 | 12764976 | <reponame>TheBrownViking20/DSstuff<gh_stars>1-10
import os
import glob
from process_alpha import text_process
| 1.210938 | 1 |
teste.py | richardoliveira96/Gerenciador-de-senhas | 0 | 12764977 | import sqlite3
MASTER_PASSWORD = "<PASSWORD>"
senha = input("Insira sua senha master: ")
if senha != MASTER_PASSWORD:
print("Senha inválida! Encerrando ...")
exit()
conn = sqlite3.connect('password.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS users(
service T... | 3.953125 | 4 |
bench/bench_long_empty_string.py | janaknat/markupsafe | 415 | 12764978 | <filename>bench/bench_long_empty_string.py
from markupsafe import escape
def run():
string = "Hello World!" * 1000
escape(string)
| 1.554688 | 2 |
tests/integration/conftest.py | stonepreston/github-runner-operator | 2 | 12764979 | <filename>tests/integration/conftest.py
from pathlib import Path
import pytest
import yaml
@pytest.fixture
def metadata():
metadata = Path("./metadata.yaml")
data = yaml.safe_load(metadata.read_text())
return data
@pytest.fixture
def model(ops_test):
return ops_test.model
@pytest.fixture
def appl... | 2 | 2 |
python/marvin/tools/spaxel.py | margudo/marvin | 49 | 12764980 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: <NAME>, <NAME>, and <NAME>
# @Date: 2017-11-03
# @Filename: spaxel.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
#
# @Last modified by: <NAME> (<EMAIL>)
# @Last modified time: 2018-11-08 18:00:34
from __future_... | 2 | 2 |
torchcam/cams/__init__.py | alexandrosstergiou/torch-cam | 749 | 12764981 | <reponame>alexandrosstergiou/torch-cam
from .cam import *
from .gradcam import *
from .utils import *
| 0.800781 | 1 |
supasurvey/runtests.py | invisiblehands/django-supasurvey | 3 | 12764982 | <filename>supasurvey/runtests.py<gh_stars>1-10
#!/usr/bin/env python
import sys
from django.conf import settings
def runtests():
from django.test.utils import get_runner
TestRunner = get_runner(settings)
test_runner = TestRunner(verbosity=1, interactive=True)
failures = test_runner.run_tests(['sup... | 1.851563 | 2 |
dfirtrack_config/migrations/0014_main_overview.py | thomas-kropeit/dfirtrack | 273 | 12764983 | <gh_stars>100-1000
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dfirtrack_config', '0013_csvimporterconfigmodel'),
]
operations = [
migrations.AddField(
model_name='mainconfigmodel',
name='main_overview',
... | 1.8125 | 2 |
infer.py | bennyguo/sketch2model | 21 | 12764984 | <filename>infer.py<gh_stars>10-100
import os
from options.infer_options import InferOptions
from data import create_dataset
from models import create_model
import torch
if __name__ == '__main__':
opt = InferOptions().parse()
dataset_infer = create_dataset(opt, mode='infer', shuffle=False)
model = create... | 2.390625 | 2 |
examples/check_model.py | Idein/onnigiri | 2 | 12764985 | <gh_stars>1-10
import sys
import numpy as np
import onnx
import onnxruntime
def make_sess(path: str) -> onnxruntime.InferenceSession:
sess_opts = onnxruntime.SessionOptions()
sess_opts.log_severity_level = 3
return onnxruntime.InferenceSession(path, sess_options=sess_opts, providers=["CPUExecutionProvide... | 2.015625 | 2 |
swan/widgets/plot_grid.py | INM-6/swan | 3 | 12764986 | """
Created on Nov 21, 2013
@author: <NAME>
In this module you can find the :class:`MyPlotGrid` which is just
a :class:`PyQt5.QtGui.QScrollArea` with some additions.
More important is the :class:`MyPlotContent`.
It shows an overview of many :class:`src.myplotwidget.MyPlotWidget`
and manages them.
"""
from pyqtgraph.... | 2.8125 | 3 |
CommonTools/PileupAlgos/python/PUPuppi_cff.py | ckamtsikis/cmssw | 852 | 12764987 | import FWCore.ParameterSet.Config as cms
from CommonTools.PileupAlgos.Puppi_cff import *
pupuppi = puppi.clone(
invertPuppi = True
)
| 1.148438 | 1 |
criteo_marketing_transition/models/patch_ad_set.py | criteo/criteo-python-marketing-transition-sdk | 0 | 12764988 | # coding: utf-8
"""
Criteo API Transition Swagger
This is used to help Criteo clients transition from MAPI to Criteo API # noqa: E501
The version of the OpenAPI document: 1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class PatchAdSet(objec... | 1.734375 | 2 |
src/robot_service/rabbitmq.py | kenesparta/movie-service-api | 4 | 12764989 | import pika
import config
class RabbitMq:
def __init__(self):
self.conn = None
self.channel = None
self.__config = config.RABBITMQ
self.__connect()
def __connect(self):
self.conn = pika.BlockingConnection(
pika.ConnectionParameters(
host=sel... | 2.671875 | 3 |
django_grapesjs/forms/fields.py | TheLazzziest/django_grapesjs | 6 | 12764990 | from django import forms
from django_grapesjs.settings import BASE, GRAPESJS_DEFAULT_HTML, REDACTOR_CONFIG
from django_grapesjs.utils import apply_string_handling
from .widgets import GrapesJsWidget
__all__ = (
'GrapesJsField',
)
class GrapesJsField(forms.CharField):
'''
Form field with support grapesjs... | 2.125 | 2 |
split_data/test/test_wiki_vector_summary.py | taisa831/Chainer-Slack-Twitter-Dialogue | 0 | 12764991 | <reponame>taisa831/Chainer-Slack-Twitter-Dialogue<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from input_file import InputFile
from split_synonym_class import SplitSynonymClass
import pyximport
pyximport.in... | 2.296875 | 2 |
cli/iotexetl/utils/string_utils.py | blockchain-etl/iotex-etl | 3 | 12764992 | import base64
def base64_string(val):
if val is None or val == b'':
return None
return base64.b64encode(val).decode('utf-8')
def to_int(val):
if val is None:
return val
if val == b'':
return 0
if isinstance(val, bytes):
return int.from_bytes(val, 'big')
if isi... | 3.03125 | 3 |
courtside/game/views.py | alok102singh/courtside | 49 | 12764993 | <gh_stars>10-100
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from forms.forms import GameForm
from game.models import Player, Sport, Game
def about(request):
return rend... | 2.5 | 2 |
d4s2_api/tests_models.py | Duke-GCB/D4S2 | 0 | 12764994 | <filename>d4s2_api/tests_models.py
from django.db import IntegrityError
from django.core import serializers
from django.test import TestCase
from d4s2_api.models import *
from django.contrib.auth.models import User
import datetime
class TransferBaseTestCase(TestCase):
def setUp(self):
self.transfer_id = ... | 2.609375 | 3 |
agrid/grid.py | TobbeTripitaka/grid | 15 | 12764995 | <filename>agrid/grid.py
#!/usr/bin/env python3
# <NAME> 2020
# <EMAIL> <EMAIL>
# version = '0.3.9.2'
# https://doi.org/10.5281/zenodo.2553966
#
# MIT License#
# Copyright (c) 2019 <NAME>#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation f... | 1.523438 | 2 |
src/server/scraper/scripts/login_google.py | wotsyula/flask-scrapper | 0 | 12764996 | #!/usr/bin/env python3
"""
Script that logs into `google.com`
"""
from logging import debug
from typing import Generator
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.keys import Keys
from ..script import Script as BaseClass
URL = 'https://www.google.co... | 3.0625 | 3 |
components/server/src/data_model/meta/scale.py | kargaranamir/quality-time | 33 | 12764997 | <gh_stars>10-100
"""Data model scales."""
from pydantic import BaseModel # pylint: disable=no-name-in-module
from .base import DescribedModel
class Scale(DescribedModel): # pylint: disable=too-few-public-methods
"""Base model for scales."""
class Scales(BaseModel): # pylint: disable=too-few-public-methods
... | 1.851563 | 2 |
python-django/oauth2demo/oauth/core/token.py | SequencingDOTcom/oAuth2-demo | 1 | 12764998 | <reponame>SequencingDOTcom/oAuth2-demo
class Token(object):
def __init__(self, access_token, refresh_token, lifetime):
self.access_token = access_token # Access token value
self.refresh_token = refresh_token # Token needed for refreshing access token
self.lifetime = lifetime # Access token l... | 2.40625 | 2 |
app/services/authentication/authenticator/request_analyzer.py | maxzhenzhera/my_vocab_backend | 0 | 12764999 | from dataclasses import dataclass
from typing import cast
from fastapi import Request
__all__ = ['RequestAnalyzer']
@dataclass
class RequestAnalyzer:
request: Request
@property
def client_ip_address(self) -> str:
return cast(str, self.request.client.host)
@property
def client_user_age... | 2.8125 | 3 |
sa/profiles/Zyxel/MSAN/get_version.py | ewwwcha/noc | 1 | 12765000 | # -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Zyxel.MSAN.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------... | 1.796875 | 2 |
_unittests/ut_install/test_LONG_install_module.py | sdpython/pymyinstall | 8 | 12765001 | <gh_stars>1-10
"""
@brief test log(time=1s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
from pymyinstall.installhelper.module_install import ModuleInstall
from pymyinstall.installhelper.module_install_version import get_module_version
class TestLONGInstallModule (unittest.TestCase):
def tes... | 2.15625 | 2 |
Open3d/code/Pipelines/icp_registration.py | yueliu1999/3d-vision | 7 | 12765002 | import open3d as o3d
import copy
import numpy as np
# Helper visualization function
def draw_registration_result(source, target, transformation):
source_temp = copy.deepcopy(source)
target_temp = copy.deepcopy(target)
source_temp.paint_uniform_color([1, 0.706, 0])
target_temp.paint_uniform_color([0, 0.... | 2.171875 | 2 |
uncompress/uncompress.py | Apiquet/utils | 0 | 12765003 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Uncompress program for tar, tar.gz, zip, etc
Args:
- Path to the compressed file to extract
- Path to the output folder for extracted files
Example:
python3 uncompress.py -i path/to/file.tar.gz -o path/for/extractedfiles
"""
import argparse
... | 3.796875 | 4 |
report_generator.py | aravindskrishnan/COVID19-Report-Generator | 0 | 12765004 |
"""
Developer : <NAME>
VER : 1.0
Data Source : https://api.covid19india.org/v4/data.json
"""
import urllib.request
import urllib.error
import json
import matplotlib.pyplot as plt
import numpy as np
import time
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
#Graph Plotting Function
def plo... | 2.375 | 2 |
src/utils/run_step04_train_models.py | Iretha/IoT23-network-traffic-anomalies-classification | 9 | 12765005 | <filename>src/utils/run_step04_train_models.py
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import MinMaxScaler, StandardScaler
from sklearn.svm import L... | 2.15625 | 2 |
newStuff.py | mts5qd/cs3240-labdemo | 0 | 12765006 | <gh_stars>0
def main():
print(hi)
if __name__ == '__main__': main()
| 1.671875 | 2 |
modules/stitch_fragments.py | hillerlab/TOGA | 32 | 12765007 | #!/usr/bin/env python3
"""
Author: <NAME>.
Included in TOGA by <NAME>.
"""
import argparse
import sys
from datetime import datetime as dt
from collections import defaultdict
try:
from modules.common import make_cds_track
from modules.common import flatten
except ImportError:
from common import make_cds_tra... | 2.609375 | 3 |
src/openprocurement/api/interfaces.py | EBRD-ProzorroSale/openprocurement.api | 102 | 12765008 | # -*- coding: utf-8 -*-
from zope.interface import Interface
class IOPContent(Interface):
""" Openprocurement Content """
class IContentConfigurator(Interface):
""" Content configurator """
| 1.421875 | 1 |
test/lib/mayaUsd/fileio/testAddMayaReference.py | sun-frog/maya-usd | 0 | 12765009 | <reponame>sun-frog/maya-usd
#!/usr/bin/env python
#
# Copyright 2022 Autodesk
#
# 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.96875 | 2 |
pyjs9/__init__.py | ericmandel/pyjs9 | 14 | 12765010 | """
pyjs9.py: connects Python and JS9 via the JS9 (back-end) helper
"""
from __future__ import print_function
import time
import json
import base64
import logging
from traceback import format_exc
from threading import Condition
from io import BytesIO
import requests
__all__ = ['JS9', 'js9Globals']
"""
pyjs9.py conn... | 2.34375 | 2 |
F_Machine_learning/2_Supervised-Learning/solutions/ex0_4a.py | oercompbiomed/CBM101 | 7 | 12765011 | def pcnt(N, p):
return int(p * N) | 1.789063 | 2 |
2019/day-14/part12.py | amochtar/adventofcode | 1 | 12765012 | #!/usr/bin/env python
from collections import defaultdict
from math import ceil
def solve(input):
def element(s):
n, el = s.split()
return (el, int(n))
def nxt(needs):
for el, n in needs.items():
if el != 'ORE' and n > 0:
return (el, n)
def ore_needed... | 3.28125 | 3 |
tests/test_models/test_dna_sequence.py | klavinslab/benchling-api | 36 | 12765013 | import pytest
def test_web_link(session):
dnas = session.DNASequence.last(10)
for dna in dnas:
loaded = session.DNASequence.from_share_link(dna.web_url)
assert loaded.id == dna.id
# def test_share_link(session):
#
# # dna = session.DNASequence.from_share_link('https://benchling.com/s/se... | 2.21875 | 2 |
ctf/TokyoWesterns18/swap/exploit.py | lordidiot/lordidiot.github.io | 1 | 12765014 | #!/usr/bin/python
from pwn import *
import sys
#sys.path.append('/home/lord_idiot/CTF-Tools/python-libs')
HOST = "swap.chal.ctf.westerns.tokyo"
PORT = 37567
prev = None
stack_leak = None
stopRecv = False
def sett(a, b):
global stopRecv
if stopRecv:
r.sendline("1")
r.sendline(str(a))
r.sendline(str(b))
retu... | 2.53125 | 3 |
scripts/monitoring/cron-send-usage-pv.py | north-team/openshift-tools | 0 | 12765015 | <reponame>north-team/openshift-tools
#!/usr/bin/env python
""" Report the usage of the pv """
# We just want to see any exception that happens
# don't want the script to die under any cicumstances
# script must try to clean itself up
# pylint: disable=broad-except
# main() function has a lot of setup and error handli... | 2.109375 | 2 |
src/sentinel/azext_sentinel/vendored_sdks/security_insights/models/scheduled_alert_rule.py | hpsan/azure-cli-extensions | 0 | 12765016 | # coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | 1.820313 | 2 |
src/packageurl/contrib/purl2url.py | canvasslabs/packageurl-python | 0 | 12765017 | # -*- coding: utf-8 -*-
#
# Copyright (c) the purl authors
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... | 1.875 | 2 |
submissions/joi2014yo/a.py | m-star18/atcoder | 1 | 12765018 | <filename>submissions/joi2014yo/a.py
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
cnt = 0
for i in range(5):
cnt += max(40, int(readline()))
print(cnt // 5)
| 2.578125 | 3 |
setup.py | bobrik/py-cpuinfo | 0 | 12765019 | <reponame>bobrik/py-cpuinfo
# Copyright (c) 2014-2021 <NAME> <<EMAIL>>
# Py-cpuinfo gets CPU info with pure Python 2 & 3
# It uses the MIT License
# It is hosted at: https://github.com/workhorsy/py-cpuinfo
import os
from setuptools import setup
with open(os.path.join(os.getcwd(), 'README.rst'), 'r') as f:
readme_... | 1.710938 | 2 |
Secao8_FuncoesPython/DefinindoFuncoes.py | PauloFTeixeira/curso_python | 0 | 12765020 | """
- Sção pequenas partes de código que realizam tarefas específicas
- Pode ou nõa receber entrada de dados e retornar uma saída de dados
- Muito úteis para para executar procedimentos similares por repetidas vezes
OBS.: Se a função realiza várias tarefas dentro dela, é bom fazer uma verificação para que a função sej... | 4.4375 | 4 |
jocasta/connectors/influx.py | chrishannam/zeep | 0 | 12765021 | import json
from influxdb import InfluxDBClient
import logging
import platform
from typing import Dict, List
logging.basicConfig(
level=logging.ERROR,
format='%(asctime)s.%(msecs)03d %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
)
logger = logging.getLogger(__name__)
class InfluxDBConnector... | 2.875 | 3 |
validate.py | hkchengrex/pytorch-semseg | 1 | 12765022 | <reponame>hkchengrex/pytorch-semseg
import yaml
import torch
import argparse
import timeit
import numpy as np
from PIL import Image
from torch.utils import data
from ptsemseg.models import get_model
from ptsemseg.loader import get_loader
from ptsemseg.metrics import runningScore
from ptsemseg.utils import convert_st... | 2.109375 | 2 |
plots/for_paper/nice_plots.py | jacqueschen1/adam_sgd_heavy_tails | 1 | 12765023 | <reponame>jacqueschen1/adam_sgd_heavy_tails
"""
Used to generate the plots for the increasing batch size experiments
"""
import pandas
import numpy as np
import matplotlib.pyplot as plt
import math
import data_helpers as h
import fplt
import data_selection
import plotting_common as plth
from plotting_common import (
... | 2.515625 | 3 |
src/feverous/utils/util.py | creisle/FEVEROUS | 42 | 12765024 | import json
import sys
import os
import jsonlines
import traceback
import logging
from tqdm import tqdm
import pickle
import itertools
import linecache
import html
import re
ALL_TITLES = {}
class WikiElement(object):
def get_ids(self) -> list:
"""Returns list of all ids in that element"""
pass
... | 2.6875 | 3 |
model_building_tools/gen_classes/psql_to_csv.py | jdailey/EnergyPATHWAYS | 26 | 12765025 | <reponame>jdailey/EnergyPATHWAYS<gh_stars>10-100
#!/usr/bin/env python
from __future__ import print_function
import click
import os
import pandas as pd
from postgres import Tables_to_ignore, mkdirs, PostgresDatabase
@click.command()
@click.option('--dbname', '-d', default='pathways',
help='PostgreSQL da... | 2.453125 | 2 |
tests/test_backwards.py | arvindanugula/flywheel | 72 | 12765026 | <reponame>arvindanugula/flywheel
""" Test backwards-compatible behavior """
import json
from flywheel import Field, Model
from flywheel.fields.types import TypeDefinition, DictType, STRING
from flywheel.tests import DynamoSystemTest
class JsonType(TypeDefinition):
""" Simple type that serializes to JSON """
... | 2.53125 | 3 |
insights/parsers/tests/test_neutron_server_log.py | lhuett/insights-core | 121 | 12765027 | <gh_stars>100-1000
from insights.parsers.neutron_server_log import NeutronServerLog
from insights.tests import context_wrap
NEUTRON_LOG = """
2016-09-13 05:56:45.155 30586 WARNING keystonemiddleware.auth_token [-] Identity response: {"error": {"message": "Could not find token: b45405915eb44e608885f894028d37b9", "code"... | 2.25 | 2 |
dm.py | seluciano/instagram-scrapping-server | 1 | 12765028 | from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
import time,random,names,os,requests,sys
from seleniumwire import webdriver
from random_username.generate import generate_username
from selenium.webdriver.firefox.options import Options
from selenium.webdriver import Act... | 2.140625 | 2 |
scripts/dirichlet_3d_spiky_plot.py | karalleyna/pyprobml | 0 | 12765029 | <reponame>karalleyna/pyprobml
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from mpl_toolkits.mplot3d import proj3d
from scipy.stats import dirichlet
grain = 20 #how many points along each axis to plot
edgedist = 0.008 #How close to an extreme value of say [1,0,0] are we willing to... | 2.359375 | 2 |
tests/test_core.py | mathbou/seed_intersphinx_mapping | 3 | 12765030 | <reponame>mathbou/seed_intersphinx_mapping
# stdlib
from typing import get_type_hints
# 3rd party
import packaging.requirements
import pytest
from coincidence import PEP_563
# this package
from seed_intersphinx_mapping import cache, get_sphinx_doc_url
def test_get_sphinx_doc_url():
assert cache.clear(get_sphinx_do... | 2.09375 | 2 |
FairTest/users/models.py | RexWangSida/FairTest | 3 | 12765031 | <gh_stars>1-10
from django.db import models
from django_mysql.models import ListCharField
# Create your models here.
class User(models.Model):
email = models.CharField(max_length = 60, unique=True)
uid = models.CharField(max_length = 10, unique=True, primary_key=True)
school = models.CharField(max_length =... | 2.53125 | 3 |
tests/resources/xmpp_handlers.py | pombreda/tipfy | 23 | 12765032 | from tipfy.appengine.xmpp import BaseHandler, CommandHandler
class XmppHandler(CommandHandler):
def foo_command(self, message):
message.reply('Foo command!')
def bar_command(self, message):
message.reply('Bar command!')
def text_message(self, message):
super(XmppHandler, self).te... | 2.515625 | 3 |
vial-plugin/mail/api.py | baverman/vial-mail | 1 | 12765033 | <reponame>baverman/vial-mail<gh_stars>1-10
import os.path
from email.parser import HeaderParser
from email.utils import getaddresses
from email.header import decode_header
from unidecode import unidecode
def get_book(fname):
result = []
for line in open(fname):
addr, title = line.rstrip('\r\n').spli... | 2.5 | 2 |
examples/deck_of_cards_gui.py | Ellis0817/Introduction-to-Programming-Using-Python | 0 | 12765034 | """Dock of card GUI."""
import random
from tkinter import Button # Import tkinter
from tkinter import Frame # Import tkinter
from tkinter import Label # Import tkinter
from tkinter import LEFT # Import tkinter
from tkinter import PhotoImage
from tkinter import Tk # Import tkinter
class DeckOfCardsGUI(object):
... | 3.375 | 3 |
app/utils/assets.py | coolpalani/Flask-Salt | 12 | 12765035 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# __author__: Yxn
# date: 2016/10/14
from flask_assets import Bundle
bundles = {
'common_css': Bundle(
'css/body.css',
'css/lib/adminlte/adminlte.min.css',
'css/lib/bootstrap/bootstrap.min.css',
'css/lib/skins/skin-blue.min.css',
... | 1.539063 | 2 |
alice.py | finnsjames/ssn | 0 | 12765036 | import govt
import service
from cryptography.hazmat.primitives.asymmetric import dh
import tools
def print_as_hex(data: bytes):
print(data.hex())
def main():
NAME = "Alice"
# TODO: This is just to get a large prime number
params = dh.generate_parameters(generator=2, key_size=512)
p = params.pa... | 2.875 | 3 |
preprocess/proc_stage2.py | 3dlg-hcvc/ANCSH-pytorch | 2 | 12765037 | import os
import h5py
import pandas as pd
import logging
import numpy as np
from progress.bar import Bar
from multiprocessing import Pool, cpu_count
from omegaconf import OmegaConf
from tools.utils import io
# from ANCSH_lib.utils import NetworkType
# from tools.visualization import Viewer, ANCSHVisualizer
import uti... | 1.976563 | 2 |
cli/skyline/user_code_utils.py | danielsnider/ecosystem-project-website-template | 23 | 12765038 | <filename>cli/skyline/user_code_utils.py
import contextlib
import os
import sys
from skyline.exceptions import exceptions_as_analysis_errors
@contextlib.contextmanager
def user_code_environment(script_root_path, project_root):
"""
A combined context manager that activates all relevant context managers
us... | 2.609375 | 3 |
flowsa/flowbysector.py | modelearth/flowsa | 13 | 12765039 | # flowbysector.py (flowsa)
# !/usr/bin/env python3
# coding=utf-8
"""
Produces a FlowBySector data frame based on a method file for the given class
To run code, specify the "Run/Debug Configurations" Parameters to the
"flowsa/data/flowbysectormethods" yaml file name
you want to use.
Example: "Parameters: --m Water_na... | 2.21875 | 2 |
tests/api/test_api_create_pseudorandom_ids.py | LCBRU/identity | 0 | 12765040 | <gh_stars>0
import pytest
from identity.printing.discordance import ID_TYPE_PARTICIPANT
from identity.model.id import PseudoRandomId
from tests.api import add_api_key_to_url
path = '/api/create_pseudorandom_ids'
@pytest.mark.parametrize(
"id_count",
[
(1),
(10),
],
)
def test__create_pseu... | 2.21875 | 2 |
app.py | cynepton/fyyur | 0 | 12765041 | #----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
import json
import dateutil.parser
import babel
from flask import Flask, render_template, request, Response, flash, redirect, url_for
from flask_moment... | 2.296875 | 2 |
colab/apps/issues/urls.py | caseywstark/colab | 1 | 12765042 | from django.conf.urls.defaults import *
from issues.models import Issue
from voting.views import vote_on_object
urlpatterns = patterns("issues.views",
url(r"^$", "issues", name="issue_list"),
url(r"^create/$", "create", name="issue_create"),
url(r"^my_issues/$", "issues", kwargs={'mine': True}, na... | 2.046875 | 2 |
data_structures_two/2_linked_list.py | amanalok/python-dsa | 0 | 12765043 | <filename>data_structures_two/2_linked_list.py
class Node:
def __init__(self, data):
self.data = data
self.next = None
def __repr__(self):
return self.data
class LinkedList:
def __init__(self):
self.front = None
self.rear = None
def __repr__(self):
cur... | 3.953125 | 4 |
src/scs_dfe/climate/sht_conf.py | open-seneca/alphasense_aq_sensor | 1 | 12765044 | """
Created on 13 Dec 2016
@author: <NAME> (<EMAIL>)
the I2C addresses of the internal (in A4 pot) and external (exposed to air) SHTs
example JSON:
{"int": "0x44", "ext": "0x45"}
"""
from collections import OrderedDict
from scs_core.data.json import PersistentJSONable
from scs_dfe.climate.sht31 import SHT31
# -... | 2.15625 | 2 |
src/NN_4_layer.py | FrankZhang427/ModifiedMNIST | 0 | 12765045 | <gh_stars>0
# This file implements the 4-layer fully-connected feedforward neuron network. The activation function is tanh and softmax is implemented at the output layer. A weighting function is incorporated in the gradient descent process to deal with imbalanced training classes. Different hyper-parameters can be spec... | 3.59375 | 4 |
code/1M_mouse_brain/run_scanorama_1M.py | jhu99/vipcca_paper | 0 | 12765046 | import scxx.preprocessing as pp
import scxx.plotting as pl
import scanorama
import os
import numpy as np
import scanpy as sc
from anndata import AnnData
np.random.seed(0)
NAMESPACE = 'mouse_brain'
BATCH_SIZE = 1000
result_dir="./results/1M_mouse_brain/scanorama/"
data_names = [
'data/mouse_brain/nuclei',
'da... | 2.28125 | 2 |
where/parsers/eop_bulletin_a.py | ingridfausk/where | 16 | 12765047 | <reponame>ingridfausk/where
"""A parser for reading data from EOP files
Description:
------------
Reads data from EOP files.
"""
# Midgard imports
from midgard.dev import plugins
from midgard.math.unit import Unit
from midgard.parsers._parser_line import LineParser
@plugins.register
class EopBulletinAParser(LineP... | 2.078125 | 2 |
minos/data_generation/US_missing_deterministic.py | RobertClay/Paper1 | 0 | 12765048 | <gh_stars>0
"""For correcting missing data that is deterministic on other attributes."""
import pandas as pd
import numpy as np
import US_utils
import US_missing_description
def det_missing(data, columns, conditioner, replacer):
"""Correct data that is deterministically missing.
Requires a data frame, a col... | 3.65625 | 4 |
share/gan_face/train_gan.py | tomsnail/opencv_tf_py | 0 | 12765049 | #-*- coding:utf-8 -*-
from generate_face import *
from gan_model import ganModel
import tensorflow as tf
if __name__ == '__main__':
hparams = tf.contrib.training.HParams(
data_root = './../../datas/gan_face/img_align_celeba',
crop_h = 108, #对原始图片裁剪后高
crop_w = 108, #对原始图片裁剪后宽
r... | 2.265625 | 2 |
server/kraken/migrations/versions/5b13b262b132_added_repo_changes.py | fossabot/kraken-3 | 66 | 12765050 | <filename>server/kraken/migrations/versions/5b13b262b132_added_repo_changes.py<gh_stars>10-100
"""added repo changes
Revision ID: 5b13b262b132
Revises: <KEY>
Create Date: 2021-04-07 06:02:59.604892
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import orm
from sqlalchemy.sql import insert
from sql... | 1.757813 | 2 |