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 |
|---|---|---|---|---|---|---|
Lib/compiler/strict/rewriter/rewriter.py | penguin-wwy/cinder | 0 | 48600 | <gh_stars>0
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
from __future__ import annotations
import ast
from ast import (
AST,
AnnAssign,
Assign,
AsyncFunctionDef,
Attribute,
Call,
ClassDef,
Constant,
Delete,
DictComp,
ExceptHandler,
For,
... | 1.851563 | 2 |
code/client/visuals.py | xiaoxiae/Mynt | 0 | 48601 | """A module for anything color/animation related."""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from math import ceil, cos, pi
from time import time
from typing import *
Numeric = Union[int, float]
def linear_interpolation(a: Numeric, b: Numeric, x: Nume... | 3.40625 | 3 |
exporters/groupers/no_grouper.py | scrapinghub/exporters | 41 | 48602 | <gh_stars>10-100
from exporters.groupers.base_grouper import BaseGrouper
class NoGrouper(BaseGrouper):
"""
Default group module, used when no grouping strategies are needed.
"""
def __init__(self, *args, **kwargs):
super(NoGrouper, self).__init__(*args, **kwargs)
def group_batch(self, ba... | 2.078125 | 2 |
cli/tests/test_polyflow/test_io.py | hackerwins/polyaxon | 0 | 48603 | <filename>cli/tests/test_polyflow/test_io.py
#!/usr/bin/python
#
# Copyright 2019 Polyaxon, 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/LICENS... | 2.09375 | 2 |
data_structure/busca_profundidade_largura.py | uadson/data-structure | 0 | 48604 | <gh_stars>0
class Vertice:
def __init__(self, rotulo):
self.rotulo = rotulo
self.visitado = False
self.adjacentes = []
def adiciona_adjacente(self, adjacente):
self.adjacentes.append(adjacente)
def mostra_adjacentes(self):
for i in self.adjacentes:
print(i.vertice.rotulo, i.custo)
cla... | 3.265625 | 3 |
Assignment 4/NNet.py | Chirag-Galani/B551-Elements-Of-Artificial-Intelligence | 0 | 48605 | #!/usr/bin/env python
'''
#
# Neural networks is a supervised learning algorithm, which utilizes neurons (which is a mathematical functions which accepts weighted values, and gives an output using an activation function) inorder to learn a problem and
# then to evaluate and predict the outcomes for data which has not ... | 4.28125 | 4 |
data_preparation_play.py | superporchetta/tide_prediction | 0 | 48606 | <reponame>superporchetta/tide_prediction
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
from transformers import ViTFeatureExtractor, ViTModel, ViTConfig, DistilBertModel, DistilBertConfig
from tqdm.notebook i... | 2.0625 | 2 |
ORStools/core/directions_core.py | Fragoso09/orstool-qgis | 0 | 48607 | <reponame>Fragoso09/orstool-qgis
# -*- coding: utf-8 -*-
"""
/***************************************************************************
ORStools
A QGIS plugin
QGIS client to query openrouteservice
-------------------
begin : 2017-... | 1.375 | 1 |
utilities/visualisation/image_data/display_3d_depth_image.py | bootml/agent | 0 | 48608 | <reponame>bootml/agent<filename>utilities/visualisation/image_data/display_3d_depth_image.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'cnheider'
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import scipy.misc
def main():
# lena = scipy.misc.ascent... | 2.546875 | 3 |
pyscripts/solution_parser.py | qwergram/vsxml2azurejson | 0 | 48609 | import util
import io
class SolutionParser(object):
def __init__(self, sln_path):
# Initialize SolutionParser Object
assert util.test_path(sln_path, 'f'), sln_path
self.path = sln_path
self.raw_content = []
self.data = {
"version": None,
"vsversion":... | 2.65625 | 3 |
documents/migrations/0001_initial.py | iliadmitriev/taskcamp | 4 | 48610 | <filename>documents/migrations/0001_initial.py<gh_stars>1-10
# Generated by Django 3.1.7 on 2021-03-22 07:18
from django.db import migrations, models
import documents.helpers
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 1.757813 | 2 |
src/quocslib/__init__.py | marcorossignolo/QuOCS | 0 | 48611 | <reponame>marcorossignolo/QuOCS<filename>src/quocslib/__init__.py
from __future__ import absolute_import, division, print_function, unicode_literals
__VERSION__ = "0.0.a7"
| 1.15625 | 1 |
src/cartpole_dqn.py | veda-s4dhak/OpenAI_Gym_Testing | 0 | 48612 | <reponame>veda-s4dhak/OpenAI_Gym_Testing
"""
This module contains the deep reinforcement learning model which can
learn the OpenAI Cartpole Gym using reinforcement learning or imitation
learning
"""
import random
import numpy as np
from collections import deque
from keras.models import Sequential
from keras.layers imp... | 2.484375 | 2 |
lppydsmc/data/__init__.py | Quettle/lppydsmc | 0 | 48613 | <filename>lppydsmc/data/__init__.py<gh_stars>0
from . import saver | 1.109375 | 1 |
src/utils/encryption_utils.py | tomgilbertson/script-server-v1 | 833 | 48614 | <reponame>tomgilbertson/script-server-v1<gh_stars>100-1000
import base64
import hashlib
from utils.apr1 import hash_apr1
def md5_apr1(salt, text):
return hash_apr1(salt, text)
def sha1(text):
result = hashlib.sha1(text.encode('utf8'))
return base64.b64encode(result.digest()).decode('utf8')
| 2.4375 | 2 |
joytest.py | AlessioMorale/fport-joy-bridge | 0 | 48615 | #!/usr/bin/env python3
from evdev import UInput, UInputError, ecodes, AbsInfo
from evdev import util
from fport import FportParser, FportMessageControl
import serial
from time import sleep
if __name__ == '__main__':
device = None
def handler(message):
if type(message) is FportMessageControl:
... | 2.359375 | 2 |
reagent/net_builder/continuous_actor/__init__.py | kellielu/ReAgent | 2 | 48616 | <reponame>kellielu/ReAgent<gh_stars>1-10
#!/usr/bin/env python3
from . import dirichlet_fully_connected # noqa
from . import fully_connected # noqa
from . import gaussian_fully_connected # noqa
| 1.171875 | 1 |
bitHopper/Logic/__init__.py | DavidVorick/bitHopper | 2 | 48617 | """
This module contains all of the server selection logic.
It supplies one function:
get_server() which returns the name of a server to mine.
It has two external dependencies.
1) btcnet_info via btcnet_wrapper
2) a way to pull getworks for checking if we should delag pools
"""
import ServerLogic
import bitHopper.... | 2.765625 | 3 |
2015/day08.py | mbcollins2/aoc | 0 | 48618 | import re
class solve_day(object):
with open('inputs/day08.txt', 'r') as f:
data = f.readlines()
def part1(self):
# try 1: 5979 (too high)
# try 2: 2043 (too high)
# try 3: 1376 (too high)
count_lit = 0
count_mem = 0
# self.data = ['""', '"abc"', r'"... | 3.015625 | 3 |
tests/test_forms.py | kennethlove/django-tempus-dominus | 1 | 48619 | <gh_stars>1-10
import importlib
import pytest
from . import forms
from tempus_dominus import widgets
@pytest.mark.parametrize("form_class", [
forms.DateFieldForm,
forms.TimeFieldForm,
forms.DateTimeFieldForm,
])
def test_forms_render(form_class):
"""
Smoke test that forms render
"""
ass... | 2.109375 | 2 |
Ago-Dic-2019/DanielM/PracticaUno/3.9_DinnerGuests.py | Arbupa/DAS_Sistemas | 41 | 48620 | <gh_stars>10-100
# 3-9. Dinner Guests: Working with one of the programs from Exercises 3-4 through 3-7 (page 46),
# use len() to print a message indicating the number of people you are inviting to dinner.
guests = ['Antonio', 'Emanuel', 'Francisco']
message = "1.- Hello dear uncle " + guests[0] + ", I hope you can co... | 3.890625 | 4 |
argocd_client/models/v1alpha1_cluster.py | thepabloaguilar/argocd-client | 1 | 48621 | # coding: utf-8
"""
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from argocd_client.configuration import Configuration
class V1alp... | 1.78125 | 2 |
src/msgraph/model/shared.py | microsoftarchive/msgraph-sdk-python | 7 | 48622 | # -*- coding: utf-8 -*-
"""
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
"""
from __future__ import unicode_literals
from ..model.identity_set i... | 1.960938 | 2 |
speedtweet/twitterpost.py | MSAdministrator/speedtweet | 2 | 48623 | import os
import requests
import tweepy
import random
from .littlebirdy import LittleBirdy
class TwitterPost(LittleBirdy):
_TWEET = '''{account} I am experiencing issues with my internet. My speed is at {down} MB/s Down & {up} MB/s Up.
This is {percent}% below what I am paying for.
'''
def post(self, d... | 2.953125 | 3 |
env/lib/python3.7/site-packages/wn/omw.py | thunlp/BkdAtk-LWS | 10 | 48624 | <gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2020 NLTK Project
# Author:
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
import io
import os
from collections import defaultdict
from wn.constants import omw_dir
def parse_omw_line(omw_line):
offset_pos, lemma_typ... | 2.90625 | 3 |
2021/day1.py | Sujatha-Nagarajan/AdventOfCode | 1 | 48625 | #https://adventofcode.com/2021/day/1
input2="""131
140
136
135
155
175
178
186
187
189
194
195
203
193
178
179
180
188
204
214
215
252
253
261
281
294
293
299
300
301
307
333
324
322
323
335
319
312
313
312
320
323
324
336
341
347
357
358
363
357
334
348
364
365
367
370
369
373
344
328
330
327
339
340
341
335
342
347... | 1.367188 | 1 |
pyplwnxml/tests/test_plwnxmlParser.py | red-rocket-dev/plwnXMLParser | 5 | 48626 | <reponame>red-rocket-dev/plwnXMLParser
from unittest import TestCase
from pyplwnxml import PlwnxmlParser, PartOfSpeech, SentimentType, Qualifier, RelationType
class TestPlwnxmlParser(TestCase):
def setUp(self):
parser = PlwnxmlParser("test_file.xml")
self.wordnet = parser.read_wordnet()
def ... | 2.53125 | 3 |
pydsm/delsig/tests/test_simulateDSM.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 0 | 48627 | # -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME>
# All rights reserved.
# This file is part of PyDSM.
# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | 1.953125 | 2 |
src-py/PublicVariables.py | ATSM-Bot/rickroll-lang | 1 | 48628 | <reponame>ATSM-Bot/rickroll-lang
from sys import stdout
from random import choice
# Keywords
KW_print = 'i_just_wanna_tell_u_how_im_feeling'
KW_if = 'and_if_u_ask_me_how_im_feeling'
KW_let = 'give_u_up'
KW_import1 = 'we_know_the'
KW_import2 = "and_we're_gonna_play_it"
K... | 2.515625 | 3 |
tests/test_types.py | vitiral/tmq | 1 | 48629 | import socket
from unittest import TestCase
from tmq import define as td
class TestHash(TestCase):
def test_short(self):
result = td.tmq_hash("short hash")
self.assertEqual(result, 0x20dc540e)
def test_long(self):
result = td.tmq_hash("this is a pretty long hash string")
self... | 2.921875 | 3 |
errors.py | Rested/multi-translate | 1 | 48630 | from typing import Optional
from fastapi import HTTPException
class BaseMultiTranslateError(HTTPException):
def __init__(self, detail: Optional[str] = None):
super().__init__(status_code=400, detail=detail, headers={})
class TranslationEngineNotConfiguredError(BaseMultiTranslateError):
"""A problem... | 2.890625 | 3 |
argsort_info.py | ikwzm/ArgSort-Kv260 | 1 | 48631 | from uio import Uio
from argsort_axi import ArgSort_AXI
if __name__ == '__main__':
uio = Uio('uio_argsort')
argsort_axi = ArgSort_AXI(uio.regs())
argsort_axi.print_info()
argsort_axi.print_debug()
| 1.664063 | 2 |
SRC/__mainv2__.py | Prog-LucasAlves/dados_financeiros_b3 | 3 | 48632 | # This Python file uses the following encoding: utf-8
'''
Author: <NAME>
Linkedin: https://www.linkedin.com/in/lucasalves-ast/
'''
# TODO #4 Atualizar python 3.9.5 -> 3.9.9
# Importar bibliotecas internas
import __conectdb__
import __query__
import __check__
import __check_semana__
import __list__
# Importar bibli... | 2.15625 | 2 |
setup.py | Ezio-Sarthak/urwid_picker_widgets | 0 | 48633 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name="urwid_picker_widgets",
version="0.4",
description="Specialized picker widgets for urwid "
"that extend its features.",
lon... | 1.476563 | 1 |
Analysis/Clustering/mdrmsd.py | maccallumlab/calmodulin_pre_paper | 0 | 48634 | ##Clustering script for CaM_Trials##
#clusters using HDBSCAN the last 1 microsecond of simulation
#uses rmsd to native of backbone (excluding flexible tails but including peptide) as distance metric
import mdtraj as md
import numpy as np
import matplotlib.pyplot as plt
import hdbscan
MIN_SAMPLES = 200 #determined fr... | 2.421875 | 2 |
turtlex/turtlex_gym/scripts/arm_moveit_test.py | andreabradpitto/turtlex | 0 | 48635 | <reponame>andreabradpitto/turtlex
#!/usr/bin/env python3
import rospy
import numpy as np
import sys
import moveit_commander
#import moveit_msgs.msg
import geometry_msgs.msg
import time
#from std_srvs.srv import Empty
from utils import tcolors
# TODO this code is untested and not properly documented for the current ... | 2.265625 | 2 |
python/src/aoc/year2017/day20.py | ocirne/adventofcode | 1 | 48636 | import re
from dataclasses import dataclass
from itertools import combinations
from aoc.util import load_input, load_example
def part1(lines):
r""" ¯\_(ツ)_/¯ """
return next(index for index, line in enumerate(lines) if "a=<0,0,0>" in line)
@dataclass
class Particle:
position: tuple
velocity: tuple
... | 3.078125 | 3 |
client/hr_services/doctype/employee_loan_application/employee_loan_application.py | mhbu50/client | 0 | 48637 | <reponame>mhbu50/client
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, math
from frappe import _
from frappe.utils import flt
from frappe.model.mapper import get_mapped... | 1.765625 | 2 |
hopper/utils/bitbake/BitBakeTask.py | Xilinx/hopper | 2 | 48638 | # Copyright (c) 2015 Xilinx Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | 1.6875 | 2 |
rainbow/dueling_dqn.py | RayYoh/BasicRL | 12 | 48639 | <reponame>RayYoh/BasicRL
from dqn import DQN
from utils import *
from logx import *
import gym
class DuelingDQN(DQN):
def __init__(
self,
env_fn,
target_update,epsilon_decay,
dqn = DuelingNetwork, seed=0,
steps_per_epoch=600,
epochs=100, replay_size=int(2000),
... | 2.1875 | 2 |
tools/build_rules/test_rules_private.bzl | jobechoi/bazel | 16,989 | 48640 | # Copyright 2019 The Bazel 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 applicable la... | 1.71875 | 2 |
openmc_plasma_source/ring_source.py | mdfaisal98/openmc-plasma-source | 0 | 48641 |
import openmc
class FusionRingSource(openmc.Source):
"""An openmc.Source object with some presets to make it more convenient
for fusion simulations using a ring source. All attributes can be changed
after initialization if required. Default isotropic ring source with a Muir
energy distribution.
... | 2.296875 | 2 |
python/items_factory.py | yeachan153/GildedRose-Refactoring-Kata | 0 | 48642 | <filename>python/items_factory.py
from python.items import AgedBrieItem, BackStageItem, RagnarosItem, ConjuredItem
from python.exceptions import InvalidRepositoryException
from typing import Union
class ItemsFactory:
"""Generates correct item objects
based on specified parameter
"""
@staticmethod
... | 2.859375 | 3 |
rdll.py | juntalis/python-ctypes-sandbox | 3 | 48643 | # encoding: utf-8
"""
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for mor... | 2.328125 | 2 |
pyneos/mypaths.py | kavehshamsi/neos | 0 | 48644 | <filename>pyneos/mypaths.py
import os
home_dir = os.path.expanduser('~')
neos_dir = '.' # have this point to your neos directory
neos_cmd = neos_dir + '/bin/neos'
abc_cmd = neos_dir + '/bin/abc'
abclib_path = neos_dir + '/cells/simpler.lib'
neos_bench_dir = neos_dir + '/bench/'
| 1.765625 | 2 |
allauth/socialaccount/providers/eveonline_provider/urls.py | Fuzzwah/django-allauth | 0 | 48645 | from allauth.socialaccount.providers.oauth2_provider.urls import default_urlpatterns
from .provider import EveOnlineProvider
urlpatterns = default_urlpatterns(EveOnlineProvider)
| 1.289063 | 1 |
py-td3-cinema/obj.py | HuguesGuilleus/istyPOO | 0 | 48646 | <reponame>HuguesGuilleus/istyPOO
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from storage.struct import Struct as Struct
from storage.db import DB as DB
if not os.path.exists("data/"):
os.makedirs("data/")
# Classes
class Guest(Struct):
def __init__(self, db):
super(Guest, self).__init__({
"*Nam... | 2.890625 | 3 |
portal/trigger_states/views.py | uwcirg/true_nth_usa_portal | 3 | 48647 | <reponame>uwcirg/true_nth_usa_portal
from flask import Blueprint, current_app, jsonify, request
from .empro_states import users_trigger_state
from .models import TriggerState
from ..database import db
from ..date_tools import FHIR_datetime
from ..extensions import oauth
from ..models.user import get_user
from ..views.c... | 2.078125 | 2 |
project/school-website/school_website/basic/views.py | imsks/Web-Dev-with-python-and-Django | 0 | 48648 | <reponame>imsks/Web-Dev-with-python-and-Django<filename>project/school-website/school_website/basic/views.py
from django.shortcuts import render
from django.views.generic import (TemplateView, )
import datetime
# returns current year
def getCurrentYear() :
currYear = datetime.datetime.now()
return currYear.yea... | 2.171875 | 2 |
ytdownloadbot/helpers/downloader.py | DiscordBot2020/KucingSMP-Downloader | 0 | 48649 | from .errors import DownloaderFinished, NotAcceptedFormat, StreamNotFound
from moviepy.audio.io.AudioFileClip import AudioFileClip
from typing import Any, BinaryIO, Optional
from pytube import Stream, YouTube
class Downloader(YouTube):
def __init__(self, url: str, format: str):
super().__init__(
... | 2.890625 | 3 |
house_prices_regression_model/predict.py | jmonsalverodilla/house_prices_regression_model | 0 | 48650 | import typing as t
import numpy as np
import pandas as pd
from house_prices_regression_model import __version__ as VERSION
from house_prices_regression_model.processing.data_manager import load_pipeline
from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH
from house_prices_regression_m... | 2.609375 | 3 |
hybrid/samplers.py | arcondello/dwave-hybrid | 0 | 48651 | # Copyright 2018 D-Wave Systems 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 wri... | 1.570313 | 2 |
app/utils/message.py | NehaDC-IMC/connect-processor-template-for-python | 0 | 48652 | <reponame>NehaDC-IMC/connect-processor-template-for-python<filename>app/utils/message.py
class TierFulfillmentMessages(object):
RROR_PROCESSING_TIER_REQUEST = 'There has been an error processing the tier config request. Error description: {}'
class BasePurchaseMessages:
pass
class BaseChangeMessages:
pas... | 1.820313 | 2 |
src/gui/SelectActorsFormWrapper.py | perfidia/afefuc | 0 | 48653 | <filename>src/gui/SelectActorsFormWrapper.py
'''
Created on Apr 25, 2013
@author: <NAME>
'''
from PyQt4 import QtCore, QtGui
from generated.ui.SelectForm import Ui_SelectForm
#from format import model
#from utils import converter
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda ... | 1.945313 | 2 |
guillotina/db/strategies/simple.py | rboixaderg/guillotina | 173 | 48654 | <gh_stars>100-1000
from guillotina import configure
from guillotina import glogging
from guillotina.db.interfaces import IDBTransactionStrategy
from guillotina.db.interfaces import ITransaction
from guillotina.db.strategies.base import BaseStrategy
logger = glogging.getLogger("guillotina")
@configure.adapter(for_=I... | 2.09375 | 2 |
ktrade/ib_api.py | ShabbirHasan1/ktrade | 0 | 48655 | <gh_stars>0
import logging
from ktrade.config import is_configured, configuration_for
from time import sleep
from ktrade.queues import inbound_queue, outbound_queue
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from threading import Thread
class IBApi(EWrapper, EClient):
def __init__(self):
... | 2.25 | 2 |
app/grandchallenge/products/migrations/0007_projectairfiles.py | nlessmann/grand-challenge.org | 101 | 48656 | # Generated by Django 3.1.11 on 2021-07-01 20:18
from django.db import migrations, models
import grandchallenge.core.storage
class Migration(migrations.Migration):
dependencies = [
("products", "0006_product_ce_under"),
]
operations = [
migrations.CreateModel(
name="Project... | 1.5 | 2 |
rl/valuefunction/linear.py | nickswalker/counterpoint-reinforcement-learning | 1 | 48657 | <reponame>nickswalker/counterpoint-reinforcement-learning
from typing import List, Set
import numpy as np
from rl.action import Action
from rl.state import State
from rl.valuefunction import FeatureExtractor
class PerActionLinearVFA:
def __init__(self, num_features, actions: List[Action], initial_value=0.0):
... | 2.96875 | 3 |
shop/shop/products/validators.py | nikolaynikolov971/NftShop | 0 | 48658 | from django.core.exceptions import ValidationError
def is_alpha_or_space_validator(value):
result = all(c.isalpha() or c.isspace() for c in value)
if not result:
raise ValidationError("Write a valid name.")
| 2.9375 | 3 |
src/oscar/templatetags/dashboard_tags.py | sainjusajan/django-oscar | 0 | 48659 | <filename>src/oscar/templatetags/dashboard_tags.py
from django import template
from oscar.core.compat import assignment_tag
from oscar.core.loading import get_class
get_nodes = get_class('dashboard.menu', 'get_nodes')
register = template.Library()
@assignment_tag(register)
def dashboard_navigation(user):
... | 1.734375 | 2 |
amlearn/utils/tests/test_data.py | Qi-max/amlearn | 12 | 48660 | import numpy as np
from amlearn.utils.basetest import AmLearnTest
from amlearn.utils.data import get_isometric_lists
class test_data(AmLearnTest):
def setUp(self):
pass
def test_get_isometric_lists(self):
test_lists= [[1, 2, 3], [4], [5, 6], [1, 2, 3]]
isometric_lists = \
... | 2.84375 | 3 |
DishDash/pages/text_photo_parser.py | NealWhitlock/MyDish-DS | 1 | 48661 | <filename>DishDash/pages/text_photo_parser.py
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
# Imports from this application
from app import app
# 2 column ... | 2.4375 | 2 |
setup.py | dsuch/warlock | 10 | 48662 | # 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 1.476563 | 1 |
traxee-simple/traxee/flipkart/forms.py | chauhan17nitin/traxee | 0 | 48663 | from django import forms
class UserForm(forms.Form):
name = forms.CharField(max_length=30)
email = forms.CharField(max_length=30, widget = forms.EmailInput)
password = forms.CharField(widget = forms.PasswordInput)
class Meta:
fields = ['name', 'email', 'password']
# class HandlerForm(forms.... | 2.21875 | 2 |
fleet_management/core/vehicle/serializers.py | nahidsaikat/Fleet-Management-Backend | 3 | 48664 | <reponame>nahidsaikat/Fleet-Management-Backend
from rest_framework import serializers
from .models import Vehicle
class VehicleSerializer(serializers.ModelSerializer):
class Meta:
model = Vehicle
fields = ('id', 'serial', 'fleet', 'status', 'driver')
| 2.1875 | 2 |
src/profile_build_tools/__init__.py | atu4403/profile_build_tools | 0 | 48665 | from .atcoder_images import update_atcoder_images
from .pypi_stats import get_pypi_stats
from .qiita_stats import get_qiita_stats
from .github_stats import get_github_stats, _to_list
| 0.917969 | 1 |
Ejercicios/for.py | julioh/python-chile | 0 | 48666 | <gh_stars>0
#! /usr/bin/python
# -*- coding: iso-8859-15 -*-
n = int(input("Ingrese la cantidad de datos: "))
suma = 0
for i in range(n):
x = float(input("Ingrese el dato: "))
suma = suma + x
prom = suma / n
print("El promedio es: " ,prom) | 3.875 | 4 |
interface/popup.py | spatocode/seeker | 0 | 48667 | <gh_stars>0
import wx
class PopupMenu(wx.Menu):
def __init__(self, parent):
super(PopupMenu, self).__init__()
self.parent = parent
sendPackets = wx.MenuItem(self, wx.NewId(), "Send Packets")
self.Append(sendPackets)
copyPackets = wx.MenuItem(self, wx.NewId(), "Copy Packets... | 2.140625 | 2 |
backend-code/yeprayas_project/settings.py | sumitpal1007/yeprayas_react | 0 | 48668 | <reponame>sumitpal1007/yeprayas_react<filename>backend-code/yeprayas_project/settings.py<gh_stars>0
"""
Django settings for yeprayas_project project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full... | 1.75 | 2 |
src/jobs_done10/_tests/test_repository.py | prusse-martin/jobs_done10 | 21 | 48669 | <filename>src/jobs_done10/_tests/test_repository.py
from jobs_done10.repository import Repository
def testNameFromURL():
tests = [
('/path/to/repo.git/', 'repo'),
('file:///path/to/repo.git/', 'repo'),
('file://~/path/to/repo.git/', 'repo'),
('git://host.xz/path/to/repo.git/', 'r... | 2.21875 | 2 |
CAIL2020/sfksz/formatter/BertWordFormatter.py | ShenDezhou/CAIL | 71 | 48670 | import json
import torch
import numpy as np
import os
#from pytorch_pretrained_bert import BertTokenizer
from transformers import BertTokenizer
class BertWordFormatter:
def __init__(self, config, mode):
self.max_question_len = config.getint("data", "max_question_len")
self.max_option_len = config.g... | 2.671875 | 3 |
docs/src/common/space/example.py | visigoths/visigoth | 0 | 48671 | <gh_stars>0
# -*- coding: utf-8 -*-
from visigoth import Diagram
from visigoth.common import Space, Text
d = Diagram(fill="white")
d.add(Text("Example Space, see below...",font_height=32,text_attributes={"stroke":"darkblue"}))
d.add(Space(200,200))
d.add(Text("...did you miss it? ^^^^",font_height=32,text_attributes=... | 2.59375 | 3 |
memit/apps.py | russlbrown/memit | 0 | 48672 | <filename>memit/apps.py
from django.apps import AppConfig
class MemitConfig(AppConfig):
name = 'memit'
| 1.117188 | 1 |
djstripe/management/__init__.py | iqbalabd/dj-stripe | 2 | 48673 | """
.. module:: djstripe.management.
:synopsis: dj-stripe - management module, contains commands.
"""
| 1.140625 | 1 |
Mailbox/models.py | Positron11/Corkran | 0 | 48674 | from django.db import models
from datetime import datetime
from django.contrib import messages
from django.dispatch import receiver
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from polymorphic.models import PolymorphicModel
from Blog.models import Comment, Article, Announc... | 2.1875 | 2 |
archive/extras/cat_dog_estimator/main.py | Pandinosaurus/tensorflow-workshop | 796 | 48675 | """
A very simplified introduction to TensorFlow using Estimator API for training a
cat vs. dog classifier from the CIFAR-10 dataset. This version is intentionally
simplified and has a lot of room for improvment, in speed and accuracy.
Usage:
python main.py [train|predict] [predict file]
"""
import sys
import nump... | 3.828125 | 4 |
c2cgeoportal/tests/test_wfsparsing.py | pgiraud/c2cgeoportal | 0 | 48676 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# l... | 1.296875 | 1 |
aiotfm/client.py | Athesdrake/aiotfm | 30 | 48677 | import asyncio
import logging
import random
import warnings
from typing import AnyStr, ByteString, Callable, List, Optional, Union
from aiotfm.connection import Connection
from aiotfm.enums import Community, GameMode, TradeError
from aiotfm.errors import AiotfmException, AlreadyConnected, CommunityPlatformErro... | 2.265625 | 2 |
cruzdb/sequence.py | adelq/cruzdb | 82 | 48678 | import urllib as U
__all__ = ('sequence', )
def _seq_from_xml(xml):
start = xml.find(">", xml.find("<DNA")) + 1
end = xml.rfind("</DNA>")
return xml[start:end].replace(' ', '').replace('\n', '').strip()
def sequence(db, chrom, start, end):
"""
return the sequence for a region using the UCSC DAS
... | 3.140625 | 3 |
Tests/test_Statistics.py | jasmansingh84/PyStatisticalcalci | 0 | 48679 | <reponame>jasmansingh84/PyStatisticalcalci<filename>Tests/test_Statistics.py<gh_stars>0
import unittest
from CsvReader.CsvReader import CsvReader
from CsvReader.CsvReader2 import CsvReader2
from Statistics.Statistics import Statistics
class MyTestCase(unittest.TestCase):
def setUp(self) -> None:
self.Stat... | 3.046875 | 3 |
nipype/interfaces/tests/test_matlab.py | satra/NiPypeold | 0 | 48680 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
from tempfile import mkdtemp
from shutil import rmtree
from nipype.testing import (assert_equal, assert_true, assert_false,
assert_raises, skipif, parametric)
import ... | 1.992188 | 2 |
malcolm/modules/xmap/blocks/__init__.py | hir12111/pymalcolm | 11 | 48681 | <reponame>hir12111/pymalcolm
from malcolm.yamlutil import check_yaml_names, make_block_creator
xmap_driver_block = make_block_creator(__file__, "xmap_driver_block.yaml")
xmap_runnable_block = make_block_creator(__file__, "xmap_runnable_block.yaml")
__all__ = check_yaml_names(globals())
| 1.921875 | 2 |
tools/sam_filter.py | rishavray/PILFER | 8 | 48682 | <filename>tools/sam_filter.py
#!/usr/bin/python
import sys
import csv
import re
csvin = csv.reader(sys.stdin,delimiter="\t")
csvout = csv.writer(sys.stdout,delimiter="\t")
pattern = re.compile('NM:i:\d*')
for row in csvin:
nm_id = [i for i, x in enumerate(row) if re.search(pattern, x)]
nm_fields = row[nm_id[0]].spl... | 2.859375 | 3 |
app/ac_common/testrunner.py | marwahaha/allecena | 3 | 48683 | # coding: utf-8
import os
from django.test.runner import DiscoverRunner
from django.conf import settings
class AcTestRunner(DiscoverRunner):
def __init__(self, **kwargs):
super(AcTestRunner, self).__init__(**kwargs)
self.no_db = kwargs.get('no_db', None) if kwargs.get('no_db', None) is not None ... | 2.078125 | 2 |
plot_graphs_forest.py | jcdesousa/azure-ml-experiment | 2 | 48684 | <reponame>jcdesousa/azure-ml-experiment
try:
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
from scipy import interp
from itertools import cycle
import numpy as np
from sklearn.metrics import roc_curve, auc
from sklearn.metrics import confusion_matrix
from s... | 2.640625 | 3 |
sigflow/blocks/filter.py | lamyc/sigflow | 1 | 48685 | """A filter block.
"""
import control
import numpy as np
import scipy
from .base import Block
class Filter(Block):
"""A Filter block class
This is simply a single-input-single-output LTI system defined by a
single TransferFunction object.
Parameters
----------
tf : control.TransferFunction
... | 3.359375 | 3 |
cogs/restart.py | snoringninja/niftybot-discord | 0 | 48686 | <filename>cogs/restart.py
# -*- coding: utf-8 -*-
"""
restart.py
@author xNifty
@site - https://snoring.ninja
Restart the python process
I wouldn't recommend using this
"""
import os
import sys
from discord.ext import commands
from resources.config import ConfigLoader
class Restart():
"""Restart()
Restart ... | 2.734375 | 3 |
abc170/d_TLE.py | nishio/atcoder | 1 | 48687 | N = int(input())
AS = [int(x) for x in input().split()]
ok = []
for i in range(N):
for j in range(N):
if i == j:
continue
if AS[i] % AS[j] == 0:
break
else:
ok.append(i)
print(len(ok))
| 3.03125 | 3 |
webapp/models.py | JagerCox/InverseRelation | 0 | 48688 | <gh_stars>0
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class Contact(models.Model):
name = models.CharField(max_length=25, help_text="Example: John", null=False, blank=False)
surname = models.CharField(max_length=100, help_text="Example: Doe", null=False, blank=Fal... | 2.1875 | 2 |
MyUtils/ImageProcessing.py | mairob/Semantic-segmentation-and-Depth-estimation | 6 | 48689 | #! /usr/bin/python3
#############################################################
### Helper File for TFRecords and Image manipulation ########
#############################################################
import tensorflow as tf
import numpy as np
## Label mapping for Cityscapes (34 classes)
Cityscapes34_I... | 2.0625 | 2 |
src/traffic_analysis/d05_evaluation/frame_level_evaluator.py | dssg/air_pollution_estimation | 7 | 48690 | import pandas as pd
import numpy as np
import xml.etree.ElementTree as ElementTree
from traffic_analysis.d00_utils.bbox_helpers import bboxcv2_to_bboxcvlib
from traffic_analysis.d05_evaluation.parse_annotation import parse_annotation
from traffic_analysis.d05_evaluation.compute_mean_average_precision import get_avg_p... | 2.515625 | 3 |
src/model/Point.py | DaDudek/Tetris | 2 | 48691 | <reponame>DaDudek/Tetris
class Point:
def __init__(self, x: int, y: int):
self.x = x
self.y = y
def getX(self) -> int:
return self.x
def getY(self) -> int:
return self.y
def setX(self, x: int) -> None:
self.x = x
def setY(self, y: int) -> None:
sel... | 2.984375 | 3 |
src/config/utilities.py | ionitadaniel19/testframeworksevolution | 0 | 48692 | '''
Created on 24.05.2014
@author: ionitadaniel19
'''
import logging.config
import os
import json
from xlsmanager import easyExcel
from constants import *
import traceback
import copy
def setup_logging(default_path='logging.json', default_level=logging.INFO,env_key='LOG_CFG'):
"""Setup logging conf... | 2.5625 | 3 |
puente-etl/jobs.py | puente-development-international/serverless | 0 | 48693 | from load_to_s3 import export_to_s3_as_dataframe, export_to_s3_as_csv
from transform_form_specifications import get_custom_form_schema_df
from transform_form_results import get_form_results_df
from utils.clients import Clients
from utils.constants import PuenteTables
def run_transform_jobs(event, context):
"""
... | 2.359375 | 2 |
api/migrations/0001_initial.py | study-abacus/admin-site | 1 | 48694 | # Generated by Django 2.1.2 on 2019-06-21 15:16
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ContactQuery',
fields=[
('id', models.AutoF... | 1.859375 | 2 |
helper.py | chin-gyou/lstm | 0 | 48695 | <filename>helper.py
def num_contain(f,token):
with open(f) as fin:
lines=fin.readlines()
r=[l for l in lines if token not in l]
print(len(r))
def combine(f1,f2,w):
l1=open(f1).readlines()
l2=open(f2).readlines()
pair=zip(l1,l2)
print(pair[0])
r=[lin1.strip()+" "+lin2.strip()+"\n" for ... | 2.71875 | 3 |
views/template.py | dev-easyshares/mighty | 0 | 48696 | <reponame>dev-easyshares/mighty
from django.views.generic.base import TemplateView
from mighty.views.base import BaseView
class TemplateView(BaseView, TemplateView):
pass | 1.3125 | 1 |
grading/postgrade.py | berkeley-dsep-infra/data8xhub | 9 | 48697 | """
Script to post grades back to EdX
"""
import requests
import json
import os
import time
from oauthlib.oauth1.rfc5849 import signature, parameters
from lxml import etree
from hashlib import sha1
import argparse
import base64
class GradePostException(Exception):
def __init__(self, response=None):
self.r... | 2.703125 | 3 |
backend/metric/ulca-utility-service/src/repositories/notifierrepo.py | agupta54/ulca | 3 | 48698 | <reponame>agupta54/ulca
import pymongo
import logging
import config
from logging.config import dictConfig
log = logging.getLogger('fie')
class NotifierRepo:
def __init__(self):
pass
def count_data_col(self, query,schema,collection):
log.info(f"Mongo count calculation : {query},{schema},... | 2.265625 | 2 |
python/opscore/RO/Astro/Cnv/TopoFromObs.py | sdss/opscore | 0 | 48699 | <gh_stars>0
#!/usr/bin/env python
"""
History:
2002-07-22 ROwen Converted to Python from the TCC's cnv_UnRefract 2-2.
2002-12-23 ROwen Fixed "obsP too small" message; thanks to pychecker.
2005-04-26 ROwen Fixed minor indentation oddity.
2007-04-24 ROwen Converted from Numeric to numpy.
2007-09-19 ROwen ... | 2.015625 | 2 |