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 |
|---|---|---|---|---|---|---|
commit_data.py | iwangjian/ByteCup2018 | 80 | 45700 | <filename>commit_data.py
import os
import argparse
def process_decoded(args):
if not os.path.exists(args.result_dir):
os.mkdir(args.result_dir)
punct = ["/", "`", "+", "-", ";", "-lrb-", "-rrb-", "``", "|", "~", """]
for file in os.listdir(args.decode_dir):
file_path = os.path.join(ar... | 2.859375 | 3 |
ping_dashboard/services/location_service.py | eli-cobler/PingDashboard | 0 | 45701 | <filename>ping_dashboard/services/location_service.py
from typing import List
import os
from sqlalchemy.orm.exc import NoResultFound
import sqlalchemy.sql
from ping_dashboard.data import db_session
from ping_dashboard.data.location import Location
def init_db():
top_folder = os.path.dirname(__file__)
rel_file ... | 2.796875 | 3 |
src/main/python/server/encoder.py | eecevit-tgm/flask-vue-heroku | 0 | 45702 | <gh_stars>0
"""
.. module:: encoder
:synopsis: Restful User-Service image encoder
.. moduleauthor:: <NAME> <github.com/eecevit-tgm>
"""
import base64
def encode(file):
"""
A base64 encoder for Images
:param file: Path of the Image which should be encoded. !IMPORTANT! file ending e.g.: eecevit.jpg
... | 2.140625 | 2 |
helpers/python/sqid/classes.py | tp1-SpZIaPvBD/sqid | 54 | 45703 | <reponame>tp1-SpZIaPvBD/sqid
import logging
from collections import defaultdict
from . import sparql, queries, statistics
logger = logging.getLogger(__name__)
def update_class_records():
"""Updates statistics for classes."""
logger.info('Fetching class ids and labels for '
'classes with dire... | 2.3125 | 2 |
src/helpers/config.py | daavofficial/Aural | 0 | 45704 |
VERSION = "0.0.2"
VERSION_GUI = "0.0.2"
VERSION_CUI = "0.0.0"
VERSION_AUDIOCABLE = "0.0.2"
VERSION_ROUTE = "0.0.2"
VERSION_SETINGS = "0.0.1"
CALLBACK_AUDIOCABLE_SELECTED = None
CALLBACK_ROUTE_SELECTED = None
SETTINGS = None
CONFIGURATION = None
PATH_ROOT = ""
PATH_SETTINGS = "" | 1.09375 | 1 |
2020/2/2b.py | sishtiaq/aoc | 0 | 45705 | <filename>2020/2/2b.py<gh_stars>0
import functools
from input import input
def split(l):
lohi, letter, s = l.split(' ')
lo,hi = lohi.split('-')
letter = letter.split(':')[0]
return (int(lo),int(hi),letter,s)
def check(lo,hi,letter,string):
l1 = string[lo-1]
l2 = string[hi-1]
# either l1... | 3.75 | 4 |
antinuke/antinuke.py | AAA3A-AAA3A/AAA3A-cogs | 1 | 45706 | from .AAA3A_utils.cogsutils import CogsUtils # isort:skip
from redbot.core import commands # isort:skip
from redbot.core.i18n import Translator, cog_i18n # isort:skip
from redbot.core.bot import Red # isort:skip
import discord # isort:skip
import typing # isort:skip
from typing import List, Optional, Tuple,... | 2.171875 | 2 |
cornflow-dags/DAG/roadef/solvers/PeriodicMIP.py | ggsdc/corn | 2 | 45707 | <reponame>ggsdc/corn
from .RoutesGenerator import RoutesGenerator
from .MIPModel import MIPModel
from collections import defaultdict, OrderedDict
from pytups import SuperDict, TupList
from datetime import datetime
import pulp as pl
import pickle
import json
import itertools
class PeriodicMIP(MIPModel):
def __init... | 2.171875 | 2 |
gochan/browser.py | morin4ga/gochan | 1 | 45708 | import webbrowser
from subprocess import Popen
from typing import List
from gochan.config import BROWSER_PATH
def open_link(url: str):
if BROWSER_PATH is None:
webbrowser.open(url)
else:
Popen([BROWSER_PATH, url])
def open_links(urls: List[str]):
if BROWSER_PATH is None:
for url... | 2.625 | 3 |
api/alembic/versions/2710366d3d68_add_domain_s_ip.py | dodobox-s-team/dodobox-ext | 0 | 45709 | """Add domain's ip
Revision ID: 2710366d3d68
Revises: 43b883c483b4
Create Date: 2021-12-22 03:19:46.487228
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '2<PASSWORD>'
down_revision = '43b883c483b4'
branch_labels = None
depends_on = None
def upgrade():
... | 1.484375 | 1 |
tests/test_images.py | Muhammad-R/flaskr | 2 | 45710 | <reponame>Muhammad-R/flaskr<filename>tests/test_images.py
import os
import shutil
import pytest
from flask import url_for
from werkzeug.datastructures import FileStorage
from flaskr import images
from flaskr.db import get_db
class ExampleImage(object):
def __init__(self):
self.filename = "example.png"
... | 2.53125 | 3 |
lints/reserved_words.py | yrom1/sqlint | 0 | 45711 | <reponame>yrom1/sqlint
"""SQL reserved words style checker.
The rule: Use uppercase for SQL reserved keywords.
"""
import re
from typing import List, Tuple
from lints.common import remove_multiline_comments, remove_dashdash_comments, remove_punctuation, remove_spacing, find_lowercase_sql_keywords
def main(query: st... | 3.109375 | 3 |
vstutils/api/meta.py | FloThinksPi-Forks/vstutils | 36 | 45712 | <gh_stars>10-100
from rest_framework.metadata import SimpleMetadata
from . import fields, serializers
class VSTMetadata(SimpleMetadata):
label_lookup = SimpleMetadata.label_lookup
origin_mapping = SimpleMetadata.label_lookup.mapping
mapping_fields = {
fields.FileInStringField: 'file',
fie... | 1.65625 | 2 |
install_packages/ip_vtktudoss.py | nagyistoce/devide.johannes | 1 | 45713 | # Copyright (c) <NAME>, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# added -fpermissive to CMAKE_CXX_FLAGS to workaround g++ 4.3 compile
# problem on the included CPT code. We were getting "changes meaning
# of" errors as documented in
# http://stupefydeveloper.blogspot.com/2008/11/c-name-lookup-c... | 1.8125 | 2 |
envs.py | webdizz/expansion-ai | 0 | 45714 | import gym
from gym import wrappers
from gym.envs.registration import register
from config import Params
# register ExpansionAi gym env
register(
id='ExpansionAi-v0',
entry_point='expansionai_env:ExpansionAiEnv',
)
def create_expansionai_env(env_id, video=False, params=Params()):
gym.spec(env_id)._kwarg... | 2.109375 | 2 |
train.py | Rayaction/ECO-paddle | 0 | 45715 | <reponame>Rayaction/ECO-paddle<gh_stars>0
import argparse
import ast
import logging
import os
import numpy as np
import paddle.fluid as fluid
from config import parse_config, merge_configs, print_configs
from model import ECO
from reader import KineticsReader
logging.root.handlers = []
FORMAT = '[%(leve... | 2.359375 | 2 |
opexebo/tests/test_general/test_upsample.py | simon-ball/opexebo | 4 | 45716 | <reponame>simon-ball/opexebo<filename>opexebo/tests/test_general/test_upsample.py<gh_stars>1-10
""" Tests for upsampling"""
import numpy as np
import pytest
from opexebo.general import upsample as func
print("=== tests_upsampling ===")
###############################################################################
... | 2.09375 | 2 |
detectors/__init__.py | bc-jcarlson/secret-bridge | 152 | 45717 | from detectors.detectsecrets import DetectSecrets
from detectors.gitsecrets import GitSecrets
from detectors.trufflehog import TruffleHog
# TODO: Turn this into a registry to match the notifiers pattern?
AvailableDetectors = {
'detect-secrets': DetectSecrets,
'git-secrets': GitSecrets,
'trufflehog': Truffle... | 1.46875 | 1 |
release/stubs.min/System/Windows/Controls/__init___parts/ItemContainerGenerator.py | YKato521/ironpython-stubs | 0 | 45718 | <filename>release/stubs.min/System/Windows/Controls/__init___parts/ItemContainerGenerator.py
class ItemContainerGenerator(
object,
IRecyclingItemContainerGenerator,
IItemContainerGenerator,
IWeakEventListener,
):
""" Generates the user interface (UI) on behalf of its host,such as an�System.Win... | 2.171875 | 2 |
Scripts/simulation/apartments/situations/neighbor_group_hangout.py | velocist/TS4CheatsInfo | 0 | 45719 | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\apartments\situations\neighbor_group_hangout.py
# Compiled at: 2018-11-17 02:17:10
# Size of source ... | 1.476563 | 1 |
drf_routers/routers.py | tranvietanh1991/drf-routers | 1 | 45720 | <filename>drf_routers/routers.py
"""
Routers for nested resources.
Example:
# urls.py
from rest_framework_nested import routers
router = routers.SimpleRouter()
router.register(r'domains', DomainViewSet)
domains_router = routers.NestedSimpleRouter(router, r'domains', lookup='domain')
domains... | 2.421875 | 2 |
WhittlerTests/WhittlerProgramTests.py | NeilJustice/whittler | 0 | 45721 | import inspect
import os
import sys
import unittest
from unittest.mock import call, patch
from Whittler import File, Process, WhittlerProgram
from WhittlerTests import Random, UnitTester
testNames = [
'test_get_module_ReturnsWhittlerProgramModule',
'test_make_whittler_filepath_for_command_ReturnsHomeSlashDot... | 2.609375 | 3 |
algorithms/etc.py | kupns-aka-kupa/alg_p_strc | 0 | 45722 | def xor_reverse(iterable):
lenght = len(iterable)
i = 0
while i < lenght // 2:
iterable[i] ^= iterable[lenght - i - 1]
iterable[lenght - i - 1] ^= iterable[i]
iterable[i] ^= iterable[lenght - i - 1]
i += 1
return iterable
| 3.484375 | 3 |
cdd/pkg_utils.py | SamuelMarks/doctrans | 2 | 45723 | <filename>cdd/pkg_utils.py
"""
pkg_utils
"""
from distutils.sysconfig import get_python_lib
def relative_filename(filename, remove_hints=tuple()):
"""
Remove all the paths which are not relevant
:param filename: Filename
:type filename: ```str```
:param remove_hints: Hints as to what can be rem... | 2.765625 | 3 |
awards/models.py | shamanu4/test_project | 1 | 45724 | from django.db import models
from django.utils.translation import ugettext as _
from ckeditor_uploader.fields import RichTextUploadingField
class RangAward(models.Model):
title = models.CharField(verbose_name=_('Заголовок'), max_length=60)
volume = models.DecimalField(verbose_name=_('Объём'), max_digits=10, d... | 1.90625 | 2 |
Scripts/CEBatchLayerFBXExport.py | Holisticnature/CityEngineToolKit-GeodesignToolkit | 8 | 45725 | # --------------------------------
# Name: CEBatchFBXExport.py
# Purpose: Batch export of CE layers to game engine importable FBXs.
# Current Owner: <NAME>
# Last Modified: 7/12/2017
# Copyright: (c) Co-Adaptive
# CityEngine Vs: 2017
# Python Version: 2.7
# License
# Copyright 2015 <NAME>
#
# Licensed under the Apa... | 2.234375 | 2 |
vel/rl/commands/record_movie_command.py | tigerwlin/vel | 51 | 45726 | <gh_stars>10-100
import cv2
import numpy as np
import os.path
import pathlib
import sys
import torch
import tqdm
import typing
from vel.api import ModelConfig, TrainingInfo
from vel.api.base import Storage, ModelFactory
from vel.rl.api.base import EnvFactory
from vel.openai.baselines.common.atari_wrappers import Frame... | 2.203125 | 2 |
python_work/Chapter2_Exercises/exe7_name_cases.py | Elektra-2/python_crash_course_2nd | 1 | 45727 | nome = "\tCarolina"
nome = nome.strip()
print(nome) | 2.234375 | 2 |
src/ggrc_workflows/migrations/versions/20140814213948_c8263593153_add_object_approval_flag_to_.py | sbilly/ggrc-core | 1 | 45728 | <filename>src/ggrc_workflows/migrations/versions/20140814213948_c8263593153_add_object_approval_flag_to_.py
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Add object_approval flag to taskgrouptask
Revision ID: c8263593153
Revises: <PASSWORD>
Create ... | 1.15625 | 1 |
src/azure-cli/azure/cli/command_modules/apim/operations/api_policy/params.py | kevinhillinger/azure-cli | 0 | 45729 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 1.765625 | 2 |
game.py | SajjadBrohi/snake-game-python | 1 | 45730 | import tkinter as tk
import random
class Controller(object):
"""
A class to control the movement of the snake in the game
"""
def __init__(self, screen):
"""
Binds the arrow keys to the game canvas.
Parameters:
screen (Canvas): The canvas for the Snake game.
... | 4 | 4 |
src/netvlad.py | YuanPJ/acoustic-probing-model | 0 | 45731 | # coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_pl... | 2.671875 | 3 |
fhir/resources/tests/test_specimendefinition.py | cstoltze/fhir.resources | 144 | 45732 | <reponame>cstoltze/fhir.resources
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/SpecimenDefinition
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes # noq... | 1.664063 | 2 |
luno_python/base_client.py | jayuuza/luno-python | 0 | 45733 | <filename>luno_python/base_client.py
import json
import platform
import requests
import six
try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
from . import VERSION
from .error import APIError
DEFAULT_BASE_URL = 'https://api.mybitx.com'
DEFAULT_TIMEOUT = 10
PYTHON_... | 2.84375 | 3 |
Interview/MergeKLists/main.py | matthewwen/interview-practice | 1 | 45734 | <filename>Interview/MergeKLists/main.py
# Definition for singly-linked list.
import heapq
from typing import List
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeKLists(self, lists: List[ListNode]) -> ListNode:
head, curr ... | 3.859375 | 4 |
cogs/utils/classes/LohiEmbed.py | Sendouc/lohi-python | 0 | 45735 | # https://discordapp.com/developers/docs/resources/channel#embed-limits
import discord
from ..lists import (
weapons_english_internal,
abilities_short_to_emoji,
top_500_emoji,
weapons_to_emoji,
)
# Cheers to Lean
class LohiEmbed:
def __init__(
self,
title="\uFEFF",
descrip... | 2.75 | 3 |
data/reanalysis_data/download-scripts/download_uwind_sigma995.py | Skye777/transformer | 0 | 45736 | <gh_stars>0
#!/usr/bin/env python
#################################################################
# Python Script to retrieve 164 online Data files of 'ds131.2',
# total 4.49G. This script uses 'requests' to download data.
#
# Highlight this script by Select All, Copy and Paste it into a file;
# make the file executa... | 3.140625 | 3 |
tests/images/test_image_utils.py | danjampro/panoptes-utils | 3 | 45737 | <filename>tests/images/test_image_utils.py
import os
import tempfile
import numpy as np
import pytest
from astropy.nddata import Cutout2D
from panoptes.utils import images as img_utils
from panoptes.utils import error
def test_crop_data():
ones = np.ones((201, 201))
assert ones.sum() == 40401.
cropped01... | 2.34375 | 2 |
tool/script/read_bus.py | outech-robotic/code | 7 | 45738 | import argparse
import asyncio
import json
import sys
import time
from google.protobuf import json_format
from google.protobuf.message import DecodeError
from highlevel.adapter.socket.isotp import ISOTPSocketAdapter, ISOTPAddress
from proto.gen.python.outech_pb2 import BusMessage
t_last = time.time()
async def mai... | 2.375 | 2 |
mbzextract/plugins/skeleton/module_name.py | davidschlachter/mbzextract | 2 | 45739 | """Basic template for creating new plugins.
A basic plugin should have at the very minimum a class called 'moodle_module',
with an '__init__(self, **kwargs)' method that populates a table in the temporary
backup database with the structure of the module it is attempting to extract, a
parse method that parses the backu... | 2.75 | 3 |
roles/importer/files/importer/checkpointR8x/get_config.py | NilsPur/firewall-orchestrator | 0 | 45740 | <reponame>NilsPur/firewall-orchestrator
#!/usr/bin/python3
import json, argparse
import requests, requests.packages
import time, logging
import sys
sys.path.append(r"/usr/local/fworch/importer")
import common, getter
requests.packages.urllib3.disable_warnings() # suppress ssl warnings only
parser = argparse.Argumen... | 1.820313 | 2 |
twitter_credentials.py | abrahes12-day/Web-Scraping-Tweepy | 0 | 45741 | # Variables that contain the user credentials to access Twitter API.
ACCESS_TOKEN = "<KEY>"
ACCESS_TOKEN_SECRET = "<KEY>"
CONSUMER_KEY = "iRwp1I7vH0cBoWNIO5w0uxURN"
CONSUMER_SECRET = "<KEY>"
| 1.804688 | 2 |
lib/losses.py | CompVis/behavior-driven-video-synthesis | 14 | 45742 | import torch
from torch import nn
from torch.nn import functional as F
from lib.utils import bounding_box_batch, get_member
from models.pose_discriminator import MIDisc, MIDiscConv1
from lib.utils import toggle_grad
from torch.optim import Adam
from collections import namedtuple
VGGOutput = namedtuple(
"VGGOutput... | 2.03125 | 2 |
syft/frameworks/torch/tensors/__init__.py | amitkarn3/PythnSyft | 1 | 45743 | # Do not change the import sequence it can cause deadlock
from . import interpreters
from . import decorators
__all__ = ["decorators", "interpreters"]
| 1.054688 | 1 |
npc_engine/services/text_generation/__init__.py | npc-engine/npc-engine | 12 | 45744 | <filename>npc_engine/services/text_generation/__init__.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""Text generation API services.
This module implements specific models and wraps them under
the common interface for loading and inference.
Example:
```
from npc_engine.services.text_generation impor... | 1.953125 | 2 |
polyadicqml/circuitML.py | JoaquinKeller/polyadicQML | 19 | 45745 | """Implementation of circuit for ML
"""
from numpy import pi, random, zeros_like, zeros, log2
class circuitML():
"""Abstract Quantum ML circuit interface.
Provides a unified interface to run multiple parametric circuits with
different input and model parameters, agnostic of the backend, implemented
in... | 3.421875 | 3 |
mb_24x256_512.py | MarksBench/mb_24x256_512 | 0 | 45746 | '''
mb_24x256_512.py
Very Simple MicroPython module/driver for Microchip 24x256 and 24x512 I2C EEPROM
Author: <EMAIL>
Version: 0.1, 2021-06-04
**NOTE(1): There is no guarantee that this software will work in the way you expect (or at all).
**Use at your own risk.
**NOTE(2): This driver is intended to b... | 3.15625 | 3 |
titan/components/customizes/test.py | DeSireFire/titans | 17 | 45747 | from titan.components import Base
class Test(Base):
@staticmethod
def default():
print("test")
| 1.710938 | 2 |
src/permedcoe/utils/artifact.py | PerMedCoE/permedcoe | 0 | 45748 | import os
from permedcoe.core.constants import SEPARATOR
DO_NOT_PARSE = (".pyc", ".def", ".sif")
PARSING_KEY = "NEW_NAME"
PARSING_PATH = "/PATH/TO/"
def adapt_name(name, path):
""" Replace recursively into the given path they keyword with name.
Like a set recursively.
Args:
name (str): Name to p... | 3.203125 | 3 |
api/utils/custom_jwt.py | CaspianSoft-TR/Sober | 0 | 45749 | <filename>api/utils/custom_jwt.py
import datetime
from rest_framework_jwt.settings import api_settings
from api.serializers import UserSerializer
def jwt_response_payload_handler(token, user=None, request=None):
""" Custom response payload handler.
This function controlls the custom payload after login or t... | 2.65625 | 3 |
embench-iot/pylib/embench_core.py | Hecmay/llvm-pass-skeleton | 2 | 45750 | <gh_stars>1-10
#!/usr/bin/env python3
# Common python procedures for use across Embench.
# Copyright (C) 2017, 2019 Embecosm Limited
#
# Contributor: <NAME> <<EMAIL>>
# Contributor: <NAME> <<EMAIL>>
#
# This file is part of Embench.
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Embench common procedures.
This ve... | 2.140625 | 2 |
pedsnetdcc/dict_logging.py | PEDSnet/pedsnetdcc | 0 | 45751 | import collections
import datetime
import json
import logging
import time
# Python 2 compatibility
try:
from logging.handlers import QueueHandler
except ImportError:
from logutils.queue import QueueHandler
# Python 2/3 hack for stringify, below
try:
unicode
except NameError:
unicode = str
nocolor =... | 2.765625 | 3 |
calculations.py | jordanrmerrick/Hackathon2020 | 0 | 45752 | from math import radians, cos, sqrt
from dbi import select_from_zip, select_from_id, create_connection
from api import *
import usaddress
def distance(lat1, lon1, lat2, lon2):
x = radians(lon1 - lon2) * cos(radians((lat1 + lat2) / 2))
y = radians(lat1 - lat2)
# 6371000 is the radius of earth, used to tria... | 3.515625 | 4 |
app/migrations/0004_auto_20210528_2005.py | ThebiggunSeeoil/VIS-MASTER | 0 | 45753 | # Generated by Django 3.0 on 2021-05-28 20:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_auto_20210528_1759'),
]
operations = [
migrations.AlterField(
model_name='site',
name='stati... | 1.53125 | 2 |
GWTPhotoAlbum/scripts/genDeploymentPackage.py | jecki/gwtphotoalbum | 2 | 45754 | <filename>GWTPhotoAlbum/scripts/genDeploymentPackage.py<gh_stars>1-10
#!/usr/bin/python
#
# Copyright 2008 <NAME> (<EMAIL>).
#
# 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.... | 2.421875 | 2 |
fuzzy_toolbox/sugeno/sugeno_.py | jdvelasq/pyfuzzy | 0 | 45755 | <gh_stars>0
"""
Sugeno fuzzy model
==============================================================================
"""
import matplotlib.pyplot as plt
import numpy as np
import progressbar
from sklearn.linear_model import LinearRegression
class Sugeno:
"""Creates a Sugeno inference system.
Args:
num... | 3.078125 | 3 |
pyrhessys/read_shellscript.py | DavidChoi76/pyRHESSys | 0 | 45756 | import os
import shutil
import pkg_resources
delineation_d8 = pkg_resources.resource_filename(
__name__, 'sh_code/grass_delineation_d8.sh')
delineation_dinf = pkg_resources.resource_filename(
__name__, 'sh_code/grass_delineation_dinf.sh')
spatial_hierarchy = pkg_resources.resource_filename(
__n... | 1.65625 | 2 |
mindinsight/datavisual/data_transform/graph/optimized_graph.py | mindspore-ai/mindinsight | 216 | 45757 | <reponame>mindspore-ai/mindinsight<gh_stars>100-1000
# Copyright 2021 Huawei Technologies Co., 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... | 1.859375 | 2 |
src/pyGLMHMM/GLMHMMSymbLik.py | aslansd/pyGLMHMM | 3 | 45758 | import numpy as np
def _GLMHMM_symb_lik(emit_w, X_trial, y_trial):
num_states = emit_w.shape[0]
num_emissions = emit_w.shape[1]
# Put the stimulus (X_trial) in a different format for easier multiplication
X_trial_mod = np.tile(np.reshape(X_trial, (1, 1, X_trial.shape[0], X_trial.shape[1]), ... | 2.265625 | 2 |
pytouch/trainingmachine.py | aboutNisblee/PyTouch | 3 | 45759 | import copy
import logging
from datetime import datetime, timedelta
from collections import namedtuple
from blinker import Signal
__all__ = [
'Event',
'TrainingMachineObserver',
'TrainingMachine',
]
logger = logging.getLogger(__name__)
class Event(dict):
""" Events that are expected by the process... | 2.578125 | 3 |
descriptor-packages/tools/charm-generator/setup.py | ayoubbargueoui1996/osm-devops | 0 | 45760 | <gh_stars>0
# Copyright 2019 Whitestack, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.421875 | 1 |
Athos/RandomForests/parse_graphviz_to_ezpc_input.py | kanav99/EzPC | 221 | 45761 | """
Authors: <NAME>, <NAME>.
Copyright:
Copyright (c) 2021 Microsoft Research
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, ... | 2.234375 | 2 |
ann_three_body/learning/util.py | mruijzendaal/python_ann_three_body | 0 | 45762 | def split_data(input, output, validation_percentage=0.1):
num_sets = output.shape[0]
num_validation = int(num_sets * validation_percentage)
return (input[:-num_validation], output[:-num_validation]), (input[-num_validation:], output[-num_validation:])
| 2.71875 | 3 |
bin/udp_client.py | ingenarius/LoxBerry-Plugin-synology-v2 | 0 | 45763 | #!/usr/bin/python3
import socket
UDP_IP="127.0.0.1"
UDP_PORT=5000
MESSAGE="Snapshot: 2"
print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)
print("message: \"%s\"" % MESSAGE)
sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
sock.sendto( MESSAGE.encode('ascii'), (UDP_IP, UDP_PORT) )
| 3 | 3 |
include/tclap-1.4.0-rc1/tests/test90.py | SpaceKatt/cpp-cli-poc | 62 | 45764 | #!/usr/bin/python
import simple_test
simple_test.test("test29", ["-h", ])
| 1.0625 | 1 |
Recipes/Recipes/web_app/models.py | petel3/Softuni_education | 2 | 45765 | <gh_stars>1-10
from django.db import models
class Recipe(models.Model):
TITLE_MAX_LEN=30
INGREDIENTS_MAX_LEN=250
title=models.CharField(
max_length=TITLE_MAX_LEN,
)
image_url=models.URLField()
description=models.TextField()
ingredients=models.CharField(
max_length=INGREDI... | 2.21875 | 2 |
pluto/control/controllable/commands.py | chalant/zipline-core | 0 | 45766 | import abc
from protos.clock_pb2 import (
SESSION_START,
SESSION_END,
MINUTE_END,
BEFORE_TRADING_START
)
from pluto.coms.utils import conversions
class StopExecution(Exception):
pass
class Command(abc.ABC):
__slots__ = ['_request', '_controllable']
def __init__(self, controllable, reque... | 2.375 | 2 |
mudi/plotting/__init__.py | getzlab/mudi | 1 | 45767 | <filename>mudi/plotting/__init__.py
from .qc import adata_qc, adata_qc_grid
from .de import volcano_plot
from .enrich import pw_enrichment
from .misc import plot_barplot_a_by_b
| 0.972656 | 1 |
mapillary_tools/process_geotag_properties.py | martinskans/mapillary_tools | 0 | 45768 | <gh_stars>0
import logging
import os
import typing as T
import json
import datetime
import jsonschema
import piexif
from . import image_log, types, error, uploader
from .exif_write import ExifEdit
from .geo import normalize_bearing
from .geotag import (
geotag_from_exif,
geotag_from_gopro,
geotag_from_nme... | 2.25 | 2 |
Exercise04/4-38.py | ywyz/IntroducingToProgrammingUsingPython | 0 | 45769 | '''
@Date: 2019-08-26 20:55:29
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors: ywyz
@LastEditTime: 2019-08-26 20:56:13
'''
import turtle
import math
x1, y1, width1, height1 = eval(
input("Enter r1's center x- and y-coordinates,width, and height: "))
x2, y2, width2, height2 = eval... | 3.640625 | 4 |
tests/test_coverage.py | mixedconnections/showprocess | 0 | 45770 | import unittest
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import processparser as pp
class PstTestCase(unittest.TestCase):
"""This class represents the pst test case"""
def test_ps_output(self):
ps_command = 'ps -e l'
column_header, processes = pp.get... | 2.640625 | 3 |
examples/profiler_sgp4.py | danielk333/SORTS | 4 | 45771 | <reponame>danielk333/SORTS<filename>examples/profiler_sgp4.py
#!/usr/bin/env python
'''
Profiling SGP4
======================
'''
import numpy as np
from sorts.profiling import Profiler
from sorts.propagator import SGP4
p = Profiler()
prop = SGP4(
settings = dict(
out_frame='TEME',
),
profiler ... | 2.09375 | 2 |
Main.py | ytyaru/GitHub.Language.Database.Insert.201703161053 | 1 | 45772 | import LanguageSource
import Inserter
class Main(object):
def __init__(self):
self.source = LanguageSource.LanguageSource()
self.inserter = Inserter.Inserter()
def Run(self):
self.inserter.Insert(self.source.Get())
if __name__ == "__main__":
m = Main()
m.Run()
| 2.53125 | 3 |
programmers/lv3/find_route.py | mrbartrns/swacademy_structure | 0 | 45773 | # 길찾기 게임
import heapq
class Node:
def __init__(self, data, idx):
self._data = data
self._idx = idx
self.left = None
self.right = None
@property
def data(self):
return self._data
@data.setter
def data(self, data):
self._data = data
@property
... | 3.65625 | 4 |
Day 16 - Intermediate - Object Oriented Programming (OOP)/01_PROJECT_oop_coffee_machine/coffee_machine.py | not-lucky/100_Days_of_Code_-_The_Complete_Python_Pro_Bootcamp_for_2022 | 0 | 45774 | from menu import Menu
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
coffee_maker = CoffeeMaker()
money_machine = MoneyMachine()
menu = Menu()
def coffee_machine():
while True:
choose = input(f'What would you like: ({menu.get_items()})').lower()
if choose == 'report'... | 3.359375 | 3 |
0122_BestTimeToBuyAndSellStock(2).py | yingzhuo1994/LeetCode | 0 | 45775 | class Solution:
def maxProfit(self, prices: List[int]) -> int:
# 1st solution
# O(n) time | O(1) space
profit = 0
start = prices[0]
end = start
for i, price in enumerate(prices):
if price >= end and i < len(prices) - 1:
end = price
... | 2.96875 | 3 |
parsec/commands/workflows/extract_workflow_from_history.py | erasche/parsec | 8 | 45776 | import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('extract_workflow_from_history')
@click.argument("history_id", type=str)
@click.argument("workflow_name", type=str)
@click.option(
"--job_ids",
help="Optional list of job IDs... | 2.40625 | 2 |
pucadmin/secondments/migrations/0001_initial.py | JobDoesburg/PUC-admin | 0 | 45777 | # Generated by Django 3.2.5 on 2021-11-26 20:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
("organisations", "0004_auto_20210718_1147"),
("schools", "0004_auto_20211126_2107"),
]
o... | 1.835938 | 2 |
lib/utils/stat.py | shikorab/DSG | 9 | 45778 | <gh_stars>1-10
class Stat:
def __init__(self):
self.sum = {}
self.sum_square = {}
self.count = {}
def add(self, key, value):
self.count[key] = self.count.get(key, 0) + 1
self.sum[key] = self.sum.get(key, 0.0) + value
self.sum_square[key] = self.sum_square.get(ke... | 3.484375 | 3 |
main_menu.py | Steven-Wilson/pyweek25 | 0 | 45779 | <reponame>Steven-Wilson/pyweek25
import model
import pyxelen
from view import *
from sounds import *
from utils import *
def set_scene(state, **kwargs):
return state.set(scene=state.scene.set(**kwargs))
def selection(state):
return state.scene.selection
def select_next(state):
state = set_scene(state... | 2.5 | 2 |
workflow/models.py | uktrade/approval-firebreak | 1 | 45780 | <reponame>uktrade/approval-firebreak<gh_stars>1-10
import uuid
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.db import models
from django.urls import reverse
from django_fsm import FSMField, transition
from chartofaccount.mode... | 1.882813 | 2 |
generated-libraries/python/netapp/net/net_ifgrp_info.py | radekg/netapp-ontap-lib-get | 2 | 45781 | <filename>generated-libraries/python/netapp/net/net_ifgrp_info.py<gh_stars>1-10
from netapp.netapp_object import NetAppObject
class NetIfgrpInfo(NetAppObject):
"""
Network interface group information
When returned as part of the output, all elements of this typedef
are reported, unless limited by a set... | 2.390625 | 2 |
gui_rest_client/menu_handlers.py | devdo-eu/macau | 0 | 45782 | import gui_rest_client.common as common
import pyglet
def on_key_release_factory(window):
"""
Function used to create specific on_key_release method for window property of MenuWindow object.
:param window: MenuWindow object
:return: functor with prepared on_key_release method
"""
def functor(s... | 2.640625 | 3 |
core/SSD/vgg.py | calmisential/SkeNetch | 1 | 45783 | import torch
import torch.nn as nn
import torch.nn.functional as F
class VGG(nn.Module):
def __init__(self, use_bn=False):
super(VGG, self).__init__()
self.conv1 = VGG._make_conv_block(3, 64, 3, 1, 1, use_bn)
self.conv2 = VGG._make_conv_block(64, 64, 3, 1, 1, use_bn)
self.pool1 = n... | 2.5625 | 3 |
tivac_power_JCA0224D01/GERBERS/2.-creado desde flatcam/procesa_gcode.py | fgallud/kicad | 0 | 45784 | import re
velocidad_xy=200 #[mm/minuto]
velocidad_z=10 #[mm/minuto]
fichero_nombres=['agujeros_broca0.6.gcode',
'agujeros_broca0.8.gcode',
'agujeros_broca1.1.gcode']
def procesa_fichero(fichero_nombre):
fichero=open(fichero_nombre,'r')
texto_todo=fichero.read()
fichero.c... | 2.59375 | 3 |
var/spack/repos/builtin/packages/py-iocapture/package.py | player1537-forks/spack | 11 | 45785 | <gh_stars>10-100
# Copyright 2013-2022 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 PyIocapture(PythonPackage):
"""Capture stdout, stderr easily."""
hom... | 1.570313 | 2 |
tobias/tobiasfyi/settings/base.py | tobias-fyi/tobiasfyi | 0 | 45786 | """
tobias.fyi :: Base Django settings
"""
import os
import dj_database_url
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
# === Application definition === #
INSTALLED_APPS = [
"home",
"search",
"blog",
"navigator",
"wagtail.co... | 1.679688 | 2 |
stubs.min/System/__init___parts/Object.py | ricardyn/ironpython-stubs | 1 | 45787 | class Object:
"""
Supports all classes in the .NET Framework class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.
object()
"""
def __delattr__(self,*args):
""" __delattr__(self: o... | 2.53125 | 3 |
debug/vis.py | arpit196/multihead-siamese-nets | 2 | 45788 | <filename>debug/vis.py
import matplotlib.pyplot as plt
import seaborn as sns
def attention_visualization(att):
sns.heatmap(att[0, :, :])
plt.show()
| 2.34375 | 2 |
try1.py | joseph-reynolds/minecraft-pidoodles | 1 | 45789 | #!/usr/bin/python
"""Ideas for minecraft
Ideas:
- determine the size of the world (x..x, y..y, z..z)
- given a house foundation, build the entire house
- clear a large area of blocks
- dig a shaft or steps down
- jump to the top of a nearby tree
- create a miniature world: reduce (256,256) to (16,16)
- determi... | 3.75 | 4 |
setup.py | philipwfowler/gromarks | 0 | 45790 | <filename>setup.py
from setuptools import setup
setup(
name='gromarks',
version='0.1',
author='<NAME>',
packages=['gromarks'],
scripts=["bin/gromarks-analyse.py","bin/gromarks-create.py"],
license='MIT',
long_description=open('README.md').read(),
)
| 1.148438 | 1 |
todocli/interface.py | JuanChiogna/tod0 | 0 | 45791 | import tkinter as tk
import os
def get_values(event):
global window, title_value, title_entry, details_value, details_entry
title_value = title_entry.get()
details_value = details_entry.get()
window.destroy()
def toggle_details(event):
global window, title_entry, details_entry
if details_entry... | 3.140625 | 3 |
lightparam/param_qt.py | portugueslab/lightparam | 3 | 45792 | <gh_stars>1-10
from lightparam import Parametrized, Param, ParameterTree
from lightparam.gui import ParameterGui
from PyQt5.QtWidgets import QApplication, QDialog, QWidget, QLayout
from PyQt5.QtCore import pyqtSignal, QObject
class ParametrizedQt(Parametrized, QObject):
sig_param_changed = pyqtSignal(dict)
d... | 2.171875 | 2 |
assignment3/src/nn_preprocess.py | nilax97/col774 | 5 | 45793 | import numpy as np
import time
import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
path_train = sys.argv[1];
path_test = sys.argv[2];
one_train = sys.argv[3];
one_test = sys.argv[4];
def one_hot(array):
n = array.shape[0];
X = np.zeros((n,85));
Y = np.zeros((n,10));
for i in rang... | 2.46875 | 2 |
bin/capture_jls_v2.py | blackenstock/pyjoulescope_examples | 5 | 45794 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020-2021 Jetperch 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/LICENS... | 2.65625 | 3 |
trade_system/offers/choises.py | Artsiom-Shlapakou/trade-system | 0 | 45795 | <reponame>Artsiom-Shlapakou/trade-system<filename>trade_system/offers/choises.py
BUY = 1
SALE = 2
OrderType = [
(BUY, 'BUY'),
(SALE, 'SALE')
] | 1.085938 | 1 |
HLTrigger/special/test/testDynamicPrescaler.py | SWuchterl/cmssw | 6 | 45796 | <reponame>SWuchterl/cmssw<gh_stars>1-10
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(True)
)
process.source = cms.Source("EmptySource")
process.maxEvents = cms.unt... | 1.445313 | 1 |
modules/example_name_get/models/custom_model.py | ngi-odoo/examples | 0 | 45797 | <reponame>ngi-odoo/examples
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class CustomModel(models.Model):
_name = 'custom.model'
_description = 'Custom Model'
_rec_name = 'custom_name'
name = fields.Char('Name', default='Name', required=True)
custom_int = fields.Integer('Custom I... | 2.25 | 2 |
spike2_processor/tests/params.py | Pennsieve/timeseries-processor | 0 | 45798 | <filename>spike2_processor/tests/params.py<gh_stars>0
from base_processor.timeseries.tests import TimeSeriesTest, ChannelTest
# -----------------------------
# parameters for channel tests
# -----------------------------
# ----------------------- test channels -----------------------
channels_00 = [
# continuous... | 1.953125 | 2 |
lib/sundials_6.0.0/benchmarks/advection_reaction_3D/scripts/pickle_solution_output.py | detcitty/math | 256 | 45799 | <gh_stars>100-1000
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2021, Lawrence Livermore National Security
# and Southern Methodist University.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files f... | 2.28125 | 2 |