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 |
|---|---|---|---|---|---|---|
pymagnitude/third_party/allennlp/tests/data/dataset_readers/snli_reader_test.py | tpeng/magnitude | 1,520 | 13200 | # pylint: disable=no-self-use,invalid-name
from __future__ import division
from __future__ import absolute_import
import pytest
from allennlp.data.dataset_readers import SnliReader
from allennlp.common.util import ensure_list
from allennlp.common.testing import AllenNlpTestCase
class TestSnliReader(object):
@py... | 2.171875 | 2 |
binding/python/setup.py | pmateusz/libgexf | 0 | 13201 | <filename>binding/python/setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
setup.py file for Libgexf
"""
from setuptools import Extension, setup
#from distutils.core import Extension, setup
libgexf_module = Extension(
'_libgexf', # genere un _libgexf.so
include_dirs=['/usr/include/libxml2'],
sources=[... | 1.570313 | 2 |
util/import/raze/crates.bzl | silas-enf/rules_rust | 1 | 13202 | <reponame>silas-enf/rules_rust<gh_stars>1-10
"""
@generated
cargo-raze generated Bazel file.
DO NOT EDIT! Replaced on runs of cargo-raze
"""
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # bui... | 1.460938 | 1 |
scripts/print_thread_name.py | Satheeshcharon/Multithreading-python | 0 | 13203 | <reponame>Satheeshcharon/Multithreading-python
#!/usr/bin/python
## This program creates a thread,
## officially names it and
## tries to print the name
import threading
import time
def ThreadFunction():
print(threading.currentThread().getName(), "Starting")
time.sleep(2)
print(threading.currentThread().getN... | 3.75 | 4 |
scripts/first_trace_success_test.py | axelzedigh/DLSCA | 9 | 13204 | <filename>scripts/first_trace_success_test.py
import os.path
import sys
import h5py
import numpy as np
import matplotlib.pyplot as plt
from keras.models import load_model
from keras.losses import categorical_crossentropy
import tensorflow as tf
import heapq
import re
modelName = 'CW_validation.h5'
successResultsNPY = ... | 2.296875 | 2 |
raptrcontainer/appropriated/admin.py | richard-parks/RAPTR | 0 | 13205 | from django.contrib import admin
from .models import AppropriatedHistory
@admin.register(AppropriatedHistory)
class AppropriatedHistoryAdmin(admin.ModelAdmin):
list_display = [
'fiscal_year',
'source',
'dollars_received'
]
list_editable = [
'dollars_received',
]
or... | 1.460938 | 1 |
ringallreduce_simulator.py | hgao10/horovod_simulation | 0 | 13206 | <reponame>hgao10/horovod_simulation
import collections
import time
import heapq
from horovod_simulator_config import SimulatorConfig, SchedulingDisc
from utils.logger import get_logger
import typing
from queue import PriorityQueue
class Packet():
def __init__(self, iteration_idx, layer_idx, packet_idx, packet_size... | 2.46875 | 2 |
ABNOOrchestrator/ABNOParameters.py | HPNLAB/ABNO-FUTEBOL | 0 | 13207 | <reponame>HPNLAB/ABNO-FUTEBOL<gh_stars>0
__author__ = 'alejandroaguado'
from xml.etree import ElementTree
class ABNOParameters:
def __init__(self, filename):
self.document = ElementTree.parse(filename)
root = self.document.getroot()
tag = self.document.find('abnoconfig')
self.addr... | 2.5625 | 3 |
influencer-detection/src/api/influencers/api/v1.py | luisblazquezm/influencer-detection | 4 | 13208 | #!flask/bin/python
# Copyright 2021 <NAME> (@luisblazquezm)
# See LICENSE for details.
from flask_restx import Api
api = Api(version='1.0',
title='Influencer Detection Project',
description="**PORBI Influencer Detection project's Flask RESTX API**") | 1.6875 | 2 |
core/models/sparse_bp_cnn.py | JeremieMelo/L2ight | 7 | 13209 | <reponame>JeremieMelo/L2ight<gh_stars>1-10
'''
Description:
Author: <NAME> (<EMAIL>)
Date: 2021-10-24 16:23:50
LastEditors: <NAME> (<EMAIL>)
LastEditTime: 2021-10-24 16:23:50
'''
from collections import OrderedDict
from typing import Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import torch
import t... | 1.929688 | 2 |
lite/demo/python/mobilenetv1_full_api.py | 714627034/Paddle-Lite | 3 | 13210 | # Copyright (c) 2019 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 appli... | 2.46875 | 2 |
discord_ui/errors.py | brotherelric/discord-ui | 26 | 13211 | from discord.ext.commands import BadArgument
class InvalidLength(BadArgument):
"""This exception is thrown whenever a invalid length was provided"""
def __init__(self, my_name, _min=None, _max=None, *args: object) -> None:
if _min is not None and _max is not None:
err = "Length of '" + my_n... | 3.171875 | 3 |
Python/bot_2.py | maurovasconcelos/Ola-Mundo | 1 | 13212 | from selenium import webdriver
navegador = webdriver.Chrome()
navegador.get("https://webstatic-sea.mihoyo.com/ys/event/signin-sea/index.html?act_id=e202102251931481&lang=pt-pt") | 2.1875 | 2 |
filestream.py | ziyua/filestream | 0 | 13213 | <filename>filestream.py
#!/usr/bin/python
# -*- coding: gb2312 -*-
import fileinput
import os
class FileStream:
def __init__(self, filename, cutsize=2048):
self.filename = filename
self.cutsize = cutsize # 2048 byte
self.size = os.path.getsize(self.filename)
self.file = fileinpu... | 3.328125 | 3 |
libvirt_vm_optimizer/util/arg_parser.py | atiratree/libvirt-vm-optimizer | 1 | 13214 | import argparse
from argparse import ArgumentError
from libvirt_vm_optimizer.util.utils import Profile
class Settings:
def __init__(self, libvirt_xml=None,
output_xml=None,
in_place=False,
profile=Profile.DEFAULT,
force_multithreaded_pinning=Fal... | 2.609375 | 3 |
lib_bgp_data/collectors/mrt/mrt_base/mrt_file.py | jfuruness/lib_bgp_data | 16 | 13215 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module contains class MRT_File.
The MRT_File class contains the functionality to load and parse
mrt files. This is done through a series of steps, detailed in README.
"""
__authors__ = ["<NAME>", "<NAME>"]
__credits__ = ["<NAME>", "<NAME>", "<NAME>"]
__Lisence__... | 2.71875 | 3 |
demo.py | mhy12345/rcaudio | 31 | 13216 | <reponame>mhy12345/rcaudio<gh_stars>10-100
from rcaudio import *
import time
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s')
def demo1():
CR = CoreRecorder(
time = 10,
sr = 1000,
bat... | 2.046875 | 2 |
Backend/linux.py | TheInvincibleLearner/simranquirky.github.io | 0 | 13217 | #!/usr/bin/python3
print("content-type: text/html")
print()
import subprocess as sp
import cgi
fs = cgi.FieldStorage()
cmd = fs.getvalue("command")
output = sp.getoutput("sudo "+cmd)
print("<body style='padding: 40px;'>")
print('<h1 style="color:#df405a;" >Output</h1>')
print("<pre>{}</pre>".format(ou... | 2.421875 | 2 |
tests/test_swagger_registry.py | niall-byrne/flask-restful-swagger | 667 | 13218 | from flask import Flask
from flask_restful_swagger.swagger import SwaggerRegistry
try:
from unittest.mock import patch
except ImportError:
from mock import patch
@patch("flask_restful_swagger.swagger._get_current_registry")
@patch("flask_restful_swagger.swagger.render_homepage")
def test_get_swagger_registr... | 2.328125 | 2 |
gcp_census/bigquery/bigquery_handler.py | ocadotechnology/gcp-census | 40 | 13219 | <gh_stars>10-100
import logging
import webapp2
from googleapiclient.errors import HttpError
from gcp_census.bigquery.bigquery_client import BigQuery
from gcp_census.bigquery.bigquery_task import BigQueryTask
class BigQueryBaseClass(webapp2.RequestHandler):
def __init__(self, request=None, response=None):
... | 2.5625 | 3 |
Solutions/Python/Posix command(7 kyu).py | collenirwin/Codewars-Solutions | 0 | 13220 | <reponame>collenirwin/Codewars-Solutions
from os import popen
def get_output(s):
return popen(s).read() | 1.875 | 2 |
resources/src/gcp_iam_service_account.py | kfirz/deployster | 0 | 13221 | <reponame>kfirz/deployster
#!/usr/bin/env python3.6
import argparse
import json
import sys
from typing import Sequence, MutableSequence
from dresources import DAction, action
from external_services import ExternalServices
from gcp import GcpResource
class GcpIamServiceAccount(GcpResource):
def __init__(self, d... | 1.96875 | 2 |
tests/consumtodb_test.py | thomas-for-aiven/monitor | 0 | 13222 | <gh_stars>0
#!/usr/bin/python3
import pytest
import monitor.monitorshared as m
import monitor.consumtodb as con
def test_db_connection(tmpdir):
"test postgres connection"
conf = m.Configuration('configx.ini', "test")
# in case the field is empty
if conf.db_host == '':
pytest.skip("no brok... | 2.1875 | 2 |
pytorch3dunet/unet3d/config.py | VolkerH/pytorch-3dunet | 0 | 13223 | <filename>pytorch3dunet/unet3d/config.py
import argparse
import torch
import yaml
def load_config():
parser = argparse.ArgumentParser(description='UNet3D training')
parser.add_argument('--config', type=str, help='Path to the YAML config file', required=True)
args = parser.parse_args()
config = _load_... | 2.75 | 3 |
Code/chatbot.py | pavithra-b-reddy/Chatbot-CS310 | 0 | 13224 | # This codes are referenced from the Github repo (https://github.com/parulnith/Building-a-Simple-Chatbot-in-Python-using-NLTK/blob/master/chatbot.py)
# Loading the required packages
import nltk
import random
import string
import warnings
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics... | 3.578125 | 4 |
relo/core/log.py | cwoebker/relo | 0 | 13225 | <filename>relo/core/log.py<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
import sys
LEVEL = {
'NORMAL': 0,
'INFO': 1,
'DEBUG': 2,
'CRITICAl': 0,
'ERROR': 0,
'EXCEPTION': 0,
}
class Color(object):
ESCAPE = '\033[%sm'
BOLD = '1;%s'
UNDERLINE = '4;%s'
BLUE_ARROW = ESCAPE % ... | 2.1875 | 2 |
client/src/proto3/socket_server.py | andrhahn/pi-spy | 1 | 13226 | <reponame>andrhahn/pi-spy<filename>client/src/proto3/socket_server.py
import SocketServer
import io
import logging
import struct
import threading
import PIL.Image
import pika
import config
logging.basicConfig(level=logging.INFO)
class RequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
p... | 2.40625 | 2 |
lib/showFaces.py | ZakDoesGaming/OregonTrail | 6 | 13227 | <gh_stars>1-10
from pygame import image
class ShowFaces():
def __init__(self, filePath, colour = (0, 0, 0), posX = 0, posY = 100, resourcePath = ""):
self.filePath = filePath
self.colour = colour
self.posX = posX
self.posY = posY
self.resourcePath = resourcePath
self.image = image.load(self.resourcePath +... | 2.890625 | 3 |
Thirdparty/libpsd/build.py | stinvi/dava.engine | 26 | 13228 | <reponame>stinvi/dava.engine
import os
import shutil
import build_utils
def get_supported_targets(platform):
if platform == 'win32':
return ['win32']
elif platform == 'darwin':
return ['macos']
elif platform == 'linux':
return ['linux']
else:
return []
def get_depende... | 2.046875 | 2 |
molpal/__init__.py | mchaker/lab-molpal | 1 | 13229 | <reponame>mchaker/lab-molpal<gh_stars>1-10
from .explorer import Explorer
__version__ = "1.0.2" | 1.171875 | 1 |
Data.py | praenubilus/lc-tool | 0 | 13230 | import subprocess
import os.path
import json
import time
import urllib.parse
from typing import Any, Tuple
import config
from requests_html import HTMLSession
from markdownify import markdownify
class Data:
def __init__(
self,
data_file_path: str = config.DATA_FILE_PATH,
preload: bool = Fa... | 2.703125 | 3 |
examples/python/WeightedCentroidalVoronoi.py | mparno/sdot2d | 0 | 13231 | <filename>examples/python/WeightedCentroidalVoronoi.py<gh_stars>0
import pysdot as ot
import numpy as np
import matplotlib.pyplot as plt
numPts = 100
xbnds = [0.0,1.0] # minimum and maximum x values
ybnds = [0.0,1.0] # minimum and maximum y values
Ns = [50,50]
bbox = ot.BoundingBox(xbnds[0],xbnds[1],ybnds[0],ybnds[1... | 2.671875 | 3 |
Combinatorialifier.py | Theta291/Partial-Application-in-Python | 0 | 13232 | #Exercise: Try to make a function that accepts a function of only positional arguments and returns a function that takes the same number of positional arguments and, given they are all iterators, attempts every combination of one arguments from each iterator.
#Skills: Partial application, Iteration
papplycomboreverse ... | 3.6875 | 4 |
ursa/graph/node.py | adgirish/ursa | 0 | 13233 | <gh_stars>0
class Node:
"""
This object is a generic node, the basic component of a Graph.
Fields:
data -- the data this node will contain. This data can be any format.
"""
def __init__(self, data):
self.data = data
| 3.015625 | 3 |
api/api_funct.py | pjclock/haproxy-wi | 0 | 13234 | import os
import sys
os.chdir(os.path.dirname(__file__))
sys.path.append(os.path.dirname(__file__))
sys.path.append(os.path.join(sys.path[0], '/var/www/haproxy-wi/app/'))
from bottle import route, run, template, hook, response, request, post
import sql
import funct
def return_dict_from_out(id, out):
data = {}
data... | 2.109375 | 2 |
trove-11.0.0/trove/guestagent/datastore/experimental/vertica/service.py | scottwedge/OpenStack-Stein | 1 | 13235 | <gh_stars>1-10
# Copyright [2015] Hewlett-Packard Development Company, L.P.
# 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... | 1.492188 | 1 |
waymo_open_dataset/waymo_detection_dataset.py | abahnasy/IDP | 0 | 13236 | """ Waymo dataset with votes.
Author: <NAME>
Date: 2020
"""
import os
import sys
import numpy as np
import pickle
from torch.utils.data import Dataset
import scipy.io as sio # to load .mat files for depth points
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.appe... | 2.4375 | 2 |
smoketests/tests/test_dir_test.py | erlware-deprecated/sinan | 7 | 13237 | import unittest
import sin_testing as st
import pexpect
import os
class TestFail(st.SmokeTest):
@st.sinan("build")
def build(self, child, app_desc):
if not os.path.isfile(os.path.join(os.getcwd(),
"test", "test_module.erl")):
raise "Nome module f... | 2.125 | 2 |
budgetportal/tests/test_management_commands.py | fluenty/datamanager | 0 | 13238 | from budgetportal.models import (
FinancialYear,
Sphere,
Government,
Department,
Programme,
)
from django.core.management import call_command
from django.test import TestCase
from tempfile import NamedTemporaryFile
from StringIO import StringIO
import yaml
class BasicPagesTestCase(TestCase):
de... | 2.203125 | 2 |
src/fedservice/utils.py | rohe/fedservice | 3 | 13239 | import json
import logging
import ssl
import sys
from oidcrp.exception import ResponseError
logger = logging.getLogger(__name__)
def load_json(file_name):
with open(file_name) as fp:
js = json.load(fp)
return js
def fed_parse_response(instance, info, sformat="", state="", **kwargs):
if sformat... | 2.625 | 3 |
plugins/rd_bot.py | deg4uss3r/rd_bot | 0 | 13240 | <filename>plugins/rd_bot.py
from __future__ import unicode_literals
import requests
import json
import os
import sys
outputs = []
def get_lat_lng(city):
try:
googleclientSecretFile = open('google_api_key', 'r')
GCLIENTSECRET = googleclientSecretFile.read()
GCLIENTSECRET = GCLIENTSECRET[:-1... | 2.609375 | 3 |
swss.py | andycranston/swss | 0 | 13241 | <gh_stars>0
#! /usr/bin/python3
#
# @(!--#) @(#) swss.py, version 002, 27-july-2018
#
# open a series of home pages and take a screen shot of each one
#
################################################################################################
#
# imports
#
import sys
import os
import argparse
import glob
impo... | 2.234375 | 2 |
api/migrations/versions/0be658f07ac6_state_consumed.py | eve-git/namex | 4 | 13242 | """state consumed
Revision ID: 0be658f07ac6
Revises: bd1e892d0609
Create Date: 2021-07-18 21:26:04.588007
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy import String
# revision identifiers, used by Alembic.
revision = '0be658f07ac6'
down_revision = 'bd1e... | 1.40625 | 1 |
tests/test_pydantic.py | hCaptcha/hmt-basemodels | 3 | 13243 | <filename>tests/test_pydantic.py<gh_stars>1-10
from unittest import TestCase, mock
from copy import deepcopy
from pydantic.error_wrappers import ValidationError
from basemodels.pydantic import Manifest
from basemodels.pydantic.manifest.data.taskdata import TaskDataEntry
SIMPLE = {
"job_mode": "batch",
"reque... | 2.25 | 2 |
olutils/path.py | OctaveLauby/olutils | 1 | 13244 | <reponame>OctaveLauby/olutils<filename>olutils/path.py
from os.path import exists
def get_next_path(path_frmt: str, start: int = 1) -> str:
"""Return next available path based on path_frmt (1 positional-placeholder)"""
return path_frmt.format(get_next_path_index(path_frmt, start=start))
def get_next_path_in... | 2.765625 | 3 |
env/lib/python2.7/site-packages/certifi/__init__.py | wagnermarkd/stationary-hud | 6 | 13245 | <gh_stars>1-10
from .core import where, old_where
__version__ = "2016.02.28"
| 0.933594 | 1 |
setup.py | jacobschaer/qt_compat | 0 | 13246 | <filename>setup.py<gh_stars>0
from setuptools import setup, find_packages
setup(
name="QtCompat",
version="0.1",
packages=find_packages(),
scripts=[],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires=[],
pac... | 1.328125 | 1 |
test/patterns/joined_validation/test_joined_validation.py | acheshkov/aibolit | 0 | 13247 | <filename>test/patterns/joined_validation/test_joined_validation.py
import os
from unittest import TestCase
from aibolit.patterns.joined_validation.joined_validation import JoinedValidation
from pathlib import Path
class TestJoinedValidation(TestCase):
dir_path = Path(os.path.realpath(__file__)).parent
patter... | 2.78125 | 3 |
python_structure/data_structures/lists_tuples_dictionaries/tuple_defs.py | bangyen/pascal-triangle | 1 | 13248 | <gh_stars>1-10
"""
Global tuple to avoid make a new one each time a method is called
"""
my_tuple = ("London", 123, 18.2)
def city_tuple_declaration():
city = ("Rome", "London", "Tokyo")
return city
def tuple_get_element(index: int):
try:
element = my_tuple[index]
print(element)
exce... | 3.9375 | 4 |
annotations/filters.py | acdh-oeaw/ner-annotator | 1 | 13249 | import django_filters
from . models import NerSample
class NerSampleListFilter(django_filters.FilterSet):
text = django_filters.CharFilter(
lookup_expr='icontains',
help_text=NerSample._meta.get_field('text').help_text,
label=NerSample._meta.get_field('text').verbose_name
)
c... | 1.859375 | 2 |
m3o_plugin/postcode.py | JustIceQAQ/play_m3o_in_python | 0 | 13250 | # TODO Postcode: https://m3o.com/postcode/overview
| 0.945313 | 1 |
learning_algorithms/hysteretic_q_matrix.py | swj0418/Reinforcement_Learning_Framework | 1 | 13251 | import numpy as np
class Agent:
def __init__(self):
self.q_table = np.zeros(shape=(3, ))
self.rewards = []
self.averaged_rewards = []
self.total_rewards = 0
self.action_cursor = 1
class HystereticAgentMatrix:
def __init__(self, environment, increasing_learning_rate=0.9... | 2.78125 | 3 |
psiz/keras/layers/kernel.py | asuiconlab/psiz | 0 | 13252 | # -*- coding: utf-8 -*-
# Copyright 2020 The PsiZ 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 r... | 2.484375 | 2 |
apps/user/migrations/0005_auto_20190804_1443.py | tiger-fight-tonight/E-Server | 6 | 13253 | <reponame>tiger-fight-tonight/E-Server
# Generated by Django 2.1.7 on 2019-08-04 06:43
import datetime
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('user', '0004_auto_20190804_1438'),
]
operations = [
migrations.AlterField... | 1.710938 | 2 |
scripts/get_plat_name.py | uuosio/gscdk | 6 | 13254 | <gh_stars>1-10
import platform
#check the platform for linux, macos, windows
if platform.system() == "Linux":
print("manylinux1_x86_64")
elif platform.system() == "Windows":
print("win-amd64")
elif platform.system() == "Darwin":
print("macosx_10_15_x86_64")
else:
print("Unknown")
| 2.546875 | 3 |
submissions/mirror-reflection/solution.py | Wattyyy/LeetCode | 0 | 13255 | <reponame>Wattyyy/LeetCode
# https://leetcode.com/problems/mirror-reflection
class Solution:
def mirrorReflection(self, p, q):
if q == 0:
return 0
i = 0
val = 0
while True:
val += q
i += 1
if (i % 2 == 0) and (val % p == 0):
... | 3.640625 | 4 |
sdk/python/kulado_azure/batch/get_account.py | kulado/kulado-azure | 0 | 13256 | # coding=utf-8
# *** WARNING: this file was generated by the Kulado Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import kulado
import kulado.runtime
from .. import utilities, tables
class GetAccountResult:
"""
A... | 1.921875 | 2 |
run/run_fd_tgv_conv.py | huppd/PINTimpact | 0 | 13257 | <reponame>huppd/PINTimpact
""" running converferce for finite differences and Taylor-Green vortex """
import os
from math import pi
import xml.etree.ElementTree as ET
import platform_paths as pp
import manipulator as ma
# load parameter file
ma.set_ids('../XML/parameterTGVTime.xml')
TREE = ET.parse('../XML/parameterT... | 2 | 2 |
DCSCN.py | dattv/DCSCN-Tensorflow | 3 | 13258 | <filename>DCSCN.py
"""
"""
import logging
import os
import random
import time
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from helper import loader, utility as util
matplotlib.use("agg")
INPUT_IMAGE_DIR = "input"
INTERPOLATED_IMAGE_DIR = "interpolated"
TRUE_IMAGE_D... | 2.15625 | 2 |
tests/tests.py | cjapp/tkinter_simpleEncodeDecode | 0 | 13259 | <gh_stars>0
from .context import main
| 1.039063 | 1 |
ofa/tutorial/imagenet_eval_helper.py | johsnows/once-for-all | 0 | 13260 | import os.path as osp
import numpy as np
import math
from tqdm import tqdm
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.utils.data
from torchvision import transforms, datasets
from ofa.utils import AverageMeter, accuracy
from ofa.model_zoo import ofa_specialized
from ofa.imagenet_classifica... | 1.835938 | 2 |
python/housinginsights/sources/cama.py | mrkem598/housing-insights | 0 | 13261 | <reponame>mrkem598/housing-insights<gh_stars>0
# Script is deprecated, as of September 18, 2017.
# zoneUnitCount now calculated with LoadData's _get_residential_units()
#
from pprint import pprint
import os
import sys
import requests
from collections import OrderedDict
import csv
import datetime
PYTHON_PATH = os.path... | 2.34375 | 2 |
certbot_dns_cfproxy/__init__.py | ProfFan/certbot-dns-cfproxy | 2 | 13262 | <filename>certbot_dns_cfproxy/__init__.py
"""
The `~certbot_dns_cfproxy.dns_cfproxy` plugin automates the process of
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
subsequently removing, TXT records using the CFProxy API.
Examples
--------
.. code-block:: bash
:caption: To acquire a ... | 1.789063 | 2 |
web-app/servers/card-recognize/app.py | woojae9488/HLF_chaincode | 2 | 13263 | <reponame>woojae9488/HLF_chaincode<filename>web-app/servers/card-recognize/app.py
from flask import Flask, make_response, request
from flask_cors import CORS
import json
from config import *
from StudentCard import *
from ApiError import *
App = Flask(__name__)
cors = CORS(App,
resources={r'*': {'origins'... | 2.578125 | 3 |
smart_home/power_controller.py | achuchev/-SmartHome-AlexaLambda | 0 | 13264 | <gh_stars>0
import logging
from smart_home.mqtt_client import MQTTClient
from smart_home.utils_lambda import get_utc_timestamp, error_response, success_response, get_request_message_id, get_mqtt_topics_from_request, get_request_name, get_friendly_name_from_request
class PowerController(object):
@staticmethod
... | 2.34375 | 2 |
components/mpas-seaice/testing_and_setup/testcases/advection/plot_testcase.py | Fa-Li/E3SM | 235 | 13265 | from netCDF4 import Dataset
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
import matplotlib.cm as cm
import numpy as np
#-------------------------------------------------------------
def plot_subfigure(axis, array, nCells, n... | 2.390625 | 2 |
ABC_A/ABC063_A.py | ryosuke0825/atcoder_python | 0 | 13266 | <filename>ABC_A/ABC063_A.py
a, b = map(int, input().split())
if a+b >= 10:
print("error")
else:
print(a+b)
| 2.859375 | 3 |
aeropy/filehandling/paraview.py | belac626/AeroPy | 0 | 13267 | #### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
network_number = 2
filename = 'test_network'
directory = 'C:\\Users\\leal26\\Documents\\GitHub\\AeroPy\\aeropy\\CST\\'
# get active view... | 2.0625 | 2 |
pyFIRS/utils.py | Ecotrust/pyFIRS | 3 | 13268 | import glob
import json
import os
import subprocess
import time
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import ParseError
import geopandas as gpd
import rasterio
import numpy as np
from shapely.geometry import Polygon
class PipelineError(RuntimeError):
def __init__(self, message):
s... | 2.765625 | 3 |
test/test_message.py | Smac01/Stego | 0 | 13269 | #!/usr/bin/env python3
import unittest
import sys
sys.path.insert(0, '.')
from random import choice
from PIL import Image
from stego.encoder import embed
from stego.decoder import extract, _decompress, IncorrectPassword
from stego.base import make_array, as_string, extract_metadata
images = ['test/rgba.png', 'test/... | 2.640625 | 3 |
tests/test_simulation_utils.py | burgersmoke/epysurv | 8 | 13270 | import pandas as pd
from rpy2 import robjects
from epysurv.simulation.utils import add_date_time_index_to_frame, r_list_to_frame
def test_add_date_time_index_to_frame():
df = add_date_time_index_to_frame(pd.DataFrame({"a": [1, 2, 3]}))
freq = pd.infer_freq(df.index)
assert freq == "W-MON"
def test_r_li... | 2.640625 | 3 |
assemble/tool/assemble_CodeBlockUnixMake.py | vbloodv/blood | 2 | 13271 | <reponame>vbloodv/blood
import cmake
cmake.buildCmake(
'CodeBlockUnixMake',
'../../',
'../../assemble/'
)
| 1.179688 | 1 |
examples/python/bunny_pieline.py | Willyzw/vdbfusion | 119 | 13272 | <reponame>Willyzw/vdbfusion
#!/usr/bin/env python3
# @file cow_pipeline.py
# @author <NAME> [<EMAIL>]
#
# Copyright (c) 2021 <NAME>, all rights reserved
import argh
from datasets import BunnyGeneratedDataset as Dataset
from vdbfusion_pipeline import VDBFusionPipeline as Pipeline
def main(
data_source... | 1.835938 | 2 |
tests/test_dashboard_generator_generate_widget.py | phelewski/aws-codepipeline-dashboard | 0 | 13273 | import os
import pytest
from dashboard_generator import DashboardGenerator
def test_generate_widget_ensure_return_value_is_dict(env_variables):
response = DashboardGenerator()._generate_widget(y=1, period=60, pipeline='foo')
assert type(response) == dict
def test_generate_widget_ensure_values_are_used_pro... | 2.265625 | 2 |
opencadd/tests/structure/test_superposition_mda.py | pipaj97/opencadd | 39 | 13274 | """
Tests for opencadd.structure.superposition.engines.mda
"""
import pytest
from opencadd.structure.core import Structure
from opencadd.structure.superposition.engines.mda import MDAnalysisAligner
def test_mda_instantiation():
aligner = MDAnalysisAligner()
def test_mda_calculation():
aligner = MDAnalysisA... | 2.046875 | 2 |
examples/python/hello2.py | redcodestudios/legion_script | 13 | 13275 | import engine
print("Python: Script 2")
class Rotation(metaclass=engine.MetaComponent):
def __init__(self):
self.trans = 5
result = engine.query(Color)
print("Python: Query colors from Script 2")
for c in result:
c.string()
print("--------------------")
| 2.796875 | 3 |
io_scene_halo/file_tag/import_tag.py | AerialDave144/Halo-Asset-Blender-Development-Toolset | 0 | 13276 | <reponame>AerialDave144/Halo-Asset-Blender-Development-Toolset
# ##### BEGIN MIT LICENSE BLOCK #####
#
# MIT License
#
# Copyright (c) 2022 <NAME>
#
# 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 Sof... | 1.3125 | 1 |
pines/smartread.py | jpn--/pine | 2 | 13277 |
import gzip, os, struct, zipfile, io
class SmartFileReader(object):
def __init__(self, file, *args, **kwargs):
if file[-3:]=='.gz':
with open(file, 'rb') as f:
f.seek(-4, 2)
self._filesize = struct.unpack('I', f.read(4))[0]
self.file = gzip.open(file, *args, **kwargs)
elif file[-4:]=='.zip':
... | 2.71875 | 3 |
lib/clckwrkbdgr/time.py | umi0451/dotfiles | 2 | 13278 | <gh_stars>1-10
from __future__ import absolute_import
from time import *
import datetime
import six
def get_utctimestamp(mtime=None): # pragma: no cover
""" Converts local mtime (timestamp) to integer UTC timestamp.
If mtime is None, returns current UTC time.
"""
if mtime is None:
if six.PY2:
return int((date... | 2.75 | 3 |
configutator/__version.py | innovate-invent/configutator | 0 | 13279 | <filename>configutator/__version.py
__version__ = [1, 0, 2]
__versionstr__ = '.'.join([str(i) for i in __version__])
if __name__ == '__main__':
print(__versionstr__) | 1.804688 | 2 |
tests/integration/test_serialise.py | csiro-easi/eo-datasets | 0 | 13280 | from pathlib import Path
from typing import Dict
from eodatasets3 import serialise
from .common import assert_same, dump_roundtrip
def test_valid_document_works(tmp_path: Path, example_metadata: Dict):
generated_doc = dump_roundtrip(example_metadata)
# Do a serialisation roundtrip and check that it's still ... | 2.265625 | 2 |
src/plot/plot-bb/plot_methods.py | bcrafton/speed_read | 0 | 13281 |
import numpy as np
import matplotlib.pyplot as plt
####################
def merge_dicts(list_of_dicts):
results = {}
for d in list_of_dicts:
for key in d.keys():
if key in results.keys():
results[key].append(d[key])
else:
results[key] = [d[key]]... | 2.484375 | 2 |
build/getversion.py | timgates42/subversion | 3 | 13282 | #!/usr/bin/env 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
#... | 2.640625 | 3 |
redis/p02-vote/client/c02.py | JoseIbanez/testing | 1 | 13283 | #!/usr/bin/python
import httplib
import random
import argparse
import sys
#Get options
parser = argparse.ArgumentParser(
description='Testing vote app')
parser.add_argument(
'-port',
type=int,
help='port of server',
default=8000)
parser.add_argument(
'-host',
... | 2.890625 | 3 |
vm_manager/vm_functions/admin_functionality.py | NeCTAR-RC/bumblebee | 3 | 13284 | from uuid import UUID
import django_rq
import logging
from datetime import datetime, timezone, timedelta
from django.core.mail import mail_managers
from django.db.models import Count
from django.db.models.functions import TruncDay
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcu... | 1.898438 | 2 |
scripts/af_renameSG.py | aaronfang/small-Scripts | 1 | 13285 | <filename>scripts/af_renameSG.py
# rename shading group name to material name but with SG ended
import pymel.core as pm
import re
selSG = pm.ls(sl=True,fl=True)
for SG in selSG:
curMat = pm.listConnections(SG,d=1)
for mat in curMat:
if pm.nodeType(mat) == 'blinn' or pm.nodeType(mat) == 'lambert':
... | 2.453125 | 2 |
conftest.py | berpress/MT5WT | 0 | 13286 | import pytest
from common.common import NETTING_ACCOUNT
from fixture.application import Application
@pytest.fixture(scope="session")
def app(request):
base_url = request.config.getoption("--base_url")
fixture = Application(base_url)
fixture.wd.maximize_window()
fixture.wd.implicitly_wait(10)
yield... | 2 | 2 |
chapps/tests/test_util/test_util.py | easydns/chapps | 1 | 13287 | <filename>chapps/tests/test_util/test_util.py
"""CHAPPS Utilities Tests
.. todo::
Write tests for :class:`~chapps.util.VenvDetector`
"""
import pytest
from pprint import pprint as ppr
from chapps.util import AttrDict, PostfixPolicyRequest
pytestmark = pytest.mark.order(1)
class Test_AttrDict:
def test_attr_... | 2.5 | 2 |
PMMH/apps/game/map/admin.py | metinberkkaratas/ProjectMagic-MightofHeroes | 0 | 13288 | <gh_stars>0
from django.contrib import admin
from .models import Map
admin.site.register(Map)
| 1.117188 | 1 |
models/__init__.py | pgodet/star_flow | 10 | 13289 | <reponame>pgodet/star_flow<filename>models/__init__.py
from . import pwcnet
from . import pwcnet_irr
from . import pwcnet_occ_joint
from . import pwcnet_irr_occ_joint
from . import tr_flow
from . import tr_features
from . import IRR_PWC
from . import IRR_PWC_occ_joint
from . import STAR
PWCNet = pwcne... | 1.351563 | 1 |
blkdiscovery/blkid.py | jaredeh/blkdiscovery | 0 | 13290 | import os
import re
#hack for python2 support
try:
from .blkdiscoveryutil import *
except:
from blkdiscoveryutil import *
class Blkid(BlkDiscoveryUtil):
def parse_line(self,line):
details = {}
diskline = line.split(':',1)
if len(diskline) < 2:
return
path = disk... | 2.6875 | 3 |
cosa/analyzers/bmc_ltl.py | zsisco/CoSA | 52 | 13291 | <reponame>zsisco/CoSA
# Copyright 2018 <NAME>
#
# Licensed under the modified BSD (3-clause BSD) License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.... | 1.882813 | 2 |
paleomix/nodes/bowtie2.py | MikkelSchubert/paleomix | 33 | 13292 | #!/usr/bin/python3
#
# Copyright (c) 2012 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | 2.015625 | 2 |
modu_01/04_02_lab.py | 94JuHo/study_for_deeplearning | 0 | 13293 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #내 맥북에서 발생되는 에러를 없애기 위한 코드
import tensorflow as tf
#using matrix
x_data = [[73., 80., 75.], [93., 88., 93.,], [89., 91., 90.], [96., 98., 100.], [73., 66., 70.]]
y_data = [[152.], [185.], [180.], [196.], [142.]]
X = tf.placeholder(tf.float32, shape=[None, 3]) #n개의 데... | 2.9375 | 3 |
freezer/storage/fslike.py | kwu83tw/freezer | 141 | 13294 | <reponame>kwu83tw/freezer
# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# 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... | 1.960938 | 2 |
rubicon/repository/asynchronous/s3.py | gforsyth/rubicon | 0 | 13295 | from rubicon.repository.asynchronous import AsynchronousBaseRepository
from rubicon.repository.utils import json
class S3Repository(AsynchronousBaseRepository):
"""The asynchronous S3 repository uses `asyncio` to
persist Rubicon data to a remote S3 bucket.
S3 credentials can be specified via environment ... | 2.78125 | 3 |
examples/multidata_example.py | zssherman/ACT | 62 | 13296 | <reponame>zssherman/ACT
"""
==================================================
Example on how to plot multiple datasets at a time
==================================================
This is an example of how to download and
plot multiple datasets at a time.
.. image:: ../../multi_ds_plot1.png
"""
import act
import m... | 2.890625 | 3 |
gpdata.py | masenov/bullet | 0 | 13297 | flat_x = x.flatten()
flat_y = y.flatten()
flat_z = z.flatten()
size = flat_x.shape[0]
filename = 'landscapeData.h'
open(filename, 'w').close()
f = open(filename, 'a')
f.write('#include "LinearMath/btScalar.h"\n#define Landscape01VtxCount 4\n#define Landscape01IdxCount 4\nbtScalar Landscape01Vtx[] = {\n')
for i in r... | 2.46875 | 2 |
samples/create_project.py | zuarbase/server-client-python | 470 | 13298 | ####
# This script demonstrates how to use the Tableau Server Client
# to create new projects, both at the root level and how to nest them using
# parent_id.
#
#
# To run the script, you must have installed Python 3.6 or later.
####
import argparse
import logging
import sys
import tableauserverclient as TSC
def cre... | 2.90625 | 3 |
tests/test_threading.py | nmandery/rasterio | 1,479 | 13299 | <filename>tests/test_threading.py
from threading import Thread
import time
import unittest
import rasterio as rio
from rasterio.env import get_gdal_config
class TestThreading(unittest.TestCase):
def test_multiopen(self):
"""
Open a file from different threads.
Regression test for issue #... | 2.5 | 2 |