max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
python/paddle/tensor/attribute.py | douch/Paddle | 1 | 2600 | # Copyright (c) 2020 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 app... | # Copyright (c) 2020 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 app... | en | 0.444077 | # Copyright (c) 2020 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 app... | 2.045163 | 2 |
ocdsmerge/exceptions.py | open-contracting/ocds-merge | 4 | 2601 | <reponame>open-contracting/ocds-merge
class OCDSMergeError(Exception):
"""Base class for exceptions from within this package"""
class MissingDateKeyError(OCDSMergeError, KeyError):
"""Raised when a release is missing a 'date' key"""
def __init__(self, key, message):
self.key = key
self.me... | class OCDSMergeError(Exception):
"""Base class for exceptions from within this package"""
class MissingDateKeyError(OCDSMergeError, KeyError):
"""Raised when a release is missing a 'date' key"""
def __init__(self, key, message):
self.key = key
self.message = message
def __str__(self)... | en | 0.893438 | Base class for exceptions from within this package Raised when a release is missing a 'date' key Raised when a release is not an object Raised when a release has a null 'date' value Raised when a release has a non-string 'date' value Raised when a path is a literal and an object in different releases Base class for war... | 2.864485 | 3 |
appcodec.py | guardhunt/TelemterRC | 0 | 2602 | <filename>appcodec.py
import evdev
import time
import struct
class appcodec():
def __init__(self):
self.device = evdev.InputDevice("/dev/input/event2")
self.capabilities = self.device.capabilities(verbose=True)
self.capaRAW = self.device.capabilities(absinfo=False)
self.config = {}
... | <filename>appcodec.py
import evdev
import time
import struct
class appcodec():
def __init__(self):
self.device = evdev.InputDevice("/dev/input/event2")
self.capabilities = self.device.capabilities(verbose=True)
self.capaRAW = self.device.capabilities(absinfo=False)
self.config = {}
... | en | 0.658044 | build state dictionary for controller #build config dictionary by code and name #build state dictionary from raw codes | 2.8208 | 3 |
scripts/examples/OpenMV/16-Codes/find_barcodes.py | jiskra/openmv | 1,761 | 2603 | # Barcode Example
#
# This example shows off how easy it is to detect bar codes using the
# OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # High Res!
sensor.set_windowing((640, 80... | # Barcode Example
#
# This example shows off how easy it is to detect bar codes using the
# OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # High Res!
sensor.set_windowing((640, 80... | en | 0.861347 | # Barcode Example # # This example shows off how easy it is to detect bar codes using the # OpenMV Cam M7. Barcode detection does not work on the M4 Camera. # High Res! # V Res of 80 == less work (40 for 2X the speed). # must turn this off to prevent image washout... # must turn this off to prevent image washout... # B... | 3.248161 | 3 |
Python/factorial.py | devaslooper/Code-Overflow | 0 | 2604 | <reponame>devaslooper/Code-Overflow
n=int(input("Enter number "))
fact=1
for i in range(1,n+1):
fact=fact*i
print("Factorial is ",fact)
| n=int(input("Enter number "))
fact=1
for i in range(1,n+1):
fact=fact*i
print("Factorial is ",fact) | none | 1 | 4.137993 | 4 | |
mundo 3/099.py | thiagofreitascarneiro/Curso-de-Python---Curso-em-Video | 1 | 2605 | <reponame>thiagofreitascarneiro/Curso-de-Python---Curso-em-Video
import time
# O * é para desempacotar o paramêtro. Permite atribuir inumeros parametros.
def maior(* num):
contador = maior = 0
print('Analisando os valores passados...')
for v in num:
contador = contador + 1
print(f'{v} ', end... | import time
# O * é para desempacotar o paramêtro. Permite atribuir inumeros parametros.
def maior(* num):
contador = maior = 0
print('Analisando os valores passados...')
for v in num:
contador = contador + 1
print(f'{v} ', end='', flush=True)
time.sleep(0.3)
if contador == 1... | pt | 0.505019 | # O * é para desempacotar o paramêtro. Permite atribuir inumeros parametros. | 3.945343 | 4 |
tests/test_packed_to_padded.py | theycallmepeter/pytorch3d_PBR | 0 | 2606 | <gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from common_testing import TestCaseMixin, get_random_cuda_devi... | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from common_testing import TestCaseMixin, get_random_cuda_device
from pyt... | en | 0.839522 | # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. PyTorch implementation of packed_to_padded function. PyTorch implementation of padded_to_packed function. Check th... | 2.22759 | 2 |
easyric/tests/test_io_geotiff.py | HowcanoeWang/EasyRIC | 12 | 2607 | <filename>easyric/tests/test_io_geotiff.py
import pyproj
import pytest
import numpy as np
from easyric.io import geotiff, shp
from skimage.io import imread
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
def test_prase_header_string_width():
out_dict = geotiff._prase_header_string("* 256 image_w... | <filename>easyric/tests/test_io_geotiff.py
import pyproj
import pytest
import numpy as np
from easyric.io import geotiff, shp
from skimage.io import imread
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
def test_prase_header_string_width():
out_dict = geotiff._prase_header_string("* 256 image_w... | en | 0.370144 | # should raise error because WGS 84 / UTM ... should be full # [TODO] # [Todo] # When not convert to float, mean_values = 97.562584 # assert mean_ht == np.float32(97.562584) # another case that not working in previous version: # Cannot convert np.nan to int, fixed by astype(float) TIFF file: 200423_G_M600pro_transparen... | 2.225338 | 2 |
src/ebay_rest/api/buy_marketplace_insights/models/item_location.py | matecsaj/ebay_rest | 3 | 2608 | # coding: utf-8
"""
Marketplace Insights API
<a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\" alt=\"Limited Release\" />(Limited Release)</a> The Marketpl... | # coding: utf-8
"""
Marketplace Insights API
<a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\" alt=\"Limited Release\" />(Limited Release)</a> The Marketpl... | en | 0.743358 | # coding: utf-8 Marketplace Insights API <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\" alt=\"Limited Release\" />(Limited Release)</a> The Marketplace Insig... | 2.150873 | 2 |
fractionalKnapsack.py | aadishgoel2013/Algos-with-Python | 6 | 2609 | <filename>fractionalKnapsack.py
# Fractional Knapsack
wt = [40,50,30,10,10,40,30]
pro = [30,20,20,25,5,35,15]
n = len(wt)
data = [ (i,pro[i],wt[i]) for i in range(n) ]
bag = 100
data.sort(key=lambda x: x[1]/x[2], reverse=True)
profit=0
ans=[]
i=0
while i<n:
if data[i][2]<=bag:
bag-=data[... | <filename>fractionalKnapsack.py
# Fractional Knapsack
wt = [40,50,30,10,10,40,30]
pro = [30,20,20,25,5,35,15]
n = len(wt)
data = [ (i,pro[i],wt[i]) for i in range(n) ]
bag = 100
data.sort(key=lambda x: x[1]/x[2], reverse=True)
profit=0
ans=[]
i=0
while i<n:
if data[i][2]<=bag:
bag-=data[... | en | 0.602349 | # Fractional Knapsack | 2.852399 | 3 |
pysrc/classifier.py | CrackerCat/xed | 1,261 | 2610 | #!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2019 Intel Corporation
#
# 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-... | #!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2019 Intel Corporation
#
# 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-... | en | 0.831656 | #!/usr/bin/env python # -*- python -*- #BEGIN_LEGAL # #Copyright (c) 2019 Intel Corporation # # 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-... | 1.910208 | 2 |
tests/integration/api/test_target_groups.py | lanz/Tenable.io-SDK-for-Python | 90 | 2611 | <reponame>lanz/Tenable.io-SDK-for-Python<gh_stars>10-100
import pytest
from tenable_io.api.target_groups import TargetListEditRequest
from tenable_io.api.models import TargetGroup, TargetGroupList
@pytest.mark.vcr()
def test_target_groups_create(new_target_group):
assert isinstance(new_target_group, TargetGroup)... | import pytest
from tenable_io.api.target_groups import TargetListEditRequest
from tenable_io.api.models import TargetGroup, TargetGroupList
@pytest.mark.vcr()
def test_target_groups_create(new_target_group):
assert isinstance(new_target_group, TargetGroup), u'The `create` method did not return type `TargetGroup`... | none | 1 | 2.152967 | 2 | |
Installation/nnAudio/Spectrogram.py | tasercake/nnAudio | 0 | 2612 | """
Module containing all the spectrogram classes
"""
# 0.2.0
import torch
import torch.nn as nn
from torch.nn.functional import conv1d, conv2d, fold
import numpy as np
from time import time
from nnAudio.librosa_functions import *
from nnAudio.utils import *
sz_float = 4 # size of a float
epsilon = 10e-8 # fudg... | """
Module containing all the spectrogram classes
"""
# 0.2.0
import torch
import torch.nn as nn
from torch.nn.functional import conv1d, conv2d, fold
import numpy as np
from time import time
from nnAudio.librosa_functions import *
from nnAudio.utils import *
sz_float = 4 # size of a float
epsilon = 10e-8 # fudg... | en | 0.736867 | Module containing all the spectrogram classes # 0.2.0 # size of a float # fudge factor for normalization ### --------------------------- Spectrogram Classes ---------------------------### This function is to calculate the short-time Fourier transform (STFT) of the input signal. Input signal should be in either of t... | 2.609075 | 3 |
train.py | hui-won/KoBART_Project | 13 | 2613 | <gh_stars>10-100
import argparse
import logging
import os
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
from pytorch_lightning import loggers as pl_loggers
from torch.utils.data import DataLoader, Dataset
from dataset import KoBARTSummaryDataset
from transformers import BartForCondi... | import argparse
import logging
import os
import numpy as np
import pandas as pd
import pytorch_lightning as pl
import torch
from pytorch_lightning import loggers as pl_loggers
from torch.utils.data import DataLoader, Dataset
from dataset import KoBARTSummaryDataset
from transformers import BartForConditionalGeneration,... | en | 0.776555 | # OPTIONAL, called for every GPU/machine (assigning state is OK) # split dataset # add model specific args # Prepare optimizer # warm up lr | 2.035712 | 2 |
homeassistant/components/shelly/sensor.py | RavensburgOP/core | 1 | 2614 | <reponame>RavensburgOP/core
"""Sensor for Shelly."""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Final, cast
import aioshelly
from homeassistant.components import sensor
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries ... | """Sensor for Shelly."""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Final, cast
import aioshelly
from homeassistant.components import sensor
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from home... | en | 0.717119 | Sensor for Shelly. Set up sensors for device. Represent a shelly sensor. Initialize sensor. Return value of sensor. State class of sensor. Return unit of sensor. Represent a shelly REST sensor. Return value of sensor. State class of sensor. Return unit of sensor. Represent a shelly sleeping sensor. Return value of sens... | 1.993912 | 2 |
tests/web/config.py | zcqian/biothings.api | 0 | 2615 | <filename>tests/web/config.py
"""
Web settings to override for testing.
"""
import os
from biothings.web.settings.default import QUERY_KWARGS
# *****************************************************************************
# Elasticsearch Variables
# ****************************************************************... | <filename>tests/web/config.py
"""
Web settings to override for testing.
"""
import os
from biothings.web.settings.default import QUERY_KWARGS
# *****************************************************************************
# Elasticsearch Variables
# ****************************************************************... | en | 0.253876 | Web settings to override for testing. # ***************************************************************************** # Elasticsearch Variables # ***************************************************************************** # ***************************************************************************** # User Input Con... | 1.537589 | 2 |
InvenTree/InvenTree/management/commands/rebuild_thumbnails.py | rocheparadox/InvenTree | 656 | 2616 | """
Custom management command to rebuild thumbnail images
- May be required after importing a new dataset, for example
"""
import os
import logging
from PIL import UnidentifiedImageError
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db.utils import OperationalError... | """
Custom management command to rebuild thumbnail images
- May be required after importing a new dataset, for example
"""
import os
import logging
from PIL import UnidentifiedImageError
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db.utils import OperationalError... | en | 0.746167 | Custom management command to rebuild thumbnail images - May be required after importing a new dataset, for example Rebuild all thumbnail images Rebuild the thumbnail specified by the "image" field of the provided model | 2.421813 | 2 |
cogs/carbon.py | Baracchino-Della-Scuola/Bot | 6 | 2617 | <gh_stars>1-10
import discord
from discord.ext import commands
import urllib.parse
from .constants import themes, controls, languages, fonts, escales
import os
from pathlib import Path
from typing import Any
# from pyppeteer import launch
from io import *
import requests
def encode_url(text: str) -> str:
first_e... | import discord
from discord.ext import commands
import urllib.parse
from .constants import themes, controls, languages, fonts, escales
import os
from pathlib import Path
from typing import Any
# from pyppeteer import launch
from io import *
import requests
def encode_url(text: str) -> str:
first_encoding = urlli... | en | 0.503456 | # from pyppeteer import launch # Carbonsh encodes text twice Args: hex (str): | 2.609825 | 3 |
examples/show_artist.py | jimcortez/spotipy_twisted | 0 | 2618 | <gh_stars>0
# shows artist info for a URN or URL
import spotipy_twisted
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
sp = spotipy_twisted.Spotify()
artist = sp.artist(urn)
pprint.pprint(artist)
| # shows artist info for a URN or URL
import spotipy_twisted
import sys
import pprint
if len(sys.argv) > 1:
urn = sys.argv[1]
else:
urn = 'spotify:artist:3jOstUTkEu2JkjvRdBA5Gu'
sp = spotipy_twisted.Spotify()
artist = sp.artist(urn)
pprint.pprint(artist) | en | 0.746035 | # shows artist info for a URN or URL | 2.632582 | 3 |
examples/mcp3xxx_mcp3002_single_ended_simpletest.py | sommersoft/Adafruit_CircuitPython_MCP3xxx | 0 | 2619 | <filename>examples/mcp3xxx_mcp3002_single_ended_simpletest.py
import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3002 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
# create the spi bus
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
# create the cs (chip select)
cs = dig... | <filename>examples/mcp3xxx_mcp3002_single_ended_simpletest.py
import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3002 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
# create the spi bus
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
# create the cs (chip select)
cs = dig... | en | 0.419077 | # create the spi bus # create the cs (chip select) # create the mcp object # create an analog input channel on pin 0 | 3.120196 | 3 |
glue/core/data_factories/tables.py | rosteen/glue | 550 | 2620 | from glue.core.data_factories.helpers import has_extension
from glue.config import data_factory
__all__ = ['tabular_data']
@data_factory(label="ASCII Table",
identifier=has_extension('csv txt tsv tbl dat '
'csv.gz txt.gz tbl.bz '
... | from glue.core.data_factories.helpers import has_extension
from glue.config import data_factory
__all__ = ['tabular_data']
@data_factory(label="ASCII Table",
identifier=has_extension('csv txt tsv tbl dat '
'csv.gz txt.gz tbl.bz '
... | none | 1 | 2.630534 | 3 | |
code_doc/views/author_views.py | coordt/code_doc | 0 | 2621 | <filename>code_doc/views/author_views.py
from django.shortcuts import render
from django.http import Http404
from django.views.generic.edit import UpdateView
from django.views.generic import ListView, View
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django... | <filename>code_doc/views/author_views.py
from django.shortcuts import render
from django.http import Http404
from django.views.generic.edit import UpdateView
from django.views.generic import ListView, View
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django... | en | 0.874354 | # logger for this file A generic view of the authors in a list View for editing information about an Author .. note:: in order to be able to edit an Author, the user should have the 'code_doc.author_edit' permission on the Author object. # TODO check if needed Manages the views associated to the ... | 2.35654 | 2 |
d00dfeed/analyses/print_sloc_per_soc.py | rehosting/rehosting_sok | 4 | 2622 | # External deps
import os, sys, json
from pathlib import Path
from typing import Dict, List
# Internal deps
os.chdir(sys.path[0])
sys.path.append("..")
import df_common as dfc
import analyses_common as ac
# Generated files directory
GEN_FILE_DIR = str(Path(__file__).resolve().parent.parent) + os.sep + "generated_file... | # External deps
import os, sys, json
from pathlib import Path
from typing import Dict, List
# Internal deps
os.chdir(sys.path[0])
sys.path.append("..")
import df_common as dfc
import analyses_common as ac
# Generated files directory
GEN_FILE_DIR = str(Path(__file__).resolve().parent.parent) + os.sep + "generated_file... | en | 0.471618 | # External deps # Internal deps # Generated files directory # TODO: ugly parent.parent pathing # Collection # Total SLOC for this SoC # Closed-source driver #print("{}: {}".format(cmp_str, driver_sloc)) # Final stats | 2.290752 | 2 |
mingpt/lr_decay.py | asigalov61/minGPT | 18 | 2623 | import math
import pytorch_lightning as pl
class LearningRateDecayCallback(pl.Callback):
def __init__(self, learning_rate, warmup_tokens=<PASSWORD>, final_tokens=<PASSWORD>, lr_decay=True):
super().__init__()
self.learning_rate = learning_rate
self.tokens = 0
self.final_tokens = f... | import math
import pytorch_lightning as pl
class LearningRateDecayCallback(pl.Callback):
def __init__(self, learning_rate, warmup_tokens=<PASSWORD>, final_tokens=<PASSWORD>, lr_decay=True):
super().__init__()
self.learning_rate = learning_rate
self.tokens = 0
self.final_tokens = f... | en | 0.729446 | # number of tokens processed this step (i.e. label is not -100) # linear warmup # cosine learning rate decay | 2.414088 | 2 |
apprise/config/ConfigBase.py | calvinbui/apprise | 0 | 2624 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 <NAME> <<EMAIL>>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 withou... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 <NAME> <<EMAIL>>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 withou... | en | 0.845011 | # -*- coding: utf-8 -*- # # Copyright (C) 2020 <NAME> <<EMAIL>> # All rights reserved. # # This code is licensed under the MIT License. # # 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 withou... | 1.375001 | 1 |
ffmpeg_util.py | manuel-fischer/ScrollRec | 0 | 2625 | import sys
import subprocess
from subprocess import Popen, PIPE
AV_LOG_QUIET = "quiet"
AV_LOG_PANIC = "panic"
AV_LOG_FATAL = "fatal"
AV_LOG_ERROR = "error"
AV_LOG_WARNING = "warning"
AV_LOG_INFO = "info"
AV_LOG_VERBOSE = "verbose"
AV_LOG_DEBUG = "debug"
ffmpeg_loglevel = AV_LOG_ERROR
IS_WIN32 = 'win32' ... | import sys
import subprocess
from subprocess import Popen, PIPE
AV_LOG_QUIET = "quiet"
AV_LOG_PANIC = "panic"
AV_LOG_FATAL = "fatal"
AV_LOG_ERROR = "error"
AV_LOG_WARNING = "warning"
AV_LOG_INFO = "info"
AV_LOG_VERBOSE = "verbose"
AV_LOG_DEBUG = "debug"
ffmpeg_loglevel = AV_LOG_ERROR
IS_WIN32 = 'win32' ... | none | 1 | 2.505746 | 3 | |
setup.py | rizar/CLOSURE | 14 | 2626 | from setuptools import setup
setup(
name="nmn-iwp",
version="0.1",
keywords="",
packages=["vr", "vr.models"]
)
| from setuptools import setup
setup(
name="nmn-iwp",
version="0.1",
keywords="",
packages=["vr", "vr.models"]
)
| none | 1 | 1.002867 | 1 | |
analysis_tools/PYTHON_RICARDO/output_ingress_egress/scripts/uniform_grid.py | lefevre-fraser/openmeta-mms | 0 | 2627 | """ Represent a triangulated surface using a 3D boolean grid"""
import logging
import numpy as np
from rpl.tools.ray_tracing.bsp_tree_poly import BSP_Element
from rpl.tools.geometry import geom_utils
import data_io
class BSP_Grid(object):
def __init__(self, node_array, tris, allocate_step=100000):
... | """ Represent a triangulated surface using a 3D boolean grid"""
import logging
import numpy as np
from rpl.tools.ray_tracing.bsp_tree_poly import BSP_Element
from rpl.tools.geometry import geom_utils
import data_io
class BSP_Grid(object):
def __init__(self, node_array, tris, allocate_step=100000):
... | en | 0.801004 | Represent a triangulated surface using a 3D boolean grid Store the triangles with an enumeration so that even when they are subdivided their
identity is not lost. # Reference to the full list of nodes Increase node array size by the allocate_step amount. Adds a new node to the end of the node array (expanding... | 3.0624 | 3 |
silver_bullet/crypto.py | Hojung-Jeong/Silver-Bullet-Encryption-Tool | 0 | 2628 | '''
>List of functions
1. encrypt(user_input,passphrase) - Encrypt the given string with the given passphrase. Returns cipher text and locked pad.
2. decrypt(cipher_text,locked_pad,passphrase) - Decrypt the cipher text encrypted with SBET. It requires cipher text, locked pad, and passphrase.
'''
# CODE ============... | '''
>List of functions
1. encrypt(user_input,passphrase) - Encrypt the given string with the given passphrase. Returns cipher text and locked pad.
2. decrypt(cipher_text,locked_pad,passphrase) - Decrypt the cipher text encrypted with SBET. It requires cipher text, locked pad, and passphrase.
'''
# CODE ============... | en | 0.48926 | >List of functions 1. encrypt(user_input,passphrase) - Encrypt the given string with the given passphrase. Returns cipher text and locked pad. 2. decrypt(cipher_text,locked_pad,passphrase) - Decrypt the cipher text encrypted with SBET. It requires cipher text, locked pad, and passphrase. # CODE ======================... | 3.93852 | 4 |
pyfire/errors.py | RavidLevi98/pyfire | 0 | 2629 | <reponame>RavidLevi98/pyfire
# -*- coding: utf-8 -*-
"""
pyfire.errors
~~~~~~~~~~~~~~~~~~~~~~
Holds the global used base errors
:copyright: 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import xml.etree.ElementTree as ET
class XMPPProtoc... | # -*- coding: utf-8 -*-
"""
pyfire.errors
~~~~~~~~~~~~~~~~~~~~~~
Holds the global used base errors
:copyright: 2011 by the pyfire Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import xml.etree.ElementTree as ET
class XMPPProtocolError(Exception):
"""Ba... | en | 0.70799 | # -*- coding: utf-8 -*- pyfire.errors ~~~~~~~~~~~~~~~~~~~~~~ Holds the global used base errors :copyright: 2011 by the pyfire Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. Base class for all errors that can be sent via XMPP Protocol to peer # per default all e... | 1.821039 | 2 |
app/nextMoveLogic.py | thekitbag/starter-snake-python | 0 | 2630 | import random
class Status(object):
def getHeadPosition(gamedata):
me = gamedata['you']
my_position = me['body']
head = my_position[0]
return head
def getMyLength(gamedata):
me = gamedata['you']
my_position = me['body']
if my_position[0] == my_position[1] == my_position[2]:
return 1
elif my_... | import random
class Status(object):
def getHeadPosition(gamedata):
me = gamedata['you']
my_position = me['body']
head = my_position[0]
return head
def getMyLength(gamedata):
me = gamedata['you']
my_position = me['body']
if my_position[0] == my_position[1] == my_position[2]:
return 1
elif my_... | en | 0.441407 | returns proximity to a wall either parallel to, head-on or corner #corners #headons #parrallels #first go #remove opposite direction #no danger keep going #in a corner #headon #parallel | 3.193812 | 3 |
generator/util.py | gbtami/lichess-puzzler | 1 | 2631 | from dataclasses import dataclass
import math
import chess
import chess.engine
from model import EngineMove, NextMovePair
from chess import Color, Board
from chess.pgn import GameNode
from chess.engine import SimpleEngine, Score
nps = []
def material_count(board: Board, side: Color) -> int:
values = { chess.PAWN:... | from dataclasses import dataclass
import math
import chess
import chess.engine
from model import EngineMove, NextMovePair
from chess import Color, Board
from chess.pgn import GameNode
from chess.engine import SimpleEngine, Score
nps = []
def material_count(board: Board, side: Color) -> int:
values = { chess.PAWN:... | en | 0.431086 | # print(info) winning chances from -1 to 1 https://graphsketch.com/?eqn1_color=1&eqn1_eqn=100+*+%282+%2F+%281+%2B+exp%28-0.004+*+x%29%29+-+1%29&eqn2_color=2&eqn2_eqn=&eqn3_color=3&eqn3_eqn=&eqn4_color=4&eqn4_eqn=&eqn5_color=5&eqn5_eqn=&eqn6_color=6&eqn6_eqn=&x_min=-1000&x_max=1000&y_min=-100&y_max=100&x_tick=100&y_tick... | 2.808031 | 3 |
sleep.py | SkylerHoward/O | 0 | 2632 | import time, morning
from datetime import datetime
def main():
while True:
a = time.mktime(datetime.now().timetuple())
n = datetime.now()
if n.hour == 6 and (n.minute-(n.minute%5)) == 15:
return morning.main()
time.sleep(300 - (time.mktime(datetime.now().timetuple())-a)) | import time, morning
from datetime import datetime
def main():
while True:
a = time.mktime(datetime.now().timetuple())
n = datetime.now()
if n.hour == 6 and (n.minute-(n.minute%5)) == 15:
return morning.main()
time.sleep(300 - (time.mktime(datetime.now().timetuple())-a)) | none | 1 | 3.545153 | 4 | |
tests/unit/commands/local/start_lambda/test_cli.py | ourobouros/aws-sam-cli | 2 | 2633 | <reponame>ourobouros/aws-sam-cli
from unittest import TestCase
from mock import patch, Mock
from samcli.commands.local.start_lambda.cli import do_cli as start_lambda_cli
from samcli.commands.local.cli_common.user_exceptions import UserException
from samcli.commands.validate.lib.exceptions import InvalidSamDocumentExce... | from unittest import TestCase
from mock import patch, Mock
from samcli.commands.local.start_lambda.cli import do_cli as start_lambda_cli
from samcli.commands.local.cli_common.user_exceptions import UserException
from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException
from samcli.commands.local.... | en | 0.663032 | # Mock the __enter__ method to return a object inside a context manager | 2.280514 | 2 |
restapi/services/Utils/test_getters.py | Varun487/CapstoneProject_TradingSystem | 3 | 2634 | <gh_stars>1-10
from django.test import TestCase
import pandas as pd
from .getters import Getter
from .converter import Converter
from strategies.models import Company
from strategies.models import IndicatorType
class GetDataTestCase(TestCase):
def setUp(self) -> None:
# Dummy company data
Comp... | from django.test import TestCase
import pandas as pd
from .getters import Getter
from .converter import Converter
from strategies.models import Company
from strategies.models import IndicatorType
class GetDataTestCase(TestCase):
def setUp(self) -> None:
# Dummy company data
Company.objects.cre... | en | 0.575155 | # Dummy company data # Dummy indicator data No inputs are given All inputs provided Only df_flag input is provided Whether it returns correct obj list when input is correct # Returns correct object list for company # Returns correct object list for Indicator Whether it returns correct df when input is correct # Returns... | 2.573763 | 3 |
pytorch_toolkit/ote/ote/modules/trainers/mmdetection.py | abhatikar/training_extensions | 2 | 2635 | <filename>pytorch_toolkit/ote/ote/modules/trainers/mmdetection.py
"""
Copyright (c) 2020 Intel Corporation
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/L... | <filename>pytorch_toolkit/ote/ote/modules/trainers/mmdetection.py
"""
Copyright (c) 2020 Intel Corporation
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/L... | en | 0.856799 | Copyright (c) 2020 Intel Corporation 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,... | 1.660823 | 2 |
svn-go-stats/transform.py | BT-OpenSource/bt-betalab | 1 | 2636 | import sys
import json
import subprocess
import re
import statistics
def get_complexity():
# Load the cyclomatic complexity info
cyclostats = subprocess.check_output(['./gocyclo', 'repo']).decode("utf-8")
results = re.findall('([0-9]+)\s([^\s]+)\s([^\s]+)\s([^:]+):([0-9]+):([0-9]+)', cyclostats)
# S... | import sys
import json
import subprocess
import re
import statistics
def get_complexity():
# Load the cyclomatic complexity info
cyclostats = subprocess.check_output(['./gocyclo', 'repo']).decode("utf-8")
results = re.findall('([0-9]+)\s([^\s]+)\s([^\s]+)\s([^:]+):([0-9]+):([0-9]+)', cyclostats)
# S... | en | 0.857501 | # Load the cyclomatic complexity info # Setup a dictionary in which to keep track of the complixities # for each file # Build an array of complexities for each file # Pick out the median value (picking the highest of the two # middle entries if needed) for each file # Load the const string duplication info # Build an a... | 2.891619 | 3 |
test/test_python_errors.py | yangyangxcf/parso | 0 | 2637 | """
Testing if parso finds syntax errors and indentation errors.
"""
import sys
import warnings
import pytest
import parso
from parso._compatibility import is_pypy
from .failing_examples import FAILING_EXAMPLES, indent, build_nested
if is_pypy:
# The errors in PyPy might be different. Just skip the module for n... | """
Testing if parso finds syntax errors and indentation errors.
"""
import sys
import warnings
import pytest
import parso
from parso._compatibility import is_pypy
from .failing_examples import FAILING_EXAMPLES, indent, build_nested
if is_pypy:
# The errors in PyPy might be different. Just skip the module for n... | en | 0.897772 | Testing if parso finds syntax errors and indentation errors. # The errors in PyPy might be different. Just skip the module for now. # Somehow in Python3.3 the SyntaxError().lineno is sometimes None This example doesn't work with FAILING_EXAMPLES, because the line numbers are not always the same / incorrect in Pytho... | 2.689604 | 3 |
shogitk/usikif.py | koji-hirono/pytk-shogi-replayer | 0 | 2638 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from shogitk.shogi import Coords, Move, BLACK, WHITE, DROP, PROMOTE
RANKNUM = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8,
'i': 9
}
def decoder(f):
color = ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from shogitk.shogi import Coords, Move, BLACK, WHITE, DROP, PROMOTE
RANKNUM = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8,
'i': 9
}
def decoder(f):
color = ... | en | 0.769321 | # -*- coding: utf-8 -*- | 2.580781 | 3 |
etherbank_cli/oracles.py | ideal-money/etherbank-cli | 1 | 2639 | <reponame>ideal-money/etherbank-cli
import click
from . import utils
@click.group()
def main():
"Simple CLI for oracles to work with Ether dollar"
pass
@main.command()
@click.option('--ether-price', type=float, help="The ether price in ether dollar")
@click.option('--collateral-ratio', type=float, help="The... | import click
from . import utils
@click.group()
def main():
"Simple CLI for oracles to work with Ether dollar"
pass
@main.command()
@click.option('--ether-price', type=float, help="The ether price in ether dollar")
@click.option('--collateral-ratio', type=float, help="The collateral ratio")
@click.option(
... | none | 1 | 2.614501 | 3 | |
src/grader/machine.py | MrKaStep/csc230-grader | 0 | 2640 | import getpass
from plumbum import local
from plumbum.machines.paramiko_machine import ParamikoMachine
from plumbum.path.utils import copy
def _once(f):
res = None
def wrapped(*args, **kwargs):
nonlocal res
if res is None:
res = f(*args, **kwargs)
return res
return wrapp... | import getpass
from plumbum import local
from plumbum.machines.paramiko_machine import ParamikoMachine
from plumbum.path.utils import copy
def _once(f):
res = None
def wrapped(*args, **kwargs):
nonlocal res
if res is None:
res = f(*args, **kwargs)
return res
return wrapp... | none | 1 | 2.388133 | 2 | |
Mundo 1/Ex33.py | legna7/Python | 0 | 2641 | <reponame>legna7/Python<gh_stars>0
salario = float(input('digite o seu salario: '))
aumento = (salario + (salario * 15)/100 if salario <= 1250 else salario + (salario * 10)/100)
print(aumento) | salario = float(input('digite o seu salario: '))
aumento = (salario + (salario * 15)/100 if salario <= 1250 else salario + (salario * 10)/100)
print(aumento) | none | 1 | 3.852744 | 4 | |
tests/test_tree.py | andreax79/airflow-code-editor | 194 | 2642 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import os.path
import airflow
import airflow.plugins_manager
from airflow import configuration
from flask import Flask
from unittest import TestCase, main
from airflow_code_editor.commons import PLUGIN_NAME
from airflow_code_editor.tree import (
get_tree,
)
asser... | #!/usr/bin/env python
import os
import os.path
import airflow
import airflow.plugins_manager
from airflow import configuration
from flask import Flask
from unittest import TestCase, main
from airflow_code_editor.commons import PLUGIN_NAME
from airflow_code_editor.tree import (
get_tree,
)
assert airflow.plugins_m... | ru | 0.26433 | #!/usr/bin/env python | 2.304398 | 2 |
examples/token_freshness.py | greenape/flask-jwt-extended | 2 | 2643 | from quart import Quart, jsonify, request
from quart_jwt_extended import (
JWTManager,
jwt_required,
create_access_token,
jwt_refresh_token_required,
create_refresh_token,
get_jwt_identity,
fresh_jwt_required,
)
app = Quart(__name__)
app.config["JWT_SECRET_KEY"] = "super-secret" # Change ... | from quart import Quart, jsonify, request
from quart_jwt_extended import (
JWTManager,
jwt_required,
create_access_token,
jwt_refresh_token_required,
create_refresh_token,
get_jwt_identity,
fresh_jwt_required,
)
app = Quart(__name__)
app.config["JWT_SECRET_KEY"] = "super-secret" # Change ... | en | 0.896272 | # Change this! # Standard login endpoint. Will return a fresh access token and # a refresh token # create_access_token supports an optional 'fresh' argument, # which marks the token as fresh or non-fresh accordingly. # As we just verified their username and password, we are # going to mark the token as fresh here. # Re... | 2.739189 | 3 |
env/lib/python3.7/site-packages/tinvest/typedefs.py | umchemurziev/Practics | 1 | 2644 | from datetime import datetime
from typing import Any, Dict, Union
__all__ = 'AnyDict'
AnyDict = Dict[str, Any] # pragma: no mutate
datetime_or_str = Union[datetime, str] # pragma: no mutate
| from datetime import datetime
from typing import Any, Dict, Union
__all__ = 'AnyDict'
AnyDict = Dict[str, Any] # pragma: no mutate
datetime_or_str = Union[datetime, str] # pragma: no mutate
| pt | 0.274601 | # pragma: no mutate # pragma: no mutate | 2.611622 | 3 |
keras/linear/model/pipeline_train.py | PipelineAI/models | 44 | 2645 | <gh_stars>10-100
import os
os.environ['KERAS_BACKEND'] = 'theano'
os.environ['THEANO_FLAGS'] = 'floatX=float32,device=cpu'
import cloudpickle as pickle
import pipeline_invoke
import pandas as pd
import numpy as np
import keras
from keras.layers import Input, Dense
from keras.models import Model
from keras.models impor... | import os
os.environ['KERAS_BACKEND'] = 'theano'
os.environ['THEANO_FLAGS'] = 'floatX=float32,device=cpu'
import cloudpickle as pickle
import pipeline_invoke
import pandas as pd
import numpy as np
import keras
from keras.layers import Input, Dense
from keras.models import Model
from keras.models import save_model, loa... | en | 0.66967 | # min-max -1,1 # model_pkl_path = 'model.pkl' # with open(model_pkl_path, 'wb') as fh: # pickle.dump(pipeline_invoke, fh) | 2.340739 | 2 |
tests/effects/test_cheerlights.py | RatJuggler/led-shim-effects | 1 | 2646 | from unittest import TestCase
from unittest.mock import Mock, patch
import sys
sys.modules['smbus'] = Mock() # Mock the hardware layer to avoid errors.
from ledshimdemo.canvas import Canvas
from ledshimdemo.effects.cheerlights import CheerLightsEffect
class TestCheerLights(TestCase):
TEST_CANVAS_SIZE = 3 # t... | from unittest import TestCase
from unittest.mock import Mock, patch
import sys
sys.modules['smbus'] = Mock() # Mock the hardware layer to avoid errors.
from ledshimdemo.canvas import Canvas
from ledshimdemo.effects.cheerlights import CheerLightsEffect
class TestCheerLights(TestCase):
TEST_CANVAS_SIZE = 3 # t... | en | 0.869935 | # Mock the hardware layer to avoid errors. # type: int # Must check before and after in case it changes during the test. | 2.792431 | 3 |
figures/Figure_7/02_generate_images.py | Jhsmit/ColiCoords-Paper | 2 | 2647 | from colicoords.synthetic_data import add_readout_noise, draw_poisson
from colicoords import load
import numpy as np
import mahotas as mh
from tqdm import tqdm
import os
import tifffile
def chunk_list(l, sizes):
prev = 0
for s in sizes:
result = l[prev:prev+s]
prev += s
yield result
... | from colicoords.synthetic_data import add_readout_noise, draw_poisson
from colicoords import load
import numpy as np
import mahotas as mh
from tqdm import tqdm
import os
import tifffile
def chunk_list(l, sizes):
prev = 0
for s in sizes:
result = l[prev:prev+s]
prev += s
yield result
... | en | 0.852765 | # Crop the data for when the cell is on the border of the image # Limit image position to the edges of the image Generate microscopy images from a list of cell objects by placing them randomly oriented in the image. add poissonian and readout noise to brightfield images # ratio between 'background' (no cells) and cell ... | 2.316977 | 2 |
epiphancloud/models/settings.py | epiphan-video/epiphancloud_api | 0 | 2648 | <filename>epiphancloud/models/settings.py
class DeviceSettings:
def __init__(self, settings):
self._id = settings["id"]
self._title = settings["title"]
self._type = settings["type"]["name"]
self._value = settings["value"]
@property
def id(self):
return self._id
... | <filename>epiphancloud/models/settings.py
class DeviceSettings:
def __init__(self, settings):
self._id = settings["id"]
self._title = settings["title"]
self._type = settings["type"]["name"]
self._value = settings["value"]
@property
def id(self):
return self._id
... | none | 1 | 2.289305 | 2 | |
dictionary.py | SchmitzAndrew/OSS-101-example | 0 | 2649 | <filename>dictionary.py
word = input("Enter a word: ")
if word == "a":
print("one; any")
elif word == "apple":
print("familiar, round fleshy fruit")
elif word == "rhinoceros":
print("large thick-skinned animal with one or two horns on its nose")
else:
print("That word must not exist. This dictionary is... | <filename>dictionary.py
word = input("Enter a word: ")
if word == "a":
print("one; any")
elif word == "apple":
print("familiar, round fleshy fruit")
elif word == "rhinoceros":
print("large thick-skinned animal with one or two horns on its nose")
else:
print("That word must not exist. This dictionary is... | none | 1 | 4.021801 | 4 | |
solved_bronze/num11720.py | ilmntr/white_study | 0 | 2650 | <gh_stars>0
cnt = int(input())
num = list(map(int, input()))
sum = 0
for i in range(len(num)):
sum = sum + num[i]
print(sum) | cnt = int(input())
num = list(map(int, input()))
sum = 0
for i in range(len(num)):
sum = sum + num[i]
print(sum) | none | 1 | 3.465846 | 3 | |
setup.py | sdnhub/kube-navi | 0 | 2651 | <gh_stars>0
from distutils.core import setup
setup(
name = 'kube_navi',
packages = ['kube_navi'], # this must be the same as the name above
version = '0.1',
description = 'Kubernetes resource discovery toolkit',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/sdnhub/kube-navi', # us... | from distutils.core import setup
setup(
name = 'kube_navi',
packages = ['kube_navi'], # this must be the same as the name above
version = '0.1',
description = 'Kubernetes resource discovery toolkit',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/sdnhub/kube-navi', # use the URL to... | en | 0.861654 | # this must be the same as the name above # use the URL to the github repo # I'll explain this in a second # arbitrary keywords | 1.504878 | 2 |
flink-ai-flow/ai_flow/metric/utils.py | MarvinMiao/flink-ai-extended | 1 | 2652 | #
# 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... | #
# 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... | en | 0.86503 | # # 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... | 1.504579 | 2 |
src/moduels/gui/Tab_Help.py | HaujetZhao/Caps_Writer | 234 | 2653 | <reponame>HaujetZhao/Caps_Writer<filename>src/moduels/gui/Tab_Help.py
# -*- coding: UTF-8 -*-
from PySide2.QtWidgets import QWidget, QPushButton, QVBoxLayout
from PySide2.QtCore import Signal
from moduels.component.NormalValue import 常量
from moduels.component.SponsorDialog import SponsorDialog
import os, webbrowser
... | # -*- coding: UTF-8 -*-
from PySide2.QtWidgets import QWidget, QPushButton, QVBoxLayout
from PySide2.QtCore import Signal
from moduels.component.NormalValue import 常量
from moduels.component.SponsorDialog import SponsorDialog
import os, webbrowser
class Tab_Help(QWidget):
状态栏消息 = Signal(str, int)
def __init... | zh | 0.363833 | # -*- coding: UTF-8 -*- # 先初始化各个控件 # 再将各个控件连接到信号槽 # 然后布局 # 再定义各个控件的值 # self.masterLayout.addWidget(self.打开帮助按钮) # self.masterLayout.addWidget(self.ffmpegMannualNoteButton) | 2.278647 | 2 |
app/routes/register.py | AuFeld/COAG | 1 | 2654 | <gh_stars>1-10
from typing import Callable, Optional, Type, cast
from fastapi import APIRouter, HTTPException, Request, status
from app.models import users
from app.common.user import ErrorCode, run_handler
from app.users.user import (
CreateUserProtocol,
InvalidPasswordException,
UserAlreadyExists,
V... | from typing import Callable, Optional, Type, cast
from fastapi import APIRouter, HTTPException, Request, status
from app.models import users
from app.common.user import ErrorCode, run_handler
from app.users.user import (
CreateUserProtocol,
InvalidPasswordException,
UserAlreadyExists,
ValidatePassword... | en | 0.644751 | Generate a router with the register route. # type: ignore # Prevent mypy complain | 2.589206 | 3 |
utils/visual.py | xizaoqu/Panoptic-PolarNet | 90 | 2655 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
def flow_to_img(flow, normalize=True):
"""Convert flow to viewable image, using color hue to encode flow vector orientation, and color saturation to
encode vector length. This is similar to the OpenCV tutorial on dense optical flow, e... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
def flow_to_img(flow, normalize=True):
"""Convert flow to viewable image, using color hue to encode flow vector orientation, and color saturation to
encode vector length. This is similar to the OpenCV tutorial on dense optical flow, e... | en | 0.742156 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Convert flow to viewable image, using color hue to encode flow vector orientation, and color saturation to encode vector length. This is similar to the OpenCV tutorial on dense optical flow, except that they map vector length to the value plane of the HSV color mod... | 3.860742 | 4 |
DistributedRL/Gateway/build/Code/sim/Parser/LAI/GreenIndex.py | zhkmxx9302013/SoftwarePilot | 4 | 2656 | <filename>DistributedRL/Gateway/build/Code/sim/Parser/LAI/GreenIndex.py<gh_stars>1-10
import argparse
from PIL import Image, ImageStat
import math
parser = argparse.ArgumentParser()
parser.add_argument('fname')
parser.add_argument('pref', default="", nargs="?")
args = parser.parse_args()
im = Image.open(args.fname)
R... | <filename>DistributedRL/Gateway/build/Code/sim/Parser/LAI/GreenIndex.py<gh_stars>1-10
import argparse
from PIL import Image, ImageStat
import math
parser = argparse.ArgumentParser()
parser.add_argument('fname')
parser.add_argument('pref', default="", nargs="?")
args = parser.parse_args()
im = Image.open(args.fname)
R... | none | 1 | 2.425066 | 2 | |
reports/heliosV1/python/heliosStorageStats/heliosStorageStats.py | ped998/scripts | 0 | 2657 | <gh_stars>0
#!/usr/bin/env python
"""cluster storage stats for python"""
# import pyhesity wrapper module
from pyhesity import *
from datetime import datetime
import codecs
# command line arguments
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--vip', type=str, default='helios.cohesity... | #!/usr/bin/env python
"""cluster storage stats for python"""
# import pyhesity wrapper module
from pyhesity import *
from datetime import datetime
import codecs
# command line arguments
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--vip', type=str, default='helios.cohesity.com') # cl... | en | 0.349516 | #!/usr/bin/env python cluster storage stats for python # import pyhesity wrapper module # command line arguments # cluster to connect to # username # (optional) domain - defaults to local # optional password # authenticate # outfile # cluster = api('get', 'cluster') # headings | 2.528392 | 3 |
src/advanceoperate/malimgthread.py | zengrx/S.M.A.R.T | 10 | 2658 | <reponame>zengrx/S.M.A.R.T<filename>src/advanceoperate/malimgthread.py<gh_stars>1-10
#coding=utf-8
from PyQt4 import QtCore
import os, glob, numpy, sys
from PIL import Image
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import confusion_matrix
from sklearn.neighbors import KNeighborsClassif... | #coding=utf-8
from PyQt4 import QtCore
import os, glob, numpy, sys
from PIL import Image
from sklearn.cross_validation import StratifiedKFold
from sklearn.metrics import confusion_matrix
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neighbors import BallTree
from sklearn import cross_validation
from ... | zh | 0.608171 | #coding=utf-8 # 特征 # 标签 # 标号 # [家族号, 家族中序号, 文件名, 总序号] 准备绘制矩阵的数据 @X:特征矩阵 @y:标签 @n:所有样本家族名称 @l:对应家族个数 # 打乱数组 # 10重 # print l[l_list[3] - 1] # print l_list # print no_imgs # 输出所有家族包含文件个数 # 初始化矩阵 # 10-fold Cross Validation # Training # roughly 2.5 secs # Testing # output is labels and not indices # roughly ... | 2.33795 | 2 |
tests/unittests/command_parse/test_stream.py | itamarhaber/iredis | 1,857 | 2659 | def test_xrange(judge_command):
judge_command(
"XRANGE somestream - +",
{"command": "XRANGE", "key": "somestream", "stream_id": ["-", "+"]},
)
judge_command(
"XRANGE somestream 1526985054069 1526985055069",
{
"command": "XRANGE",
"key": "somestream",
... | def test_xrange(judge_command):
judge_command(
"XRANGE somestream - +",
{"command": "XRANGE", "key": "somestream", "stream_id": ["-", "+"]},
)
judge_command(
"XRANGE somestream 1526985054069 1526985055069",
{
"command": "XRANGE",
"key": "somestream",
... | en | 0.765052 | # short of a parameter # two subcommand together shouldn't match # test for MAXLEN option # spcify stream id # FIXME current grammar can't support multiple tokens # so the ids will be recongized to keys. | 1.893929 | 2 |
tests/test_find_forks/test_find_forks.py | ivan2kh/find_forks | 41 | 2660 | <filename>tests/test_find_forks/test_find_forks.py
# coding: utf-8
"""test_find_fork."""
# pylint: disable=no-self-use
from __future__ import absolute_import, division, print_function, unicode_literals
from os import path
import unittest
from six import PY3
from find_forks.__init__ import CONFIG
from find_forks.find... | <filename>tests/test_find_forks/test_find_forks.py
# coding: utf-8
"""test_find_fork."""
# pylint: disable=no-self-use
from __future__ import absolute_import, division, print_function, unicode_literals
from os import path
import unittest
from six import PY3
from find_forks.__init__ import CONFIG
from find_forks.find... | en | 0.456687 | # coding: utf-8 test_find_fork. # pylint: disable=no-self-use # pylint: disable=no-name-in-module Used in test_interesting.py. Used in test_interesting.py. To run this test you'll need to prepare git first, run: git remote add test-origin-1 https://github.com/frost-nzcr4/find_forks.git git remote add t... | 2.31145 | 2 |
neutron/agent/l3/dvr_router.py | insequent/neutron | 0 | 2661 | # Copyright (c) 2015 Openstack Foundation
#
# 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 ... | # Copyright (c) 2015 Openstack Foundation
#
# 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 ... | en | 0.831863 | # Copyright (c) 2015 Openstack Foundation # # 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 ... | 1.728015 | 2 |
sider/warnings.py | PCManticore/sider | 19 | 2662 | <reponame>PCManticore/sider
""":mod:`sider.warnings` --- Warning categories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module defines several custom warning category classes.
"""
class SiderWarning(Warning):
"""All warning classes used by Sider extend this base class."""
class PerformanceWarning(Sid... | """:mod:`sider.warnings` --- Warning categories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module defines several custom warning category classes.
"""
class SiderWarning(Warning):
"""All warning classes used by Sider extend this base class."""
class PerformanceWarning(SiderWarning, RuntimeWarning):
... | en | 0.659171 | :mod:`sider.warnings` --- Warning categories ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module defines several custom warning category classes. All warning classes used by Sider extend this base class. The category for warnings about performance worries. Operations that warn this category would work but... | 1.626925 | 2 |
kadal/query.py | Bucolo/Kadal | 1 | 2663 | MEDIA_SEARCH = """
query ($search: String, $type: MediaType, $exclude: MediaFormat, $isAdult: Boolean) {
Media(search: $search, type: $type, format_not: $exclude, isAdult: $isAdult) {
id
type
format
title {
english
romaji
native
}
synonyms
status
description
start... | MEDIA_SEARCH = """
query ($search: String, $type: MediaType, $exclude: MediaFormat, $isAdult: Boolean) {
Media(search: $search, type: $type, format_not: $exclude, isAdult: $isAdult) {
id
type
format
title {
english
romaji
native
}
synonyms
status
description
start... | en | 0.408525 | query ($search: String, $type: MediaType, $exclude: MediaFormat, $isAdult: Boolean) { Media(search: $search, type: $type, format_not: $exclude, isAdult: $isAdult) { id type format title { english romaji native } synonyms status description startDate { year ... | 1.271874 | 1 |
sandbox/test/testChainop.py | turkeydonkey/nzmath3 | 1 | 2664 | <reponame>turkeydonkey/nzmath3<filename>sandbox/test/testChainop.py
import unittest
import operator
import sandbox.chainop as chainop
class BasicChainTest (unittest.TestCase):
def testBasicChain(self):
double = lambda x: x * 2
self.assertEqual(62, chainop.basic_chain((operator.add, double), 2, 31)... | import unittest
import operator
import sandbox.chainop as chainop
class BasicChainTest (unittest.TestCase):
def testBasicChain(self):
double = lambda x: x * 2
self.assertEqual(62, chainop.basic_chain((operator.add, double), 2, 31))
square = lambda x: x ** 2
self.assertEqual(2**31, ... | none | 1 | 3.144182 | 3 | |
labs_final/lab5/experiments/run_trpo_pendulum.py | mrmotallebi/berkeley-deeprl-bootcamp | 3 | 2665 | #!/usr/bin/env python
import chainer
from algs import trpo
from env_makers import EnvMaker
from models import GaussianMLPPolicy, MLPBaseline
from utils import SnapshotSaver
import numpy as np
import os
import logger
log_dir = "data/local/trpo-pendulum"
np.random.seed(42)
# Clean up existing logs
os.system("rm -rf {... | #!/usr/bin/env python
import chainer
from algs import trpo
from env_makers import EnvMaker
from models import GaussianMLPPolicy, MLPBaseline
from utils import SnapshotSaver
import numpy as np
import os
import logger
log_dir = "data/local/trpo-pendulum"
np.random.seed(42)
# Clean up existing logs
os.system("rm -rf {... | en | 0.290362 | #!/usr/bin/env python # Clean up existing logs | 1.962913 | 2 |
jtyoui/regular/regexengine.py | yy1244/Jtyoui | 1 | 2666 | #!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2019/12/2 10:17
# @Author: <EMAIL>
"""
正则解析器
"""
try:
import xml.etree.cElementTree as et
except ModuleNotFoundError:
import xml.etree.ElementTree as et
import re
class RegexEngine:
def __init__(self, xml, str_):
"""加载正则表。正则表为xml
:pa... | #!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2019/12/2 10:17
# @Author: <EMAIL>
"""
正则解析器
"""
try:
import xml.etree.cElementTree as et
except ModuleNotFoundError:
import xml.etree.ElementTree as et
import re
class RegexEngine:
def __init__(self, xml, str_):
"""加载正则表。正则表为xml
:pa... | zh | 0.6756 | #!/usr/bin/python3.7 # -*- coding: utf-8 -*- # @Time : 2019/12/2 10:17 # @Author: <EMAIL> 正则解析器 加载正则表。正则表为xml :param xml: 正则表的位置 :param str_: 要匹配的字符串 根据xml的tag来实现不同的正则提取 :param tag: xml的tag标签 :return: 正则提取的数据 tag标签不分开抽取 tag标签分开提取 | 2.775862 | 3 |
proglearn/transformers.py | rflperry/ProgLearn | 0 | 2667 | <gh_stars>0
"""
Main Author: <NAME>
Corresponding Email: <EMAIL>
"""
import keras
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.utils.validation import check_array, check_is_fitted, check_X_y
from .base import BaseTransformer
class NeuralClassificationTransformer(BaseTransformer):
... | """
Main Author: <NAME>
Corresponding Email: <EMAIL>
"""
import keras
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.utils.validation import check_array, check_is_fitted, check_X_y
from .base import BaseTransformer
class NeuralClassificationTransformer(BaseTransformer):
"""
A... | en | 0.503716 | Main Author: <NAME> Corresponding Email: <EMAIL> A class used to transform data from a category to a specialized representation. Parameters ---------- network : object A neural network used in the classification transformer. euclidean_layer_idx : int An integer to represent the final l... | 3.001534 | 3 |
morphelia/external/saphire.py | marx-alex/Morphelia | 0 | 2668 | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.collections as mcoll
from matplotlib.ticker import MaxNLocator
plt.style.use('seaborn-darkgrid')
class BaseTraj:
def __init__(self, model, X):
self.model = model
assert len(X.shape) == 2, f"X should be 2... | import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.collections as mcoll
from matplotlib.ticker import MaxNLocator
plt.style.use('seaborn-darkgrid')
class BaseTraj:
def __init__(self, model, X):
self.model = model
assert len(X.shape) == 2, f"X should be 2... | en | 0.709026 | Bin rho values and dwell time on polar coordinates. :param rho: :param theta: :param dt: :param bins: :return: Transition vectors between states on polar coordinates. :return: Normalized transition time. :return: # normalize by transition probability Normalized... | 2.496637 | 2 |
account/views.py | Stfuncode/food-beverage-investigator | 0 | 2669 | import imp
from venv import create
from django.shortcuts import render, redirect
from django.views import View
from django.views.generic import (
ListView,
)
from account.models import *
from account.forms import *
from data.models import *
from django.contrib.auth import login as auth_login
from django.contrib.a... | import imp
from venv import create
from django.shortcuts import render, redirect
from django.views import View
from django.views.generic import (
ListView,
)
from account.models import *
from account.forms import *
from data.models import *
from django.contrib.auth import login as auth_login
from django.contrib.a... | en | 0.968116 | # Create your views here. | 2.217521 | 2 |
fpds/client.py | mgradowski/aiproject | 0 | 2670 | <filename>fpds/client.py<gh_stars>0
import cv2
import aiohttp
import asyncio
import concurrent.futures
import argparse
import numpy as np
async def camera_source(ws: aiohttp.ClientWebSocketResponse, threadpool: concurrent.futures.ThreadPoolExecutor, src_id: int=0):
loop = asyncio.get_running_loop()
try:
... | <filename>fpds/client.py<gh_stars>0
import cv2
import aiohttp
import asyncio
import concurrent.futures
import argparse
import numpy as np
async def camera_source(ws: aiohttp.ClientWebSocketResponse, threadpool: concurrent.futures.ThreadPoolExecutor, src_id: int=0):
loop = asyncio.get_running_loop()
try:
... | none | 1 | 2.481323 | 2 | |
Giveme5W1H/extractor/tools/key_value_cache.py | bkrrr/Giveme5W | 410 | 2671 | import logging
import os
import pickle
import sys
import threading
import time
from typing import List
from Giveme5W1H.extractor.root import path
from Giveme5W1H.extractor.tools.util import bytes_2_human_readable
class KeyValueCache(object):
def __init__(self, cache_path):
"""
:param cache_path: ... | import logging
import os
import pickle
import sys
import threading
import time
from typing import List
from Giveme5W1H.extractor.root import path
from Giveme5W1H.extractor.tools.util import bytes_2_human_readable
class KeyValueCache(object):
def __init__(self, cache_path):
"""
:param cache_path: ... | en | 0.820487 | :param cache_path: path to cache, must be relative to the root.py file # resolve path relative to the path file # ad a meaningful extension # reload cache object form disc, if any # size is not considering child's None values are considered as invalid results (ToughRequest) is producing none for exceptions set ... | 2.325088 | 2 |
nsst_translate_corpus.py | AlexanderJenke/nsst | 0 | 2672 | from argparse import ArgumentParser
from tqdm import tqdm
import NSST
from nsst_translate import best_transition_sequence
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("--nsst_file", default="output/nsst_tss20_th4_nSt100_Q0.pkl", help="nsst file")
parser.add_argument("--src_lan... | from argparse import ArgumentParser
from tqdm import tqdm
import NSST
from nsst_translate import best_transition_sequence
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("--nsst_file", default="output/nsst_tss20_th4_nSt100_Q0.pkl", help="nsst file")
parser.add_argument("--src_lan... | en | 0.514845 | # load NSST # open files # iterate over sentences, first 4096 -> test sentences # remove line breaks # try to translate # prepare tokenisations # run nsst # get best result # write to csv # catch empty registers # close files | 2.530863 | 3 |
10 Days of Statistics/Day 1/Standard Deviation.py | dhyanpatel110/HACKERRANK | 0 | 2673 | # Import library
import math
# Define functionts
def mean(data):
return sum(data) / len(data)
def stddev(data, size):
sum = 0
for i in range(size):
sum = sum + (data[i] - mean(data)) ** 2
return math.sqrt(sum / size)
# Set data
size = int(input())
numbers = list(map(int, input().split()))
# ... | # Import library
import math
# Define functionts
def mean(data):
return sum(data) / len(data)
def stddev(data, size):
sum = 0
for i in range(size):
sum = sum + (data[i] - mean(data)) ** 2
return math.sqrt(sum / size)
# Set data
size = int(input())
numbers = list(map(int, input().split()))
# ... | en | 0.40658 | # Import library # Define functionts # Set data # Get standard deviation | 3.796369 | 4 |
Homework/Hw4/Solution/problem5a.py | jmsevillam/Herramientas-Computacionales-UniAndes | 0 | 2674 | <reponame>jmsevillam/Herramientas-Computacionales-UniAndes
def decode(word1,word2,code):
if len(word1)==1:
code+=word1+word2
return code
else:
code+=word1[0]+word2[0]
return decode(word1[1:],word2[1:],code)
Alice='Ti rga eoe esg o h ore"ermetsCmuainls'
Bob='hspormdcdsamsaefrte<... | def decode(word1,word2,code):
if len(word1)==1:
code+=word1+word2
return code
else:
code+=word1[0]+word2[0]
return decode(word1[1:],word2[1:],code)
Alice='Ti rga eoe esg o h ore"ermetsCmuainls'
Bob='hspormdcdsamsaefrte<NAME>ae"'
print(decode(Alice,Bob,'')) | none | 1 | 3.615768 | 4 | |
pychron/lasers/power/composite_calibration_manager.py | ASUPychron/pychron | 31 | 2675 | <reponame>ASUPychron/pychron
# ===============================================================================
# Copyright 2012 <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
#
# ht... | # ===============================================================================
# Copyright 2012 <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/... | en | 0.660842 | # =============================================================================== # Copyright 2012 <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/... | 1.463991 | 1 |
ttt_package/libs/best_move.py | Ipgnosis/tic_tac_toe | 0 | 2676 | <gh_stars>0
# refactored from make_play to simplify
# by Russell on 3/5/21
#from ttt_package.libs.move_utils import get_open_cells
from ttt_package.libs.compare import get_transposed_games, reorient_games
from ttt_package.libs.calc_game_bound import calc_game_bound
from ttt_package.libs.maxi_min import maximin
# find... | # refactored from make_play to simplify
# by Russell on 3/5/21
#from ttt_package.libs.move_utils import get_open_cells
from ttt_package.libs.compare import get_transposed_games, reorient_games
from ttt_package.libs.calc_game_bound import calc_game_bound
from ttt_package.libs.maxi_min import maximin
# find the best mo... | en | 0.81799 | # refactored from make_play to simplify # by Russell on 3/5/21 #from ttt_package.libs.move_utils import get_open_cells # find the best move for this agent, based on prior games in the game_history # note that len gives the number of the move about to be made #print("best_move - this_board:", this_board) # TRANSPOSE the... | 2.983634 | 3 |
yard/skills/66-python/cookbook/yvhai/demo/mt/raw_thread.py | paser4se/bbxyard | 1 | 2677 | #!/usr/bin/env python3
# python 线程测试
import _thread
import time
from yvhai.demo.base import YHDemo
def print_time(thread_name, interval, times):
for cnt in range(times):
time.sleep(interval)
print(" -- %s: %s" % (thread_name, time.ctime(time.time())))
class RawThreadDemo(YHDemo):
def __in... | #!/usr/bin/env python3
# python 线程测试
import _thread
import time
from yvhai.demo.base import YHDemo
def print_time(thread_name, interval, times):
for cnt in range(times):
time.sleep(interval)
print(" -- %s: %s" % (thread_name, time.ctime(time.time())))
class RawThreadDemo(YHDemo):
def __in... | zh | 0.32557 | #!/usr/bin/env python3 # python 线程测试 # 主线程无限等待 | 3.55906 | 4 |
rasa/utils/tensorflow/constants.py | praneethgb/rasa | 8 | 2678 | # constants for configuration parameters of our tensorflow models
LABEL = "label"
IDS = "ids"
# LABEL_PAD_ID is used to pad multi-label training examples.
# It should be < 0 to avoid index out of bounds errors by tf.one_hot.
LABEL_PAD_ID = -1
HIDDEN_LAYERS_SIZES = "hidden_layers_sizes"
SHARE_HIDDEN_LAYERS = "share_hid... | # constants for configuration parameters of our tensorflow models
LABEL = "label"
IDS = "ids"
# LABEL_PAD_ID is used to pad multi-label training examples.
# It should be < 0 to avoid index out of bounds errors by tf.one_hot.
LABEL_PAD_ID = -1
HIDDEN_LAYERS_SIZES = "hidden_layers_sizes"
SHARE_HIDDEN_LAYERS = "share_hid... | en | 0.74317 | # constants for configuration parameters of our tensorflow models # LABEL_PAD_ID is used to pad multi-label training examples. # It should be < 0 to avoid index out of bounds errors by tf.one_hot. # Deprecated and superseeded by CONNECTION_DENSITY | 1.880079 | 2 |
client/canyons-of-mars/maze.py | GamesCreatorsClub/GCC-Rover | 3 | 2679 | <reponame>GamesCreatorsClub/GCC-Rover
#
# Copyright 2016-2019 Games Creators Club
#
# MIT License
#
import math
import pyroslib
import pyroslib.logging
import time
from pyroslib.logging import log, LOG_LEVEL_ALWAYS, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
from rover import WheelOdos, WHEEL_NAMES
from rover import normaiseAn... | #
# Copyright 2016-2019 Games Creators Club
#
# MIT License
#
import math
import pyroslib
import pyroslib.logging
import time
from pyroslib.logging import log, LOG_LEVEL_ALWAYS, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
from rover import WheelOdos, WHEEL_NAMES
from rover import normaiseAngle, angleDiference
from challenge_util... | en | 0.515565 | # # Copyright 2016-2019 Games Creators Club # # MIT License # # TODO calc gaps # pyroslib.publish("move/steer", "300 120") # Values that worked speed=150, steer=5-7, dist=4 # self.speed = 150 # 150 # mm/second - TODO use odo to update to correct value! # 5-7 # 4 # divide with 10 and by 180 -> 450/10 - 45deg # divide w... | 2.996135 | 3 |
src/spaceone/monitoring/conf/proto_conf.py | jean1042/monitoring | 5 | 2680 | PROTO = {
'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'],
'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'],
'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'],
'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy']... | PROTO = {
'spaceone.monitoring.interface.grpc.v1.data_source': ['DataSource'],
'spaceone.monitoring.interface.grpc.v1.metric': ['Metric'],
'spaceone.monitoring.interface.grpc.v1.project_alert_config': ['ProjectAlertConfig'],
'spaceone.monitoring.interface.grpc.v1.escalation_policy': ['EscalationPolicy']... | none | 1 | 1.053654 | 1 | |
tests/delete_regress/models.py | PirosB3/django | 2 | 2681 | <gh_stars>1-10
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Award(models.Model):
name = models.CharField(max_length=25)
object_id = models.PositiveIntegerField()
conte... | from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Award(models.Model):
name = models.CharField(max_length=25)
object_id = models.PositiveIntegerField()
content_type = model... | en | 0.715987 | # Models for #15776 # Models for #16128 | 2.056933 | 2 |
All_Program.py | TheoSaify/Yolo-Detector | 0 | 2682 | import cv2
from cv2 import *
import numpy as np
from matplotlib import pyplot as plt
###############################SIFT MATCH Function#################################
def SIFTMATCH(img1,img2):
# Initiate SIFT detector
sift = cv2.xfeatures2d.SIFT_create()
# find the keypoints and descri... | import cv2
from cv2 import *
import numpy as np
from matplotlib import pyplot as plt
###############################SIFT MATCH Function#################################
def SIFTMATCH(img1,img2):
# Initiate SIFT detector
sift = cv2.xfeatures2d.SIFT_create()
# find the keypoints and descri... | en | 0.465269 | ###############################SIFT MATCH Function################################# # Initiate SIFT detector # find the keypoints and descriptors with SIFT # store all the good matches as per Lowe's ratio test. # draw matches in green color # draw only inliers # Move it to (40,30) #The function waits for specified mill... | 2.784992 | 3 |
apps/UI_phone_mcdm.py | industrial-optimization-group/researchers-night | 0 | 2683 | import dash
from dash.exceptions import PreventUpdate
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import dash_table
import plotly.express as ex
import plotly.graph_objects as go
import pandas as pd
imp... | import dash
from dash.exceptions import PreventUpdate
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import dash_table
import plotly.express as ex
import plotly.graph_objects as go
import pandas as pd
imp... | en | 0.439387 | # .container class is fixed, .container.scalable is scalable # Top card with details(?) # className="text-center mt-4", # className="text-center mt-5", @app.callback(Output("tooltips", "children"), [Input("callback-dump", "children")]) def tooltips(tooldict): num = len(tooldict["ids"]) content = [] for i in... | 2.429579 | 2 |
pyxon/utils.py | k-j-m/Pyxon | 0 | 2684 | <reponame>k-j-m/Pyxon<filename>pyxon/utils.py<gh_stars>0
import pyxon.decode as pd
def unobjectify(obj):
"""
Turns a python object (must be a class instance)
into the corresponding JSON data.
Example:
>>> @sprop.a # sprop annotations are needed to tell the
>>> @sprop.b # unobjectify function ... | import pyxon.decode as pd
def unobjectify(obj):
"""
Turns a python object (must be a class instance)
into the corresponding JSON data.
Example:
>>> @sprop.a # sprop annotations are needed to tell the
>>> @sprop.b # unobjectify function what parameter need
>>> @sprop.c # to be written out.... | en | 0.704156 | Turns a python object (must be a class instance) into the corresponding JSON data. Example: >>> @sprop.a # sprop annotations are needed to tell the >>> @sprop.b # unobjectify function what parameter need >>> @sprop.c # to be written out. >>> class Baz(object): pass >>> def __init__(sel... | 3.109278 | 3 |
AxonDeepSeg/segment.py | sophie685/newfileplzworklord | 0 | 2685 | # Segmentation script
# -------------------
# This script lets the user segment automatically one or many images based on the default segmentation models: SEM or
# TEM.
#
# <NAME> - 2017-08-30
# Imports
import sys
from pathlib import Path
import json
import argparse
from argparse import RawTextHelpFormatter
from tqd... | # Segmentation script
# -------------------
# This script lets the user segment automatically one or many images based on the default segmentation models: SEM or
# TEM.
#
# <NAME> - 2017-08-30
# Imports
import sys
from pathlib import Path
import json
import argparse
from argparse import RawTextHelpFormatter
from tqd... | en | 0.843254 | # Segmentation script # ------------------- # This script lets the user segment automatically one or many images based on the default segmentation models: SEM or # TEM. # # <NAME> - 2017-08-30 # Imports # Global variables # Definition of the functions Segment the image located at the path_testing_image location. :p... | 3.022807 | 3 |
tests/test_hedges.py | aplested/DC_Pyps | 1 | 2686 | from dcstats.hedges import Hedges_d
from dcstats.statistics_EJ import simple_stats as mean_SD
import random
import math
def generate_sample (length, mean, sigma):
#generate a list of normal distributed samples
sample = []
for n in range(length):
sample.append(random.gauss(mean, sigma))
return ... | from dcstats.hedges import Hedges_d
from dcstats.statistics_EJ import simple_stats as mean_SD
import random
import math
def generate_sample (length, mean, sigma):
#generate a list of normal distributed samples
sample = []
for n in range(length):
sample.append(random.gauss(mean, sigma))
return ... | en | 0.892052 | #generate a list of normal distributed samples #answer is in self.d #bootstrap is similar at high d but gives wider intervals at low d ###tests #expect d = 5 #expect d = 2 #expect d = 1, fail | 2.787989 | 3 |
src/FYP/fifaRecords/urls.py | MustafaAbbas110/FinalProject | 0 | 2687 | from django.urls import path
from . import views
urlpatterns = [
path('', views.Records, name ="fRec"),
] | from django.urls import path
from . import views
urlpatterns = [
path('', views.Records, name ="fRec"),
] | none | 1 | 1.520856 | 2 | |
spacy_transformers/tests/regression/test_spacy_issue6401.py | KennethEnevoldsen/spacy-transformers | 0 | 2688 | import pytest
from spacy.training.example import Example
from spacy.util import make_tempdir
from spacy import util
from thinc.api import Config
TRAIN_DATA = [
("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}),
("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}),
]
cfg_string = """
... | import pytest
from spacy.training.example import Example
from spacy.util import make_tempdir
from spacy import util
from thinc.api import Config
TRAIN_DATA = [
("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}),
("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}),
]
cfg_string = """
... | en | 0.751985 | [nlp] lang = "en" pipeline = ["transformer","textcat"] [components] [components.textcat] factory = "textcat" [components.textcat.model] @architectures = "spacy.TextCatEnsemble.v2" [components.textcat.model.tok2vec] @architectures = "spacy-transformers.TransformerListener.v1" ... | 2.406087 | 2 |
hydra/client/repl.py | rpacholek/hydra | 0 | 2689 | import asyncio
from ..core.common.io import input
from .action_creator import ActionCreator
class REPL:
def __init__(self, action_queue, config, *args, **kwargs):
self.action_queue = action_queue
self.config = config
async def run(self):
await asyncio.sleep(1)
print("Insert c... | import asyncio
from ..core.common.io import input
from .action_creator import ActionCreator
class REPL:
def __init__(self, action_queue, config, *args, **kwargs):
self.action_queue = action_queue
self.config = config
async def run(self):
await asyncio.sleep(1)
print("Insert c... | none | 1 | 2.773332 | 3 | |
train_dv3.py | drat/Neural-Voice-Cloning-With-Few-Samples | 361 | 2690 | <reponame>drat/Neural-Voice-Cloning-With-Few-Samples
"""Trainining script for seq2seq text-to-speech synthesis model.
usage: train.py [options]
options:
--data-root=<dir> Directory contains preprocessed features.
--checkpoint-dir=<dir> Directory where to save model checkpoints [default: check... | """Trainining script for seq2seq text-to-speech synthesis model.
usage: train.py [options]
options:
--data-root=<dir> Directory contains preprocessed features.
--checkpoint-dir=<dir> Directory where to save model checkpoints [default: checkpoints].
--hparams=<parmas> Hyper param... | en | 0.639703 | Trainining script for seq2seq text-to-speech synthesis model. usage: train.py [options] options: --data-root=<dir> Directory contains preprocessed features. --checkpoint-dir=<dir> Directory where to save model checkpoints [default: checkpoints]. --hparams=<parmas> Hyper paramete... | 2.506412 | 3 |
magic_mirror.py | alcinnz/Historical-Twin | 1 | 2691 | #! /usr/bin/python2
import time
start = time.time()
import pygame, numpy
import pygame.camera
# Init display
screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN)
pygame.display.set_caption("Magic Mirror")
#pygame.mouse.set_visible(False)
# Init font
pygame.font.init()
font_colour = 16, 117, 186
fonts = {40: p... | #! /usr/bin/python2
import time
start = time.time()
import pygame, numpy
import pygame.camera
# Init display
screen = pygame.display.set_mode((0,0), pygame.FULLSCREEN)
pygame.display.set_caption("Magic Mirror")
#pygame.mouse.set_visible(False)
# Init font
pygame.font.init()
font_colour = 16, 117, 186
fonts = {40: p... | en | 0.360116 | #! /usr/bin/python2 # Init display #pygame.mouse.set_visible(False) # Init font # Init AI # Init clock # Init camera # Mainloop # 30s | 2.668221 | 3 |
resolwe/__init__.py | plojyon/resolwe | 27 | 2692 | <reponame>plojyon/resolwe<gh_stars>10-100
""".. Ignore pydocstyle D400.
=======
Resolwe
=======
Open source enterprise dataflow engine in Django.
"""
from resolwe.__about__ import ( # noqa: F401
__author__,
__copyright__,
__email__,
__license__,
__summary__,
__title__,
__url__,
__ver... | """.. Ignore pydocstyle D400.
=======
Resolwe
=======
Open source enterprise dataflow engine in Django.
"""
from resolwe.__about__ import ( # noqa: F401
__author__,
__copyright__,
__email__,
__license__,
__summary__,
__title__,
__url__,
__version__,
) | en | 0.494347 | .. Ignore pydocstyle D400. ======= Resolwe ======= Open source enterprise dataflow engine in Django. # noqa: F401 | 1.030127 | 1 |
audio_som64_u_grupo1.py | andremsouza/swine_sound_analysis | 0 | 2693 | # %% [markdown]
# # Testing python-som with audio dataset
# %% [markdown]
# # Imports
# %%
import matplotlib.pyplot as plt
# import librosa as lr
# import librosa.display as lrdisp
import numpy as np
import pandas as pd
import pickle
import seaborn as sns
import sklearn.preprocessing
from python_som import SOM
FILE... | # %% [markdown]
# # Testing python-som with audio dataset
# %% [markdown]
# # Imports
# %%
import matplotlib.pyplot as plt
# import librosa as lr
# import librosa.display as lrdisp
import numpy as np
import pandas as pd
import pickle
import seaborn as sns
import sklearn.preprocessing
from python_som import SOM
FILE... | en | 0.622843 | # %% [markdown] # # Testing python-som with audio dataset # %% [markdown] # # Imports # %% # import librosa as lr # import librosa.display as lrdisp # %% [markdown] # # Loading dataset # %% # type: ignore # %% [markdown] # ## Checking for and dropping duplicates # %% # Resetting index for duplicate analysis # Rebuildin... | 2.640968 | 3 |
footy/engine/UpdateEngine.py | dallinb/footy | 2 | 2694 | """Prediction Engine - Update the data model with the most resent fixtures and results."""
from footy.domain import Competition
class UpdateEngine:
"""Prediction Engine - Update the data model with the most resent fixtures and results."""
def __init__(self):
"""Construct a UpdateEngine object."""
... | """Prediction Engine - Update the data model with the most resent fixtures and results."""
from footy.domain import Competition
class UpdateEngine:
"""Prediction Engine - Update the data model with the most resent fixtures and results."""
def __init__(self):
"""Construct a UpdateEngine object."""
... | en | 0.85227 | Prediction Engine - Update the data model with the most resent fixtures and results. Prediction Engine - Update the data model with the most resent fixtures and results. Construct a UpdateEngine object. Retrieve data for the supplied competition code. Returns ------- Competition A C... | 3.092784 | 3 |
bindings/pydeck/docs/scripts/embed_examples.py | marsupialmarcos/deck.gl | 2 | 2695 | """Script to embed pydeck examples into .rst pages with code
These populate the files you see once you click into a grid cell
on the pydeck gallery page
"""
from multiprocessing import Pool
import os
import subprocess
import sys
from const import DECKGL_URL_BASE, EXAMPLE_GLOB, GALLERY_DIR, HTML_DIR, HOSTED_STATIC_PAT... | """Script to embed pydeck examples into .rst pages with code
These populate the files you see once you click into a grid cell
on the pydeck gallery page
"""
from multiprocessing import Pool
import os
import subprocess
import sys
from const import DECKGL_URL_BASE, EXAMPLE_GLOB, GALLERY_DIR, HTML_DIR, HOSTED_STATIC_PAT... | en | 0.813736 | Script to embed pydeck examples into .rst pages with code These populate the files you see once you click into a grid cell on the pydeck gallery page # If running for rtfd.io, set this variable from the Admin panel # Don't add a deck.gl docs link if we're not referencing a layer # Obviously very rough, should change t... | 2.754386 | 3 |
symbolicR/python/forward_kin.py | mharding01/augmented-neuromuscular-RT-running | 0 | 2696 | <filename>symbolicR/python/forward_kin.py
import numpy as np
import sympy as sp
import re
import os
######################
# #
# 17 16 21 #
# 18 15 22 #
# 19 14 23 #
# 20 01 24 #
# 02 08 #
# 03 09 #
# 04 10 #
# 05 ... | <filename>symbolicR/python/forward_kin.py
import numpy as np
import sympy as sp
import re
import os
######################
# #
# 17 16 21 #
# 18 15 22 #
# 19 14 23 #
# 20 01 24 #
# 02 08 #
# 03 09 #
# 04 10 #
# 05 ... | en | 0.747821 | ###################### # # # 17 16 21 # # 18 15 22 # # 19 14 23 # # 20 01 24 # # 02 08 # # 03 09 # # 04 10 # # 05 11 # # 06 12 # # 07 13 # # # #####################... | 2.51512 | 3 |
examples/last.py | 0xiso/PyMISP | 5 | 2697 | <reponame>0xiso/PyMISP
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key, misp_verifycert
import argparse
import os
import json
# Usage for pipe masters: ./last.py -l 5h | jq .
def init(url, key):
return PyMISP(url, key, misp_verifycert, 'json')
def d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymisp import PyMISP
from keys import misp_url, misp_key, misp_verifycert
import argparse
import os
import json
# Usage for pipe masters: ./last.py -l 5h | jq .
def init(url, key):
return PyMISP(url, key, misp_verifycert, 'json')
def download_last(m, last, o... | en | 0.377985 | #!/usr/bin/env python # -*- coding: utf-8 -*- # Usage for pipe masters: ./last.py -l 5h | jq . | 2.745666 | 3 |
saleor/dashboard/urls.py | Chaoslecion123/Diver | 0 | 2698 | from django.conf.urls import include, url
from django.views.generic.base import TemplateView
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .collection.urls import urlpatterns as collection_urls
from .customer.urls import urlpatterns as customer_urls
from .discount.urls ... | from django.conf.urls import include, url
from django.views.generic.base import TemplateView
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .collection.urls import urlpatterns as collection_urls
from .customer.urls import urlpatterns as customer_urls
from .discount.urls ... | en | 0.180908 | # BEGIN :: SoftButterfly Extensions -------------------------------------------- # END :: SoftButterfly Extensions ---------------------------------------------- # Extensions # BEGIN :: SoftButterfly Extensions ---------------------------------------- # END :: SoftButterfly Extensions ----------------------------------... | 1.595943 | 2 |
experiments/CUB_fewshot_raw/FRN/ResNet-12/train.py | Jf-Chen/FRN-main | 43 | 2699 | import os
import sys
import torch
import yaml
from functools import partial
sys.path.append('../../../../')
from trainers import trainer, frn_train
from datasets import dataloaders
from models.FRN import FRN
args = trainer.train_parser()
with open('../../../../config.yml', 'r') as f:
temp = yaml.safe_load(f)
data... | import os
import sys
import torch
import yaml
from functools import partial
sys.path.append('../../../../')
from trainers import trainer, frn_train
from datasets import dataloaders
from models.FRN import FRN
args = trainer.train_parser()
with open('../../../../config.yml', 'r') as f:
temp = yaml.safe_load(f)
data... | none | 1 | 2.113657 | 2 |