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 |
|---|---|---|---|---|---|---|
test/crossrunner/compat.py | BluechipSystems/thrift | 0 | 900 | import os
import sys
if sys.version_info[0] == 2:
_ENCODE = sys.getfilesystemencoding()
def path_join(*args):
bin_args = map(lambda a: a.decode(_ENCODE), args)
return os.path.join(*bin_args).encode(_ENCODE)
def str_join(s, l):
bin_args = map(lambda a: a.decode(_ENCODE), l)
b = s.decode(_ENCODE)... | 2.96875 | 3 |
test/test_vom.py | usamaahmadkhan/vpp | 0 | 901 | #!/usr/bin/env python
""" VAPI test """
import unittest
import os
import signal
from framework import VppTestCase, running_extended_tests, \
VppTestRunner, Worker
@unittest.skipUnless(running_extended_tests(), "part of extended tests")
class VOMTestCase(VppTestCase):
""" VPP Object Model Test """
def te... | 2.265625 | 2 |
locations/spiders/tesco.py | bealbrown/allhours | 0 | 902 | <reponame>bealbrown/allhours<filename>locations/spiders/tesco.py
import json
import re
import scrapy
from locations.hourstudy import inputoutput
DAYS = {
'mo': 'Mo',
'tu': 'Tu',
'we': 'We',
'fr': 'Fr',
'th': 'Th',
'sa': 'Sa',
'su': 'Su',
}
class TescoSpider(scrapy.Spider):
name = "tesco"... | 2.8125 | 3 |
astropy/table/serialize.py | tacaswell/astropy | 1 | 903 | from importlib import import_module
import re
from copy import deepcopy
from collections import OrderedDict
from astropy.utils.data_info import MixinInfo
from .column import Column
from .table import Table, QTable, has_info_class
from astropy.units.quantity import QuantityInfo
__construct_mixin_classes = ('astropy.t... | 2.3125 | 2 |
UVa 573 - The Snail/sample/main.py | tadvi/uva | 1 | 904 | '''
Created on Jun 18, 2013
@author: <NAME>
All rights reserved.
'''
import time
from multiprocessing.pool import Pool
parallelSolve = False
infinity = 1 << 30
def solve(par):
H, U, D, F = par
day = 0
amountRise = U
currH = 0
while True:
amountRise = U * (1 - 0.01 * F * day)
cur... | 3.15625 | 3 |
scibert/models/text_classifier.py | tomhoper/scibert | 1,143 | 905 | from typing import Dict, Optional, List, Any
import torch
import torch.nn.functional as F
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.modules import FeedForward, TextFieldEmbedder, Seq2SeqEncoder
from allennlp.nn import InitializerApplicator, RegularizerApplicator
from al... | 2.59375 | 3 |
plugins/template/tasks.py | crotwell/cmd2 | 469 | 906 | #
# -*- coding: utf-8 -*-
"""Development related tasks to be run with 'invoke'"""
import os
import pathlib
import shutil
import invoke
TASK_ROOT = pathlib.Path(__file__).resolve().parent
TASK_ROOT_STR = str(TASK_ROOT)
# shared function
def rmrf(items, verbose=True):
"""Silently remove a list of directories or ... | 2.28125 | 2 |
scripts/automation/trex_control_plane/interactive/trex/examples/stl/ndr_plugin.py | timgates42/trex-core | 956 | 907 | import stl_path
class MyNDRPlugin():
def __init__(self):
pass
def pre_iteration(self, finding_max_rate, run_results=None, **kwargs):
""" Function ran before each iteration.
:parameters:
finding_max_rate: boolean
Indicates whether we are running ... | 2.953125 | 3 |
homeassistant/components/epsonworkforce/sensor.py | maexono/home-assistant | 2 | 908 | """Support for Epson Workforce Printer."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_MONITORED_CONDITIONS
from homeassistant.exceptions import PlatformNotReady
import homeassistant.... | 2.28125 | 2 |
bot/exts/help_channels/_cog.py | bast0006/bot | 0 | 909 | <gh_stars>0
import asyncio
import logging
import random
import typing as t
from datetime import datetime, timezone
from operator import attrgetter
import discord
import discord.abc
from discord.ext import commands
from bot import constants
from bot.bot import Bot
from bot.exts.help_channels import _caches, _channel, ... | 2.65625 | 3 |
code/menu/screens/shopmenu.py | LordZagreus/LodeRunner | 1 | 910 | <filename>code/menu/screens/shopmenu.py
import os
import math
import random
import time
from code.menu.menu import Menu
from code.tools.eventqueue import EventQueue
from code.tools.xml import XMLParser
from code.utils.common import coalesce, intersect, offset_rect, log, log2, xml_encode, xml_decode, translate_rgb... | 2.890625 | 3 |
lib/bridgedb/runner.py | liudonghua123/bridgedb | 0 | 911 | # -*- coding: utf-8 ; test-case-name: bridgedb.test.test_runner -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>>
# please also see AUTHORS file
# :copyright: (c) 2007-2015, The Tor Project, Inc.
# (c) 2007-2015, all entities... | 1.859375 | 2 |
wce_triage/ops/create_image_runner.py | pfrouleau/wce-triage-v2 | 3 | 912 | <filename>wce_triage/ops/create_image_runner.py
#!/usr/bin/env python3
#
# Create disk image
#
import re, sys, traceback
from .tasks import task_fetch_partitions, task_refresh_partitions, task_mount, task_remove_persistent_rules, task_remove_logs, task_fsck, task_shrink_partition, task_expand_partition, task_unmount
... | 2.1875 | 2 |
batch_processing_dataflow/play_store_flow.py | KeeplerIO/meetup-hands-on-gcp-2019 | 1 | 913 | <gh_stars>1-10
import argparse
import logging
import apache_beam as beam
from apache_beam.io import WriteToBigQuery
from apache_beam.io import ReadFromText, WriteToText
from apache_beam.options.pipeline_options import PipelineOptions
class ProcessCSV(beam.DoFn):
def process(self, element, *args, **kwargs):
... | 2.40625 | 2 |
backend/main/server/resources/Message.py | Manotomo-Alliance-Support-Squad/WWS | 0 | 914 | from flask import request
from flask_jwt import jwt_required
from flask_restful import Resource
from main.server import app, cache, db
from main.server.models import Message, MessageSchema
messages_schema = MessageSchema(many=True)
message_schema = MessageSchema()
@app.after_request
def add_header(response):
r... | 2.4375 | 2 |
demos/chicken_pasta/chicken_pasta.py | icaros-usc/wecook | 15 | 915 | <filename>demos/chicken_pasta/chicken_pasta.py
#!/usr/bin/env python3
import rospy
from wecook.msg import ActionMsg, TaskMsg, SceneMsg, ObjectMsg, ContainingMsg, AgentMsg
def talker():
pub = rospy.Publisher('WeCookDispatch', TaskMsg, queue_size=10)
rospy.init_node('wecook_chicken_pasta', anonymous=True)
... | 2.140625 | 2 |
volttron/platform/vip/agent/subsystems/heartbeat.py | rmay-intwine/volttron | 0 | 916 | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2017, Battelle Memorial Institute.
#
# 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... | 1.210938 | 1 |
datasets/experimental/ni_superalloys/Ni_superalloy.py | kyawlin/smlb | 0 | 917 | """Ni-Superalloy dataset.
Scientific Machine Learning Benchmark
A benchmark of regression models in chem- and materials informatics.
2019, <NAME>, Citrine Informatics.
See class NiSuperalloyDataset for details.
"""
import os
import json
import zipfile
from typing import List, Optional, Tuple, Union
import numpy as ... | 2.71875 | 3 |
metricbeat/module/postgresql/test_postgresql.py | SHolzhauer/beats | 4 | 918 | import metricbeat
import os
import pytest
import sys
import unittest
class Test(metricbeat.BaseTest):
COMPOSE_SERVICES = ['postgresql']
def common_checks(self, output):
# Ensure no errors or warnings exist in the log.
self.assert_no_logged_warnings()
for evt in output:
t... | 2.15625 | 2 |
pytorch_lightning/accelerators/cpu_backend.py | ozen/pytorch-lightning | 0 | 919 | <gh_stars>0
# Copyright The PyTorch Lightning team.
#
# 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... | 2.0625 | 2 |
books/admin.py | aurphillus/Django-Library-Completed | 0 | 920 | from django.contrib import admin
from books.models import Genre, Author, Book, TBR
# Register your models here.
admin.site.register(Genre)
admin.site.register(Author)
admin.site.register(Book)
admin.site.register(TBR) | 1.585938 | 2 |
rabbitmq/tests/common.py | jfmyers9/integrations-core | 1 | 921 | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
from packaging import version
from datadog_checks.base.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(HERE))
... | 1.867188 | 2 |
st2common/st2common/util/pack.py | timgates42/st2 | 0 | 922 | <reponame>timgates42/st2
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/license... | 1.570313 | 2 |
module1-introduction-to-sql/query.py | jrslagle/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 923 |
# Look at the charactercreator_character table
# GET_CHARACTERS = """
# SELECT *
# FROM charactercreator_character;
# """
# How many total Characters are there? (302)
TOTAL_CHARACTERS = """
SELECT COUNT(*) as number_of_characters
FROM charactercreator_character;
"""
# How many of each specific subclass?
# TOTAL_SUBC... | 3.4375 | 3 |
pixelproject/grid.py | MickaelRigault/pixelproject | 0 | 924 | <filename>pixelproject/grid.py
#! /usr/bin/env python
#
import warnings
import numpy as np
UNIT_SQUARE = np.asarray([[0,0],[0,1],[1,1],[1,0]])-0.5
from propobject import BaseObject
from shapely import geometry
import pandas
import geopandas
# ======================= #
# #
# Functions ... | 2.9375 | 3 |
numpy/lib/format.py | AnirudhDagar/numpy | 5 | 925 | """
Binary serialization
NPY format
==========
A simple format for saving numpy arrays to disk with the full
information about them.
The ``.npy`` format is the standard binary file format in NumPy for
persisting a *single* arbitrary NumPy array on disk. The format stores all
of the shape and dtype information necess... | 3.390625 | 3 |
gva/data/validator/is_valid_enum.py | gva-jjoyce/gva_data | 0 | 926 | <gh_stars>0
"""
Enumerator Test
"""
from typing import Any
class is_valid_enum():
"""
Test if a variable is on a list of valid values
"""
__slots__ = ('symbols')
def __init__(self, **kwargs):
"""
-> "type": "enum", "symbols": ["up", "down"]
symbols: list of allowed values ... | 3.28125 | 3 |
events_page/app.py | los-verdes/lv-event-pagenerator | 0 | 927 | #!/usr/bin/env python
from zoneinfo import ZoneInfo
import flask
from dateutil.parser import parse
from flask_assets import Bundle, Environment
from logzero import logger, setup_logger
from webassets.filter import get_filter
from config import cfg
from apis import calendar as gcal
setup_logger(name=__name__)
app =... | 2.375 | 2 |
bin/focus_scan.py | desihub/desicmx | 3 | 928 | <gh_stars>1-10
#!/usr/bin/env python
import astropy.io.fits as fits
import numpy as np
import os
import matplotlib.pyplot as plt
import argparse
def _fname(expid, night,
basedir='/n/home/datasystems/users/ameisner/reduced/focus',
ccds=False):
fname = basedir + '/' + night + '/' + st... | 2.25 | 2 |
proto_3/ddq/topics/logics/topic.py | jadnohra/connect | 0 | 929 | from typing import List
from ddq.taxonomy.reference import Reference
from ddq.topics.topic import Topic
class Logic(Topic):
def references(self) -> List[Reference]:
return [
Reference("Classical and Nonclassical Logics",
[("Eric", "Schechter")])
]
| 2.4375 | 2 |
pythia/utils/logger.py | abhiskk/pythia | 2 | 930 | # Copyright (c) Facebook, Inc. and its affiliates.
import base64
import logging
import os
import sys
from tensorboardX import SummaryWriter
from pythia.utils.distributed_utils import is_main_process
from pythia.utils.general import (ckpt_name_from_core_args,
foldername_from_config_ov... | 1.796875 | 2 |
sdk/python/pulumi_google_native/healthcare/v1beta1/user_data_mapping.py | AaronFriel/pulumi-google-native | 44 | 931 | <reponame>AaronFriel/pulumi-google-native
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Unio... | 1.8125 | 2 |
_doc/sphinxdoc/source/conf.py | Jerome-maker/ensae_teaching_cs | 0 | 932 | import sys
import os
import sphinx_rtd_theme
source_path = os.path.normpath(
os.path.join(
os.path.abspath(
os.path.split(__file__)[0])))
try:
from conf_base import *
except ImportError:
sys.path.append(source_path)
from conf_base import *
html_theme = 'sphinx_rtd_theme'
html_the... | 1.960938 | 2 |
dolfyn/adv/api.py | lkilcher/dolfyn-light | 0 | 933 | <filename>dolfyn/adv/api.py
"""
This module contains routines for reading and working with adv
data. It contains:
+-----------------------------------+-----------------------------------------+
| Name | Description |
+===================================+========... | 2.265625 | 2 |
server/api/migrations/0002_auto_20201011_1053.py | ShahriarDhruvo/WebTech_Assignment2 | 0 | 934 | # Generated by Django 3.1.2 on 2020-10-11 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='task',
name='author',
field=m... | 1.523438 | 2 |
flink-ai-flow/lib/notification_service/notification_service/mongo_event_storage.py | lisy09/flink-ai-extended | 1 | 935 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 2.015625 | 2 |
src/unicon/plugins/confd/csp/__init__.py | tahigash/unicon.plugins | 1 | 936 | __author__ = "<NAME> <<EMAIL>>"
from unicon.plugins.confd import ConfdServiceList, ConfdConnection, ConfdConnectionProvider
from .statemachine import CspStateMachine
from .settings import CspSettings
from . import service_implementation as csp_svc
class CspServiceList(ConfdServiceList):
def __init__(self):
... | 1.804688 | 2 |
setup.py | rrwen/search_google | 15 | 937 | # -*- coding: utf-8 -*-
from setuptools import setup
import search_google as package
def readme():
with open('README.rst') as f:
return ''.join(f.readlines()[11:])
setup(
name=package.__name__,
version=package.__version__,
description=package.__description__,
long_description=readme(),
author=pack... | 1.265625 | 1 |
setup.py | chearon/macpack | 24 | 938 | <filename>setup.py
import setuptools
import os
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst') if os.path.exists('README.md') else ''
except ImportError:
description = ''
setuptools.setup(
name = 'macpack',
packages = setuptools.find_packages(),
version = '1.0.3',
description = '... | 1.796875 | 2 |
WEEK2/day5/scripts/06_NB_Challenges_Isolines.py | tizon9804/SS2017 | 0 | 939 | import vtk
# Read the file (to test that it was written correctly)
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName("../data/wind_image.vti")
reader.Update()
print(reader.GetOutput())
# Convert the image to a polydata
imageDataGeometryFilter = vtk.vtkImageDataGeometryFilter()
imageDataGeometryFilter.SetInputCon... | 2.421875 | 2 |
mbbl_envs/mbbl/env/gym_env/invertedPendulum.py | hbutsuak95/iv_rl | 9 | 940 | <reponame>hbutsuak95/iv_rl
"""
# -----------------------------------------------------------------------------
# @brief:
# Tingwu: reset the reward function so that it's more similar to the one
# defined in GYM
# -----------------------------------------------------------------------------
"""
import nump... | 2.359375 | 2 |
ACME/visdom/__init__.py | mauriziokovacic/ACME | 3 | 941 | from .bar import *
from .create_session import *
from .image import *
from .line import *
from .mesh import *
from .pie import *
from .text import *
from .VisdomFigure import *
from .VisdomScene import *
| 1.09375 | 1 |
web/pingpongpiweb.py | andrewdyersmith/pingpongpi | 0 | 942 | <gh_stars>0
# Ping Pong Pi web UI running on flask.
# Uses zmq to speak to daemon controlling screen.
from flask import Flask, render_template, appcontext_tearing_down, request
from multiprocessing import Process, Queue
from multiprocessing.connection import Client
import atexit
import time
import zmq
app = Flask(__n... | 2.5625 | 3 |
watcher/tests/decision_engine/strategy/strategies/test_base.py | ajaytikoo/watcher | 64 | 943 | # -*- encoding: utf-8 -*-
# Copyright (c) 2019 European Organization for Nuclear Research (CERN)
#
# 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.710938 | 2 |
main.py | BenG49/sudoku | 0 | 944 | <filename>main.py
from sudoku import Sudoku
def main():
s = Sudoku.parse(
'''
-------------
| |2 | |
| | 6 |4 3|
| | 5| 7 |
-------------
| 7 | 2|8 |
|51 | 4|9 |
| 9| 3| |
-------------
| | 9| |
| 2| | 98|
| 83|1 |2 |
-------------
'''
)
print(s)
print(s.s... | 3 | 3 |
test/test_sampler.py | pfnet-research/autogbt-alt | 83 | 945 | <filename>test/test_sampler.py<gh_stars>10-100
import numpy as np
import pandas as pd
from autogbt.sampler import MajorityUnderSampler
def _test_sample(y):
sampler = MajorityUnderSampler()
idx = sampler.sample(y, 40000, 3.0)
assert len(idx) == 40000
assert y[idx].sum() == 10000
def test_sample_with_... | 2.5625 | 3 |
experiment/diabetes/accuracy_info.py | leandro-santiago/bloomwisard | 2 | 946 | import numpy as np
import sys
from timeit import default_timer as timer
sys.path.append("../../")
from core import wnn
from encoding import thermometer
from encoding import util
#Load Diabetes data
base_path = "../../dataset/diabetes/"
#2/3 Test
bits_encoding = 20
train_data, train_label, test_data, test_label, data... | 2.203125 | 2 |
PyGame/pygame1/tutorial1/startercode.py | hoppfull/Legacy-Python | 0 | 947 | <reponame>hoppfull/Legacy-Python
from pygamehelper import *
from pygame import *
from pygame.locals import *
from vec2d import *
from random import uniform
import numpy as np
class Starter(PygameHelper):
def __init__(self):
self.w, self.h = 800, 600
PygameHelper.__init__(self, size=(self.w, self.h... | 2.8125 | 3 |
main.py | thewhiteninja/twitch-recorder | 0 | 948 | import glob
import os
import sys
import utils
from recorder import StreamRec
OUTDIR = ""
def parse_args(a):
global OUTDIR
i = 1
while i < len(a):
if a[i] in ["-h", "--help", "/?"]:
usage()
if a[i] in ["-d", "--dir"]:
OUTDIR = a[i + 1]
i += 1
i ... | 2.921875 | 3 |
karbor-1.3.0/karbor/policies/protectables.py | scottwedge/OpenStack-Stein | 0 | 949 | # Copyright (c) 2017 Huawei Technologies Co., Ltd.
# 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
#
# ... | 1.765625 | 2 |
router.example.py | unyo/uhpackage | 0 | 950 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# routers are dictionaries of URL routing parameters.
#
# For each request, the effective router is:
# the built-in default base router (shown below),
# updated by the BASE router in routes.py routers,
# updated by the app-specific router in routes.py routers (if an... | 2.359375 | 2 |
notebooks/2018.11.09 Meeting.py | costrouc/uarray | 0 | 951 | <reponame>costrouc/uarray
#%%
from uarray.core import *
#%%
s = Scalar(Int(10))
#%%
@operation
def Always(a: T) -> CCallableUnary[T, CContent]:
...
#%%
register(Call(Always(w("a")), w("idx")), lambda a, idx: a)
#%%
a_ten = Always(s)
#%%
s = Sequence(Int(10), a_ten)
| 2.015625 | 2 |
var/spack/repos/builtin/packages/py-black/package.py | dwstreetNNL/spack | 0 | 952 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyBlack(PythonPackage):
"""Black is the uncompromising Python code formatter. By using it,... | 1.804688 | 2 |
store/adminshop/templatetags/admin_extras.py | vallemrv/my_store_test | 0 | 953 | <filename>store/adminshop/templatetags/admin_extras.py
# -*- coding: utf-8 -*-
# @Author: <NAME> <valle>
# @Date: 27-Aug-2017
# @Email: <EMAIL>
# @Filename: admin_extras.py
# @Last modified by: valle
# @Last modified time: 02-Feb-2018
# @License: Apache license vesion 2.0
from django import template
from django.... | 1.9375 | 2 |
doc/tutorial/using_gpu_solution_1.py | abdalazizrashid/Theano-PyMC | 0 | 954 | <gh_stars>0
#!/usr/bin/env python
# Aesara tutorial
# Solution to Exercise in section 'Using the GPU'
# 1. Raw results
import numpy as np
import aesara
import aesara.tensor as tt
aesara.config.floatX = "float32"
rng = np.random
N = 400
feats = 784
D = (
rng.randn(N, feats).astype(aesara.config.floatX),
... | 2.46875 | 2 |
chainercv/transforms/bbox/translate_bbox.py | souravsingh/chainercv | 1 | 955 | def translate_bbox(bbox, y_offset=0, x_offset=0):
"""Translate bounding boxes.
This method is mainly used together with image transforms, such as padding
and cropping, which translates the left top point of the image from
coordinate :math:`(0, 0)` to coordinate
:math:`(y, x) = (y_{offset}, x_{offse... | 3.671875 | 4 |
behave/features/environment.py | ministryofjustice/cla-end-to-end-tests | 1 | 956 | <gh_stars>1-10
import os
from configparser import ConfigParser
from helper.helper_web import get_browser
def before_all(context):
config = ConfigParser()
print((os.path.join(os.getcwd(), 'setup.cfg')))
my_file = (os.path.join(os.getcwd(), 'setup.cfg'))
config.read(my_file)
# Reading the browser ... | 2.3125 | 2 |
recipe_organizer/gui/recipe_list/recipe_source.py | j-sommer/recipe-organizer | 0 | 957 | <filename>recipe_organizer/gui/recipe_list/recipe_source.py
from pathlib import Path
from tkinter import Frame, Label
from recipe_organizer.events.event import Event, EventType
from recipe_organizer.events.event_observer import EventObserver
from recipe_organizer.events.event_publisher import EventPublisher
from recip... | 2.390625 | 2 |
var/spack/repos/builtin/packages/spot/package.py | xiki-tempula/spack | 1 | 958 | <filename>var/spack/repos/builtin/packages/spot/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Spot(AutotoolsPackage):
"""Spot... | 1.273438 | 1 |
0.py | itspuneet/itspuneet | 0 | 959 | <reponame>itspuneet/itspuneet
k=0
while k!=1:
print(k)
k+=1
| 3.109375 | 3 |
jss_figures_replication_script.py | Cole-vJ/AdvEMDpy | 0 | 960 |
# ________
# /
# \ /
# \ /
# \/
import random
import textwrap
import emd_mean
import AdvEMDpy
import emd_basis
import emd_utils
import numpy as np
import pandas as pd
import cvxpy as cvx
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from ... | 2.015625 | 2 |
GPT-distributed.py | wenhuchen/LogicNLG | 141 | 961 | <filename>GPT-distributed.py<gh_stars>100-1000
import argparse
import logging
import torch
import torch.nn.functional as F
import numpy as np
from torch import nn
from torch.autograd import Variable
from transformers import GPT2Config
from transformers import GPT2LMHeadModel, GPT2Tokenizer, BertTokenizer
from DataLoade... | 2.40625 | 2 |
bentoml/saved_bundle/loader.py | niits/BentoML | 3,451 | 962 | <gh_stars>1000+
# Copyright 2019 Atalaya Tech, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed... | 1.898438 | 2 |
migrations/versions/0158_remove_rate_limit_default.py | cds-snc/notifier-api | 41 | 963 | """
Revision ID: 0158_remove_rate_limit_default
Revises: 0157_add_rate_limit_to_service
Create Date: 2018-01-09 14:33:08.313893
"""
import sqlalchemy as sa
from alembic import op
revision = "0158_remove_rate_limit_default"
down_revision = "0157_add_rate_limit_to_service"
def upgrade():
op.execute("ALTER TABLE ... | 1.460938 | 1 |
gen-post.py | younghk/younghk.netlify.com | 0 | 964 | <gh_stars>0
import os
import errno
from datetime import datetime
print("Generating A New Post\n")
post_name = input('Input Post Name: ')
date_time = datetime.now()
date_time_dir = date_time.strftime("%Y-%m-%d")
date_time_post = date_time.strftime("%Y-%m-%d %H:%M:%S")
p_name = post_name.replace(" ","-")
p_name = p_n... | 3.0625 | 3 |
rmgpy/reactionTest.py | Lyle-zhang/RMG-Py | 0 | 965 | #!/usr/bin/env python
# encoding: utf-8 -*-
"""
This module contains unit tests of the rmgpy.reaction module.
"""
import numpy
import unittest
from external.wip import work_in_progress
from rmgpy.species import Species, TransitionState
from rmgpy.reaction import Reaction
from rmgpy.statmech.translation import Transl... | 2.328125 | 2 |
backend/core/api_urls.py | albeiks/omaralbeik.com | 10 | 966 | <filename>backend/core/api_urls.py
from django.conf.urls import url, include
from core.routers import OptionalTrailingSlashRouter
from blog import views as blogViews
from snippets import views as snippetsViews
from projects import views as projectsViews
from tags import views as tagsViews
from contents import views as... | 2.078125 | 2 |
python/video_ADG.py | alexberndt/mobile-AGV-optimization | 2 | 967 | """
closed-loop MILP solved to determine optimal ordering defined by ADG
"""
import sys
import yaml
import time
import matplotlib.colors as mcolors
import matplotlib
import matplotlib.pyplot as plt
import random
import logging
import time
import networkx as nx
import csv
import statistics as stat
import os
import ... | 2.25 | 2 |
tests/model/test_guest.py | bcurnow/rfid-security-svc | 0 | 968 | <reponame>bcurnow/rfid-security-svc
import pytest
from unittest.mock import patch
import rfidsecuritysvc.model.guest as model
from rfidsecuritysvc.model.color import Color
from rfidsecuritysvc.model.guest import Guest
from rfidsecuritysvc.model.sound import Sound
from rfidsecuritysvc.exception import SoundNotFoundErro... | 2.4375 | 2 |
ice/consoles.py | reavessm/Ice | 578 | 969 | <reponame>reavessm/Ice<gh_stars>100-1000
# encoding: utf-8
import os
import roms
def console_roms_directory(configuration, console):
"""
If the user has specified a custom ROMs directory in consoles.txt then
return that.
Otherwise, append the shortname of the console to the default ROMs
directory given by... | 3.4375 | 3 |
clue/c3.py | dumpmemory/roformer-v2 | 44 | 970 | <filename>clue/c3.py
#! -*- coding:utf-8 -*-
# CLUE评测
# c3多项选择阅读理解
# 思路:每个选项分别与问题、篇章拼接后打分排序
import json
import numpy as np
from snippets import *
from bert4keras.backend import keras
from bert4keras.snippets import sequence_padding, DataGenerator
from bert4keras.snippets import open
from bert4keras.snippets import tru... | 2.65625 | 3 |
tools/perf/contrib/oop_raster/oop_raster.py | zipated/src | 2,151 | 971 | <filename>tools/perf/contrib/oop_raster/oop_raster.py
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from benchmarks import smoothness,thread_times
import page_sets
from telemetry import benchmark
# pylin... | 2 | 2 |
logpy/util.py | mrocklin/logpy | 1 | 972 | <reponame>mrocklin/logpy<filename>logpy/util.py
import itertools as it
from toolz.compatibility import range, map, iteritems
def hashable(x):
try:
hash(x)
return True
except TypeError:
return False
def transitive_get(key, d):
""" Transitive dict.get
>>> from logpy.util import ... | 2.6875 | 3 |
index.py | rinocloud/rinobot-plugin-shift | 0 | 973 | import rinobot_plugin as bot
import numpy as np
def main():
# lets get our parameters and data
filepath = bot.filepath()
data = bot.loadfile(filepath)
# now comes the custom plugin logic
shift = bot.get_arg('shift', type=float, required=True)
index = bot.index_from_args(data)
data[index] =... | 2.34375 | 2 |
gluon/contrib/memcache/__init__.py | arsfeld/fog-web2py | 0 | 974 | from gluon.contrib.memcache.memcache import Client
import time
"""
examle of usage:
cache.memcache=MemcacheClient(request,[127.0.0.1:11211],debug=true)
"""
import cPickle as pickle
import thread
locker = thread.allocate_lock()
def MemcacheClient(*a, **b):
locker.acquire()
if not hasattr(MemcacheClient, '__... | 2.671875 | 3 |
test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py | aas-core-works/aas-core-csharp-codegen | 0 | 975 | <filename>test_data/parse/unexpected/symbol_table/inheritance_from_non_class/meta_model.py
class Some_enum(Enum):
some_literal = "some_literal"
class Something(Some_enum):
pass
class Reference:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
associate_ref_with(Reference)
| 2.078125 | 2 |
deepcut/deepcut.py | wannaphong/deepcut | 17 | 976 | #!/usr/bin/env python
# encoding: utf-8
import numbers
import os
import re
import sys
from itertools import chain
import numpy as np
import scipy.sparse as sp
import six
import pickle
from .model import get_convo_nn2
from .stop_words import THAI_STOP_WORDS
from .utils import CHAR_TYPES_MAP, CHARS_MAP, create_feature_... | 2.5 | 2 |
spconv/utils/__init__.py | djiajunustc/spconv | 0 | 977 | # Copyright 2021 <NAME>
#
# 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, softw... | 1.320313 | 1 |
build/android/gyp/lint.py | justremotephone/android_external_chromium_org | 2 | 978 | <gh_stars>1-10
#!/usr/bin/env python
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Android's lint tool."""
import optparse
import os
import sys
from xml.dom import minidom
from util impo... | 2.1875 | 2 |
clif/pybind11/generator.py | snu5mumr1k/clif | 0 | 979 | <filename>clif/pybind11/generator.py
# Copyright 2020 Google 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 app... | 2.125 | 2 |
advent/model/discriminator.py | ChristopheGraveline064/ADVENT | 1 | 980 | from torch import nn
def get_fc_discriminator(num_classes, ndf=64):
return nn.Sequential(
nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negative_slope=0.2, inplace=True),
nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1),
nn.LeakyReLU(negat... | 2.5 | 2 |
spyder/dependencies.py | aglotero/spyder | 2 | 981 | <reponame>aglotero/spyder
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Module checking Spyder runtime dependencies"""
import os
# Local imports
from spyder.utils import programs
class Depe... | 2.53125 | 3 |
setup.py | jasperhyp/Chemprop4SE | 1 | 982 | import os
from setuptools import find_packages, setup
# Load version number
__version__ = None
src_dir = os.path.abspath(os.path.dirname(__file__))
version_file = os.path.join(src_dir, 'chemprop', '_version.py')
with open(version_file, encoding='utf-8') as fd:
exec(fd.read())
# Load README
with ope... | 1.46875 | 1 |
mars/tensor/indexing/slice.py | HarshCasper/mars | 2 | 983 | # Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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 a... | 1.851563 | 2 |
ftplugin/python/python/pyflakes/pyflakes/checker.py | leewckk/vim.configuration | 0 | 984 | """
Main module.
Implement the central Checker class.
Also, it models the Bindings and Scopes.
"""
import __future__
import doctest
import os
import sys
PY2 = sys.version_info < (3, 0)
PY32 = sys.version_info < (3, 3) # Python 2.5 to 3.2
PY33 = sys.version_info < (3, 4) # Python 2.5 to 3.3
PY34 = ... | 2.265625 | 2 |
AutoScreenShot.py | infinyte7/Auto-Screenshot | 3 | 985 | # Project Name: Auto Screenshot
# Description: Take screenshot of screen when any change take place.
# Author: Mani (Infinyte7)
# Date: 26-10-2020
# License: MIT
from pyscreenshot import grab
from PIL import ImageChops
import os
import time
import subprocess, sys
from datetime import datetime
import tkinter as tk
fr... | 3.21875 | 3 |
rqalpha/utils/logger.py | HaidongHe/rqalpha | 1 | 986 | <reponame>HaidongHe/rqalpha
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以... | 1.523438 | 2 |
salt/modules/oracle.py | wikimedia/operations-debs-salt | 0 | 987 | # -*- coding: utf-8 -*-
'''
Oracle DataBase connection module
:mainteiner: <NAME> <<EMAIL>>
:maturity: new
:depends: cx_Oracle
:platform: all
:configuration: module provide connections for multiple Oracle DB instances.
**OS Environment**
.. code-block:: text
ORACLE_HOME: path to oracle product
... | 2.328125 | 2 |
tests/test_std.py | ashwini-balnaves/python-consul | 469 | 988 | <filename>tests/test_std.py
import base64
import operator
import struct
import time
import pytest
import six
import consul
import consul.std
Check = consul.Check
class TestHTTPClient(object):
def test_uri(self):
http = consul.std.HTTPClient()
assert http.uri('/v1/kv') == 'http://127.0.0.1:8500... | 2.28125 | 2 |
Q58/sol.py | shivamT95/projecteuler | 0 | 989 | <filename>Q58/sol.py
import math
def is_prime(n):
if n == 1:
return False
if n % 2 == 0 and n > 2:
return False
return all(n % i for i in range(3, int(math.sqrt(n))+1,2))
tot = 1
dia = 0
for side_length in range(3,100001,2):
hi = side_length**2
for i in range(4):
if is_prime(hi-i*side_length+... | 3.390625 | 3 |
lesson_07/02.py | alexartwww/geekbrains | 0 | 990 | task = '''
Реализовать проект расчета суммарного расхода ткани на производство одежды.
Основная сущность (класс) этого проекта — одежда, которая может иметь
определенное название. К типам одежды в этом проекте относятся пальто и костюм.
У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма)... | 2.5625 | 3 |
core/fanarttvapi.py | SchadLucas/pyscrape | 0 | 991 | <gh_stars>0
import urllib2
import json
import time
from core.helpers.decorator import Cached
from core.helpers.config import config
from core.helpers.logger import log, LogLevel
@Cached
def __request(request):
log('Send Fanart Request: ' + request.replace(config.fanart.api_key, 'XXX'), 'DEBUG')
headers = {'A... | 2.453125 | 2 |
metrics.py | AndreasLH/Image-Colourization | 1 | 992 | <reponame>AndreasLH/Image-Colourization
from math import log10, sqrt
import cv2
import numpy as np
def PSNR(original, compressed):
'''
Calculates the Peak signal to noise ratio between a ground truth image and predicted image.
see https://www.geeksforgeeks.org/python-peak-signal-to-noise-ratio-psnr/
... | 3.5625 | 4 |
redirink/insights/tests/test_models.py | Egor4ik325/redirink | 0 | 993 | <filename>redirink/insights/tests/test_models.py
"""Test insight model is working the way it should."""
import pytest
from django.core.exceptions import ValidationError
from django.db import DataError
from .factories import InsightFactory
pytestmark = pytest.mark.django_db
def test_create_new_fake_visitor_instance_... | 2.265625 | 2 |
scripts/list-all-test-suites-for-ci.py | uc-cdis/gen3-qa | 4 | 994 | <reponame>uc-cdis/gen3-qa<gh_stars>1-10
import os
import subprocess
test_suites_that_cant_run_in_parallel = [
"test-apis-dbgapTest", # not thread-safe
"test-google-googleDataAccessTest", # not thread-safe
"test-google-googleServiceAccountRemovalTest", # not th... | 1.632813 | 2 |
querybook/server/lib/query_executor/all_executors.py | set5think/querybook | 1 | 995 | from lib.utils.plugin import import_plugin
from .base_executor import parse_exception
from .executors.hive import HiveQueryExecutor
from .executors.presto import PrestoQueryExecutor
from .executors.sqlalchemy import (
MysqlQueryExecutor,
DruidQueryExecutor,
SqliteQueryExecutor,
SnowflakeQueryExecutor,
... | 2.109375 | 2 |
bot/exts/info/pypi.py | MrGrote/bot | 1 | 996 | <filename>bot/exts/info/pypi.py
import itertools
import random
import re
from contextlib import suppress
from disnake import Embed, NotFound
from disnake.ext.commands import Cog, Context, command
from disnake.utils import escape_markdown
from bot.bot import Bot
from bot.constants import Colours, NEGATIVE_REPLIES, Red... | 2.328125 | 2 |
app/decorators.py | GinnyGaga/lanbo | 0 | 997 | from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
<<<<<<< HEAD
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if not current_user.can(permission):
... | 2.34375 | 2 |
jnpy/experiments/Qt/pyqtgraph_tutorial/codeloop_org_materials/c4_drawing_curves.py | jojoquant/jnpy | 5 | 998 | <reponame>jojoquant/jnpy
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Datetime : 2019/11/14 上午2:26
# @Author : Fangyang
# @Software : PyCharm
import sys
from PyQt5.QtWidgets import QApplication
import pyqtgraph as pg
import numpy as np
app = QApplication(sys.argv)
x = np.arange(1000)
y = np.random.normal(size... | 2.296875 | 2 |
compyle/api.py | nauaneed/compyle | 0 | 999 | from .array import Array, wrap
from .ast_utils import (get_symbols, get_assigned,
get_unknown_names_and_calls, has_return, has_node)
from .config import get_config, set_config, use_config, Config
from .cython_generator import (
CythonGenerator, get_func_definition
)
from .ext_module import E... | 1.46875 | 1 |