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 |
|---|---|---|---|---|---|---|
src/search/sort/prepare_data.py | lingeen/lingeen-Ying | 0 | 34400 | # -*- coding: utf-8 -*-
# @Time : 2020/12/23 2:27 PM
# @Author : Kevin
import config
from utils.sentence_process import cut_sentence_by_character
from search.sort.word_to_sequence import Word2Sequence
import pickle
def prepare_dict_model():
lines=open(config.sort_all_file_path,"r").readlines()
ws=Word2Se... | 3.1875 | 3 |
equipment_piece.py | cookyt/mhw_optimizer | 0 | 34401 | from enum import Enum
class BodyPart(Enum):
HEAD = 0
BODY = 1
ARMS = 2
WAIST = 3
LEGS = 4
CHARM = 5
class EquipmentPiece:
def __init__(self, name, body_part, skills):
self.name = name
self.body_part = body_part
self.skills = skills
class ArmourPiece(EquipmentPie... | 3.390625 | 3 |
tests/message_handler_test.py | FelixSchwarz/mailqueue-runner | 3 | 34402 | # -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
from __future__ import absolute_import, print_function, unicode_literals
import os
import shutil
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
import uuid
from ddt import ddt as DataDrivenTestCase, data as ddt_da... | 1.890625 | 2 |
Python3/687.longest-univalue-path.py | 610yilingliu/leetcode | 0 | 34403 | <filename>Python3/687.longest-univalue-path.py<gh_stars>0
#
# @lc app=leetcode id=687 lang=python3
#
# [687] Longest Univalue Path
#
# @lc code=start
from collections import deque
def construct_tree(values):
if not values:
return None
root = TreeNode(values[0])
queue = deque([root])
leng = len... | 3.609375 | 4 |
tests/reflinks_tests.py | xqt/pwb | 1 | 34404 | #!/usr/bin/python3
"""Tests for reflinks script."""
#
# (C) Pywikibot team, 2014-2022
#
# Distributed under the terms of the MIT license.
#
import unittest
from scripts.reflinks import ReferencesRobot, XmlDumpPageGenerator, main
from tests import join_xml_data_path
from tests.aspects import ScriptMainTestCase, TestCas... | 2.375 | 2 |
sunny/publisher/ioloop.py | AnkitAggarwalPEC/HFT-Analytics-Luigi | 0 | 34405 | <gh_stars>0
import asyncio
class IOLoop(object):
self.event_loop = asyncio.get_event_loop()
def __init__(self):
pass
def start(self):
if self._running:
raise RuntimeError("IOLoop is already running")
if self._stopped:
self._stopped = False
ret... | 2.859375 | 3 |
Data Science and Machine Learning/Machine-Learning-In-Python-THOROUGH/EXAMPLES/EDABIT/EARLIER/49_triangle_challenge.py | okara83/Becoming-a-Data-Scientist | 0 | 34406 | <gh_stars>0
"""
Triangle Challenge
Given the perimeter and the area of a triangle, devise a function that returns the length of the sides of all triangles that fit those specifications. The length of the sides must be integers. Sort results in ascending order.
triangle(perimeter, area) ➞ [[s1, s2, s3]]
Examples
triang... | 4.09375 | 4 |
src/my_resnet.py | fahim19dipu/Seed-classifier | 0 | 34407 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 4 17:01:28 2021
@author: fahim
"""
from keras.models import Model
from keras.layers import Input, Add, Activation, ZeroPadding2D, BatchNormalization, Conv2D, AveragePooling2D, MaxPooling2D
from keras.initializers import glorot_uniform
def identity_block(X, f, filters, ... | 2.828125 | 3 |
integration-test/630-bus-routes-z12.py | slachiewicz/vector-datasource | 0 | 34408 | <filename>integration-test/630-bus-routes-z12.py
# block between mission & 6th and howard & 5th in SF.
# appears to have lots of buses.
# https://www.openstreetmap.org/way/88572932 -- Mission St
# https://www.openstreetmap.org/relation/3406710 -- 14X to Daly City
# https://www.openstreetmap.org/relation/3406709 -- 14X ... | 2.28125 | 2 |
bioinf/cli.py | szymanskir/bioinf | 1 | 34409 | # -*- coding: utf-8 -*-
"""Console script for bioinf."""
import sys
import click
from .sequence import Sequence
from .sequence_alignment import NeedlemanWunschSequenceAlignmentAlgorithm
from .utils import read_config, read_sequence
@click.group()
def main(args=None):
"""Console script for bioinf."""
@main.comm... | 3.09375 | 3 |
package_one/tests/test_integer_adder.py | afaquejam/AwesomeApp | 4 | 34410 | <gh_stars>1-10
import pytest
from package_one.module_one import IntegerAdder
@pytest.fixture
def adder():
print("Test set-up!")
yield IntegerAdder()
print("Test tear-down")
def test_integer_adder(adder):
assert adder.add(1, 2) == 3
"""
In case you'd like to declare a fixture that executes only once p... | 2.671875 | 3 |
tests/local/test_json.py | abarisain/mopidy | 2 | 34411 | from __future__ import unicode_literals
import unittest
from mopidy.local import json
from mopidy.models import Ref
class BrowseCacheTest(unittest.TestCase):
def setUp(self):
self.uris = [b'local:track:foo/bar/song1',
b'local:track:foo/bar/song2',
b'local:track:... | 2.609375 | 3 |
test/test_oximachine.py | ltalirz/oximachinerunner | 0 | 34412 | <reponame>ltalirz/oximachinerunner<filename>test/test_oximachine.py
# -*- coding: utf-8 -*-
# pylint:disable=missing-module-docstring, missing-function-docstring
import os
from oximachinerunner import OximachineRunner
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
def test_oximachine():
runner = Oximach... | 2.03125 | 2 |
src/OTLMOW/OTLModel/Datatypes/KlVerlichtingstoestelModelnaam.py | davidvlaminck/OTLClassPython | 2 | 34413 | # coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlVerlichtingstoestelModelnaam(KeuzelijstField):
"""De modelnaam van het verlich... | 1.796875 | 2 |
api/src/domain/object/user_interface/modal/Modal.py | SamuelJansen/Application | 0 | 34414 | <gh_stars>0
import UserInterface
import surfaceFunction, eventFunction
print('Modal library imported')
class Modal(UserInterface.UserInterface):
def __init__(self,name,size,father,
type = None,
position = None,
text = None,
textPosition = None,
fontSize = None,
sca... | 2.46875 | 2 |
ospath/ospath_expanduser.py | dineshkumar2509/learning-python | 86 | 34415 | #!/usr/bin/env python
# encoding: utf-8
"""Expand tilde in filenames.
"""
import os.path
for user in ['', 'dhellmann', 'postgres']:
lookup = '~' + user
print lookup, ':', os.path.expanduser(lookup)
| 2.078125 | 2 |
tests/test_repo.py | OmegaDroid/git-hooks | 2 | 34416 | import string
from unittest2 import TestCase
import os
from hypothesis import given
from hypothesis.strategies import text, lists
from mock import patch, Mock
from githooks import repo
class FakeDiffObject(object):
def __init__(self, a_path, b_path, new, deleted):
self.a_path = a_path
self.b_pat... | 2.421875 | 2 |
Python/Zoo/zoo.py | bill-neely/ITSE1311-1302-Spring2018 | 0 | 34417 | <filename>Python/Zoo/zoo.py<gh_stars>0
class Zoo:
def __init__(self, name, locations):
self.name = name
self.stillActive = True
self.locations = locations
self.currentLocation = self.locations[1]
def changeLocation(self, direction):
neighborID = self.currentLocation.neig... | 3.5 | 4 |
src/hashing_.py | pawelmhm/recenseo.es | 0 | 34418 | # -*- coding: utf-8 -*-
from hmac import HMAC
from hashlib import sha256
import random
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def pbkd(password,salt):
"""
password must be a string in ascii, for some reasons
string of type unicode provokes the follow... | 3.515625 | 4 |
neural-net/tensorflow/datasets.py | burntcustard/DeskBot-Zero | 0 | 34419 | <filename>neural-net/tensorflow/datasets.py
# Useful tutorial on tensorflow.contrib.data:
# https://kratzert.github.io/2017/06/15/example-of-tensorflows-new-input-pipeline.html
import glob # Used to generate image filename list
import tensorflow as tf
def input_parser(image_path, label):
"""
Convert label... | 3.234375 | 3 |
uis/widget_formatter.py | AlberLC/qt-app | 0 | 34420 | import os
import subprocess
import pathlib
def reemplazar(string):
return string.replace('self.', 'self.w.').replace('Form"', 'self.w.centralWidget"').replace('Form.', 'self.w.centralWidget.').replace('Form)', 'self.w.centralWidget)').replace('"', "'")
try:
url_archivo = input('Archivo: ').strip().strip('"'... | 2.53125 | 3 |
applications/HDF5Application/python_scripts/single_mesh_xdmf_output_process.py | AndreaVoltan/MyKratos7.0 | 2 | 34421 | <filename>applications/HDF5Application/python_scripts/single_mesh_xdmf_output_process.py
import KratosMultiphysics as KM
import KratosMultiphysics.HDF5Application.temporal_output_process_factory as output_factory
import KratosMultiphysics.HDF5Application.file_utilities as file_utils
def Factory(settings, Model):
"... | 2.375 | 2 |
docs/rename_function.py | samaid/sdc | 1 | 34422 | """
This script requires developers to add the following information:
1. add file and function name to srcfiles_srcfuncs
2. add file and directory name to srcdir_srcfiles
3. add expected display name for the function to display_names
"""
import os
import itertools
from shutil import copyfile... | 3.390625 | 3 |
src/entities/user.py | clayz/crazy-quiz-web | 0 | 34423 | from google.appengine.ext import ndb
from google.appengine.ext.ndb import msgprop
from entities import BaseEntity
from constants import Gender, UserStatus, Device, APIStatus
from errors import DataError
class User(BaseEntity):
name = ndb.StringProperty()
mail = ndb.StringProperty()
gender = msgprop.EnumPr... | 2.234375 | 2 |
paytm/models.py | Faisal-Manzer/django-paytm-checkout | 10 | 34424 | <reponame>Faisal-Manzer/django-paytm-checkout<filename>paytm/models.py
__all__ = ['Order', 'Item']
from django.db import models
from django.contrib.auth import get_user_model
from paytm import conf as paytm_conf
from paytm.helpers import sha256
class Item(models.Model):
price = models.FloatField()
name = mod... | 2.265625 | 2 |
tffm/__init__.py | FlorisHoogenboom/tffm | 0 | 34425 | from .models import TFFMClassifier, TFFMRegressor, TFFMRankNet
__all__ = ['TFFMClassifier', 'TFFMRegressor', 'TFFMRankNet']
| 1.09375 | 1 |
competitions/avito-demand-prediction/base_xgb_tune_mthread.py | gtesei/fast-furious | 19 | 34426 | <gh_stars>10-100
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
import re
from sklearn.feature_extraction import DictVectorizer
from sklearn.model_selection import train_test_split
import pandas as pd
from pandas.tseries.holiday import USFederal... | 2.125 | 2 |
tests/program_test.py | stanfortonski/Perlin-Noise-3D-Voxel-Generator | 27 | 34427 | <filename>tests/program_test.py
import sys, unittest, glfw
sys.path.insert(0, '..')
from OpenGL.GL import *
from engine.base.shader import Shader
from engine.base.program import *
import helper
class ProgramTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.window = helper.initAndGetWindow(... | 2.328125 | 2 |
movie_night/genrecollector.py | MattDrouin/movie_night | 0 | 34428 | <filename>movie_night/genrecollector.py
import aiohttp
import asyncio
# Grab the movie genre in a slightly painful way
async def get_genre(movie_title, session):
search_string = "+".join(movie_title.split())
url = f'https://www.google.com/search?q={search_string}'
async with session.get(url) as resp... | 3.203125 | 3 |
ML/WhatsApp/radar_chart.py | PepSalehi/algorithms | 0 | 34429 | # core modules
from math import pi
# 3rd party modules
import matplotlib.pyplot as plt
import pandas as pd
# internal modules
import analysis
def main(path):
df = analysis.parse_file(path)
df = prepare_df(df, grouping=(df['date'].dt.hour))
print(df.reset_index().to_dict(orient='list'))
df = pd.DataF... | 3.484375 | 3 |
LoggedSensor.py | majorpeter/puha-manager | 0 | 34430 | from datetime import datetime
from threading import Lock
from Database import Database
class LoggedSensor:
"""
This is a common base class for all sensors that have data to be stored/logged.
"""
registered_type_ids = []
def __init__(self, type_id, max_measurements=200, holdoff_time=None):
... | 3.0625 | 3 |
tests/algorithms/sets/test_cartesian.py | maurobaraldi/python-algorithms | 2 | 34431 | <reponame>maurobaraldi/python-algorithms<filename>tests/algorithms/sets/test_cartesian.py<gh_stars>1-10
#!/usr/bin/env python
import unittest
from algorithms.sets.cartesian_product import cartesian
class TestFatorial(unittest.TestCase):
def setUp(self):
self.set_a = [1, 2]
self.set_b = [4, 5]
... | 3.53125 | 4 |
libs/sdc_etl_libs/aws_helpers/S3Data.py | darknegma/docker-airflow | 0 | 34432 | import boto3
from botocore.exceptions import ClientError
import gzip
import io
import os
import csv
import re
class S3Data(object):
def __init__(self, bucket_name_, prefix_, file_, df_schema_, compression_type_,
check_headers_, file_type_, access_key_=None, secret_key_=None,
regi... | 2.578125 | 3 |
tests/test_models.py | thmslmr/timebomb-client | 1 | 34433 | from datetime import datetime
import timebomb.models as models
def test_Notification():
notif = models.Notification("message")
assert notif.content == "message"
assert notif.read is False
assert str(notif) == "message"
def test_Player():
player = models.Player("name", "id")
assert player.... | 2.625 | 3 |
words_in_sentences/admin.py | FatliTalk/learnenglish | 1 | 34434 | <gh_stars>1-10
from django.contrib import admin
from .models import Tag, Sentence, Review
admin.site.register(Tag)
class ReviewInline(admin.StackedInline):
model = Review
extra = 0
readonly_fields = (
'modified_time',
'last_review_date',
)
class SentenceAdmin(admin.ModelAdmin):
... | 1.96875 | 2 |
scheduled_bots/scripts/add_ECO_evidence_code.py | turoger/scheduled-bots | 6 | 34435 | <reponame>turoger/scheduled-bots
"""
One off script to Map evidence codes between ECO and GO
https://github.com/evidenceontology/evidenceontology/blob/master/gaf-eco-mapping.txt
"""
import datetime
from wikidataintegrator import wdi_core, wdi_login
from scheduled_bots.local import WDPASS, WDUSER
login = wdi_login.WD... | 2.359375 | 2 |
emenu/conftest.py | Ryszyy/emenu | 0 | 34436 | <gh_stars>0
import pytest
from django.contrib.auth import get_user_model
from emenu.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> get_user_model(): # type: ignore
return UserFac... | 1.859375 | 2 |
pychemia/population/_population.py | quanshengwu/PyChemia | 1 | 34437 | from __future__ import unicode_literals
import json
import numpy as np
from builtins import str
from abc import ABCMeta, abstractmethod
from pychemia import HAS_PYMONGO
from pychemia.utils.computing import deep_unicode
if HAS_PYMONGO:
from pychemia.db import PyChemiaDB
class Population:
__metaclass__ = ABCMe... | 2.578125 | 3 |
python/tests/test_nessie_cli.py | ryantse/nessie | 0 | 34438 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `pynessie` package."""
import pytest
import requests_mock
import simplejson as json
from click.testing import CliRunner
from pynessie import __version__
from pynessie import cli
from pynessie.model import ReferenceSchema
def test_command_line_interface(reque... | 2.28125 | 2 |
dongtai_agent_python/context/__init__.py | luzhongyang/DongTai-agent-python-1 | 17 | 34439 | from .request_context import RequestContext
from .tracker import ContextTracker
from .request import DjangoRequest, FlaskRequest
| 1.101563 | 1 |
iaso/api/org_unit_search.py | BLSQ/iaso-copy | 29 | 34440 | <reponame>BLSQ/iaso-copy<gh_stars>10-100
import re
from django.db.models import Q, Count, Sum, Case, When, IntegerField, Value
from iaso.models import OrgUnit, Instance, DataSource
def build_org_units_queryset(queryset, params, profile):
validation_status = params.get("validation_status", OrgUnit.VALIDATION_VAL... | 2.140625 | 2 |
deep_NLP.py | AI-tist/NlpDeeplearning | 0 | 34441 | <reponame>AI-tist/NlpDeeplearning<filename>deep_NLP.py
import pandas as pd
import numpy as np
import xgboost as xgb
from tqdm import tqdm
from sklearn.svm import SVC
from keras.models import Sequential
from keras.layers.recurrent import LSTM, GRU
from keras.layers.core import Dense, Activation, Dropout
from keras.layer... | 2.328125 | 2 |
cbt/apps.py | belloshehu/multiple-choice-questions | 0 | 34442 | <reponame>belloshehu/multiple-choice-questions
from django.apps import AppConfig
class CbtConfig(AppConfig):
name = 'cbt'
| 1.304688 | 1 |
examples/python/src/authors/models.py | ShivamSarodia/sqlc | 5,153 | 34443 | # Code generated by sqlc. DO NOT EDIT.
import dataclasses
from typing import Optional
@dataclasses.dataclass()
class Author:
id: int
name: str
bio: Optional[str]
| 2.21875 | 2 |
src/wagtail_site_inheritance/__init__.py | labd/wagtail-site-inheritance | 5 | 34444 | __version__ = "0.0.1"
default_app_config = "wagtail_site_inheritance.apps.WagtailSiteInheritanceAppConfig"
| 0.992188 | 1 |
code/mod.py | aragilar/python-testing | 0 | 34445 | <filename>code/mod.py
import os.path
import numpy as np
def sinc2d(x, y):
if x == 0.0 and y == 0.0:
return 1.0
elif x == 0.0:
return np.sin(y) / y
elif y == 0.0:
return np.sin(x) / x
else:
return (np.sin(x) / x) * (np.sin(y) / y)
def a(x):
return x + 1
def b(x):
... | 2.984375 | 3 |
chooks/commands/add.py | thegedge/chooks | 0 | 34446 | <gh_stars>0
"""Adds a chook to a git repository.
Usage:
chooks add [--stdin | --argument] [--once | --filter=FILTER...] [--global]
[--fatal] [--hook=NAME...] [--name=NAME] [--disabled]
[--] <command> [<args>...]
Options:
--stdin Supply input files to this chook via stdin.
--... | 2.578125 | 3 |
dwave/inspector/utils.py | hotmess47/dwave-inspector | 3 | 34447 | <filename>dwave/inspector/utils.py
# Copyright 2020 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... | 2.203125 | 2 |
MakeConects.py | Gimba/AmberUtils | 0 | 34448 | #! /usr/bin/env python
# Copyright (c) 2015 <NAME>
# 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, ... | 2.578125 | 3 |
supersalon/professionals/models.py | dogukantufekci/supersalon | 0 | 34449 | <filename>supersalon/professionals/models.py
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Professional(models.Model):
# User
user = models.OneToOneField('users.User', primary_key=True, related_name='professional', verbose_name=_("User"))
class Meta:
o... | 2.296875 | 2 |
test.py | imjacksonchen/weightTracker | 0 | 34450 | import unittest
import datetime
from weightTrack import WeightNote
class TestWeightNote(unittest.TestCase):
### Testing getter methods ###
def test_shouldGetWeight(self):
testWeight = WeightNote(100, "Ate breakfast")
self.assertEqual(testWeight.getWeight(), 100, "Should be 100")
# Note:... | 3.65625 | 4 |
networking_infoblox/neutron/cmd/eventlet/__init__.py | rav28/networking-infoblox | 0 | 34451 | __author__ = 'hhwang'
| 0.980469 | 1 |
debauto/utils.py | flaviomilan/python-debauto-br | 5 | 34452 | # -*- encoding: utf-8 -*-
import datetime
def formata_data(data):
data = datetime.datetime.strptime(data, '%d/%m/%Y').date()
return data.strftime("%Y%m%d")
def formata_valor(valor):
return str("%.2f" % valor).replace(".", "")
| 3.25 | 3 |
docker-images/pysyft-worker/worker-server.py | linamnt/PySyft | 3 | 34453 | import argparse
import torch
import syft as sy
from syft import WebsocketServerWorker
def get_args():
parser = argparse.ArgumentParser(description="Run websocket server worker.")
parser.add_argument(
"--port",
"-p",
type=int,
default=8777,
help="port number of the webso... | 2.65625 | 3 |
datageneration/dbmake_h264hits.py | utlive/VIDMAP | 1 | 34454 | <reponame>utlive/VIDMAP<filename>datageneration/dbmake_h264hits.py
import skimage.io
import skvideo.io
import os
import h5py
from sklearn.externals import joblib
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import f1_score
import scipy.misc
im... | 1.921875 | 2 |
mopidy_mqtt/utils.py | odiroot/mopidy-mq | 0 | 34455 | <gh_stars>0
UNKNOWN = u''
def describe_track(track):
"""
Prepare a short human-readable Track description.
track (mopidy.models.Track): Track to source song data from.
"""
title = track.name or UNKNOWN
# Simple/regular case: normal song (e.g. from Spotify).
if track.artists:
arti... | 3.25 | 3 |
SimModel_Python_API/simmodel_swig/Release/SimInternalLoad_Lights_Default.py | EnEff-BIM/EnEffBIM-Framework | 3 | 34456 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path imp... | 1.765625 | 2 |
ggpy/cruft/autocode/Test_CanonicalJSON.py | hobson/ggpy | 1 | 34457 | #!/usr/bin/env python
""" generated source for module Test_CanonicalJSON """
# package: org.ggp.base.util.crypto
import junit.framework.TestCase
import org.ggp.base.util.crypto.CanonicalJSON.CanonicalizationStrategy
#
# * Unit tests for the CanonicalJSON class, which provides a
# * standard way for GGP systems t... | 2.359375 | 2 |
python_app/tenhou-bot/mahjong/tile.py | 0xsuu/Project-Mahjong | 9 | 34458 | <filename>python_app/tenhou-bot/mahjong/tile.py
# -*- coding: utf-8 -*-
class Tile(int):
TILES = '''
1s 2s 3s 4s 5s 6s 7s 8s 9s
1p 2p 3p 4p 5p 6p 7p 8p 9p
1m 2m 3m 4m 5m 6m 7m 8m 9m
ew sw ww nw
wd gd rd
'''.split()
def as_data(self):
return self.TILES[self ... | 3.109375 | 3 |
python/chrysophylax/buy_and_hold.py | dichodaemon/chrysophylax | 0 | 34459 | import garm.indicators as gari
import ham.time_utils as hamt
import ohlcv
import luigi
import strategies as chs
from luigi.util import inherits
@inherits(chs.Strategy)
class BuyAndHold(chs.Strategy):
FN = gari.buy_and_hold_signals
def requires(self):
for m in hamt.months(self.start_date, self.end_da... | 2.03125 | 2 |
py2api/output_trans.py | andeaseme/py2api | 2 | 34460 | from py2api.constants import TRANS_NOT_FOUND, _OUTPUT_TRANS, _ATTR, _VALTYPE, _ELSE
class OutputTrans(object):
"""
OutputTrans allows to flexibly define a callable object to convert the output of a function or method.
For more information, see InputTrans
"""
def __init__(self, trans_spec=None):
... | 2.953125 | 3 |
imageApi.py | draJiang/Figma-To-Eagle | 0 | 34461 | import pytesseract
import os
import time
import requests
import json
from PIL import Image,ImageFont,ImageDraw
# 读取配置文件
with open('config.json') as json_file:
config = json.load(json_file)
# 默认的文件保存的目录
MAIN_PATH = './imageApi/image/'
# FONT,用于将文字渲染成图片
FONT = config['font']
def strToImg(text,mainPath):
'''
... | 2.734375 | 3 |
level_11.py | ceafdc/PythonChallenge | 1 | 34462 | <reponame>ceafdc/PythonChallenge<gh_stars>1-10
#!/usr/bin/env python3
# url: http://www.pythonchallenge.com/pc/return/5808.html
import requests
import io
import PIL.Image
url = 'http://www.pythonchallenge.com/pc/return/cave.jpg'
un = 'huge'
pw = 'file'
auth = un, pw
req = requests.get(url, auth=auth)
img_io = io.Byt... | 3.046875 | 3 |
scripts/spark.py | Sapphirine/Reducing_Manufacturing_Failures | 4 | 34463 |
# coding: utf-8
# ### Open using Databricks Platform/Py-spark. It holds the code for developing the RandomForest Classifier on the chosen subset of important features.
# In[1]:
import os, sys
import pandas as pd
import numpy as np
from sklearn.metrics import matthews_corrcoef
import pyspark
from numpy import array... | 2.703125 | 3 |
scripts/merge_map_blocks.py | ptrebert/reference-data | 0 | 34464 | #!/usr/bin/env python3
# coding=utf-8
import os as os
import sys as sys
import io as io
import traceback as trb
import argparse as argp
import gzip as gz
import operator as op
import functools as fnt
def parse_command_line():
"""
:return:
"""
parser = argp.ArgumentParser()
parser.add_argument('--... | 2.625 | 3 |
stockMarket/getData/models.py | seba-1511/stockMarket | 10 | 34465 | #-*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class Feature(models.Model):
day = models.SmallIntegerField()
month = models.SmallIntegerField()
year = models.SmallIntegerField()
momentum = models.FloatField(
null=True, blank=True)
day5disparity = models.Flo... | 1.945313 | 2 |
main.py | boxanm/CityRunHeatMaps | 1 | 34466 | <gh_stars>1-10
import os.path
import datetime
import gpxpy
import osmnx
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
import functions as functions
from collections import Counter, OrderedDict
import time
import math
import argparse
from customClasses import Cell
parser = argparse.Argum... | 2.53125 | 3 |
scripts/ftp_mar_data.py | SmithB/SMBcorr | 0 | 34467 | <reponame>SmithB/SMBcorr<filename>scripts/ftp_mar_data.py<gh_stars>0
#!/usr/bin/env python
u"""
ftp_mar_data.py
Written by <NAME> (05/2020)
Syncs MAR regional climate outputs for a given ftp url
ftp://ftp.climato.be/fettweis
CALLING SEQUENCE:
python ftp_mar_data.py --directory=<path> <ftp://url>
INPUTS:
... | 2.703125 | 3 |
sondages/sondages_wiki_scrap.py | verycourt/Elections | 0 | 34468 | <reponame>verycourt/Elections
#!/usr/bin/python
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import requests
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
import warnings
import dateparser
import datetime
import time
import json
from json import encoder
encoder.FLOAT_RE... | 2.15625 | 2 |
RecoMuon/MuonIsolationProducers/test/isoTest_cfg.py | ckamtsikis/cmssw | 852 | 34469 | <gh_stars>100-1000
# The following comments couldn't be translated into the new config version:
#
# keep only muon-related info here
#
import FWCore.ParameterSet.Config as cms
process = cms.Process("MISO")
process.load("Configuration.EventContent.EventContent_cff")
# service = MessageLogger {
# untracked ... | 1.320313 | 1 |
app/egg/__init__.py | MultyXu/Islandr | 2 | 34470 | '''
@Description: Easter Egg
@Author: <NAME>
@Date: 2019-08-10 10:30:29
@LastEditors: <NAME>
@LastEditTime: 2019-08-10 10:36:24
'''
from flask import Blueprint
egg = Blueprint('egg', __name__)
from . import views | 1.625 | 2 |
tests/backends/test_sqlalchemy_backend.py | kuc2477/news | 2 | 34471 | <reponame>kuc2477/news<filename>tests/backends/test_sqlalchemy_backend.py
def test_get_news(sa_session, sa_backend, sa_child_news):
assert(sa_child_news == sa_backend.get_news(sa_child_news.id))
assert(sa_backend.get_news(None) is None)
def test_get_news_list(sa_session, sa_backend, sa_child_news):
assert... | 2.125 | 2 |
database/repositories/ModelBlobRepository.py | roblkenn/EECS441-Backend | 0 | 34472 | <filename>database/repositories/ModelBlobRepository.py
from azure.storage.blob.baseblobservice import BaseBlobService
from azure.storage.blob.blockblobservice import BlockBlobService
from database.models.Blob import Blob
class ModelBlobRepository:
def __init__(self):
self.blockBlobService = BlockBlobServic... | 2.375 | 2 |
day03/puzzle2b.py | techrabbit58/AdventOfCode2020 | 1 | 34473 | <reponame>techrabbit58/AdventOfCode2020<filename>day03/puzzle2b.py<gh_stars>1-10
"""
Advent Of Code 2020. Day 03. Puzzle 2.
2nd approach, just to see if this may be faster.
It turns out, the first approach had been at least 3 times faster.
This second approach is slower. Hummm!
"""
import time
input_file = 'day03.txt'... | 2.828125 | 3 |
src/mvdef/import_util.py | lmmx/mvdef | 0 | 34474 | <reponame>lmmx/mvdef
import ast
from ast import Import as IType, ImportFrom as IFType
from astor import to_source
from asttokens import ASTTokens
from .colours import colour_str as colour
from os import linesep as nl
from sys import stderr
__all__ = [
"get_import_stmt_str",
"multilinify_import_stmt_str",
"... | 2.28125 | 2 |
tests/bench/test_yahoo_nyse_VRS.py | jmabry/pyaf | 377 | 34475 | import pyaf.Bench.TS_datasets as tsds
import pyaf.Bench.YahooStocks as ys
import warnings
symbol_lists = tsds.get_yahoo_symbol_lists();
y_keys = sorted(symbol_lists.keys())
print(y_keys)
k = "nysecomp"
tester = ys.cYahoo_Tester(tsds.load_yahoo_stock_prices(k) , "YAHOO_STOCKS_" + k);
with warnings.catch_warnings():
... | 1.835938 | 2 |
fabric_utils/ci.py | selfpub-org/fabric-utils | 0 | 34476 | <gh_stars>0
import os
from functools import wraps
from fabric.api import settings, warn
def teamcity(message_name, *params, **kwargs):
force = kwargs.get('force') or False
messages = {
'testSuiteStarted': "testSuiteStarted name='%s'",
'testSuiteFinished': "testSuiteFinished name='%s'",
... | 2.125 | 2 |
sandy/sections/mf35.py | AitorBengoechea/sandy | 0 | 34477 | <reponame>AitorBengoechea/sandy
# -*- coding: utf-8 -*-
"""
This module contains a single public function:
* `read_mf35`
Function `read_mf35` reads a MF35/MT section from a string and produces a
content object with a dictionary-like structure.
The content object can be accessed using most of the keywords specifie... | 2.640625 | 3 |
src/pycropml/transpiler/antlr_py/parse.py | brichet/PyCrop2ML | 5 | 34478 | import pycropml.transpiler.antlr_py.grammars
from pycropml.transpiler.antlr_py.grammars.CSharpLexer import CSharpLexer
from pycropml.transpiler.antlr_py.grammars.CSharpParser import CSharpParser
from pycropml.transpiler.antlr_py.grammars.Fortran90Lexer import Fortran90Lexer
from pycropml.transpiler.antlr_py.grammars.F... | 2.015625 | 2 |
nrgpy/convert/convert_rld.py | kyarazhan/nrgpy | 0 | 34479 | <gh_stars>0
try:
from nrgpy import logger
except ImportError:
pass
from datetime import datetime
import os
import subprocess
import time
import traceback
from nrgpy.api.convert import nrg_api_convert
from nrgpy.utils.utilities import check_platform, windows_folder_path, affirm_directory, count_files
class loc... | 2.375 | 2 |
gitea_api/models/timeline_comment.py | r7l/python-gitea-api | 1 | 34480 | # coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class TimelineComment(object):
"""NOTE: This class is... | 1.523438 | 2 |
Blasting/Start.py | Erosion2020/SpaceCore | 4 | 34481 | <filename>Blasting/Start.py
import Blasting
name = "Blasting"
input_message = f"[{name} #]"
def menu():
print("-------------------------------弱口令爆破子模块-------------------------------")
print("1、SSH弱口令爆破")
print("2、MySQL弱口令爆破")
print("输入exit退出")
print("-----------------------------------END--------... | 2.953125 | 3 |
events/migrations/0040_event_team_size.py | horacexd/clist | 166 | 34482 | <reponame>horacexd/clist
# Generated by Django 2.2.10 on 2020-04-03 19:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0039_event_limits'),
]
operations = [
migrations.AddField(
model_name='event',
n... | 1.515625 | 2 |
src/origin_ledger_sdk/batch.py | project-origin/ledger-sdk-python | 0 | 34483 | <filename>src/origin_ledger_sdk/batch.py
from enum import Enum
from typing import List
from sawtooth_sdk.protobuf.batch_pb2 import BatchHeader
from sawtooth_sdk.protobuf.batch_pb2 import Batch as SignedBatch
from .requests import AbstractRequest
from .requests.helpers import get_signer
class BatchStatus(Enum):
... | 2.34375 | 2 |
pybud/tests/search_algos.py | Tantan4321/PyBud | 11 | 34484 | <filename>pybud/tests/search_algos.py
# Implemented from: https://stackoverflow.com/questions/9501337/binary-search-algorithm-in-python
def binary_search(sequence, value):
lo, hi = 0, len(sequence) - 1
while lo <= hi:
mid = (lo + hi) // 2
if sequence[mid] < value:
lo = mid + 1
... | 3.84375 | 4 |
dust/exe.py | tanico-rikudo/raspi4 | 0 | 34485 | <filename>dust/exe.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import time
from datetime import datetime as dt
import logging
import json
import sys
from particle_counter import ParticleCounter
# Make instance
device001 = ParticleCounter(30)
# Set signal pin
device001.set_p... | 2.171875 | 2 |
localization/pipeline/InstLoc.py | cameronwp/MMGIS | 63 | 34486 | <reponame>cameronwp/MMGIS
#! /usr/local/msl/bin/python
#******************************************************************************
# InstLoc.py <image.IMG/VIC>
#
# Project: Instrument Loco String for a given file
# Purpose: Localizations stored in python dictionary
#
# Author: <NAME>
#
... | 1.820313 | 2 |
bdpy/fig/fig.py | kencan7749/bdpy | 0 | 34487 | <reponame>kencan7749/bdpy
'''Figure module
This file is a part of BdPy.
Functions
---------
makefigure
Create a figure
box_off
Remove upper and right axes
draw_footnote
Draw footnote on a figure
'''
__all__ = [
'box_off',
'draw_footnote',
'make_violinplots',
'makefigure',
]
import mat... | 2.375 | 2 |
brain/mastermind.py | pabvald/chatbot | 0 | 34488 | <reponame>pabvald/chatbot<filename>brain/mastermind.py
from app import app, nlp
from brain import ACTIONS, LANGUAGES
from dateparser import parse
from datetime import datetime, date
from services import UserService, IntentService, AppointmentService
from utils import get_content
class MasterMind(object):
""" Mast... | 2.78125 | 3 |
isValidParentheses.py | pflun/learningAlgorithms | 0 | 34489 | class Solution:
# @param {string} s A string
# @return {boolean} whether the string is a valid parentheses
def isValidParentheses(self, s):
stack = []
dict = {"]": "[", "}": "{", ")": "("}
for char in s:
if char in dict.values():
stack.append(char)
... | 3.8125 | 4 |
fpakman/core/resource.py | vinifmor/fpakman | 39 | 34490 |
from fpakman import ROOT_DIR
def get_path(resource_path):
return ROOT_DIR + '/resources/' + resource_path
| 1.664063 | 2 |
studygroups/migrations/0122_auto_20190710_0605.py | p2pu/learning-circles | 10 | 34491 | <reponame>p2pu/learning-circles
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-07-10 06:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0121_auto_20190708_2246'),
]
operati... | 1.703125 | 2 |
rllib/contrib/bandits/envs/__init__.py | firebolt55439/ray | 21,382 | 34492 | from ray.rllib.contrib.bandits.envs.discrete import LinearDiscreteEnv, \
WheelBanditEnv
from ray.rllib.contrib.bandits.envs.parametric import ParametricItemRecoEnv
__all__ = ["LinearDiscreteEnv", "WheelBanditEnv", "ParametricItemRecoEnv"]
| 1.171875 | 1 |
cell.py | reachtarunhere/S-LSTM-PyTorch | 5 | 34493 | <filename>cell.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class HiddenGate(nn.Module):
def __init__(self, hidden_size, input_size, bias, nonlinearity="sigmoid"):
super(HiddenGate, self).__init__()
self.linear = nn.Linear(
3*hidden_size + input_size + hidden_... | 2.703125 | 3 |
python/comparatist/gcm/jlloop.py | tkf/comparatist | 0 | 34494 | <filename>python/comparatist/gcm/jlloop.py
from ..utils.jl import make_prepare
prepare = make_prepare("Comparatist.Simulators.gcm.loop")
| 1.25 | 1 |
016_3Sum_Closest.py | adwardlee/leetcode_solutions | 0 | 34495 | '''
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would have exactly one solution.
Example:
Given array nums = [-1, 2, 1, -4], and target = 1.
The sum that is closest to... | 3.984375 | 4 |
generated-libraries/python/netapp/flexcache/flexcache_info.py | radekg/netapp-ontap-lib-get | 2 | 34496 | <gh_stars>1-10
from netapp.netapp_object import NetAppObject
class FlexcacheInfo(NetAppObject):
"""
FlexCache Info
When returned as part of the output, all elements of this typedef
are reported, unless limited by a set of desired attributes
specified by the caller.
<p>
When used as input to... | 2.46875 | 2 |
corpus2graph/word_processor.py | zzcoolj/corpus2graph | 27 | 34497 | import string
import warnings
import re
from . import util
import spacy
class FileParser(object):
def __init__(self,
file_parser='txt',
xml_node_path=None, fparser=None):
if file_parser not in ['txt', 'xml', 'defined']:
msg = 'file_parser should be txt, xml or... | 2.796875 | 3 |
gaussian/__init__.py | mattaustin/gaussian | 1 | 34498 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright 2014 <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 applicab... | 2.171875 | 2 |
Exercise_07_RGB_LED.py | NaimFuad/hibiscus-sense-micropython-1 | 3 | 34499 | <filename>Exercise_07_RGB_LED.py
# <NAME> - Exercise 07 RGB LED
#
# There is 1x RGB LED.
# This RGB LED is connected to GPIO16 and integrated with WS2812.
# WS2812 is an LED controller, which use single-wire control protocol to control the LEDs.
from machine import Pin
from neopixel import NeoPixel
fr... | 3.703125 | 4 |