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 |
|---|---|---|---|---|---|---|
ergo/conditions/maxentropy.py | NixGD/ergo | 93 | 12773851 | from . import condition
class MaxEntropyCondition(condition.Condition):
def loss(self, dist) -> float:
return -self.weight * dist.entropy()
def destructure(self):
return ((MaxEntropyCondition,), (self.weight,))
def __str__(self):
return "Maximize the entropy of the distribution"
... | 3.140625 | 3 |
examples/supervised/neuralnets+svm/example_fnn.py | rueckstiess/pybrain | 3 | 12773852 | #!/usr/bin/env python
# Example script for feed-forward network usage in PyBrain.
__author__ = "<NAME>"
__version__ = '$Id$'
from pylab import figure, ioff, clf, contourf, ion, draw, show
from pybrain.utilities import percentError
from pybrain.tools.shortcuts import buildNetwork
from pybrain.supervised... | 3.109375 | 3 |
line-bot-tutorial-master/app.py | chungoppa/test | 0 | 12773853 | from flask import Flask, request, abort
import json
import datetime
from linebot import (
LineBotApi, WebhookHandler
)
from linebot.exceptions import (
InvalidSignatureError
)
from linebot.models import *
app = Flask(__name__)
# Channel Access Token
line_bot_api = LineBotApi('<KEY>
# Channel Secret
handler =... | 2.34375 | 2 |
pkgs/core/bdsim/core/tunable.py | CallumJHays/bdsim.micropython | 0 | 12773854 | <reponame>CallumJHays/bdsim.micropython
from numbers import Real
from collections import OrderedDict
from collections.abc import Iterable
from abc import ABC, abstractmethod
from typing import Set
import numpy as np
class Tunable:
"""
A parameter is a variable used by the block diagram that can be
modifie... | 3.328125 | 3 |
oth-chain/tests/test_pow_chain.py | McSido/oth-chain | 0 | 12773855 | """ Testing module for the Proof-Of-Work implementation
of the blockchain client.
"""
import hashlib
import math
import time
from queue import Queue
from queue import Empty
import nacl.encoding
import nacl.signing
from chains import Transaction, Block, Header, PoW_Blockchain
import utils
VERSION = 0.7
class TestP... | 2.828125 | 3 |
14.py | vandorjw/ProjectEuler | 0 | 12773856 |
def collatz(n, count):
if n == 1:
return count
else:
count = count + 1
if n % 2 == 0:
n = n /2
else:
n = 3 * n + 1
return collatz(n, count)
max_collatz = 1
iteration = 1
for i in range(1, 1000000):
count = 1
contesting = collatz(i, 1)
... | 3.65625 | 4 |
scripts/data.py | ldself/covidweb_api_dashboard | 0 | 12773857 | <filename>scripts/data.py
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 20 11:30:55 2021
@author: lself
"""
import pandas as pd
from collections import OrderedDict
import requests
import plotly.graph_objects as go
from plotly.offline import plot
states_default = OrderedDict([('Alabama', 'AL')])
def return_figures(... | 3.421875 | 3 |
tecladu.py | wellingtonfs/fsek-pessoal | 0 | 12773858 | <reponame>wellingtonfs/fsek-pessoal
#!/usr/bin/env python3
# so that script can be run from Brickman
import termios, tty, sys
from ev3dev.ev3 import *
# attach large motors to ports B and C, medium motor to port A
motor_left = LargeMotor('outC')
motor_right = LargeMotor('outD')
motor_a = MediumMotor('outA')
motor_b =... | 2.375 | 2 |
pages/migrations/0001_initial.py | 501code/fletcher-street-urban-riding-club | 1 | 12773859 | <filename>pages/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-31 07:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... | 1.6875 | 2 |
utils/dataset.py | NaCl-Ocean/Anchor_free_detection_rotation | 12 | 12773860 | import os
import torch
from torchvision import datasets
from utils.boxlist import BoxList
import cv2
import numpy as np
import random
def has_only_empty_bbox(annot):
# if bbox width and height <=1 , then it is a empty box
return all(any(o <= 1 for o in obj['bbox'][2:]) for obj in annot)
def ... | 2.46875 | 2 |
tests/Internship_app/test_urls_ads/urls_ad.py | StefanDimitrovDimitrov/Internship | 1 | 12773861 | <reponame>StefanDimitrovDimitrov/Internship
from django.urls import reverse,resolve
from django.test import SimpleTestCase
from Internship.internship_app.views import Home, about, CatalogCompanies, catalog_ad, create_ad, details_ad, edit_ad, \
delete_ad, deactivate_ad, activate_ad, apply
class TestUrls(SimpleTes... | 2.484375 | 2 |
examples/colors.py | edouard-lopez/colorful | 517 | 12773862 | # -*- coding: utf-8 -*-
"""
colorful
~~~~~~~~
Terminal string styling done right, in Python.
:copyright: (c) 2017 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import sys
import colorful
def show():
"""
Show the modifiers and colors
"""
# modifiers
s... | 3.125 | 3 |
test/echeck_test.py | gitter-badger/easy_echeck | 1 | 12773863 | <reponame>gitter-badger/easy_echeck<filename>test/echeck_test.py
# -*- coding: utf-8 -*-
class TestECurl():
def test_ecurl(self):
from echeck.Curlclient import Curlclient
url_list = ['https://www.baidu.com','http://www.pathcurve.cn']
client = Curlclient(url_list, 'indexfile')
res_li... | 2.515625 | 3 |
partitions/registry.py | eldarion/django-partitions | 1 | 12773864 | from django.conf import settings
class Registry(object):
def __init__(self):
self._partitions = {}
def register(self, key, app_model, expression):
if not isinstance(app_model, basestring):
app_model = "%s.%s" % (
app_model._meta.app_label,
app_mode... | 2.21875 | 2 |
events/admin.py | MufasaTheMusician/livelobby | 0 | 12773865 | <gh_stars>0
from django.contrib import admin
from events.models import Event, Participant
# Register your models here.
admin.site.register(Event)
admin.site.register(Participant)
| 1.429688 | 1 |
ml_tutorial/rnn.py | sci2lab/ml_tutorial | 38 | 12773866 | # AUTOGENERATED! DO NOT EDIT! File to edit: 09_rnn.ipynb (unless otherwise specified).
__all__ = ['generate_data', 'encode', 'decode']
# Cell
from tqdm import tqdm
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, TimeDistribu... | 2.484375 | 2 |
kelkoo/parsefields.py | sachiel/kelkoo_jsontoxml | 0 | 12773867 | # -*- coding: utf-8 -*-
"""
Actually, i want to design a django model-like with fields and inline validators,
of course time is against me, so i wrote this; close enough (not really) xD
If 'f' is None means that validator generate the content of the field
"""
MAIN_FIELDS = [
{
'f': None, # From JSO... | 2.828125 | 3 |
index-server/index-server/indexed_chunks.py | doc22940/DarkDarkGo | 1 | 12773868 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
query_processing.py - Matches the query against the saved indexed chunks and returns a list of dictionaries with docID
author: <NAME>
email: <EMAIL>
date: 12/1/2017
"""
from bs4 import BeautifulSoup
sample_indexed_chunks_dict = {"'s": {'doc_id': {'0'... | 2.796875 | 3 |
apps/usermgmt/serializers.py | ecognize-hub/ecognize | 1 | 12773869 | from rest_captcha.serializers import RestCaptchaSerializer
from rest_framework import serializers
from .models import OrgAdditionRequest
from apps.profiles.models import UserProfile
class OrgAdditionRequestSerializer(serializers.ModelSerializer):
class Meta:
model = OrgAdditionRequest
fields = ('o... | 2.1875 | 2 |
Chapter 7/args-copy.py | JoeBugajski/python-examples | 0 | 12773870 | #!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
# Functions allow variable-length argument lists
def main():
kitten('meow', 'grrr', 'purr')
# We treat it as a sequence, actually a tuple
def kitten(*args): # It's denoted as *args. args is the conventional name
if len(args): # If the length of ar... | 4.375 | 4 |
cn_dpm/train.py | ryanlindeborg/CN-DPM | 1 | 12773871 | <filename>cn_dpm/train.py<gh_stars>1-10
import os
import pickle
from typing import Optional
import torch
from sequoia.settings.sl import ContinualSLSetting, SLEnvironment
from torch import Tensor
from .data import DataScheduler
from .models import NdpmModel
def _make_collage(samples, config, grid_h, grid_w):
s ... | 2.1875 | 2 |
app/app.py | ibm-skills-network/next_instagram_pinterest | 0 | 12773872 | from posixpath import dirname
from flask import Flask, request, render_template,redirect, url_for,abort,send_from_directory
from werkzeug.utils import secure_filename
import os.path
import tempfile
import io
import os
import base64
from datetime import datetime
from pathlib import Path
import torchvision
from torchvi... | 1.914063 | 2 |
play02.py | hnishi/hnishi_test_multiprocessing | 0 | 12773873 | # -*- coding: utf-8 -*-
from multiprocessing import Pool
import os
import time
start = time.time()
def f(x):
time.sleep(1)
value = x * x
print('{}s passed...\t{}\t(pid:{})'.format(int(time.time() - start), value, os.getpid()))
return value
timeout = time.time() + 10 # sec
while True:
with Pool(pr... | 3.5625 | 4 |
mayan/apps/rest_api/urls.py | YingWang-Clare/mayan-edms-with-elasticsearch | 2 | 12773874 | from __future__ import unicode_literals
from django.conf.urls import url
from .api_views import APIResourceTypeListView
from .views import APIBase, BrowseableObtainAuthToken
urlpatterns = []
api_urls = [
url(r'^$', APIBase.as_view(), name='api_root'),
url(
r'^resources/$', APIResourceTypeListView.a... | 1.578125 | 2 |
gradefast/grader/grader.py | jhartz/gradefast | 5 | 12773875 | """
GradeFast Grader - Runs commands on submissions and controls the grading process.
Licensed under the MIT License. For more, see the LICENSE file.
Author: <NAME> <<EMAIL>>
"""
import difflib
import os
import random
import re
from collections import defaultdict
from typing import Any, Dict, List, Mapping, Optional... | 2.65625 | 3 |
tests/test-source.py | Maryan23/News-On-The-Go | 0 | 12773876 | <filename>tests/test-source.py
import unittest
class Sources:
'''
News Sources class to define news source objects
'''
def __init__(self,id,name,category,description):
self.id = id
self.name = name
self.category = category
self.description = description
class T... | 3.84375 | 4 |
storm_analysis/jupyter_examples/multiplane_psfs_to_splines.py | bintulab/storm-analysis | 0 | 12773877 | <reponame>bintulab/storm-analysis<filename>storm_analysis/jupyter_examples/multiplane_psfs_to_splines.py
#!/usr/bin/env python
"""
Helper functions for Multiplane PSF to spline conversion.
Hazen 10/17
"""
import storm_analysis.sa_library.parameters as parameters
pixel_size = 100.0
spline_z_range = 0.75
z_value = [-0.... | 2.09375 | 2 |
test/functional/f5_plugins/test_deploy_lb.py | F5Networks/f5-openstack-heat | 9 | 12773878 | # Copyright 2015-2016 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 1.609375 | 2 |
py/plot_afefeh.py | jobovy/apogee-maps | 1 | 12773879 | ###############################################################################
# plot_afefeh: the basic [a/Fe] vs. [Fe/H] plot for the data section
###############################################################################
import sys
import matplotlib
import numpy
from scipy import special
matplotlib.use('Agg')
f... | 2.5625 | 3 |
get-lib-sizes.py | bmajoros/BIGGER | 0 | 12773880 | #!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Author:<NAME>
#=========================================================================
fro... | 2.109375 | 2 |
bejmy/transactions/apps.py | bejmy/backend | 0 | 12773881 | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class TransactionsConfig(AppConfig):
name = 'bejmy.transactions'
category = 'transactions'
verbose_name = _("transactions")
def ready(self):
# apply signal receivers after all apps are ready
impo... | 1.507813 | 2 |
fxi/prompt.py | cleberzavadniak/fxi | 1 | 12773882 | <filename>fxi/prompt.py
import time
import tkinter
from tkinter.ttk import Label
class Prompt(Label):
def __init__(self, command_line, parent):
self.command_line = command_line
self.content = tkinter.StringVar()
self.reset()
self.answer = None
super().__init__(
... | 3.25 | 3 |
rafi/rv.py | fjt7tdmi/rafi-emu-python | 1 | 12773883 | # Copyright 2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 1.773438 | 2 |
src/homeautomate.py | THaeckel/PyHomeAutomate | 0 | 12773884 | """
Copyright (c) 2021 <NAME>
"""
import statedb
import traceback
import time
import datetime
from devicedetectionskill import DetectDevicePresenceSkill
from wheatherskill import WeatherSkill
from daytimeskill import DaytimeSkill
from raumfeldskill import RaumfeldTVWakeup
from hueskill import HueDaytimeAndWeatherSkil... | 2.46875 | 2 |
fluence/models/siamese_model.py | prajjwal1/fluence2 | 64 | 12773885 | import logging
import torch
from torch import nn
from transformers import AutoModel
from ..pooling import MeanPooling
logger = logging.getLogger(__name__)
class SiameseTransformer(nn.Module):
def __init__(self, args, config):
super(SiameseTransformer, self).__init__()
self.model_a = AutoModel.fro... | 2.609375 | 3 |
dep/reportlab/tests/test_graphics_render.py | csterryliu/Legal-Attest-Letter-Generator | 52 | 12773886 | <reponame>csterryliu/Legal-Attest-Letter-Generator<filename>dep/reportlab/tests/test_graphics_render.py<gh_stars>10-100
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
"""
Tests for renderers
"""
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation... | 2.25 | 2 |
handlers/web.py | wangdi1024/wangdi | 1 | 12773887 | import bcrypt
from tornado.escape import json_encode
from handlers.base import BaseHandler
class WebHandler(BaseHandler):
def get(self):
if not self.get_cookie("_csrf"):
self.set_cookie("_csrf", self.xsrf_token)
# user = xhtml_escape(self.current_user or '')
user = self.curren... | 2.59375 | 3 |
kubernetes_typed/client/models/v1_windows_security_context_options.py | sobolevn/kubernetes-typed | 22 | 12773888 | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V1WindowsSecurityContextOptionsDict generated type."""
from typing import TypedDict
V1WindowsSecurityContextOptionsDict = TypedDict(
"V1WindowsSecurityContextOptionsDict",
{
"gmsaCredentialSpec": str,
"gmsaCredentialSpecName": str,
"ru... | 1.539063 | 2 |
app.py | TonyZTYang/nyu_networking_chatapp | 0 | 12773889 | from urllib import parse
from flask import Flask, send_from_directory
from flask_restful import Resource, Api, reqparse, fields, marshal_with
from os import path
from datetime import datetime
import json
app = Flask(__name__)
api = Api(app)
# parser = reqparse.RequestParser()
users = {"test": "1"}
rooms = {
"Pub... | 2.5625 | 3 |
datasets/__init__.py | Kevincrh/multi-model_fusion | 33 | 12773890 | from .pc_aug import rotate_point_cloud_by_angle, rotation_point_cloud, jitter_point_cloud, pc_aug_funs, normal_pc
STATUS_TRAIN = "train"
STATUS_TEST = "test"
from .data_pth import * | 1.132813 | 1 |
source/apps/crawl_space/migrations/0001_initial.py | nasa-jpl-memex/memex-explorer | 31 | 12773891 | <filename>source/apps/crawl_space/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import apps.crawl_space.models
import django.db.models.deletion
import django.core.validators
class Migration(migrations.Migration):
dependencies ... | 1.851563 | 2 |
pstock/utils/quote.py | obendidi/pstock | 5 | 12773892 | import typing as tp
from datetime import date
import numpy as np
import pendulum
def get_latest_price_from_quote(price_data: tp.Dict[str, tp.Any]) -> float:
if not price_data:
raise ValueError("No price data found.")
# regular market price
regular_market_price = price_data["regularMarketPrice"][... | 2.84375 | 3 |
riss2018/synonym_stats_style.py | buoyancy99/glove | 2 | 12773893 | <filename>riss2018/synonym_stats_style.py<gh_stars>1-10
"""Author: <NAME>.
Gets the closest neighbors to the given words in embedding space.
"""
import glove
import glove.configuration
import glove.neighbors
import numpy as np
import json
import argparse
if __name__ == "__main__":
parser = argparse.... | 2.46875 | 2 |
1-getting-started/lessons/4-connect-internet/code-telemetry/pi/nightlight/app.py | kekiel/IoT-For-Beginners | 0 | 12773894 | import time
from grove.grove_light_sensor_v1_2 import GroveLightSensor
from grove.grove_led import GroveLed
import paho.mqtt.client as mqtt
import json
light_sensor = GroveLightSensor(0)
led = GroveLed(5)
id = '<ID>'
client_telemetry_topic = 'kekiot/' + id + '/telemetry'
client_name = id + 'nightlight_client'
mqtt_... | 2.5625 | 3 |
tests/factories/site.py | Stormheg/wagtail-bakery | 98 | 12773895 | <gh_stars>10-100
import factory
from wagtail.core.models import Site
class SiteFactory(factory.DjangoModelFactory):
hostname = 'localhost'
port = 80
is_default_site = True
class Meta:
model = Site
django_get_or_create = ('hostname', 'port')
| 1.726563 | 2 |
eval.py | irebai/wav2vec2 | 3 | 12773896 | <filename>eval.py
#!/usr/bin/env python3
from module.data_prep import data_prep
from module.processor import Wav2Vec2Processor
from module.model import Wav2Vec2ForCTC
import torch
import torch.nn.functional as F
from module.trainer import DataCollatorCTCWithPadding, BatchRandomSampler
from module.decoder import KenLMD... | 2.234375 | 2 |
code/report_accuracy.py | lionelmessi6410/Face-Detection-with-a-Sliding-Window | 10 | 12773897 | <filename>code/report_accuracy.py
import numpy as np
# DO NOT MODIFY EVALUATION CODE
def report_accuracy(confidences, label_vector):
confidences = confidences.ravel()
label_vector = label_vector.ravel()
assert confidences.size==label_vector.size, "Size of confidences and label_vector should be the same"
... | 3.234375 | 3 |
var/spack/repos/builtin/packages/lunchbox/package.py | MatMaul/spack | 0 | 12773898 | # Copyright 2013-2018 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 Lunchbox(CMakePackage):
"""A core C++ library for multi-threaded programming."""
homep... | 1.25 | 1 |
models/HAN/inference.py | wiekern/GenderPerformance | 0 | 12773899 | <filename>models/HAN/inference.py<gh_stars>0
import torch
import torch.nn as nn
from torch import optim
import numpy as np
from torch.nn.utils import rnn
import torch.nn.functional as F
from HierarchicalAttentionNet_pre_embed import createBatches,sortbylength,wordEncoder,sentenceEncoder,text2tensor,createEmbeddingMatri... | 2.15625 | 2 |
codechef.py | TheCez/cp-api | 0 | 12773900 | import requests
from bs4 import BeautifulSoup
import re
'''def fate_proxy():
resp=requests.get('https://raw.githubusercontent.com/fate0/proxylist/master/proxy.list')
#print(resp.text)
a=((resp.text).split('\n'))
#print(a)
p_list=[]
for i in a:
try:
p_list.append(json.loads(i)... | 2.765625 | 3 |
python_smaclient/smapi_response.py | jloehel/python_smaclient | 0 | 12773901 | #!/usr/bin/env python
import uuid
class SMAPI_Response(object):
'''
Implentation of a ICUV Request
'''
def __init__(self, output_parameters):
self._uuid = uuid.uuid1()
self._date = None
self._output_parameters = output_parameters
def get_output_parameters(self):
... | 2.796875 | 3 |
setup.py | kylef/irctk | 6 | 12773902 | <gh_stars>1-10
from setuptools import setup
with open('VERSION', 'r') as fp:
version = fp.read().strip()
setup(
name='irc-toolkit',
version=version,
author='<NAME>',
author_email='<EMAIL>',
packages=['irctk'],
entry_points={},
install_requires=[],
url='https://github.com/kylef/irct... | 1.28125 | 1 |
tests/python/test_jit_transform.py | ishine/aps | 117 | 12773903 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2021 <NAME>
# License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import pytest
import torch as th
from aps.io import read_audio
from aps.transform.utils import forward_stft, export_jit
from aps.transform import AsrTransform
egs1_wav = read_audio("tes... | 1.898438 | 2 |
var/spack/repos/builtin/packages/mod2c/package.py | lguyot/spack | 2 | 12773904 | ##############################################################################
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Mod2c(CMakePacka... | 1.570313 | 2 |
src/responsibleai/rai_analyse/create_error_analysis.py | Azure/automl-devplat2-preview | 7 | 12773905 | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import json
import logging
from responsibleai import RAIInsights
from constants import RAIToolType
from rai_component_ut... | 2.171875 | 2 |
distributed-queue/asyncResult.py | StolerHua/tools | 0 | 12773906 | <reponame>StolerHua/tools<filename>distributed-queue/asyncResult.py
import gevent.monkey as monkey
from celery import Celery
monkey.patch_all()
app = Celery('asyncResult', backend='redis://localhost:6379/0', broker='redis://localhost:6379/0')
@app.task
def add(x, y):
return x + y
# celery -A tasks worker --logle... | 2.125 | 2 |
brickout.py | prake71/Breakout | 0 | 12773907 | # Brickout Game V 0.1
# 2018 by <NAME>
# color constants
# a website for finding out color names
# https://www.w3schools.com/colors/colors_converter.asp
GREY = [105, 105, 105]
BLACK = [0, 0, 0]
PINK = [168, 76, 96]
BROWN = [133, 107, 17]
OTHERBROWN = [157, 90, 48]
GREEN = [28, 120, 29]
LIGHTGREEN = [56, 141, 47]
DARKG... | 2.828125 | 3 |
ansible_shell_monitoring/bsd_top.py | nortics/python | 0 | 12773908 | <gh_stars>0
#!/usr/local/etc/ansible/venv/top/bin/python
import json,os,psycopg2,time,subprocess,yaml
from datetime import datetime
playbook_file = '/usr/local/etc/ansible/playbooks/tops.yml'
def letter_degree(value = ''):
if value[-2].isdigit():
if value[-1] == 'K':
float_value = int(value[... | 2.28125 | 2 |
gql/schema.py | canburaks/djr | 3 | 12773909 | # ~/Blog/djr/gql/schema.py
import graphene
from items.models import Movie
from graphene_django.types import DjangoObjectType
# api-movie-model
class MovieType(DjangoObjectType):
id = graphene.Int()
name = graphene.String()
year = graphene.Int()
summary = graphene.String()
poster_url = graphene.Stri... | 2.328125 | 2 |
verkkokauppa/payment/exceptions.py | SuviVappula/tilavarauspalvelu-core | 0 | 12773910 | <filename>verkkokauppa/payment/exceptions.py
from ..exceptions import VerkkokauppaError
class PaymentError(VerkkokauppaError):
pass
class ParsePaymentError(PaymentError):
pass
class GetPaymentError(PaymentError):
pass
| 1.6875 | 2 |
maui/api.py | kblicharski/py-maui | 0 | 12773911 | from functools import reduce
from pprint import pprint
from typing import Sequence, Tuple
import requests
from graph import Graph
spring_id = 71
spring_id_legacy = 20178
def modify_string(p: str, repl: Sequence[Tuple[str, str]]) -> str:
return reduce(lambda a, kv: a.replace(*kv), repl, p)
url = 'https://api.... | 2.609375 | 3 |
exercicios/Lista4/Q28.py | AlexandrePeBrito/CursoUdemyPython | 0 | 12773912 | #Leia 10 números inteiros e armazene em um vetor v. Crie dois
#novos vetores v1 e v2. Copie os valores ímpares de v para
#v1, e os valores pares de v para v2. Note que cada um dos
#vetores v1 e v2 têm no máximo 10 elementos, mas nem todos
#os elementos são utilizados. No final escreva os elementos
#UTILIZADOS de v1 e ... | 3.515625 | 4 |
funcs/cycles/gldas_to_cycles.py | mintproject/MINT-Transformation | 1 | 12773913 | import argparse
import subprocess
from dtran.dcat.api import DCatAPI
from funcs.readers.dcat_read_func import DATA_CATALOG_DOWNLOAD_DIR
import os
import csv
import json
import shutil
from datetime import datetime
from datetime import timedelta
from pathlib import Path
from typing import Optional, Dict
import re
impor... | 2.046875 | 2 |
Workshop/Workshop/main_app/validators.py | petel3/Softuni_education | 2 | 12773914 | from django.core.exceptions import ValidationError
def only_letters_validator(value):
for ch in value:
if not ch.isalpha():
raise ValidationError("Value must contains only letters")
def file_max_size_in_mb_validator(max_size):
def validate(value):
filesize = value.file.size
... | 2.75 | 3 |
rlpyt/models/dqn/cartpole_dqn_model.py | ElisevanderPol/mdp-homomorphic-networks | 17 | 12773915 |
import torch
from rlpyt.utils.tensor import infer_leading_dims, restore_leading_dims
from rlpyt.models.conv2d import Conv2dModel
from rlpyt.models.mlp import MlpModel
from rlpyt.models.dqn.dueling import DuelingHeadModel
class CartpoleDqnModel(torch.nn.Module):
def __init__(
self,
image... | 2.15625 | 2 |
diplomacy_research/scripts/build_dataset.py | wwongkamjan/dipnet_press | 39 | 12773916 | <reponame>wwongkamjan/dipnet_press<filename>diplomacy_research/scripts/build_dataset.py
#!/usr/bin/env python3
# ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: Permission is hereby granted, free of charge, to any person obtaining
# a copy of this ... | 2.171875 | 2 |
qchem.py | EmmanuelG0ldstein/pyGSM_AMS_3 | 0 | 12773917 | from .base_lot import *
import numpy as np
import os
from .units import *
#TODO get rid of get_energy
class QChem(Lot):
def run(self,geom,multiplicity):
tempfilename = 'tempQCinp'
tempfile = open(tempfilename,'w')
if self.lot_inp_file == False:
tempfile.write(' $rem\n')
... | 2.3125 | 2 |
mtda/usb/rpi_gpio.py | LevyForchh/mtda | 0 | 12773918 | # System imports
import abc
import RPi.GPIO as GPIO
# Local imports
from mtda.usb.switch import UsbSwitch
class RPiGpioUsbSwitch(UsbSwitch):
def __init__(self):
self.dev = None
self.pin = 0
self.enable = GPIO.HIGH
self.disable = GPIO.LOW
GPIO.setwarnings(False)
... | 3.25 | 3 |
glamod-parser/glamod/parser/processors.py | GLAMOD-test/glamod-dm | 0 | 12773919 | <reponame>GLAMOD-test/glamod-dm
import os
import logging
import stringcase
from importlib import import_module
from cdmapp.models import SourceConfiguration, StationConfiguration, \
StationConfigurationOptional, HeaderTable, ObservationsTable
from .settings import CHUNK_CACHE_DIR, CHUNK_CACHE_DIR_DEPTH
f... | 1.875 | 2 |
past_archive/swexpert/2027(makeDiagonal).py | DongHyunByun/algorithm_practice | 0 | 12773920 | <reponame>DongHyunByun/algorithm_practice
for i in range(5):
for j in range(5):
if i==j:
print('#',end='')
else:
print("+",end='')
print("")
| 3.953125 | 4 |
clif/testing/python/return_value_policy_test.py | rwgk/clif | 0 | 12773921 | <reponame>rwgk/clif
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 1.773438 | 2 |
experitur/core/trial.py | moi90/experitur | 3 | 12773922 | <filename>experitur/core/trial.py
import collections.abc
import inspect
import itertools
from collections import OrderedDict, defaultdict
from collections.abc import Collection
from typing import (
TYPE_CHECKING,
Any,
Callable,
Iterable,
List,
Mapping,
Tuple,
TypeVar,
Union,
)
from... | 2.5625 | 3 |
sources/experiments/data_generation/results_data.py | JohannOberleitner/pdesolver | 0 | 12773923 | <gh_stars>0
import numpy as np
import datetime
import json
def encode_ndarray(array):
return array.tolist()
def as_ndarray(array):
return np.asarray(array, dtype=float)
def as_ResultsSet(json_data):
if '__ResultsSet__' in json_data:
return ResultsSetDecoder().decode(json_data)
return json_da... | 2.796875 | 3 |
constants.py | Ahmed4221/CICD-Test | 0 | 12773924 | <reponame>Ahmed4221/CICD-Test<filename>constants.py
DATA_URL = 'http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data'
DATA_COLUMNS = ['MPG', 'Cylinders', 'Displacement', 'Horsepower', 'Weight',
'Acceleration', 'Model Year', 'Origin']
NORMALIZE = False
TARGET_VARIABLE = 'MPG'
#... | 2.21875 | 2 |
VMBackup/main/patch/__init__.py | harvek/azure-linux-extensions | 0 | 12773925 | <filename>VMBackup/main/patch/__init__.py<gh_stars>0
#!/usr/bin/python
#
# Copyright 2015 Microsoft 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/l... | 1.898438 | 2 |
src/transformers/models/roformer/tokenization_utils.py | liminghao1630/transformers | 50,404 | 12773926 | <filename>src/transformers/models/roformer/tokenization_utils.py
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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 a... | 2.109375 | 2 |
train.py | rozim/ChessAtAGlance | 0 | 12773927 | import sys
import tensorflow as tf
import leveldb
from absl import app
from absl import flags
from absl import logging
from datetime import datetime
import warnings
import glob
import toml
import re
from contextlib import redirect_stdout
import collections
import datetime
import functools
import itertools
import math
... | 1.75 | 2 |
chb/models/DllSummaries.py | psifertex/CodeHawk-Binary | 0 | 12773928 | <reponame>psifertex/CodeHawk-Binary
# ------------------------------------------------------------------------------
# Access to the CodeHawk Binary Analyzer Analysis Results
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-... | 1.195313 | 1 |
pyckaxe/utils/logging/preview.py | Arcensoth/pyckaxe | 3 | 12773929 | import asyncio
import random
from pyckaxe.utils.logging import get_logger
def preview_logging():
log = get_logger("preview_logging")
log.debug("debug")
log.info("info")
log.warning("warning")
log.error("error")
log.critical("critical")
try:
raise ValueError("don't worry this is a ... | 2.515625 | 3 |
zfs/posix/__init__.py | mcclung/zfsp | 600 | 12773930 | <gh_stars>100-1000
import logging
from .. import ondisk
from .. import datasets
from zfs.posix.attributes import POSIXAttrs_for
logger = logging.getLogger(__name__)
class PosixObject(object):
def __init__(self, dnode: ondisk.DNode, dataset: datasets.Dataset) -> None:
self.attrs = POSIXAttrs_for(dataset)... | 1.84375 | 2 |
alpha_blending.py | michelecos/py_imagecompose | 0 | 12773931 | <filename>alpha_blending.py<gh_stars>0
import cv2
# Read the images
foreground = cv2.imread("puppets.png")
background = cv2.imread("ocean.png")
alpha = cv2.imread("puppets_alpha.png")
# Convert uint8 to float
foreground = foreground.astype(float)
background = background.astype(float)
# Normalize the alpha mask to ke... | 3.15625 | 3 |
protocols/abstract.py | lvh/async-pep | 2 | 12773932 | <gh_stars>1-10
"""
The interfaces for implementing asynchronous IO.
"""
import abc
class Protocol(metaclass=abc.ABCMeta):
def connected(self, transport):
"""
Called when the connection is established.
"""
self.transport = transport
@abc.abstractmethod
def data_received(self... | 3.25 | 3 |
src/integrated_klqp.py | pmh47/textured-mesh-gen | 30 | 12773933 |
from enum import Enum
import numpy as np
import tensorflow as tf
from edward1_utils import get_ancestors, get_descendants
class GenerativeMode(Enum):
UNCONDITIONED = 1 # i.e. sampling the learnt prior
CONDITIONED = 2 # i.e. sampling the posterior, with variational samples substituted
RECONSTRUCTION = ... | 2.421875 | 2 |
models/RegistrationToken.py | lavalamp-/RootTheBox | 3 | 12773934 | <reponame>lavalamp-/RootTheBox<filename>models/RegistrationToken.py
# -*- coding: utf-8 -*-
'''
Created on Sep 22, 2012
@author: moloch
Copyright 2012 Root the Box
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may ... | 2.09375 | 2 |
index.py | agusawa/mie-gacoan-simulation | 0 | 12773935 | <gh_stars>0
import csv
import simpy
from tabulate import tabulate
from gacoan import config
from gacoan.app import Gacoan
if __name__ == "__main__":
print(
tabulate(
[
["Durasi Simulasi", config.SIMULATION_TIME, "menit"],
["Arrival Rate", config.ARRIVAL_RATE, "... | 2.453125 | 2 |
torchocr/models/backbones/det_resnet.py | hua1024/OpenOCR | 3 | 12773936 | # coding=utf-8
# @Time : 2020/10/24 12:13
# @Auto : zzf-jeff
import torch
import torch.nn as nn
import math
from ..builder import BACKBONES
from .base import BaseBackbone
import torch.utils.model_zoo as model_zoo
from torchocr.utils.checkpoints import load_checkpoint
__all__ = [
"DetResNet"
]
... | 1.9375 | 2 |
examples/gevent_http.py | tetsuo-dance/poyonga | 13 | 12773937 | from poyonga import Groonga
import gevent
from gevent import monkey
monkey.patch_all()
def fetch(cmd, **kwargs):
g = Groonga()
ret = g.call(cmd, **kwargs)
print(ret.status)
print(ret.body)
print("*" * 40)
return ret.body
cmds = [
("status", {}),
("log_level", {"level": "warning"}),
... | 2.3125 | 2 |
rest_api/serializers.py | knaveenkumar3576/django-rest-example | 0 | 12773938 | from rest_framework import serializers
# from .models import Player, Point
from .models import Point
# class PlayerSerializer(serializers.ModelSerializer):
# class Meta:
# fields = (
# 'user_name',
# 'first_name',
# 'last_name',
# )
# model = Player
clas... | 2.296875 | 2 |
main_clsa.py | maple-research-lab/CLSA | 35 | 12773939 | <gh_stars>10-100
#Copyright (C) 2020 <NAME>
#License: MIT for academic use.
#Contact: <NAME> (<EMAIL>, <EMAIL>)
#Some codes adopted from https://github.com/facebookresearch/moco
from ops.argparser import argparser
from ops.Config_Envrionment import Config_Environment
import torch.multiprocessing as mp
from training.... | 2.625 | 3 |
python_poc/adapters/postgres_generic_adapter.py | pervcomp/Procem | 1 | 12773940 | <filename>python_poc/adapters/postgres_generic_adapter.py
# -*- coding: utf-8 -*-
"""This module includes the adapter for reading periodically updated values from a PostgreSQL database
and sending the values to the Procem RTL worker for further handling."""
# Copyright (c) TUT Tampere University of Technology 2015-... | 2.34375 | 2 |
zasim/gui/elementary.py | timo/zasim | 2 | 12773941 | """This module offers GUI tools for manipulating table-like step functions
of "elementary" cellular automatons.
Ideas for further utilities:
* Display conflicting rules for horizontal or vertical symmetry, rotational
symmetry, ...
* An editing mode, that handles simple binary logic, like::
c == 1 then resu... | 3.328125 | 3 |
app/test.py | geekrohit/celery-sqs-spot | 5 | 12773942 | import tasks
from time import sleep
print("add 3+5")
ret = tasks.add.delay(3,5)
print("Task ID:")
print(ret)
sleep(10)
print(ret.status)
| 2.671875 | 3 |
dfman/__init__.py | jniedrauer/dfman | 0 | 12773943 | <reponame>jniedrauer/dfman<filename>dfman/__init__.py
"""Initial imports"""
import logging
from dfman.config import Config
logging.getLogger(__name__).addHandler(logging.NullHandler())
| 1.492188 | 1 |
evgp_rcs/gui.py | RoboJackets/evgp-rcs | 0 | 12773944 | <filename>evgp_rcs/gui.py
import sys
import os
import logging
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt, QThread, QItemSelection
from PyQt5.Qt import QSortFilterProxyModel
from PyQt5.QtWidgets import QWidget, QGridLayout, QGroupBox, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QMessageBox... | 2.296875 | 2 |
5day/gui01.py | jsjang93/joony | 0 | 12773945 | <gh_stars>0
# gui01.py
# Python GUI --> tkinter, wxPython,PyQt
# 위젯 (Button,Label,Entry,,,,)
from tkinter import *
def btn1Click():
text1.insert(0,text1.get()+"님 어서오세요! ")
window = Tk()
#################
label1 = Label(window,text="이 름")
label1.grid(row=0,column=0)
#label1.pack()
text1 = Entry(window)
text1.... | 3.421875 | 3 |
04_datacamp/solutions/21_solutions.py | HirahTang/datascience_starter_course | 3 | 12773946 | sns.violinplot(data=df, y='Fare', x='Survived', hue='Sex', split=True)
| 1.992188 | 2 |
libptmalloc/frontend/commands/gdb/ptparam.py | nccgroup/libptmalloc | 36 | 12773947 | # -*- coding: future_fstrings -*-
from __future__ import print_function
import argparse
import binascii
import struct
import sys
import logging
from libptmalloc.frontend import printutils as pu
from libptmalloc.ptmalloc import ptmalloc as pt
from libptmalloc.frontend import helpers as h
from libptmalloc.frontend.comm... | 2.5 | 2 |
tests/base/env/spaces/test_discrete.py | pocokhc/simple_rl | 1 | 12773948 | <gh_stars>1-10
import unittest
import numpy as np
from srl.base.env.spaces import DiscreteSpace
from tests.base.env.space_test import SpaceTest
class Test(unittest.TestCase):
def setUp(self) -> None:
self.space = DiscreteSpace(5)
self.assertTrue(self.space.n == 5)
self.tester = SpaceTest... | 2.578125 | 3 |
py/zk/zkjson.py | acidburn0zzz/vitess | 1 | 12773949 | <reponame>acidburn0zzz/vitess<filename>py/zk/zkjson.py<gh_stars>1-10
# Implement a sensible wrapper that treats python objects as dictionaries
# with sensible restrictions on serialization.
import json
def _default(o):
if hasattr(o, '_serializable_attributes'):
return dict([(k, v)
for k, v in o... | 2.46875 | 2 |
1_joint_alignment/STN/atn_helpers/matrix_exp.py | BGU-CS-VIL/JA-POLS | 16 | 12773950 | <gh_stars>10-100
import tensorflow as tf
#import tensorflow.compat.v1 as tf
#tf.disable_v2_behavior()
def expm(params_matrix):
# Take the matrix exponentioal of the affine map, inorder to get an affine-defiomorphism map.
exp_params = tf.reshape(params_matrix,[-1,2,3])
# append a row of 0,0,0 before compu... | 2.125 | 2 |