content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
class Config:
def __init__(self,
use_cuda=True,
hidden_size=512,
dropout_p=0.5,
n_layers=4,
batch_size=32,
max_epochs=40,
lr=0.0001,
teacher_forcing_ratio=1.0,
see... | 30.461538 | 58 | 0.5 | [
"MIT"
] | sooftware/char-rnnlm | package/config.py | 792 | Python |
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
def updateParams(k, alpha, N,sum_log_di, x, h):
div_xByAlpha = np.divide(x,alpha)
powK_div_xByAlpha = np.power(div_xByAlpha, k)
log_div_xByAlpha = np.log(div_xByAlpha)
sum_powK_div_diByAlpha = np.sum(... | 37.071429 | 143 | 0.663776 | [
"MIT"
] | omartrinidad/pattern-recognition-bit | 01/Task13.py | 2,076 | Python |
from nose.tools import eq_, ok_
from nose.plugins.skip import SkipTest
# Skip test on PY3
from flask_admin._compat import PY2, as_unicode
if not PY2:
raise SkipTest('MongoEngine is not Python 3 compatible')
from wtforms import fields
from flask_admin import form
from flask_admin.contrib.mongoengine import ModelV... | 28.31405 | 104 | 0.608435 | [
"Apache-2.0"
] | hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/Flask_Admin-1.2.0-py2.7.egg/flask_admin/tests/mongoengine/test_basic.py | 27,408 | Python |
"""
This file offers the methods to automatically retrieve the graph Mycobacterium sp. 1554424.7.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--pr... | 33.380952 | 223 | 0.678174 | [
"MIT"
] | AnacletoLAB/ensmallen | bindings/python/ensmallen/datasets/string/mycobacteriumsp15544247.py | 3,505 | Python |
from ..data.models import TaskRow
from ..data.postgres_async_db import AsyncPostgresDB
from .utils import read_body, format_response, handle_exceptions
import asyncio
class TaskApi(object):
_task_table = None
lock = asyncio.Lock()
def __init__(self, app):
app.router.add_route(
"GET",
... | 29.264368 | 86 | 0.530244 | [
"Apache-2.0"
] | ferras/metaflow-service-clone | metadata_service/api/task.py | 5,092 | Python |
from time import sleep
from os import system
chars = "abcdefghijklmnopqrstuvwxyz1234567890"
morseCode = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", ".----", "..---", "...--... | 36.966102 | 289 | 0.331958 | [
"MIT"
] | ngmhprogramming/DailyProgrammer | Everything/python_easy_7.py | 2,181 | Python |
"""
How to use RxPY to prepare batches for asyncio client.
"""
import asyncio
from csv import DictReader
import rx
from rx import operators as ops
from rx.scheduler.eventloop import AsyncIOScheduler
from influxdb_client import Point
from influxdb_client.client.influxdb_client_async import InfluxDBClientAsync
def cs... | 29.814286 | 116 | 0.581696 | [
"MIT"
] | bonitoo-io/influxdb-client-python | examples/asynchronous_batching.py | 2,087 | Python |
# Copyright 2021 ZBW – Leibniz Information Centre for Economics
#
# 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 b... | 32.428571 | 75 | 0.750157 | [
"Apache-2.0"
] | annakasprzik/qualle | tests/label_calibration/test_simple.py | 1,591 | Python |
""" main_MST.py
Skript illustrating the calculation of a minimum weight spanning tree for an
exemplary graph instance.
Supplemental Material for the Lecture Notes "Networks - A brief Introduction
using a Paradigmatic Combinatorial Optimization Problem" at the international
summer school "Modern Computational Science ... | 24.958333 | 77 | 0.764608 | [
"MIT"
] | omelchert/MCS2018_Networks | main_MST.py | 599 | Python |
import os
import requests
WEBHOOK_URL = os.environ['DJANGO_WEBHOOK_URL']
def send_message(author_name: str, message: str) -> bool:
json_data = {
# 'content': f'**{name}**\n\n{message}'
'embeds': [
{
'author': {
'name': author_name,
}... | 23.26087 | 57 | 0.500935 | [
"MIT"
] | archimedeans/integration-bee | round/webhooks.py | 535 | Python |
"""
ASGI config for anyberry project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETT... | 23.117647 | 78 | 0.78626 | [
"MIT"
] | Egor4ik325/anyberry | web-api/anyberry/asgi.py | 393 | Python |
"""
The MIT License (MIT)
Copyright (c) 2017 Andreas Poppele
Copyright (c) 2017 Roland Jaeger
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 the... | 35.706564 | 79 | 0.561635 | [
"MIT"
] | Eyenseo/gitScrabber | gitScrabber/scrabTasks/file/languageDetector.py | 9,248 | Python |
# Core Pkgs
import streamlit as st
# EDA Pkgs
import pandas as pd
import numpy as np
from PIL import Image
# Utils
import os
import joblib
import hashlib
# passlib,bcrypt
# Data Viz Pkgs
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
# DB
from managed_db import *
# Password
def generate_ha... | 35.211538 | 277 | 0.702713 | [
"MIT"
] | Let-Me-Code/Hepatitis-B-Mortality-Prediction | app.py | 10,986 | Python |
# Modification 2020 RangiLyu
# Copyright 2018-2019 Open-MMLab.
# 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 applicabl... | 37.026316 | 86 | 0.592514 | [
"Apache-2.0"
] | yangzilongdmgy/merge_monster_3d | mmdet3d/models/dense_heads/assigner/assign_result.py | 8,442 | Python |
"""
Interface item implementation. There are several notations supported
- class box with interface stereotype
- folded interface
- ball is drawn to indicate provided interface
- socket is drawn to indicate required interface
Interface item can act as icon of assembly connector, see
`gaphor.diagram.connector`... | 33.250639 | 88 | 0.590032 | [
"Apache-2.0"
] | 987Frogh/Makehuman | gaphor/diagram/classes/interface.py | 13,001 | Python |
import random
import time
pc=random.randint(0,10)
tentativas=0
chute=0
print('INICIANDO')
time.sleep(2)
while chute != pc:
chute=int(input('Digite um número entre 0 a 10: '))
print('PROCESSANDO')
time.sleep(1)
if chute < pc:
print('Mais, tente novamente.')
elif chute > pc:
print('Mne... | 24.705882 | 59 | 0.661905 | [
"MIT"
] | jhonatanmaia/python | study/curso-em-video/exercises/058.py | 422 | Python |
from optparse import OptionParser
import os,sys
import itertools
import re
def readSrc(src_dir):
lines=[]
for root, dirs, files in os.walk(src_dir):
for file in files:
if file.endswith(".cpp"):
lines+=["New_file "+ file]
lines_file = open(os.path.join(root, ... | 33.469231 | 119 | 0.478626 | [
"BSD-3-Clause"
] | cea-trust-platform/trust-code | Outils/TRIOXDATA/XTriou/Extract_xdata.py | 8,702 | Python |
import zmq
import random
ctx = zmq.Context(1)
sock = ctx.socket(zmq.REP)
sock.connect('tcp://127.0.0.1:7001')
while True:
parts = sock.recv_multipart()
print("GOT", parts)
if random.randrange(3) == 0:
import os, signal
os.kill(os.getpid(), signal.SIGKILL)
sock.send(b"Echo: " + b' '.join... | 23.5 | 44 | 0.62614 | [
"MIT"
] | asvetlov/zerogw | examples/crashing.py | 329 | Python |
__all__ = [
'BaseClassificationAggregator',
'BaseImageSegmentationAggregator',
'BaseEmbeddingsAggregator',
'BaseTextsAggregator',
'BasePairwiseAggregator',
]
import attr
from .. import annotations
@attr.s
@annotations.manage_docstring
class BaseClassificationAggregator:
""" This is a base cla... | 34.612903 | 124 | 0.724138 | [
"Apache-2.0"
] | artinmajdi/crowd-kit | build/lib/crowdkit/aggregation/base/__init__.py | 3,219 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 35.646154 | 75 | 0.740613 | [
"Apache-2.0"
] | DevangiDas/beam | sdks/python/apache_beam/examples/snippets/util.py | 2,317 | Python |
import numpy as np
__all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern"]
class Kernel(object):
def __init__(self, parnames=[], name=''):
"""
:param parnames:
A list of names of the kernel params, used to alias the intrinsic
parameter names. This way different inst... | 30.098039 | 83 | 0.582736 | [
"MIT"
] | errai34/prospector | prospect/likelihood/kernels.py | 3,070 | Python |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from spack.version import Version
class Meme(AutotoolsPackage):
"""The MEME Suite allows the bio... | 44.87234 | 96 | 0.697013 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | BenjaminRodenberg/spack | var/spack/repos/builtin/packages/meme/package.py | 2,109 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sun May 20 11:35:03 2018
@author: DanielM
"""
import os
import numpy as np
import shelve
# Setup some parameters given by paradigm_frequency_inhibition.py
stim_delay = 100 # ms
dt = 0.01 # ms
stim_dtp = stim_delay / dt
data_path = "C:\\Users\\Daniel\\pyDentateData\\tuning\\r... | 31.172414 | 110 | 0.698009 | [
"MIT"
] | danielmk/pyDentateeLife2020 | analysis/tuning_get_seclamp_currents_frequency.py | 904 | Python |
# -*- coding: utf-8 -*-
"""Top-level package for medium-shell."""
__author__ = 'Colin Bitterfield'
__email__ = 'cbitterfield@gmail.com'
__version__ = '0.1.0'
| 20 | 41 | 0.675 | [
"MIT"
] | cbitterfield/medium-shell | medium-shell/__init__.py | 160 | Python |
class Person(object):
""" Class Person for testing python.
Following packages need to be installed:
- requests
:param name: person's name, string
:param age: person's age, integer
:param phone: person's phone, string
:rtype: object
"""
def __init__(self, name, age, phone):
... | 25.109589 | 92 | 0.56192 | [
"MIT"
] | jhsaraja/testiprojekti | person.py | 3,666 | Python |
# coding: utf8
from spacy.symbols import POS, TAG, DEP, LEMMA, HEAD
from spacy.language import Language
from spacy.tokens import Doc
from spacy.util import get_lang_class
import numpy
import re
class StanfordNLPLanguage(Language):
def __init__(self, snlp, meta=None, **kwargs):
"""Initialize the Language c... | 38.580838 | 85 | 0.60329 | [
"MIT"
] | mehmetilker/spacy-stanfordnlp | spacy_stanfordnlp/language.py | 6,443 | Python |
def train_instance_plot(temp_data_X, temp_data_Y, save_name):
plt.figure(figsize=(12,8))
plot_dx = 0
for chdx in range(3):
plt.plot(temp_data_X[:, chdx]/np.max(temp_data_X[:, chdx]) + plot_dx*2,color='k')
plot_dx += 1
plt.plot(temp_data_Y[:,0]-2,color='b')
plt.plot(temp_dat... | 28.823529 | 89 | 0.612245 | [
"MIT"
] | MrXiaoXiao/PickNet_keras | src/misc/plot.py | 490 | Python |
import socket
from pywincffi.core import dist
from pywincffi.dev.testutil import TestCase, mock_library
from pywincffi.exceptions import WindowsAPIError
from pywincffi.kernel32 import CloseHandle
from pywincffi.wintypes import LPWSANETWORKEVENTS, socket_from_object
from pywincffi.ws2_32 import (
WSAGetLastError, W... | 34.359155 | 79 | 0.659561 | [
"MIT"
] | opalmer/pycffiwin32 | tests/test_ws2_32/test_events.py | 4,879 | Python |
try :
from facepy import GraphAPI
from facepy.exceptions import OAuthError
import time
from sys import stdout
except ImportError:
print("Import Error")
token = 'Enter-Token-Here'
OWNER_NAME = ''
photos_together = {}
no_of_comments = {}
words_in_comment = {}
no_of_messages = {}
total_chat_length = {... | 32.900794 | 89 | 0.638162 | [
"MIT"
] | ashish1294/facepy-scripts | friendship_py3.py | 8,291 | Python |
import zutils
class zhighlighter:
def highlight(self, text):
return [(zutils.CL_FG, zutils.CL_BG, zutils.AT_BLINK if i % 2 == 0 else zutils.AT_NORMAL) for i in range(len(text))] #LOL!
| 31.5 | 124 | 0.719577 | [
"MIT"
] | herimonster/zoid | zhighlighter.py | 189 | Python |
from rest_framework import permissions
class PolyaxonPermission(permissions.BasePermission):
"""
Polyaxon Base permission system.
"""
def has_object_permission(self, request, view, obj):
return False
| 20.636364 | 56 | 0.722467 | [
"MPL-2.0"
] | AntonFriberg/polyaxon | polyaxon/scopes/permissions/base.py | 227 | Python |
import glob
import json
import os
import shutil
import subprocess
from .helpers import *
def constructor(*args, default_channel=True, no_rc=True, no_dry_run=False):
umamba = get_umamba()
cmd = [umamba, "constructor"] + [arg for arg in args if arg]
try:
res = subprocess.check_output(cmd)
... | 34.173469 | 84 | 0.59779 | [
"BSD-3-Clause"
] | ExternalRepositories/mamba | micromamba/tests/test_constructor.py | 3,349 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import typing # NOQA: F401
from nixnet import _cconsts
from nixnet import _errors
from nixnet import _props
from nixnet import constants
from nixnet.database import _collection
from nixnet.database import _d... | 38.647826 | 118 | 0.657779 | [
"MIT"
] | bigoulours/nixnet-python | nixnet/database/_subframe.py | 8,889 | Python |
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 42.167857 | 315 | 0.720505 | [
"CC0-1.0"
] | databricks-academy/data-engineering-with-databricks | Data-Engineering-with-Databricks/06 - Incremental Data Processing/DE 6.1 - Incremental Data Ingestion with Auto Loader.py | 11,807 | Python |
import numpy as np
def log_gaussian(x, mean, sigma):
"""
Computes the log-probability of X=x for a Gaussian of mean=mean and sigma=sigma
Parameters
----------
x
mean
sigma
Returns
-------
"""
log_pdf = -(x - mean) ** 2 / (2 * sigma ** 2)
log_pdf = log_pdf - np.log((n... | 23.333333 | 83 | 0.503297 | [
"BSD-3-Clause"
] | calispac/cta-lstchain | lstchain/image/pdf.py | 910 | Python |
repeat_age = 0
while repeat_age < 3:
age = int(
input(f"Check your movie ticket price by typing your age below. You may check {3 - repeat_age} more times\n"))
if age < 3:
print("Your ticket is free!")
elif 3 <= age <= 12:
print("Your ticket costs $10")
elif age > 12:
prin... | 34.888889 | 118 | 0.61465 | [
"MIT"
] | kg55555/pypractice | Part 1/Chapter 7/exercise_7.6.py | 628 | Python |
from django.contrib.auth.models import AbstractUser
from django.db import models
import uuid
# class Role(models.Model):
# '''
# The Role entries are managed by the system,
# automatically created via a Django data migration.
# '''
# name = models.CharField(max_length=50, default=1)
# de... | 28.046154 | 71 | 0.628086 | [
"MIT"
] | RadySonabu/ThesisAPI | user/models.py | 1,823 | Python |
'''
'''
import hashlib
import uuid
import logging
from cassandra.cluster import Cluster
from cassandra.policies import DCAwareRoundRobinPolicy
from subprocess import PIPE, Popen
from kazoo.client import KazooClient
from multiprocessing import Process
class CassandraAware:
def init__(self):
self.cluster ... | 36.353191 | 126 | 0.594288 | [
"BSD-3-Clause"
] | rsacpp/repre | clique3.py | 8,543 | Python |
from matplotlib import pyplot as plt
from matplotlib_venn import venn2
import glob
import compare_two_zlists as cv
import math
from scipy.stats import hypergeom
from decimal import Decimal
from math import log
def make_venn_matrix(filename_list):
fig1 = plt.figure(1)
fig1.suptitle('Differentially Expressed Genes Ov... | 26.835052 | 84 | 0.676143 | [
"MIT"
] | YeoLab/gscripts | gscripts/general/venn_matrix.py | 2,603 | Python |
from ctypes import cdll, c_int, c_ulonglong, c_char_p
import time
import json
import thread
def runList(ll, interpID, inputList):
strList = json.dumps(inputList)
listID = ll.elconn_list_from_json(strList.encode())
resultID = ll.elconn_call(interpID, listID)
return resultID
# === load library
ll = cd... | 33.225806 | 72 | 0.724272 | [
"MIT"
] | epicframework/EPIC-Core | connective/connective/python/elconn_trial_script.py | 3,090 | Python |
from lxml import html
from Proxy import Proxy
import urllib.request
import urllib.parse
import urllib.error
import data
import sys
import bcolors
class Search :
#Initializes variables
def __init__(self, useproxy, retries = None, verbose = False, sleep = 5):
self.urls = [] # contains scraped urls
... | 37.256098 | 115 | 0.572504 | [
"MIT"
] | Spectrum256/webvulns | dev/Search.py | 3,055 | Python |
# !pip install transformers
import torch
from transformers.file_utils import is_tf_available, is_torch_available, is_torch_tpu_available
from transformers import BertTokenizerFast, BertForSequenceClassification
from transformers import Trainer, TrainingArguments
import numpy as np
import random
from sklearn.datasets i... | 41.078947 | 115 | 0.730728 | [
"MIT"
] | AJuneSlop/pythoncode-tutorials | machine-learning/nlp/bert-text-classification/train.py | 4,683 | Python |
# DADSA - Assignment 1
# Reece Benson
import json
from classes import Player as Player
from classes import Season as Season
from classes import Tournament as Tournament
from classes import Round as Round
from classes import Match as Match
class Handler():
# Define the variables we will be using
app = None
... | 33.8 | 83 | 0.582249 | [
"MIT"
] | reecebenson/DADSA-Tennis-PartA | .history/classes/Handler_20171106200011.py | 2,535 | Python |
'''
Test script for GrFNN, plotting the entrainment for a sin wave of changing frequency.
@author T. Kaplan
'''
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import time
from gfnn import FrequencyType, FrequencyDist, ZParams, GrFNN
from plot import spectro_plot
# Constr... | 24.326923 | 85 | 0.658498 | [
"MIT"
] | Kappers/oscirhythm | model/sin_example_gfnn.py | 1,265 | Python |
from maestro.core.provider import BaseSyncProvider
class NoSQLSyncProvider(BaseSyncProvider):
pass | 20.8 | 50 | 0.836538 | [
"BSD-3-Clause"
] | estudio89/maestro-python | maestro/backends/base_nosql/provider.py | 104 | Python |
'''
Adapted from https://github.com/IntelligentQuadruped, with permission
Description: Module to connect to camera and retrieve RGB and depth data. Currently supports the Intel RealSense R200 Camera.
'''
import numpy as np
import logging
import time
import cv2
import matplotlib.pyplot as plt
from skimage.transform imp... | 31.134328 | 125 | 0.591243 | [
"MIT"
] | marioliu/AutonomousQuadblade | Camera/camera.py | 6,258 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-08 21:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0011_auto_20171108_2343'),
]
operations = [
migrations.AddField(
... | 22.666667 | 62 | 0.630252 | [
"MIT"
] | Eleazar-Harold/mpesa_api | mpesa_api/core/migrations/0012_onlinecheckout_transaction_date.py | 476 | Python |
#!/usr/bin/env python
# Copyright 2012 La Honda Research Center, 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 ap... | 26.09375 | 74 | 0.713772 | [
"Apache-2.0"
] | bopopescu/extra-specs-1 | tools/clean_file_locks.py | 1,670 | Python |
from flask import Flask
from flask_cors import CORS
from . import configs
def create_app():
app = Flask(__name__)
app.config.from_object(configs.Config)
CORS(app, resources={r"/api/*": {"origins": "*"}})
from .controllers import api_blueprint
app.register_blueprint(api_blueprint)
return ap... | 18.941176 | 54 | 0.704969 | [
"MIT"
] | BiznetGIO/whois-api | app/__init__.py | 322 | Python |
# Copyright 2018 Yegor Bitensky
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... | 34.15 | 74 | 0.746706 | [
"Apache-2.0"
] | YegorDB/THPoker | tests/utils.py | 683 | Python |
import redis
import json
from itertools import zip_longest
from common.config import REDIS_ADDR, REDIS_PORT, REDIS_DB
def batcher(iterable, n):
args = [iter(iterable)] * n
return zip_longest(*args)
def insert2redis(ids, dataList):
# dataList [{"videoId": id, "feat": feat, "name": name}]
r = redis.Re... | 29.424242 | 95 | 0.625644 | [
"Apache-2.0"
] | JackLCL/bootcamp | solutions/video_similarity_search/search-video-demo/search/controller/database.py | 1,942 | Python |
from django.contrib import admin
from menus.models import Dish, Menu
@admin.register(Menu)
class MenuAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'description', 'created', 'updated')
search_fields = ('id', 'name', 'description')
list_filter = ('created', 'updated')
raw_id_fields = ('dishes',... | 25.037037 | 70 | 0.606509 | [
"MIT"
] | dzbrozek/emenu-api | emenuapi/menus/admin.py | 676 | Python |
"""
show_interface.py
IOSXE parsers for the following show commands:
* show interfaces
* show ip interfaces <interface>
* show ip interface brief
* show ip interface brief | include Vlan
* show interfaces switchport
* show ip interface
* show interfaces <interface>
* show ipv6 i... | 44.005934 | 145 | 0.479359 | [
"Apache-2.0"
] | Tristou27/genieparser | src/genie/libs/parser/iosxe/show_interface.py | 155,737 | Python |
import subprocess
import tator
def test_activities(host, token, video_type, video):
cmd = [
'python3',
'examples/activities.py',
'--host', host,
'--token', token,
'--video_type_id', str(video_type),
'--video_id', str(video),
]
subprocess.run(cmd, check=True)... | 21.4 | 52 | 0.573209 | [
"MIT"
] | cvisionai/tator-py | test/examples/test_activities.py | 321 | Python |
import os
from setuptools import setup, find_packages
from guizero import __name__, __package__, __version__, __author__
## This is a Python 3 package only
from sys import version_info
if version_info.major != 3:
print("This package will only work with Python 3. \n"
"If you already have Python 3 installe... | 33.627907 | 178 | 0.720609 | [
"BSD-3-Clause"
] | hormigaAzul/guizero | setup.py | 2,892 | Python |
import os
import logging
import seqlog
from seqlog import StructuredRootLogger, StructuredLogger, ConsoleStructuredLogHandler
if bool(os.environ.get('PROD')):
# Production logging setup
url = os.environ.get('SEQ_URL')
key = os.environ.get('SEQ_BOT_KEY')
if not key:
raise Exception('SEQ_BOT_K... | 27.585366 | 86 | 0.678161 | [
"MIT"
] | ClemBotProject/ClemBot | ClemBot.Bot/bot/__init__.py | 1,131 | Python |
import filecmp
import os
from os.path import abspath, dirname, join, exists
import pytest
from image_diet import storage
THIS_DIR = abspath(dirname(__file__))
@pytest.fixture
def dietstorage():
dietstorage = storage.DietStorage()
# Filesystem storage parameters
dietstorage.location = THIS_DIR
diets... | 27.497297 | 77 | 0.686259 | [
"MIT"
] | samastur/image-diet2 | tests/test_storage.py | 5,087 | Python |
import pytest
from model_mommy import mommy
from rest_framework import status
import json
'''
This set of tests exists to test all example requests used in the API documentation
if any of these tests break, but others do not, you should first check that the specified
request is still valid. If the request is no longe... | 49.54902 | 118 | 0.550257 | [
"CC0-1.0"
] | COEJKnight/five | usaspending_api/api_docs/tests/test_documentation_examples.py | 5,054 | Python |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dj8bihu.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are ... | 33.6875 | 73 | 0.686456 | [
"MIT"
] | RileyGe/dj8bihu | manage.py | 539 | Python |
"""project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 35.666667 | 90 | 0.71028 | [
"BSD-3-Clause"
] | sewi2/simple-django-template | project/example/urls.py | 1,070 | Python |
import uuid
import requests;
import os;
from PIL import Image
from io import BytesIO
__name__ = "download_images"
def download(link, counter, size, root_folder, class_name):
IMG_SIZE = size, size
response = requests.get(link, timeout=3.000)
file = BytesIO(response.content)
img = Image.open(file)
i... | 30.185185 | 83 | 0.653988 | [
"MIT"
] | Bergolfs/idt | idt/utils/download_images.py | 815 | Python |
import time
import cv2
import numpy as np
j = 1
while 1:
path = 'Bearing/' + str(j) + '.jpg'
img = cv2.imread(path)
img_copy = img.copy()
img = cv2.blur(img, (1, 1))
gray = cv2.cvtColor(img_copy, cv2.COLOR_BGR2GRAY)
# flag, img_copy = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
imgra... | 34.541667 | 120 | 0.496984 | [
"Apache-2.0"
] | Thinkin99/intelligent_visionforce_assemble | ellcircle_detect.py | 1,772 | Python |
# Generated by Django 2.0.8 on 2018-09-21 10:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app_challenges', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='challenge',
name='challenge_co... | 24.157895 | 116 | 0.62963 | [
"MIT"
] | Audiotuete/backend_challenge_api | app_challenges/migrations/0002_auto_20180921_1031.py | 459 | Python |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import base64
import hashlib
import math
from ccxt.base.errors import ExchangeError
f... | 38.633282 | 156 | 0.517489 | [
"MIT"
] | QuoineFinancial/ccxt | python/ccxt/async_support/btcmarkets.py | 25,073 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 该例程将发布/person_info话题,自定义消息类型learning_communication::PersonMsg
import rospy
from learning_communication.msg import PersonMsg
def velocity_publisher():
# ROS节点初始化
rospy.init_node('person_publisher', anonymous=True)
# 创建一个Publisher,发布名为/person_info的topic,消息类型为Person... | 25.026316 | 79 | 0.700315 | [
"Apache-2.0"
] | Colin1245/ROS-Theory-Application-Shenlan | 3.ROS_communication/learning_communication/scripts/person_publisher.py | 1,089 | Python |
#one.py
print('hello')
def func():
print("Func() in one.py")
print("TOP LEVEL IN one.py")
if __name__ == "__main__":
print("one.py is being run directly!")
else:
print("one.py has been imported!") | 16.833333 | 39 | 0.658416 | [
"MIT"
] | bitadept/codebook | Programming Languages & Libraries/Python/Python Complete Bootcamp/__name__ and __main__/one.py | 202 | Python |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 29.736626 | 111 | 0.679076 | [
"Apache-2.0"
] | michalbrys/probability | tensorflow_probability/python/internal/backend/numpy/numpy_array.py | 14,452 | Python |
import netrc, os, unittest, sys, textwrap
from test import test_support
temp_filename = test_support.TESTFN
class NetrcTestCase(unittest.TestCase):
def make_nrc(self, test_data):
test_data = textwrap.dedent(test_data)
mode = 'w'
if sys.platform != 'cygwin':
mode += ... | 36.381679 | 80 | 0.573017 | [
"Apache-2.0"
] | Jeff-Tian/mybnb | Python27/Lib/test/test_netrc.py | 4,766 | Python |
"""pycodestyle support."""
from pycodestyle import BaseReport, StyleGuide, get_parser, _parse_multi_options
from pylama.lint import Linter as Abstract
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class Linter(Abstract):
"""pycodestyle runner."""
@staticmethod
... | 28.704225 | 80 | 0.597645 | [
"MIT"
] | BHills15/vimrc | vimfiles/bundle/vim-python/submodules/pylama/pylama/lint/pylama_pycodestyle.py | 2,038 | Python |
# Microsoft Azure Linux Agent
#
# Copyright 2014 Microsoft Corporation
#
# 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 b... | 28.270742 | 74 | 0.708372 | [
"Apache-2.0"
] | vittyvk/WALinuxAgent | azurelinuxagent/common/conf.py | 6,474 | Python |
import discord
from discord.ext import commands
import humanize
import traceback
import random
import datetime
import json
class Information(commands.Cog):
def __init__(self, client):
self.client = client
self.launched_at = datetime.datetime.utcnow()
@commands.Cog.listener()
async def on_r... | 50.25817 | 411 | 0.606346 | [
"CC0-1.0"
] | EaBro/TheImperialGod | TheImperialGod/cogs/info/info.py | 15,382 | Python |
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.plotly as py
import plotly.graph_objs as go
import networkx as nx
import pickle
import boto3
import io
import numpy
import pandas
############################
# Load data
BUCKET_NAME = 'blog-seq-da... | 28.686275 | 148 | 0.64149 | [
"MIT"
] | avbatchelor/insight-articles-project | src/dash_app/my_app_v8.py | 2,926 | Python |
# -*- coding: utf-8 -*-
# @Time : 2020/7/7 9:11
# @Author : lightsmile
# @Software: PyCharm
from lightutils import get_file_name
if __name__ == '__main__':
print(get_file_name("hello_world.py"))
| 20.5 | 42 | 0.663415 | [
"MIT"
] | smilelight/lightUtils | examples/get_file_name_demo.py | 205 | Python |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bethel Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BethelTestFramework
from test_framework.staticr_util import *
import... | 30.044444 | 80 | 0.678994 | [
"MIT"
] | diyathrajapakshe/bethel-core | qa/rpc-tests/staticr-tx-send.py | 1,352 | Python |
import time
import base64
from datetime import datetime
import sys
import json
from redis_support_py3.graph_query_support_py3 import Query_Support
from redis_support_py3.construct_data_handlers_py3 import Generate_Handlers
from modbus_redis_server_py3.modbus_serial_ctrl_py3 import ModbusSerialCtrl... | 36.560284 | 107 | 0.671581 | [
"MIT"
] | NanoDataCenter/nano_data_center | code/modbus_server_py3.py | 5,155 | Python |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import ... | 36.591667 | 2,646 | 0.624488 | [
"MIT"
] | JustinACoder/H22-GR3-UnrealAI | Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/rnn/ops/gen_lstm_ops.py | 35,128 | Python |
import numpy as np
from torch import nn
import torch.optim as optim
import torch
import matplotlib.pyplot as plt
import pandas as pd
import data_loader as dl
import time
import copy
import utility
import yaml
import trainer
from PIL import Image
from os import path
Image.MAX_IMAGE_PIXELS = None
from scipy.io import sav... | 42.193798 | 93 | 0.516994 | [
"MIT"
] | micqu/hotel-challenge | main.py | 5,443 | Python |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from django.core.urlresolvers import reverse
from django.http import QueryDict
from .crypto import generate_randomness
from .models import SQRLNut
from .utils import get_user_ip
class SQRLInitialization(object):
"""
SQ... | 31.581081 | 101 | 0.609114 | [
"MIT"
] | JamesonNetworks/django-sqrl | sqrl/sqrl.py | 4,674 | Python |
from abc import abstractmethod
import math
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from .fp16_util import convert_module_to_f16, convert_module_to_f32, convert_module_to_f16_2
from .nn import (
checkpoint,
conv_nd,
linear,
avg_pool_nd,
zero_modu... | 34.767331 | 160 | 0.55646 | [
"MIT"
] | AranKomat/Diff-DALLE | diff_dalle/unet.py | 36,610 | Python |
'''
This file is automatically generated; Do not edit it. :)
'''
VERSION_INFO = {
'final': True,
'version': '1.19.0',
'branch_nick': 'feature-0-Rucio_1_19_0_release_preparation',
'revision_id': 'dd9f8f94d94996ab5b3aa45b4c23ccc77cff604a',
'revno': 7719
}
| 22.916667 | 64 | 0.676364 | [
"Apache-2.0"
] | pujanm/rucio | lib/rucio/vcsversion.py | 275 | Python |
#! /usr/bin/env python
""" cryptopy.cipher.aes_sbox_analysis
AES Sbox Analysis - a simple analysis of the AES Sbox that determines
the number and size of the permutation subgroups in the transformation.
Could be extended to examine any Sbox ...
Copyright (c) 2002 by Paul A. Lambert
Read LI... | 33.009524 | 81 | 0.585978 | [
"MIT"
] | Twilight0/script.module.cryptolib | lib/cryptopy/cipher/aes_sbox_analysis.py | 3,466 | Python |
import csv # csv reader functions
from collections.abc import Counter # count uniques in a file quickly, O(nlogn)
from decimal import Decimal # just to show decimals with lower precision
# Global Variables #
from cfltools.settings import APPFOLDER
class IpAddress:
def __init__(self, ip, numOccurances):
... | 41.375 | 86 | 0.489167 | [
"MIT"
] | bradley-evans/cfltools | cfltools/depreciated/getuniqueip.py | 11,585 | Python |
# -*- coding: utf-8 -*-
"""Top-level package for {{ cookiecutter.project_name }}."""
__project__ = "{{ cookiecutter.project_name }}"
__author__ = "{{ cookiecutter.full_name }}"
__email__ = "{{ cookiecutter.email }}"
__version__ = "{{ cookiecutter.version }}"
| 29 | 60 | 0.666667 | [
"Apache-2.0"
] | AKhranovskiy/cookiecutter-python | {{cookiecutter.project_name}}/{{cookiecutter.project_slug}}/__init__.py | 261 | Python |
# custom PosLemmaTagger based on Chatterbot tagger
import string
from chatterbot import languages
import spacy
from chatterbot import tagging
class CustomPosLemmaTagger(tagging.PosLemmaTagger):
def __init__(self, language=None):
super(CustomPosLemmaTagger, self).__init__(language=None)
def get_big... | 27.925926 | 83 | 0.55305 | [
"BSD-3-Clause"
] | sciutrux/cbotami | tagging.py | 1,508 | Python |
"""Download handlers for different schemes"""
import logging
from twisted.internet import defer
from scrapy import signals
from scrapy.exceptions import NotConfigured, NotSupported
from scrapy.utils.httpobj import urlparse_cached
from scrapy.utils.misc import create_instance, load_object
from scrapy.utils.python imp... | 35.569892 | 99 | 0.620314 | [
"BSD-3-Clause"
] | Hugking/scrapy | scrapy/core/downloader/handlers/__init__.py | 3,766 | Python |
#!/usr/bin/env python
# -*- coding:utf-8 _*-
# @author : Lin Luo / Bruce Liu
# @time : 2020/1/3 21:35
# @contact : 15869300264@163.com / bruce.w.y.liu@gmail.com
import argparse
parser = argparse.ArgumentParser()
parser.add_argument_group()
parser.add_argument('-c', '--config', help='config file for run and operati... | 50.6 | 116 | 0.697628 | [
"Apache-2.0"
] | BruceWW/odyn | utils/args.py | 1,012 | Python |
import numpy as np
from yt.data_objects.selection_objects.data_selection_objects import (
YTSelectionContainer,
YTSelectionContainer3D,
)
from yt.data_objects.static_output import Dataset
from yt.funcs import ensure_list, validate_iterable, validate_object
from yt.geometry.selection_routines import points_in_c... | 35.13834 | 83 | 0.579865 | [
"BSD-3-Clause-Clear"
] | chummels/yt | yt/data_objects/selection_objects/cut_region.py | 8,890 | Python |
# terrascript/data/onelogin.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:23:37 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.data.onelogin
#
# instead of
#
# >>> import terrascript.data.onelogin.onelogin
#
# This is only available for 'official' and 'partner' providers... | 24.8 | 73 | 0.739247 | [
"BSD-2-Clause"
] | mjuenema/python-terrascript | terrascript/data/onelogin.py | 372 | Python |
import cv2
import os
import json
from collections import defaultdict
filelist_path = '/data/zfp/data/jinan/filelist.json'
img_path = '/data/zfp/data/jinan/visual/%s_fusion.png'
builidng_txt = '/data/zfp/code/mmdetection/results_merge/building/building.txt'
output_dir = '/data/zfp/code/mmdetection/visual/building'
score... | 31.184211 | 79 | 0.640506 | [
"Apache-2.0"
] | abcxs/polyrnn | mytools/building_jinan/visual.py | 1,185 | Python |
# -*- coding: utf-8 -*-
"""Common collection classes."""
from __future__ import print_function, division, absolute_import
from functools import reduce
from collections import Mapping, Set
from .compat import isiterable, iteritems, odict, text_type
def make_immutable(value):
# this function is recursive, and if n... | 30.355932 | 95 | 0.595757 | [
"BSD-3-Clause"
] | AXGKl/be_black | lib/python3.7/site-packages/conda/_vendor/auxlib/collection.py | 3,582 | Python |
def event_handler(source,evt):
if evt == lv.EVENT.CLICKED:
if source == btn1:
# treat "clicked" events only for btn1
print("Clicked")
elif evt == lv.EVENT.VALUE_CHANGED:
print("Toggled")
# create a simple button
btn1 = lv.btn(lv.scr_act(),None)
# attach the call... | 25.275862 | 50 | 0.694407 | [
"MIT"
] | Dimsmary/OpenSTM | ArduinoProject/DAC_CONTROLLER/lib/lv_demos/src/lv_ex_widgets/lv_ex_btn/lv_ex_btn_1.py | 733 | Python |
"""List options for creating Placement Groups"""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers.vs_placement import PlacementManager as PlacementManager
@click.command()
@environment.pass_env
def cli(env)... | 30.410256 | 98 | 0.711636 | [
"MIT"
] | ATGE/softlayer-python | SoftLayer/CLI/virt/placementgroup/create_options.py | 1,186 | Python |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | 43.029703 | 111 | 0.63035 | [
"MIT"
] | akondasif/open-hackathon-bak_01 | open-hackathon-server/src/hackathon/registration/register_mgr.py | 8,728 | Python |
"""
Takes the gradients of the solution to the screen mapping potential problem and
reconstructs the perpendicular deflection field.
"""
import numpy as np
import scipy as sp
import scipy.interpolate
import scipy.misc
import scipy.ndimage
from .constants import M_PROTON_G, ESU, C_CMS
def reconstruct(ri, li, rs, v, x... | 33.609053 | 152 | 0.614057 | [
"MIT"
] | flash-center/PROBLEM | problem/deflect.py | 8,167 | Python |
# coding: utf-8
try:
from lxml import etree
except ImportError:
try:
# Python 2.5
import xml.etree.cElementTree as etree
except ImportError:
try:
# Python 2.5
import xml.etree.ElementTree as etree
except ImportError:
try:
#... | 24.625 | 55 | 0.558376 | [
"MIT"
] | fdelvalle/sdk-python | maxipago/utils/xml.py | 788 | Python |
# Copyright (c) 2020 PaddlePaddle 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 app... | 40.595395 | 88 | 0.60453 | [
"Apache-2.0"
] | MissPenguin/Paddle | python/paddle/fluid/contrib/slim/quantization/imperative/qat.py | 24,682 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# refer to `https://bitbucket.org/akorn/wheezy.captcha`
import random
import string
import os.path
from io import BytesIO
from PIL import Image
from PIL import ImageFilter
from PIL.ImageDraw import Draw
from PIL.ImageFont import truetype
class Bezier:
def __init__(... | 34.764957 | 116 | 0.547019 | [
"MIT"
] | rymmx/My_information | info/utils/captcha/captcha.py | 8,171 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pipreqs - Generate pip requirements.txt file based on imports
Usage:
pipreqs [options] <path>
Options:
--use-local Use ONLY local package info instead of querying PyPI
--pypi-server <url> Use custom PyPi server
--proxy <url> Use Prox... | 34.692308 | 108 | 0.565267 | [
"MIT"
] | 0mp/pipenv | pipenv/vendor/pipreqs/pipreqs.py | 13,981 | Python |
#!/usr/bin/env python3
# Copyright (c) 2017-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test getblockstats rpc call
#
from test_framework.blocktools import COINBASE_MATURITY
from test_fram... | 41.916667 | 121 | 0.629225 | [
"MIT"
] | blinkhash/blinkhash-core | test/functional/rpc_getblockstats.py | 7,042 | Python |
"""Training run script"""
import argparse
import json
from pathlib import Path
from bisect import bisect_left
import torch
import torch_geometric as tg
import matplotlib.pyplot as plt
import local2global as l2g
from local2global_embedding.embedding import speye, train, embedding, VGAE_model, VGAE_loss, reconstructio... | 39.61302 | 147 | 0.61773 | [
"MIT"
] | LJeub/Local2Global_embedding | local2global_embedding/run.py | 21,912 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.