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 |
|---|---|---|---|---|---|---|
setup.py | UMCollab/ODM | 2 | 12784451 | <filename>setup.py
import os
from setuptools import setup
from subprocess import check_output
version = check_output(['bash', os.path.join(os.path.dirname(__file__), 'version.sh')]).decode('utf-8')
setup(
version=version,
)
| 1.609375 | 2 |
pyrate/algorithms/muondet/AverageBinEnergy.py | fscutti/pyrate | 0 | 12784452 | <filename>pyrate/algorithms/muondet/AverageBinEnergy.py
""" Compute average energy in input bins.
"""
import sys
from copy import copy
from pyrate.core.Algorithm import Algorithm
class AverageBinEnergy(Algorithm):
__slots__ = ()
def __init__(self, name, store, logger):
super().__init__(name, store, ... | 2.515625 | 3 |
src/inference_dataset.py | cmstroe/LM-BFF | 0 | 12784453 | <filename>src/inference_dataset.py
import csv
import pandas as pd
from ast import literal_eval
import random
initial_df = pd.read_csv("data/original/company_sentences_euro.csv")
inference_df = pd.DataFrame(columns = ['sentence'])
uplimit = 11000
local_uplimit = 100
for index, row in initial_df.iterrows():
if len... | 2.921875 | 3 |
seekr2/modules/common_analyze.py | astokely/seekr2 | 0 | 12784454 | <reponame>astokely/seekr2<filename>seekr2/modules/common_analyze.py
"""
common_analyze.py
Classes, functions and other objects used for analyzing SEEKR2
simulation outputs common to MMVT and Elber calculation types.
"""
import os
import glob
import xml.etree.ElementTree as ET
import subprocess
import random
from col... | 2.234375 | 2 |
authors/apps/stats/tests/base_test.py | deferral/ah-django | 1 | 12784455 | from authors.apps.reactions.tests.base_test import BaseTestCase
class ReaderStatsBaseTestCase(BaseTestCase):
"""
Holds mock data and test helpers for the reader stats
"""
def get_article_slug(self, data={}, rel_path='/read', created=False):
"""
Returns a url path to post an ar... | 2.46875 | 2 |
tests/unittests/durable_functions/orchestration_trigger/main.py | vrdmr/azure-functions-python-worker | 0 | 12784456 | # import azure.durable_functions as df
def generator_function(context):
final_result = yield context.call_activity('activity_trigger', 'foobar')
return final_result
def main(context):
# orchestrate = df.Orchestrator.create(generator_function)
# result = orchestrate(context)
# return result
r... | 2.21875 | 2 |
data/check_donors.py | jacobdeasy/flexible-ehr | 12 | 12784457 | """Check the maximum length of stay of donors in MIMIC-III.
If it is <48 it does not affect our study."""
import os
import pandas as pd
df = pd.read_csv('ADMISSIONS.csv')
df = df.loc[(df['DIAGNOSIS'].str.lower() == 'organ donor') | (df['DIAGNOSIS'].str.lower() == 'organ donor account')]
files = os.listdir('root')
od... | 2.578125 | 3 |
CraftMasterWeb/emails/views.py | Athelios/CraftMaster | 8 | 12784458 | from django.shortcuts import render, HttpResponse
from datetime import date
from .models import Email
import json
# Create your views here.
def getEmail(request):
if request.method=="POST":
email = request.POST.get('email')
Email.objects.create(
email = email,
register_date =... | 2.109375 | 2 |
algo/util/data_processor.py | HHansi/TED-S | 0 | 12784459 | # Created by Hansi at 12/22/2021
import re
import demoji
from nltk import TweetTokenizer
from sklearn.model_selection import StratifiedShuffleSplit
puncts = [',', '.', '"', ':', ')', '(', '-', '!', '?', '|', ';', "'", '$', '&', '/', '[', ']', '>', '%', '=', '#', '*',
'+', '\\', '•', '~', '@', '£',
... | 2.625 | 3 |
servicebox/services/tests/test_models.py | FlxPeters/servicebox | 0 | 12784460 | from django.test import TestCase
from services.models import (
Service,
ServiceStatusChoices,
ServiceRelation,
ServiceRealtionChoice,
Link,
LinkTypeChoice,
)
from tenancy.models import Tenant
from platforms.models import Platform
class ServiceModelTest(TestCase):
def setUp(self):
... | 2.28125 | 2 |
utils/error_log.py | Farazist/farazist-raspberrypi-app | 10 | 12784461 | import os.path
import datetime
class ErrorLog():
@staticmethod
def writeToFile(log):
time = datetime.datetime.now()
f = open('error_log.txt', 'a', encoding='utf8')
f.write(time.strftime("%Y-%m-%d %H:%M:%S ") + log + '\n')
f.close()
#test = LogFile.checkExistsFile()
#LogFile.... | 2.953125 | 3 |
common/utils/dir_utils.py | jiahaoLjh/HDNet | 18 | 12784462 | <reponame>jiahaoLjh/HDNet<filename>common/utils/dir_utils.py
import os
import sys
def make_folder(folder_name):
if not os.path.isdir(folder_name):
os.makedirs(folder_name)
def add_pypath(path):
if path not in sys.path:
sys.path.insert(0, path)
| 2.46875 | 2 |
fast_trainer/concepts.py | MITIBMxGraph/SALIENT_artifact | 6 | 12784463 | from typing import Any, Optional, Callable, List
import torch
from .samplers import PreparedBatch
from .transferers import DeviceIterator
TrainCore = Callable[[torch.nn.Module, PreparedBatch], Any]
TrainCallback = Callable[[List[PreparedBatch], List[Any]], None]
TrainImpl = Callable[[torch.nn.Module, TrainCore, Devic... | 1.960938 | 2 |
util/tweet_download.py | jayelm/TwitterSA | 0 | 12784464 | """
NOTE: This is no longer used in the actual web app, since I grab automatically
labeled tweets from Sentiment140. But, I keep it around for convenience.
A script to download tweets in a .tsv of the form
Status ID User ID Sentiment
====================================
used mainly to get tweets from the Se... | 3.15625 | 3 |
src/ghaudit/config.py | DistantThunder/ghaudit | 1 | 12784465 | from __future__ import annotations
from functools import reduce
from os import environ
from pathlib import Path
from typing import Collection, List, Optional, Set
from typing_extensions import TypedDict
Team = TypedDict(
"Team", {"name": str, "members": List[str], "children": List[str]}
)
Organisation = TypedDic... | 2.640625 | 3 |
cnn_model.py | kennethyu2017/vin_tf | 0 | 12784466 | """
implement a CNN network as mentioned in VIN paper.
Author: <NAME>
"""
import tensorflow as tf
from tensorflow.contrib.layers import conv2d, fully_connected, max_pool2d, dropout
'''
normal structure for each conv layer:conv -> elu -> bn -> pooling.
conv-1: 3x3 s:1, 50 channels .no padding .
max pooling: 2... | 3.1875 | 3 |
ryu/ryu/app/Ryuretic/Ryuretic_Intf.py | Ryuretic/RAP | 2 | 12784467 | <reponame>Ryuretic/RAP<gh_stars>1-10
#####################################################################
# Ryuretic: A Modular Framework for RYU #
# !/ryu/ryu/app/Ryuretic/Ryuretic_Intf.py #
# Authors: #
# ... | 1.898438 | 2 |
factory/tools/lib/gWftLogParser.py | ddbox/glideinwms | 0 | 12784468 | # SPDX-FileCopyrightText: 2009 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# factory/tool specific condorLogs helper
#
import binascii
import gzip
import io
import mmap
import os.path
import re
import time
from glideinwms.factory... | 2.21875 | 2 |
sim2net/speed/normal.py | harikuts/dsr_optimization | 12 | 12784469 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2012 <NAME> <mkalewski at cs.put.poznan.pl>
#
# This file is a part of the Simple Network Simulator (sim2net) project.
# USE, MODIFICATION, COPYING AND DISTRIBUTION OF THIS SOFTWARE IS SUBJECT TO
# THE TERMS AND CONDITIONS OF THE MIT LICENSE. YOU SHOULD HAVE RECEI... | 3.671875 | 4 |
pysaintcoinach/xiv/shop_listing_item.py | icykoneko/saintcoinach-py | 7 | 12784470 | <reponame>icykoneko/saintcoinach-py<filename>pysaintcoinach/xiv/shop_listing_item.py
from .interfaces import IShopListing, IShopListingItem
class ShopListingItem(IShopListingItem):
"""
General-purpose class for items to use in IShopListing.
"""
def __init__(self,
shop_item: IShopList... | 2.59375 | 3 |
setup.py | cumason123/eve_echoes | 0 | 12784471 | <reponame>cumason123/eve_echoes<filename>setup.py
from setuptools import setup, find_packages
import pathlib
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / "README.md").read_text(encoding="utf-8")
setup(
name="eve_echoes",
summary="Eve Echoes Utility Functions",
long_descriptio... | 1.382813 | 1 |
armstrong/core/arm_content/mixins/__init__.py | cirlabs/armstrong.core.arm_content | 0 | 12784472 | import pkg_resources
pkg_resources.declare_namespace(__name__)
from .authors import AuthorsMixin
from .images import *
from .publication import PublicationMixin
from .video import EmbeddedVideoMixin
| 1.039063 | 1 |
tests/conftest.py | daveisadork/PyDevNS | 7 | 12784473 | import functools
import logging
import os
import pytest
import tempfile
import devns
import devns.cli
from mock import MagicMock
@pytest.fixture
def config():
return devns.Config()
@pytest.yield_fixture
def resolver_dir(config):
resolvers = []
config.resolver_dir = os.path.join(
tempfile.gette... | 2.046875 | 2 |
tests/test_all.py | awensaunders/Proxy-Tools | 3 | 12784474 | <reponame>awensaunders/Proxy-Tools
#!/usr/bin/env python3
import pytest
import subprocess
import sys
from modules import ssh
from modules import socks
from modules import configurator
import ProxyWidget
class TestSOCKS:
@pytest.fixture
def SOCKS_setup(self):
return socks.ProxyTools('Wi-Fi')
... | 2.15625 | 2 |
src/ostorlab/agent/message/proto/v2/report/status_pb2.py | bbhunter/ostorlab | 113 | 12784475 | <reponame>bbhunter/ostorlab<gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v2/report/status.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import messag... | 1.304688 | 1 |
01_bayes_filter/ex2_1.py | sanket-pixel/robotics | 0 | 12784476 | <reponame>sanket-pixel/robotics<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
def plot_belief(belief):
plt.figure()
ax = plt.subplot(2,1,1)
ax.matshow(belief.reshape(1, belief.shape[0]))
ax.set_xticks(np.arange(0, belief.shape[0]... | 2.734375 | 3 |
PhenDisco/ReleaseV1.0/information-retrieval/Query_All_HTMLVer1.py | DBMI/iSeeDELVE | 0 | 12784477 | <filename>PhenDisco/ReleaseV1.0/information-retrieval/Query_All_HTMLVer1.py
# $Id$
# Query module for information retrieval
# This is a part if PFINDR project implemented at DBMI, UCSD
# This program is to write into format such as HTML, JSON in order to diplaying and exporting data
# Written by <NAME>, Aug 2012
imp... | 2.578125 | 3 |
GamesRL/pirate-passage/grid.py | Zhuravld/Portfolio | 0 | 12784478 | <filename>GamesRL/pirate-passage/grid.py<gh_stars>0
from utils import PointIndexed, Field
Point = tuple([int, int])
class Pirate:
"""Enemy. Occupies a single Field, travels along a route.
at: current location (field ref or point coords)
id: identifier
route: list of waypoints
"""
_count = 0... | 3.078125 | 3 |
LeetCode/Medium/partition_labels.py | shrey199325/LeetCodeSolution | 0 | 12784479 | """
A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so
that each letter appears in at most one part, and return a list of integers representing the size of these parts.
Example 1:
Input: S = "ababcbacadefegdehijhklij"
Output: [9,7,8]
Explanation:
The... | 4.25 | 4 |
src/Nodes/Graph.py | CelineDknp/SemiParsingCFG | 0 | 12784480 | from .Node import Node
from .FusedNode import FusedNode
from .SimpleBranchConditionNode import SimpleBranchConditionNode
from .MultipleBranchConditionNode import MultipleBranchConditionNode
from .ControlLoopNode import ControlLoopNode
from .LabelLoopNode import LabelLoopNode
from .LoopNode import LoopNode
from .Multipl... | 2.296875 | 2 |
abc/abc048/abc048c.py | c-yan/atcoder | 1 | 12784481 | <reponame>c-yan/atcoder
N, x = map(int, input().split())
a = list(map(int, input().split()))
result = 0
# a[0] が x 以下でないと、a[1] を空にしても条件を満たせない
t = a[0] - x
if t > 0:
result += t
a[0] -= t
for i in range(1, N):
# 箱に入っているキャンディの数が食べれる上限
t = min(a[i - 1] + a[i] - x, a[i])
if t > 0:
result += t
... | 2.453125 | 2 |
handlers/storing_passwords_handl.py | bbt-t/bot-pet-project | 0 | 12784482 | <reponame>bbt-t/bot-pet-project
from datetime import timedelta
from hashlib import scrypt as hashlib_scrypt
from hmac import compare_digest as hmac_compare_digest
from pickle import dumps as pickle_dumps
from pickletools import optimize as pickletools_optimize
from aiogram.dispatcher import FSMContext
from aiogram.dis... | 1.945313 | 2 |
werecool/main.py | Zsailer/interns2020demo | 0 | 12784483 |
def main():
print("Hello, World from Jess!")
print("Isn't this great?")
if __name__ == "__main__":
main()
| 2.3125 | 2 |
soccerpy/modules/Fundamentals/links/fixture_links.py | SlapBot/soccerpy | 0 | 12784484 | from soccerpy.modules.Fundamentals.links.base_links import BaseLinks
class FixtureLinks(BaseLinks):
def __init__(self, request):
super(FixtureLinks, self).__init__(request)
pass
| 2.046875 | 2 |
fbz_filer.py | jfarrimo/lol-logwatcher | 1 | 12784485 | <gh_stars>1-10
"""
Copyright (c) 2012 Lolapps, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
condit... | 1.070313 | 1 |
test2.py | mahendra1904/pythod-programs | 0 | 12784486 | #"ereht era ynam ysad"
x = "there are many days"
length=len(x)
l1=x.split()
str=''
for x in l1:
str=str+x[::-1]+ ' '
print(str)
| 3.546875 | 4 |
loss/__init__.py | Axrid/cv_template | 69 | 12784487 | import torch.nn as nn
from loss.gradient import grad_loss
from loss.tvloss import tv_loss
from loss.vggloss import vgg_loss
from loss.ssim import ssim_loss as criterionSSIM
from options import opt
criterionCAE = nn.L1Loss()
criterionL1 = criterionCAE
criterionBCE = nn.BCELoss()
criterionMSE = nn.MSELoss()
def get_de... | 2.1875 | 2 |
xmlmapping/log.py | YAmikep/django-xmlmapping | 2 | 12784488 | # Internal
from .settings import (
LOGGER_NAME, LOG_FILE, LOG_SIZE, LOGGER_FORMAT, LOG_LEVEL
)
from .utils.loggers import DefaultLogger
default_logger = DefaultLogger(
logger_name=LOGGER_NAME,
level=LOG_LEVEL,
log_file=LOG_FILE,
log_size=LOG_SIZE,
logger_format=LOGGER_FORMAT
)
| 1.578125 | 2 |
tests/test_gpsampler.py | tupui/batman | 0 | 12784489 | <filename>tests/test_gpsampler.py
# coding: utf8
import os
from mock import patch
import pytest
import numpy as np
import numpy.testing as npt
from batman.space.gp_sampler import GpSampler
import sys
# a simple class with a write method
class WritableObject:
def __init__(self):
self.content = []
def ... | 2.40625 | 2 |
setup.py | muirawachanga/network_billing_management | 1 | 12784490 | from __future__ import unicode_literals
from setuptools import setup, find_packages
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")
# get version from __version__ variable in network_billing_system/__init__.py
from network_billing_system import __version__ as version
setup(
... | 1.601563 | 2 |
Dataset/Leetcode/train/6/163.py | kkcookies99/UAST | 0 | 12784491 | <filename>Dataset/Leetcode/train/6/163.py<gh_stars>0
class Solution:
def XXX(self, s, numRows) :
if numRows==1:return s
l=[""]*numRows
z=numRows*2-2 #2行2个一组,3行4个一组,4行6个一组
for j in range(len(s)):
y=j%z #余数
if y<numRows:
... | 2.921875 | 3 |
apps/books/views.py | RGero215/Demo | 1 | 12784492 | from django.shortcuts import render, HttpResponse, redirect
from django.contrib import messages
from .models import Review, Author, Book
from ..login_registration.models import User
# Create your views here.
def books(request):
if 'login' not in request.session or request.session['login'] == False:
return ... | 2.125 | 2 |
test.py | racerxdl/PyMAX30100 | 0 | 12784493 | #!/usr/bin/env python
import time
from max30100.oxymeter import Oxymeter
from max30100.constants import *
x = Oxymeter(1)
lastReport = time.time() * 1000
if not x.begin():
print "Error initializing"
exit(1)
x.setIRLedCurrent(MAX30100_LED_CURR_7_6MA) # Works best with me
print "Running loop"
while True:
x.u... | 2.5 | 2 |
radynpy/utils/RadynMovie.py | grahamkerr/radynpy | 1 | 12784494 | import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
def rmovie_basicvar(cdf,
var = 'tg1',
Mm = False,
km = False,
savefig = False,
figname = 'radynvar.html',
... | 3.53125 | 4 |
HLTrigger/Configuration/python/HLT_75e33/modules/particleFlowRecHitHBHE_cfi.py | PKUfudawei/cmssw | 1 | 12784495 | import FWCore.ParameterSet.Config as cms
particleFlowRecHitHBHE = cms.EDProducer("PFRecHitProducer",
navigator = cms.PSet(
hcalEnums = cms.vint32(1, 2),
name = cms.string('PFRecHitHCALDenseIdNavigator')
),
producers = cms.VPSet(cms.PSet(
name = cms.string('PFHBHERecHitCreator'),
... | 1.304688 | 1 |
tests/test_backend.py | seeq12/seeq-udf-ui | 0 | 12784496 | from seeq import spy
import pytest
import time
@pytest.mark.system
class TestCreate:
def test_create_package_and_function(self, instantiate_ui_create_function_and_package):
ui = instantiate_ui_create_function_and_package('testPackage', 'testFunction')
assert 'testPackage' in ui.backend.fetch_udf_p... | 2.203125 | 2 |
moai/nn/residual/bottleneck.py | tzole1155/moai | 10 | 12784497 | <reponame>tzole1155/moai
import moai.nn.convolution as mic
import moai.nn.activation as mia
import torch
__all__ = [
"Bottleneck",
"PreResBottleneck",
"PreActivBottleneck",
]
'''
Bottleneck versions with 3 convolutions (2 projections, 1 bottleneck)
'''
class Bottleneck(torch.nn.Module):
def _... | 2.265625 | 2 |
test.py | Pokoai/Andrew-NG-Meachine-Learning | 1 | 12784498 |
x1, x2 = find_decision_boundary(svc, 0, 5, 1.5, 5, 2 * 10**-3)
fig. ax = plt.subplots(figsize=(10, 8))
ax.scatter(x1, x2, s=10, c='r', label='Boundary')
plot_init_pic(data, fig, ax)
ax.set_title('SVM(C=1) Decition Boundary')
ax.set_xlabel('X1')
ax.set_ylabel('X2')
ax.legend()
plt.show() | 2.890625 | 3 |
anton/lights/audio/audioprocess.py | sunnstix/dancyPi-audio-reactive-led | 0 | 12784499 | from asyncio import streams
import time
import numpy as np
import pyaudio
import anton.lights.config as config
class AudioProcess():
def __init__(self):
self.audio = pyaudio.PyAudio()
self.frames_per_buffer = int(config.MIC_RATE / config.FPS)
self.overflows = 0
self.prev_ovf_time = ... | 2.8125 | 3 |
main.py | mario21ic/swarm-status | 0 | 12784500 | <gh_stars>0
#!/usr/bin/env python3
# Usage: python main.py action
# Example: python main.py nodes|stacks|services|tasks
import time
import platform
import logging
import os
import sys
import boto3
import docker
docker_client = docker.from_env()
docker_api = docker.APIClient(base_url='unix://var/run/docker.sock')
lo... | 2.125 | 2 |
graphapi/schema.py | johnseekins/openstates.org | 51 | 12784501 | import graphene
from .legislative import LegislativeQuery
from .core import CoreQuery
class Query(LegislativeQuery, CoreQuery, graphene.ObjectType):
pass
schema = graphene.Schema(query=Query)
| 1.46875 | 1 |
objects/enemy.py | elgrandt/ShooterInc | 0 | 12784502 | import OGL
import pywavefront
from OpenGL.GL import *
class BasicEnemy(OGL.Cube):
def __init__(self,x,y,z):
OGL.Cube.__init__(self,3,8,2,x,y,z)
self.model = pywavefront.Wavefront("Handgun_obj.obj","models/")
self.model.onload = self.onload
#self.model = OGL.OBJ("Man.obj",Fse,10)
... | 2.875 | 3 |
playbooks/files/autoscaling/cpu_load.py | opentelekomcloud-infra/csm-sandbox | 2 | 12784503 | <gh_stars>1-10
""" A tool for generating a set of subsequent CPU utilization levels."""
import logging
import subprocess
import sys
import time
from argparse import ArgumentParser
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
def process(interval, utilization_list, ncpus):
for utilization i... | 3.125 | 3 |
memory/memory_object.py | nbanmp/seninja | 109 | 12784504 | <gh_stars>100-1000
from ..expr import BV, BVArray, Bool, ITE
class MemoryObj(object):
def __init__(self, name, bits=64, bvarray=None):
self.bvarray = BVArray(
"MEMOBJ_" + name, bits, 8
) if bvarray is None else bvarray
self.name = name
self.bits = bits
def __str__... | 2.78125 | 3 |
models/dino.py | guilhermesurek/3D-ResNets-PyTorch | 0 | 12784505 | <reponame>guilhermesurek/3D-ResNets-PyTorch<filename>models/dino.py<gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
class Head(nn.Module):
def __init__(self, n_classes, n_inputs=None, dropout=None):
super().__init__()
self.n_inputs = n_inputs
self.n_classes = ... | 2.109375 | 2 |
python/planck/settings_planck_2018.py | sfu-cosmo/MagCosmoMC | 0 | 12784506 | <reponame>sfu-cosmo/MagCosmoMC
import copy
import re
from paramgrid import batchjob
# plik foregrounds have to be calculated a posteriori as before (before zre6p5 filter).
ini_dir = 'batch3/'
cov_dir = 'planck_covmats/'
defaults = ['common.ini']
getdist_options = {'ignore_rows': 0.3, 'marker[nrun]': 0,
... | 1.734375 | 2 |
tests/test_operator/test_parse_comparison.py | gruebel/pycep | 2 | 12784507 | import json
from pathlib import Path
from assertpy import assert_that
from pycep import BicepParser
EXAMPLES_DIR = Path(__file__).parent / "examples/comparison"
BICEP_PARSER = BicepParser()
def test_parse_greater_than_or_equals() -> None:
# given
sub_dir_path = EXAMPLES_DIR / "greater_than_or_equals"
f... | 2.9375 | 3 |
py/tests/slice.py | DoDaek/gpython | 0 | 12784508 | # Copyright 2019 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
doc="slice"
a = slice(10)
assert a.start == None
assert a.stop == 10
assert a.step == None
a = slice(0, 10, 1)
assert a.start == 0
assert a.stop == 10
ass... | 2.3125 | 2 |
azure-iot-device/tests/common/test_async_adapter.py | necoh/azure-iot-sdk-python-preview | 35 | 12784509 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... | 2.25 | 2 |
source/Controller.py | Baumwollboebele/autonnomous_selfie_drone | 0 | 12784510 | from Constants import Constants
from djitellopy import tello
class Controller():
def __init__(self) -> None:
"""
Initialoization of class variables.
"""
self.const = Constants()
self.drone = tello.Tello()
self.up_down_velocity = 0
self.right_left_velocity... | 3.375 | 3 |
tests/test_clitool.py | daryl-scott/clitool2 | 0 | 12784511 | <filename>tests/test_clitool.py
"""Test Case for the clitool module"""
from __future__ import absolute_import
import inspect
import os
from unittest import TestCase
from clitool2 import CLITool, parse_docstr
def _test1(param1, param2, *args, **kwargs):
"""Sample function for TestCase.
Returns the supplied val... | 3.15625 | 3 |
write_rotation_to_principal_axes.py | LBJ-Wade/gadget4-tools | 1 | 12784512 | import numpy as np
from numba import njit
from snapshot_functions import read_particles_filter
from scipy.linalg import eigh
def run(argv):
if len(argv) < 5:
print('python script.py <IC-file> <preIC-file> <ID> <radius>')
return 1
ID = int(argv[3])
r = float(argv[4])
print('getting ID... | 2.203125 | 2 |
books/views.py | lazar-mikov/ManezCo | 0 | 12784513 | from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import *
from .forms import *
from django.contrib.auth.decorators import login_required
from accounts.decorators import adult_user
# Create your views here.
@login_required(login_url='login')
def bookIndex(request):
bo... | 2.21875 | 2 |
human_services/locations/migrations/0003_serviceatlocation.py | DarwishMenna/pathways-backend | 12 | 12784514 | <reponame>DarwishMenna/pathways-backend
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-21 00:46
from __future__ import unicode_literals
import common.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
... | 1.539063 | 2 |
resources/benchmark.py | WIPACrepo/file_catalog | 0 | 12784515 | #!/usr/bin/env python
from __future__ import print_function
import hashlib
import string
import random
import time
from json import dumps as json_encode, loads as json_decode
import requests
class FileCatalogLowLevel(object):
"""
Low level file catalog interface. Use like a dict::
fc = FileCatalog... | 2.78125 | 3 |
standalone_src/agent.py | lazykyama/atari_trtis_demo | 0 | 12784516 |
from collections import deque
import numpy as np
import cv2
import chainer
from chainer import links as L
import chainerrl
from chainerrl import agents
from chainerrl.action_value import DiscreteActionValue
from chainerrl import explorers
from chainerrl import links
from chainerrl import replay_buffer
def infer(... | 2.234375 | 2 |
data_code/prepare_data.py | yum-ume/Chainer_Image_caption | 0 | 12784517 | <reponame>yum-ume/Chainer_Image_caption
from pycocotools.coco import COCO
import numpy as np
import skimage.io as io
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "."))
from PIL import Image
ImageDir=sys.argv[1]
ResizeImageDir=sys.argv[2]
dataDir ='..'
dataType='val2014'
annFile='%s/anno... | 2.109375 | 2 |
tests/frequentist/test_bounds.py | danielsaaf/confidence | 107 | 12784518 | import pytest
import time
import numpy as np
from spotify_confidence.analysis.frequentist.confidence_computers.z_test_computer import sequential_bounds
@pytest.mark.skip(reason="Skipping because this test is very slow")
def test_many_days():
"""
This input (based on a real experiment) is very long, which can ... | 2.265625 | 2 |
Database_Setup.py | TannerWilcoxson/UnitAnalysis | 0 | 12784519 | <reponame>TannerWilcoxson/UnitAnalysis
import sqlite3 as sql
import sys
import os
class myVars():
'''
A Class for using persistant variables through the use of an SQLite Database
Change self.path below to be an absolute path found within your computer.
'''
def __init__(self):
path = os... | 3.171875 | 3 |
main.py | Violet64/Tkinter-Wordle | 0 | 12784520 | <reponame>Violet64/Tkinter-Wordle
import tkinter as tk
class Wordle:
def __init__(self, word):
root.bind("<KeyPress>", self.__key_press)
self.__word = word
self.__row = 0
self.__col = 0
self.__labels = []
self.__current_row = ""
for i in range(6):
... | 3.796875 | 4 |
layers/equivariant_linear.py | JoshuaMitton/InvariantGraphNetworks | 0 | 12784521 | <filename>layers/equivariant_linear.py
# import tensorflow as tf
import torch
import numpy as np
class equi_2_to_2(torch.nn.Module):
"""equivariant nn layer."""
def __init__(self, input_depth, output_depth, device):
super(equi_2_to_2, self).__init__()
self.basis_dimension = 15
self.dev... | 2.75 | 3 |
standard/single_map_plot.py | ElthaTeng/multiline-ngc3351 | 3 | 12784522 | <reponame>ElthaTeng/multiline-ngc3351
import numpy as np
import matplotlib.pyplot as plt
from astropy.wcs import WCS
from astropy.io import fits
from matplotlib.colors import LogNorm
mom0 = np.load('data_image/NGC3351_CO10_mom0.npy')
fits_map = fits.open('data_image/NGC3351_CO10_mom0_broad_nyq.fits')
wcs = WCS(fits_ma... | 2.125 | 2 |
Decoder.py | zouguojian/Improved-RLSTM | 4 | 12784523 | <gh_stars>1-10
import Rlstm as lstm
import tensorflow as tf
class decoder(object):
def __init__(self,h_state,batch_size,predict_time,layer_num=1,nodes=128,is_training=True):
'''
:param batch_size:
:param layer_num:
:param nodes:
:param is_training:
we need to define t... | 2.875 | 3 |
code/actions/compile.py | michaelbrockus/meson-ui- | 0 | 12784524 | <gh_stars>0
#!/usr/bin/env python3
#
# file: compile.py
# author: <NAME>
# gmail: <<EMAIL>>
#
class MesonCompile:
pass
| 1.34375 | 1 |
quasimodo/fact_combinor.py | Aunsiels/CSK | 16 | 12784525 | from quasimodo.parts_of_facts import PartsOfFacts
from quasimodo.data_structures.submodule_interface import SubmoduleInterface
class FactCombinor(SubmoduleInterface):
def __init__(self, module_reference):
super().__init__()
self._module_reference = module_reference
self._name = "Fact Comb... | 2.328125 | 2 |
utils.py | scanlon-dev/wallhaven-switcher | 0 | 12784526 | <reponame>scanlon-dev/wallhaven-switcher
import string, urllib, random
from pathlib import Path
import os, subprocess, configparser, sys
from threading import Timer
from common import *
def get_config_file(create=False):
home = str(Path.home())
config_dir = os.path.join(home, '.config/wallhaven/')
config_... | 2.28125 | 2 |
Factorial_Recursive.py | parth2608/NPTEL-Joy-of-computing-with-Python | 0 | 12784527 | def factorial(n):
if(n==0):
return 1
else:
return n*factorial(n-1)
n=int(input("Enter a positive number: "))
if(n<0):
print("Factorial is not defined on negative numbers.")
else:
f=factorial(n)
print("Factorial of",n,"is",f) | 4.21875 | 4 |
sc2/constants.py | Olaf-G/Bachelor-s-Degree | 7 | 12784528 | <reponame>Olaf-G/Bachelor-s-Degree<filename>sc2/constants.py
from .ids.ability_id import *
from .ids.buff_id import *
from .ids.effect_id import *
from .ids.unit_typeid import *
from .ids.upgrade_id import *
| 1.179688 | 1 |
app/main/forms.py | HenriqueLR/hangman-game | 0 | 12784529 | #coding: utf-8
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from main.utils import parse_csv_file as read_file
def _validation_word(word):
if len(word) > 46:
raise forms.ValidationError(_('Maximum length allowed 46 words.'))
if ' ' in word:
raise forms.ValidationEr... | 2.6875 | 3 |
je_editor/ui/ui_utils/keyword/__init__.py | JE-Chen/je_editor | 1 | 12784530 | <reponame>JE-Chen/je_editor
from je_editor.ui.ui_utils.keyword import *
| 1.007813 | 1 |
tests/test_transports.py | freedge/fake-switches | 42 | 12784531 | <reponame>freedge/fake-switches<gh_stars>10-100
import unittest
from hamcrest import assert_that, equal_to
from fake_switches.transports import SwitchSshService, SwitchTelnetService, SwitchHttpService
class TransportsTests(unittest.TestCase):
def test_http_service_has_default_port(self):
http_service = ... | 2.828125 | 3 |
dftd3/parameters/r2r4.py | bast/pyDFTD3 | 2 | 12784532 | <gh_stars>1-10
# -*- coding: utf-8 -*-
#
# pyDFTD3 -- Python implementation of Grimme's D3 dispersion correction.
# Copyright (C) 2020 <NAME> and contributors.
#
# This file is part of pyDFTD3.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentati... | 1.929688 | 2 |
src/dowml/lib.py | IBMDecisionOptimization/dowml | 3 | 12784533 | # --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright <NAME>, 2021
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Licens... | 2.25 | 2 |
lecture_transcriber/utils.py | Harrison88/lecture_transcriber | 0 | 12784534 | <gh_stars>0
import deepspeech
import numpy as np
class RewindableChunker:
def __init__(self, audiosegment, size=50):
self.audiosegment = audiosegment
self.size = size
self.lower_bounds = range(0, len(audiosegment), size)
self.upper_bounds = range(size, len(audiosegment) + size, siz... | 2.59375 | 3 |
ryu/app/sdnhub_apps/stateless_lb.py | bpalamol28/TP3SDN | 0 | 12784535 | # Copyright (C) 2014 SDN Hub
#
# Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.
# You may not use this file except in compliance with this License.
# You may obtain a copy of the License at
#
# http://www.gnu.org/licenses/gpl-3.0.txt
#
# Unless required by applicable law or agreed to in writing, software
... | 1.632813 | 2 |
sample/tool/__init__.py | Jeanhwea/python-project-template | 0 | 12784536 | # -*- coding: utf-8 -*-
__all__ = ()
# https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
import logging
logging.getLogger(__name__).addHandler(logging.NullHandler())
| 1.3125 | 1 |
thresholding-traceback.py | ANDROID564/pc_cyber_lab | 0 | 12784537 | <filename>thresholding-traceback.py
import numpy as np
import cv2
def nothing(x):
pass
img = cv2.imread("b4.jpg", cv2.IMREAD_GRAYSCALE)
cv2.namedWindow("Image")
cv2.createTrackbar("Threshold value", "Image", 128, 255, nothing)
#cv2.resizeWindow('image', 10,10)
while True:
value_threshold = ... | 3.5625 | 4 |
m2-modified/ims/common/agentless-system-crawler/tests/functional/test_functional_plugins.py | CCI-MOC/ABMI | 108 | 12784538 | <reponame>CCI-MOC/ABMI
import shutil
import tempfile
import unittest
import docker
import requests.exceptions
from plugins.systems.cpu_container_crawler import CpuContainerCrawler
from plugins.systems.cpu_host_crawler import CpuHostCrawler
from plugins.systems.memory_container_crawler import MemoryContainerCrawler
fro... | 2.09375 | 2 |
Pygame/SimplePygame/SimplePygame.py | kasztp/python-lessons | 35 | 12784539 | import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((600, 600), 0)
pygame.display.set_caption('Simple Pygame Game')
bee = pygame.image.load('bee1.png').convert_alpha()
beeX = 0
beeY = 0
clock = pygame.time.Clock()
loop = True
while loop:
for event in pygame.event.get():
... | 3.328125 | 3 |
ansible-devel/test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/modules/fakemodule.py | satishcarya/ansible | 0 | 12784540 | <gh_stars>0
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
module: fakemodule
short_desciption: fake module
description:
- this is a fake module
options:
_notreal:
description: really not a real... | 1.765625 | 2 |
radcontrold.py | davea/radcontrold | 1 | 12784541 | #!/usr/bin/env python
import sys
import logging
from configparser import ConfigParser
from os.path import expanduser
from socket import gethostname
from time import sleep
from eq3bt import Thermostat, Mode
from bluepy.btle import BTLEException
from mqttwrapper import run_script
log = logging.getLogger("radcontrold")
... | 2.109375 | 2 |
src/model.py | rish-16/Lightning-Transformer | 2 | 12784542 | <gh_stars>1-10
import torch
import numpy as np
from torch import nn
import pytorch_lightning as pl
class Attention(pl.LightningModule):
def __init__(self, d_model, num_heads, p, d_input=None):
super().__init__()
self.num_heads = num_heads
self.d_model = d_model
if d_input is None:
... | 2.40625 | 2 |
tests/fixture_classes/db.py | em-2/em2 | 0 | 12784543 | from em2.core import Database
class FakeConn:
async def execute(self, *args, **kwargs):
pass
class DummyAcquireContext:
def __init__(self, conn):
self.conn = conn
async def __aenter__(self):
return self.conn
async def __aexit__(self, exc_type, exc_val, exc_tb):
pass... | 2.53125 | 3 |
dedalus/Tag.py | xzoert/dedalus | 0 | 12784544 | class Tag:
ASSIGNED=1
NOT_ASSIGNED=0
INHERITED=2
def __init__(self,name):
self.name=name.strip()
self.key=name
def __hash__(self):
return hash(self.name)
def __eq__(self, other):
return self.name == other.name
def __ne__(self, other):
return not(self == other)
| 3.03125 | 3 |
admin/management/commands/deploy.py | adelsonllima/djangoplus | 21 | 12784545 | # -*- coding: utf-8 -*-
import os
import sys
import json
import time
import datetime
from django.core.management.base import BaseCommand
from fabric.api import *
from fabric.contrib.files import exists, append, contains
from django.conf import settings
username = 'root'
project_dir = os.getcwd()
project_name = proj... | 1.953125 | 2 |
main.py | bywakko/owoautofarm | 0 | 12784546 | <gh_stars>0
import discord
from discord.ext import commands
import colorama
from colorama import Fore
import asyncio
import os
#-----SETUP-----#
prefix = "!!"
#use the .env feature to hide your token
token = os.getenv("TOKEN")
#---------------#
bot = commands.Bot(command_prefix=prefix,
help_co... | 2.46875 | 2 |
customers/errors/__init__.py | hnb2/flask-customers | 1 | 12784547 | <gh_stars>1-10
'''
This module contains the error blueprint to handle all the
common HTTP errors.
'''
from flask import Blueprint, jsonify
bp = Blueprint('errors', __name__)
def _generic_error(error, message, code):
'''
Generic error handler
:param error:
A python error, is None for a normal HTT... | 2.703125 | 3 |
activelearning/aev_cluster.py | plin1112/ANI-Tools | 8 | 12784548 | <reponame>plin1112/ANI-Tools
import pyNeuroChem as pync
import hdnntools as hdn
import pyanitools as pyt
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
wkdir = '/home/jujuman/Research/DataReductionMethods/models/train_c08f/'
cnstfile = wkdir + 'rHCNO-4.6A_16-3.1A_a4-8.param... | 2 | 2 |
logs/test2.py | MLD1024/pythonDemo | 1 | 12784549 | # -*- coding: utf-8 -*-
import os
import os.path
# rootdir = 'D:\loganalyze'
# list = os.listdir(rootdir) # 列出文件夹下所有的目录与文件
# for i in range(0 ,len(list)):
# path = os.path.join(rootdir ,list[i])
# if os.path.isfile(path):
# print path
# else:
# print path
#
def getFile(path):
list... | 3.078125 | 3 |
src/testproject/sdk/internal/reporter/__init__.py | bbornhau/python-opensdk | 38 | 12784550 | <filename>src/testproject/sdk/internal/reporter/__init__.py
from .reporter import Reporter
__all__ = ["Reporter"]
| 1.085938 | 1 |