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 |
|---|---|---|---|---|---|---|
examples/beam_simple_rhino.py | franaudo/fea | 0 | 12766251 | from math import pi
from compas_fea.cad import rhino
from compas_fea.structure import CircularSection
from compas_fea.structure import ElasticIsotropic
from compas_fea.structure import ElementProperties as Properties
from compas_fea.structure import GeneralDisplacement
from compas_fea.structure import GeneralStep
from... | 1.6875 | 2 |
zinc/route53/policy.py | PressLabs/zinc | 29 | 12766252 | import copy
from collections import OrderedDict
import zinc.route53
from zinc.utils import memoized_property
from .record import Record, RECORD_PREFIX
class Policy:
def __init__(self, zone, policy):
assert isinstance(zone, zinc.route53.Zone)
self.zone = zone
self.db_policy = policy
@... | 2.65625 | 3 |
examples/tbss_tutorial.py | satra/NiPypeold | 0 | 12766253 | <filename>examples/tbss_tutorial.py
"""
XXX Currently not WORKING in release 0.3,
Check for updates
A pipeline example that uses several interfaces to
perform analysis on diffusion weighted images using
FSL fdt and tbss tools.
The data for this analysis is available at
http://www.mit.edu/~satra/... | 2.109375 | 2 |
main.py | tiagobka/PythonBenchmark | 0 | 12766254 | <reponame>tiagobka/PythonBenchmark
import threading
import multiprocessing
import functools
from time import perf_counter, perf_counter_ns, sleep
from random import randint
""" PROGRAM CHALLENGE
Threads vs. Concurrent Processes
The challenge is to write a Python script to do som... | 3.671875 | 4 |
main.py | Eli-pixel/Etext | 1 | 12766255 | from ecolor import slow_color, slow_print, ecolor
ecolor("This is red text", "red")
ecolor("This is bold blue text", "bold_blue")
slow_print("This is slow_print", 0.025)
slow_color("This is slow_print but colorful", "blue", 0.025)
slow_color("This is slow_print but colorful and bold", "bold_blue", 0.025)
| 2.546875 | 3 |
src/babysteps/cal/u1272.py | solohm/multimeter | 1 | 12766256 | <gh_stars>1-10
#!/usr/bin/env python
# Python script to communicate with the
# Agilent U1253A / U1272A / U1273A etc.
# found originally on http://goo.gl/Gycv9H
# For more information on the protocol, check
# http://blog.philippklaus.de/2014/02/agilent-u1273a/
# and http://goo.gl/oIJi96
import sys
import time
import ... | 2.921875 | 3 |
application/train_utils.py | surajpaib/Size-Matters | 0 | 12766257 | <filename>application/train_utils.py
import torch
def train(mod, optim, criterion, epoch, train_loader):
mod.train()
for batch_idx, (data, target) in enumerate(train_loader):
optim.zero_grad()
output = mod(data)
loss = criterion(output, target)
loss.backward()
optim.step()
if batc... | 2.5625 | 3 |
tccli/services/rum/rum_client.py | tencentcloudapi-test/tencentcloud-cli | 0 | 12766258 | # -*- coding: utf-8 -*-
import os
import sys
import six
import json
import tccli.options_define as OptionsDefine
import tccli.format_output as FormatOutput
from tccli import __version__
from tccli.utils import Utils
from tccli.exceptions import ConfigurationError, ClientError, ParamError
from tencentcloud.common import... | 1.695313 | 2 |
cmskit/dealers/urls.py | ozgurgunes/django-cmskit | 1 | 12766259 | <filename>cmskit/dealers/urls.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
urlpatterns = patterns('cmskit.dealers.views',
# url(r'^$', 'index', name='articles_index'),
url(r'^search/$', 'search', name='dealers_search'),
url(r'^(?P<pk>\d+)/$', 'dealer', name... | 1.734375 | 2 |
extra/neurodsp/neurodsp/shape/phase.py | davidcrowland/layer_vb_tagging | 0 | 12766260 | """
phase.py
Estimate the phase of an oscillation using a waveform-based approach
"""
import numpy as np
def extrema_interpolated_phase(x, Ps, Ts, zeroxR=None, zeroxD=None):
"""
Use peaks (phase 0) and troughs (phase pi/-pi) to estimate
instantaneous phase. Also use rise and decay zerocrossings
(phas... | 3.234375 | 3 |
simulator/generators/DtnMarkovBundleGenerator.py | seakers/dtnsim | 4 | 12766261 | # -*- coding: utf-8 -*-
import os
from collections import defaultdict
from copy import deepcopy
from warnings import warn
import numpy as np
import pandas as pd
from pathlib import Path
from simulator.core.DtnBundle import Bundle
from simulator.utils.DtnIO import load_traffic_file
from simulator.utils.DtnUtils import... | 1.71875 | 2 |
src/CLI/actioner/sonic_cli_ptp.py | project-arlo/sonic-mgmt-framework | 7 | 12766262 | <reponame>project-arlo/sonic-mgmt-framework<gh_stars>1-10
import sys
import base64
import struct
import socket
import cli_client as cc
from rpipe_utils import pipestr
from scripts.render_cli import show_cli_output
def node_addr_type(address):
try:
socket.inet_pton(socket.AF_INET, address)
except socke... | 2.046875 | 2 |
src/keras_examples/sine2.py | JouniVatanen/NLP-and-Deep-Learning | 1 | 12766263 | <gh_stars>1-10
# https://lazyprogrammer.me
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.models import Model
from keras.layers import Input, SimpleRNN, Dense
from keras.optimizers import SGD, Adam
# make the original data
series1 = np.sin(0.1*np.arange(200))
series2 = np.sin(0.2*n... | 2.8125 | 3 |
tests/test_client.py | jakm/fastjsonrpc | 7 | 12766264 | import os
import sys
sys.path.insert(0, os.path.abspath('..'))
from twisted.trial.unittest import TestCase, SkipTest
from twisted.internet.defer import Deferred
from twisted.web.server import Site
from twisted.internet import reactor
from twisted.web.client import Agent
from twisted.internet.error import TimeoutError
... | 2.09375 | 2 |
camos/plugins/openbxr/openbxr.py | danilexn/camos | 1 | 12766265 | <reponame>danilexn/camos
# -*- coding: utf-8 -*-
# Created on Sat Jun 05 2021
# Last modified on Mon Jun 07 2021
# Copyright (c) CaMOS Development Team. All Rights Reserved.
# Distributed under a MIT License. See LICENSE for more info.
from PyQt5.QtCore import pyqtSignal
import numpy as np
import h5py
from camos.tas... | 2.21875 | 2 |
mergeforms/migrations/0001_initial.py | mbronstein/ssa412 | 0 | 12766266 | <reponame>mbronstein/ssa412
# Generated by Django 3.2.6 on 2021-09-25 23:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import taggit.managers
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | 1.75 | 2 |
runner/ppo.py | 2855239858/CenLight-Traffic-Grid-Signal-Optimization-viaAction-and-State-Decomposition | 1 | 12766267 | """Multi-agent traffic light example (single shared policy)."""
from ray.rllib.agents.ppo.ppo_policy import PPOTFPolicy
from flow.envs.multiagent import MyMultiTrafficLightGridPOEnv
from flow.networks import TrafficLightGridNetwork
from flow.core.params import SumoParams, EnvParams, InitialConfig, NetParams
from flow.... | 2.71875 | 3 |
paas-ce/paas/esb/components/bk/apis/cc/add_app.py | renmcc/bk-PaaS | 767 | 12766268 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 1.6875 | 2 |
src/qbr.py | F2Binary/qbr | 0 | 12766269 | <reponame>F2Binary/qbr<filename>src/qbr.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Filename : qbr.py
# Author : <NAME>
# Created : Tue, 26 Jan 2016
# Last Modified : Sun, 31 Jan 2016
from sys import exit as Die
try:
import sys
import kociemba
import argparse
from combiner i... | 2.328125 | 2 |
KMCLib/PluginInterfaces/KMCRateCalculatorPlugin.py | txd283/vacancy-diffusion-kmclib | 1 | 12766270 | """ Module for the KMCRateCalculatorPlugin class """
# Copyright (c) 2013 <NAME>
#
# This file is part of the KMCLib project distributed under the terms of the
# GNU General Public License version 3, see <http://www.gnu.org/licenses/>.
#
import numpy
from KMCLib.Backend import Backend
from KMCLib.Exceptions.Erro... | 2.265625 | 2 |
club/views.py | Tizeta2018/itc-172-web-python | 0 | 12766271 | <filename>club/views.py<gh_stars>0
from django.shortcuts import render
from.models import Meeting, MeetingMinutes, Resource, Event
from django.contrib.auth.decorators import login_required
#create your views here.
def index (request):
return render(request, 'club/index.html')
#importing all the objects u... | 2.015625 | 2 |
models/test.py | DimensionPrism/Federated-Learning | 0 | 12766272 | import torch
from torch import nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
def test_img(model, dataset, args):
model.eval()
test_loss = 0
correct = 0
data_loader = DataLoader(dataset, batch_size=args.batch_size)
with torch.no_grad():
for index, data in enumer... | 2.703125 | 3 |
ldt/tests/dicts/semantics/test_babelnet.py | Darkdragon84/ldt | 14 | 12766273 | import unittest
import os
os.environ["TESTING_LDT"] = "TRUE"
import ldt
class Tests(unittest.TestCase):
'''
The tests in this block inspect the BabelNet functionality: the pre-computed
output is expected to be contained, but the module is not punished for
new words not in the pre-computed lists - in... | 2.8125 | 3 |
section2_change_pars_for_strong_hurricanes/Source_code_for_extracting_data/source_code_change_Clz_isftcflx_2/2_Plot_wind_intensity_time_series_errorbar.py | Sunnyfred/Atlantic_Hurricane_Simulations | 0 | 12766274 | import csv
import matplotlib as matplot
import matplotlib.pyplot as plt
import numpy as np
# List the colors that will be used for tracing the track.
colors = ['black','blue','red','green', 'cyan', \
'gray', 'gold', 'lightcoral', 'turquoise','red','blue','green','pink']
patterns = ['-', '--','--','--','--'... | 3.015625 | 3 |
droplets/tests/test_droplets.py | tefavidal/py-droplets | 2 | 12766275 | <filename>droplets/tests/test_droplets.py
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import numpy as np
import pytest
from scipy import integrate
from pde.grids import UnitGrid
from pde.tools.misc import skipUnlessModule
from droplets import droplets
def test_simple_droplet():
"""test a given simple droplet"""
... | 2.53125 | 3 |
netharn/api.py | Erotemic/netharn | 38 | 12766276 | <filename>netharn/api.py
"""
Newest parts of the top-level API
Concepts:
# Netharn API Concepts
TODO: documentation
"""
import ubelt as ub
import torch
from distutils.version import LooseVersion
_TORCH_IS_GE_1_2_0 = LooseVersion(torch.__version__) >= LooseVersion('1.2.0')
class Datasets(object):
@stat... | 2.515625 | 3 |
dsopz/oauth.py | artooro/dsopz | 34 | 12766277 | import oauth_local
import oauth_installed
import oauth_gce
import oauth_serviceaccount
import sys
import time
import http
import json
import oauth_base
class Error(Exception):
"""Exceptions"""
def resolve(t):
if t == 'installed':
return oauth_installed
elif t == 'local':
return oauth_local
elif t == 'gce':
... | 2.609375 | 3 |
utils/utilities.py | cookielanguage/IDE | 3 | 12766278 | <reponame>cookielanguage/IDE
def center(win, width=100, height=100):
win.update_idletasks()
width = width
frm_width = win.winfo_rootx() - win.winfo_x()
win_width = width + 2 * frm_width
height = height
titlebar_height = win.winfo_rooty() - win.winfo_y()
win_height = height + titlebar_heigh... | 3.03125 | 3 |
admin_page.py | Codemonk-adi/Billing | 0 | 12766279 | <reponame>Codemonk-adi/Billing
from tkinter import Button, Entry, Label, LabelFrame, Listbox
from tkinter.constants import END, OUTSIDE, RAISED
import pages
from database import Database
from helpers import *
class page_admin(pages.Page):
"""Page to add aliases and do other admin stuff."""
def __init__(self):
... | 2.46875 | 2 |
src/commands.py | lenkozina/junior | 0 | 12766280 | <reponame>lenkozina/junior
import click
from flask.cli import with_appcontext
from src.extensions import db
from src.qa.models import Answer, Chapter, Question, Section
from src.user import User
from src.uttils import load_fixture
@click.command()
@with_appcontext
def clear_questions():
"""Clear all Sections, Ch... | 2.453125 | 2 |
notes/OOBall/ooballdemo.py | KRHS-GameProgramming-2015/Manpac | 0 | 12766281 | <filename>notes/OOBall/ooballdemo.py
import sys, pygame, math, random
from Ball import *
pygame.init()
clock = pygame.time.Clock()
width = 800
height = 600
size = width, height
bgColor = r,g,b = 0, 0, 0
screen = pygame.display.set_mode(size)
balls = []
ballTimer = 0
ballTimerMax = .5 * 60
ballImages = ["An Actu... | 3.171875 | 3 |
tests/test_schema.py | ketgo/marshmallow-pyspark | 7 | 12766282 | """
Unit tests for Schema
"""
import datetime
import json
import pytest
from marshmallow import fields
from pyspark.sql.types import *
from pyspark.sql import Row
from marshmallow_pyspark.constants import *
from marshmallow_pyspark.schema import Schema, _RowValidator
def test_create():
schema = Schema()
... | 2.828125 | 3 |
pong.py | paulone1/pong | 0 | 12766283 | import pygame, random
def ball_animation():
global ball_speed_x, ball_speed_y, left_player_score, right_player_score, score_time
ball.x += ball_speed_x
ball.y += ball_speed_y
if ball.top <= 0 or ball.bottom >= screen_height:
ball_speed_y *= -1
# Left Player Score
if ball.right <= 0:
score_time = pygam... | 3.34375 | 3 |
model.py | AbinavRavi/VAE-KL | 0 | 12766284 | <gh_stars>0
import numpy as np
import torch
import torch.nn as nn
import torch.distributions as dist
class Encoder(nn.Module):
def __init__(self,input_size):
super(Encoder,self).__init__()
self.conv1 = nn.Conv2d(input_size,16,kernel_size =4,stride=2,padding=1,bias = False)
self.conv2 = nn... | 2.375 | 2 |
aggregate.py | Blosc/bloscpack-benchmarking | 1 | 12766285 | #!/usr/bin/env python
""" Award points for position. """
import benchmark_analysis_utils as bau
import pandas as pd
import sys
def aggregate(df, ratio=False):
values = ['compress', 'decompress', 'dc_no_cache']
if ratio:
values.append('ratio')
results = {}
for size in ('small', 'mid', 'large... | 2.578125 | 3 |
server_nodes/udp_bridge/standalone/udp_bridge_node.py | Rooholla-KhorramBakht/RaspiTrack | 0 | 12766286 | <filename>server_nodes/udp_bridge/standalone/udp_bridge_node.py<gh_stars>0
import numpy as np
import yaml
import pickle
from src.telemetry_utils import *
import argparse
import yaml
import os
import time
import signal
import sys
import threading
class recorderClass():
def __init__(self, path, ports_list):
... | 2.390625 | 2 |
my_settings/settings.py | GregEremeev/my_settings | 1 | 12766287 | <reponame>GregEremeev/my_settings
import os
import sys
from collections.abc import Mapping
from inspect import ismodule, getfile
class ReadOnlyDict(Mapping):
def __init__(self, dict_):
self._data = dict_
def __getitem__(self, key):
return self._data[key]
def __iter__(self):
retu... | 2.28125 | 2 |
torchcontrol/plotting/__init__.py | DiffEqML/torchcontrol | 12 | 12766288 | from .cstr import *
from .quadcopter import *
| 1.1875 | 1 |
monkq/assets/account.py | zsluedem/MonkTrader | 2 | 12766289 | <gh_stars>1-10
#
# MIT License
#
# Copyright (c) 2018 WillQ
#
# 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 rights
# to use, copy, modi... | 1.859375 | 2 |
review_model.py | santiagodiaz1993/review_score_predictor | 0 | 12766290 | import os
import pandas as pd
for file in os.listdir():
if file.endswith("json"):
reviews_data = pd.read_json("yelp_academic_dataset_review_41.json")
print(reviews_data.head())
break
| 2.6875 | 3 |
model.py | markoklemensek/Kosarka-turnir | 0 | 12766291 | import sqlite3
import pomozne_fun
conn = sqlite3.connect("kosarka_turnir")
def najboljsi_na_turnirju():
'''vrne igralca z največ doseženimi točkami na turnirju,
v primeru ko je takšnih igralcev več vrne prvega po abecedi.'''
sql = '''
SELECT
ime,
priimek
... | 3 | 3 |
mpfmc/tests/test_SlidePlayer.py | muffler-aus/mpf-mc | 0 | 12766292 | import weakref
import gc
from kivy.uix.screenmanager import WipeTransition, FadeTransition
from mpfmc.config_players.slide_player import McSlidePlayer
from mpfmc.tests.MpfMcTestCase import MpfMcTestCase
from mpfmc.transitions.move_in import MoveInTransition
from mpf.tests.MpfTestCase import MpfTestCase
import mpfmc.... | 2.125 | 2 |
setup.py | electrumsv/libcuckoofilter | 0 | 12766293 | from distutils.core import setup, Extension
import sys
module1 = Extension('bsvcuckoo',
include_dirs=['include'],
sources=["src/cuckoo_filter.c", "src/cuckoo_python.c"],
# https://cibuildwheel.readthedocs.io/en/stable/faq/#windows-importerror-dll-load-failed-... | 1.765625 | 2 |
testCloudygrids.py | zpace/manga_nebular | 0 | 12766294 | from importer import *
import sys, os
sys.path.append('/usr/data/minhas/zpace/stellarmass_pca')
import read_results as from_pca
pca_basedir = '/usr/data/minhas2/zpace/CSPs/CSPs_CKC14_MaNGA_20181026-1'
import numpy as np
import matplotlib.pyplot as plt
import pymc3
import manga_tools as m
import metallicity
import p... | 1.726563 | 2 |
simpleTicket/siteEngine/migrations/0005_auto_20160622_1028.py | abogeorge/simpleTicket | 0 | 12766295 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-22 07:28
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('siteEngine', '0004_auto_201... | 1.625 | 2 |
quora/wsgi.py | alexricheburton/gittest | 116 | 12766296 | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quora.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
from whitenoise.django import DjangoWhiteNoise
application = Cling(get_wsgi_application())
application = DjangoWhiteNoise(application)
| 1.398438 | 1 |
notifier/grabbers/better_advice.py | thejeshpr/notifier | 0 | 12766297 | import urllib.parse
from notifier.grabbers.base import Base, Internet
class BetterAdvice(object):
@staticmethod
def sync(obj: Base, *args, **kwargs):
r = Internet.html_get(obj.sync_type.base_url)
links = r.html.xpath('/html/body/div[*]/div[*]/div/div[*]/div[*]/section/div... | 2.5 | 2 |
resnet.py | Akihiro-A-Fujii/tf__resnet | 6 | 12766298 | import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Activation, Dense,Flatten, Add, TimeDistributed, Flatten, BatchNormalization
from tensorflow.keras.layers import Conv1D,MaxPooling1D,GlobalAveragePooling1D, GlobalMaxPooling1D
from tensorflow.keras.layers import... | 3.0625 | 3 |
src/sentry/api/endpoints/sentry_app_publish_request.py | lauryndbrown/sentry | 1 | 12766299 | <filename>src/sentry/api/endpoints/sentry_app_publish_request.py
from __future__ import absolute_import
from rest_framework.response import Response
from sentry import options
from sentry import features
from sentry.api.bases.sentryapps import SentryAppBaseEndpoint
from sentry.utils import email
class SentryAppPubl... | 2.3125 | 2 |
catalog/migrations/0001_initial.py | ashik4715/thanosback | 0 | 12766300 | <filename>catalog/migrations/0001_initial.py
# Generated by Django 3.0.1 on 2021-06-21 19:27
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
na... | 1.851563 | 2 |
example/ner/utils.py | tipevo/webstruct | 210 | 12766301 | <reponame>tipevo/webstruct
# -*- coding: utf-8 -*-
from functools import partial
from tqdm import tqdm
pages_progress = partial(tqdm, unit=' pages', smoothing=False, leave=True)
| 1.40625 | 1 |
plugins/haveibeenpwned/icon_haveibeenpwned/util/util.py | lukaszlaszuk/insightconnect-plugins | 0 | 12766302 | <filename>plugins/haveibeenpwned/icon_haveibeenpwned/util/util.py
import requests
import time
import random
from icon_haveibeenpwned.util.log_helper import LogHelper
class HaveIBeenPwned(object):
_HEADERS = {
"User-Agent": "Rapid7 InsightConnect",
"Accept": "application/vnd.haveibeenpwned.v2+json"... | 2.640625 | 3 |
topic_modeling.py | perkes/topic-modeling | 0 | 12766303 | <reponame>perkes/topic-modeling<filename>topic_modeling.py
from sklearn.decomposition import LatentDirichletAllocation as LDA
from sklearn.feature_extraction.text import TfidfVectorizer
from tqdm import tqdm
import pandas as pd
import numpy as np
import json, re
def topic_name(model, count_vectorizer, topics, t... | 2.703125 | 3 |
knowledgerep/Assignment1/W4_Lab_Bhattacharjee_Rajbir_R00195734.py | bhattacharjee/aima-python | 0 | 12766304 | #!/usr/bin/env python3
import sys
import os, inspect
try:
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from logic import *
except:
print("Could not import")
sys.exit(1)
def question_... | 2.71875 | 3 |
sympy/utilities/tests/test_source.py | JMSS-Unknown/sympy | 8 | 12766305 | <gh_stars>1-10
from sympy.utilities.source import get_mod_func, get_class, source
from sympy.utilities.pytest import raises
from sympy import point
from sympy.utilities.exceptions import SymPyDeprecationWarning
def test_source():
with raises(SymPyDeprecationWarning):
source(point)
def test_get_mod_func():... | 2.015625 | 2 |
ov2640.py | FunPythonEC/OV2640_uPy | 6 | 12766306 | from ov2640_constants import *
#los scripts de constantes lores y hires son para la resolucion
#se los encierra en try except para que si no son incluidos
#no haya problema, sin embargo dara problemas luego si uno de estos
#no es usado y especificado para la iniciacion de la camara
try:
from ov2640_lores_constants... | 2.109375 | 2 |
src/natcap/ui/execution.py | phargogh/natcap.ui | 0 | 12766307 | import threading
import os
import logging
import pprint
import traceback
import tempfile
from qtpy import QtCore
LOGGER = logging.getLogger(__name__)
class Executor(QtCore.QObject, threading.Thread):
"""Executor represents a thread of control that runs a python function with
a single input. Once created w... | 3.34375 | 3 |
tests/conftest.py | mondeja/mkdocs-mdpo-plugin | 3 | 12766308 | """Configuration for mkdocs_mdpo_plugin tests."""
import os
import sys
from tempfile import TemporaryDirectory
import polib
import pytest
import yaml
from mkdocs import config
from mkdocs.commands.build import build
from mkdocs_mdpo_plugin.plugin import MdpoPlugin
ROOT_DIR = os.path.abspath(os.path.dirname(os.path... | 2.140625 | 2 |
src/app/tasks/__init__.py | serious-notreally/cappa | 9 | 12766309 | default_app_config = "app.tasks.apps.TasksAppConfig"
| 1.101563 | 1 |
src/lesson_networking/socket_ipv6_address_packing.py | jasonwee/asus-rt-n14uhp-mrtg | 3 | 12766310 | import binascii
import socket
import struct
import sys
string_address = 'fdf8:f53e:61e4::18'
packed = socket.inet_pton(socket.AF_INET6, string_address)
print('Original:', string_address)
print('Packed :', binascii.hexlify(packed))
print('Unpacked:', socket.inet_ntop(socket.AF_INET6, packed))
| 2.453125 | 2 |
nse_opinf_poddmd/load_data.py | mpimd-csc/nse-opinf-poddmd | 0 | 12766311 | <filename>nse_opinf_poddmd/load_data.py
"""Loading examples matrices and snaphots data"""
__all__ = [
"get_matrices",
"load_snapshots"
]
import scipy.io
import numpy as np
import json
from nse_opinf_poddmd.cwdc_tdp_pout_vout import comp_snapshots
def savedmatsstr(problem, NV):
... | 2.375 | 2 |
IT Workshop on Python Lab Scripts/4c-ii Selection sort.py | AswinBarath/IT-Workshop-on-Python | 0 | 12766312 | array = list(map(int, input('Enter the array of integers to be sorted(separated by spaces):').split()))
for i in range(len(array)):
min_idx = i
for j in range(i + 1, len(array)):
if array[min_idx] > array[j]:
min_idx = j
array[i], array[min_idx] = array[min_idx], array[i]
print("Sorted ... | 4 | 4 |
hostmanager/tomato/migrations/0006_users3.py | dswd/ToMaTo | 2 | 12766313 | <reponame>dswd/ToMaTo<gh_stars>1-10
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Network', fields ['bridge']
db.delete_u... | 2.234375 | 2 |
pyclesperanto_prototype/_tier0/_available_device_names.py | tlambert-forks/pyclesperanto_prototype | 64 | 12766314 | <reponame>tlambert-forks/pyclesperanto_prototype
from .._tier0._device import filter_devices
from typing import List
def available_device_names(dev_type: str = None, score_key = None) -> List[str]:
"""Retrieve a list of names of available OpenCL-devices
Parameters
----------
dev_type : str
'cp... | 3.046875 | 3 |
libs/losses.py | tony92151/pedestrian_generator | 0 | 12766315 | <reponame>tony92151/pedestrian_generator
from torch.nn.functional import mse_loss
import torch
def completion_network_loss(input, output, mask):
return mse_loss(output * mask, input * mask)
def completion_network_loss_P(background, person, mask, output, lefttop, height = 128 , width = 64, devices = 'cuda:0'):
... | 2.359375 | 2 |
multiinput/models/custom_keras_model.py | NeilBotelho/ibm-fl | 2 | 12766316 | """
Licensed Materials - Property of IBM
Restricted Materials of IBM
20190891
© Copyright IBM Corp. 2020 All Rights Reserved.
"""
import logging
import keras
import time
import json
import numpy as np
import tensorflow as tf
from tensorflow.python.keras.backend import set_session
from keras import backend as k
from k... | 2.328125 | 2 |
coroutine/async_await.py | sherlockliu/pythonic | 0 | 12766317 | # !/usr/bin/python
from tornado import ioloop
async def cal(num):
print('cal called.')
x = await calculator(num)
print(x)
async def calculator(num):
try:
result = 0
for i in range(0, num):
result += i
# print(f'result is {result}')
raise Exception()
... | 3.09375 | 3 |
theme/management/commands/reset_quota.py | hydroshare/hydroshare | 178 | 12766318 | <reponame>hydroshare/hydroshare
from django.core.management.base import BaseCommand
from django_irods.storage import IrodsStorage
from django.conf import settings
class Command(BaseCommand):
help = "Reset quota by forcing quota iRODS microservices to recalculate quota for all users."
def handle(self, *args, ... | 2.015625 | 2 |
src/html_http_dao.py | Alan-Greene/wcag | 0 | 12766319 | <reponame>Alan-Greene/wcag<gh_stars>0
import requests
class HtmlHttpDao():
def get_html(self, url):
try:
html = requests.get(url,timeout=3)
html.raise_for_status()
return html.text
except requests.exceptions.RequestException as err:
print ("Html Http... | 3.03125 | 3 |
tests/integration/synthetic_data_test.py | gglin001/popart | 61 | 12766320 | <reponame>gglin001/popart
# Copyright (c) 2019 Graphcore Ltd. All rights reserved.
from collections import namedtuple
import numpy as np
import popart
import pytest
# `import test_util` requires adding to sys.path
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).resolve().parent.parent))
import t... | 1.804688 | 2 |
examples/simple/services.py | barberj/bridge-python | 0 | 12766321 | from BridgePython.bridge import Bridge
bridge = Bridge(api_key='myapikey')
#
# Publishing a Bridge service
#
# Any Python object can be published. A published service
# can be retrieved by any Bridge client with the same API key pair.
#
# Only Bridge clients using the prviate API key may publish services.
#
class T... | 3.078125 | 3 |
dirfile/pathlib_operations.py | zizonk/python-library | 0 | 12766322 | from pathlib import Path
import os
path = Path(os.getcwd())
npath = path.joinpath('zizi')
# print(path)
# print(npath.parts)
# print(npath.name)
# for idx, dirz in enumerate(path.iterdir()):
# print(idx, dirz)
#
for idx, file in enumerate(path.glob('*.zip')):
print(idx,file)
#
# pp = list(path.glob('*.py'))
... | 2.90625 | 3 |
CSW/csw_post_request.py | petercunning/notebook | 32 | 12766323 |
# coding: utf-8
# # Try some "RAW" requests to pycsw
# In[1]:
import requests, json
# In[2]:
headers = {'Content-Type': 'application/xml'}
# ### Try apiso:serviceType query
# In[3]:
input = '''
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:x... | 2.296875 | 2 |
tikreg/models.py | solleo/tikreg | 1 | 12766324 | <filename>tikreg/models.py
import time
import itertools
from collections import defaultdict as ddict
import numpy as np
from scipy import linalg as LA
from scipy.linalg import cho_factor, cho_solve
from tikreg.utils import SVD
from tikreg.kernels import lazy_kernel
import tikreg.utils as tikutils
METHOD = 'SVD'
ME... | 2.125 | 2 |
tests/unit/test_cropping.py | LukasBommes/PV-Drone-Inspect | 5 | 12766325 | import unittest
import cv2
import numpy as np
from extractor.cropping import clip_to_image_region, \
crop_module, build_merged_index
quadrilaterals = {
('e3e70682-c209-4cac-a29f-6fbed82c07cd',
'frame_000000',
'mask_000000'): {
'quadrilateral': [
[424, 279],
[499, 28... | 2.234375 | 2 |
Utils/UserGroups.py | Mihai925/EduCoding-Legacy | 0 | 12766326 | <reponame>Mihai925/EduCoding-Legacy<filename>Utils/UserGroups.py
__author__ = 'varun'
TEACHER = 'Teacher'
STUDENT = 'Student' | 1.070313 | 1 |
example/producer/app/demo.py | NimzyMaina/flask-rabbitmq | 55 | 12766327 | <gh_stars>10-100
# encoding:utf-8
from app import mq, queue
import json
@queue(queue_name='rpc-queue')
def sum_callback(ch, method, props, body):
print(props.correlation_id)
print(props.reply_to)
data = json.loads(body)
result = data['a'] + data['b']
print("Result -- " + str(result))
data = {
... | 2.25 | 2 |
core/schema/category.py | 1uy31/learning-diary | 0 | 12766328 | import graphene
from graphene import relay
from graphene_sqlalchemy import SQLAlchemyObjectType
from core.models import Category as CategoryModel
from core.models import CategoryConnector
category_connector = CategoryConnector()
class CategoryNode(SQLAlchemyObjectType):
class Meta:
model = CategoryModel... | 2.640625 | 3 |
django_postgres/view.py | zacharyvoase/django-postgres | 51 | 12766329 | <reponame>zacharyvoase/django-postgres
"""Helpers to access Postgres views from the Django ORM."""
import collections
import copy
import logging
import re
from django.db import connection, transaction
from django.db import models
import psycopg2
from . import six
FIELD_SPEC_REGEX = (r'^([A-Za-z_][A-Za-z0-9_]*)\.'
... | 2.15625 | 2 |
test/docker/startup_scripts/392_dcim_devices_primary_ips.py | hosting-de-labs/go-netbox-client | 0 | 12766330 | from dcim.models import Site, Rack, DeviceRole, DeviceType, Device, Platform
from ipam.models import IPAddress
from startup_script_utils import load_yaml
import sys
devices = load_yaml('/opt/netbox/initializers/dcim_devices.yml')
if devices is None:
sys.exit()
handled_attrs = [
'primary_ip4_id',
'primary_ip6_i... | 2.3125 | 2 |
readthedocs/rtd_tests/tests/test_version_config.py | mforbes/readthedocs.org | 4,054 | 12766331 | <gh_stars>1000+
from django.test import TestCase
from django_dynamic_fixture import get
from readthedocs.builds.models import Build, Version
from readthedocs.projects.models import Project
class VersionConfigTests(TestCase):
def setUp(self):
self.project = get(Project)
self.version = get(Version... | 2.40625 | 2 |
utils/sqlitedb.py | hkailee/Quant-Finance | 1 | 12766332 | import sqlite3, ast
##############################################
### Login to database
##############################################
def login(dbfile):
conn = sqlite3.connect(dbfile) # create or open db file
curs = conn.cursor()
return conn, curs
###########################################... | 3.640625 | 4 |
api_stack/function/query_scan_status/app.py | richardfan1126/ssm-patch-portal | 4 | 12766333 | import os
import json
import boto3
ssm = boto3.client('ssm')
def query_association():
query_association_response = ssm.list_associations(
AssociationFilterList = [
{
"key": "AssociationName",
"value": "ssm-patch-portal-scan"
}
],
)
... | 2.09375 | 2 |
tests/unit/core/domain/test_message_bus.py | meaningfy-ws/ted-xml-2-rdf | 0 | 12766334 | <reponame>meaningfy-ws/ted-xml-2-rdf
#!/usr/bin/python3
"""
"""
import logging
from ted_sws.event_manager.adapters.logger import Logger
from ted_sws.event_manager.domain.message_bus import message_bus
from ted_sws.event_manager.model.message import Log
TEST_LOGGER = Logger(name="TEST_MESSAGE_BUS_LOGGER", level=logg... | 2.375 | 2 |
example/data/migrations/0001_initial.py | lee0210/sproxy | 1 | 12766335 | # Generated by Django 2.0.7 on 2018-07-09 08:15
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Heartbeat',
fields=[
('id', models.AutoFiel... | 1.789063 | 2 |
snap/models.py | Imma7/Snap | 0 | 12766336 | from django.db import models
import datetime as dt
# Create your models here.
class Category(models.Model):
category_name = models.CharField(max_length = 50)
# image = models.ForeignKey(Image)
def __str__(self):
return self.category_name
class Location(models.Model):
location_name = models.... | 2.34375 | 2 |
run.py | gaolycn/ssr-panel-sanic | 9 | 12766337 | <reponame>gaolycn/ssr-panel-sanic
from ssr_panel import app
if __name__ == '__main__':
app.run(host=app.config.HOST, port=app.config.PORT, workers=app.config.WORKERS, debug=app.config.DEBUG)
| 1.273438 | 1 |
blog/urls.py | feynubrick/blog-django | 0 | 12766338 | <filename>blog/urls.py
from django.urls import path
from blog.views.home import get_home_page
from blog.views.about import get_about_page
from blog.views.posts import get_post_list_page, get_post_detail_page
urlpatterns = [
path('', get_home_page, name='blog_home'),
path('about', get_about_page, name='blog_ab... | 2.078125 | 2 |
add_image.py | ed-ortizm/slides-talks | 0 | 12766339 | <reponame>ed-ortizm/slides-talks
from pptx import Presentation
from pptx.util import Inches
img_path = 'data/akitas.png'
prs = Presentation()
blank_slide_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_slide_layout)
left = top = Inches(1)
pic = slide.shapes.add_picture(img_path, left, top)
left = I... | 2.625 | 3 |
simdir/setup_dd.py | fuco99/bjt_devsim | 5 | 12766340 | # Copyright 2016 Devsim 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 to in writing, s... | 2.296875 | 2 |
data.py | chrisliu298/pytorch_projects | 0 | 12766341 | <reponame>chrisliu298/pytorch_projects<gh_stars>0
import pandas as pd
import pytorch_lightning as pl
import torch
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.preprocessing.text import Tokenizer
from torch.utils.data import DataLoader, TensorDataset
class DataModule(pl.Light... | 2.8125 | 3 |
test/api_loadtest.py | shashi/JuliaBox | 50 | 12766342 | <reponame>shashi/JuliaBox
import random
import requests
from locust import HttpLocust, TaskSet
# disable warnings from printing
requests.packages.urllib3.disable_warnings()
# register APIs fib1 to fib10 with the following code:
# fib(n::AbstractString) = fib(parse(Int, n)); fib(n::Int) = (n < 2) ? n : (fib(n-1) + fib... | 2.515625 | 3 |
certleak/core/certstreamdata/certstreamobject.py | d-Rickyy-b/certleak | 0 | 12766343 | # -*- coding: utf-8 -*-
class CertstreamObject(object):
"""Base class for all the certstream data classes"""
@classmethod
def from_dict(cls, data):
"""
Returns a copy of the passed data
:param data: The dict from which an object should be created from
:return: copy of data... | 2.828125 | 3 |
quarrel/http.py | mrvillage/quarrel | 2 | 12766344 | """
The MIT License (MIT)
Copyright (c) 2021-present Village
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 rights to use, copy, modify, mer... | 1.65625 | 2 |
dss_vae/utils/tree_analysis.py | baoy-nlp/DSS-VAE | 37 | 12766345 | from collections import defaultdict
from dss_vae.structs import GlobalNames
from dss_vae.structs import FScore
from dss_vae.structs import PhraseTree
from dss_vae.utils.utility import write_docs
from dss_vae.preprocess import s2b_to_s2t
from dss_vae.preprocess import s2t_check
from dss_vae.preprocess import s2t_fix
fr... | 2.21875 | 2 |
rsi/rsi/report/summary_pembelian/summary_pembelian.py | bobzz-zone/rsi | 0 | 12766346 | <reponame>bobzz-zone/rsi
# Copyright (c) 2013, myme and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
def execute(filters=None):
columns, data = ["Tanggal:Date:150","Hari:Data:150","Faktur:Int:100","Jumlah:Currency:300"], []
where=""
if filters... | 1.921875 | 2 |
AET/imagenet/config/ImageNet_Unsupervised.py | pjwu1997/teil_project | 114 | 12766347 | <reponame>pjwu1997/teil_project<filename>AET/imagenet/config/ImageNet_Unsupervised.py
batch_size = 192*4
config = {}
# set the parameters related to the training and testing set
data_train_opt = {}
data_train_opt['batch_size'] = batch_size
data_train_opt['unsupervised'] = True
data_train_opt['epoch_size'] = None
da... | 1.945313 | 2 |
01 - Basics/00-install.py | python-demo-codes/basics | 2 | 12766348 | <reponame>python-demo-codes/basics
# HEAD
# Python Basics
# DESCRIPTION
# Describe the basic setup, and development environment of Python
# RESOURCES
#
# ----------PYTHON----------
# PYTHON ORG
# https://www.python.org/
# ANACONDA
# https://www.anaconda.com/
# ----------IDE-------------
# JUPYTER
# python3 -m pip ... | 2.671875 | 3 |
models/fpn_global_local_fmreg_ensemble.py | yinchimaoliang/GLNet | 119 | 12766349 | from .resnet import resnet50
import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
class fpn_module_global(nn.Module):
def __init__(self, numClass):
super(fpn_module_global, self).__init__()
self._up_kwargs = {'mode': 'bilinear'}
# Top layer
self.top... | 2.15625 | 2 |
src/opnsense/scripts/filter/pftop.py | onedr0p/core | 2,109 | 12766350 | <filename>src/opnsense/scripts/filter/pftop.py
#!/usr/local/bin/python3
"""
Copyright (c) 2021 <NAME> <<EMAIL>>
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... | 1.59375 | 2 |