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 |
|---|---|---|---|---|---|---|
cfdutils/examples/onera/onera.py | acrovato/pycfdutils | 0 | 26500 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf8 -*-
# test encoding: à-é-è-ô-ï-€
# Copyright 2020 <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... | 2.203125 | 2 |
tasklist/models.py | 10000volts/JLGLTaskList | 0 | 26501 | <gh_stars>0
from django.db import models
from django.db.models import Q, Prefetch
from django.db import transaction
from utils.constants import TASK_STATUS, TASK_STATUS_CHOICES
class TaskList(models.Model):
name = models.CharField(verbose_name=u'任务清单名称', max_length=128, unique=True)
def __str__(self):
... | 1.992188 | 2 |
panel/widgets/input.py | NoamGit/panel | 1 | 26502 | """
The input widgets generally allow entering arbitrary information into
a text field or similar.
"""
from __future__ import absolute_import, division, unicode_literals
import ast
from base64 import b64decode, b64encode
from datetime import datetime
from six import string_types
import param
from bokeh.models.widge... | 2.640625 | 3 |
hass_apps/heaty/window_sensor.py | taste66/hass-apps | 0 | 26503 | <gh_stars>0
"""
This module implements the WindowSensor class.
"""
import typing as T
if T.TYPE_CHECKING:
# pylint: disable=cyclic-import,unused-import
from .room import Room
import observable
from .. import common
class WindowSensor:
"""A sensor for Heaty's open window detection."""
def __init__(... | 2.5 | 2 |
common/web_client.py | newsettle/ns4_chatbot | 51 | 26504 | # -*- coding=utf-8 -*-
import urllib2
import json
import logger
import traceback
def send(apiUrl,data,method=None):
logger.debug("调用内部系统[%s],data[%r]",apiUrl,data)
try:
data_json = json.dumps(data)
headers = {'Content-Type': 'application/json'} # 设置数据为json格式,很重要
request = urllib2.Reques... | 2.96875 | 3 |
tccli/services/wss/v20180426/__init__.py | zyh911/tencentcloud-cli | 0 | 26505 | version = "2018-04-26" | 1.03125 | 1 |
notebooks/solutions/02-ex2-solution.py | ankitaguhaoakland/ml-workshop-intro | 1 | 26506 | from sklearn.datasets import load_wine
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
wine = load_wine(as_frame=True)
X, y = wine.data, wine.target
X_train, X_test, y_train, y_test = train_test_split(
X, y... | 2.84375 | 3 |
API/main/migrations/0001_initial.py | Ju99ernaut/grapeflowAPI | 0 | 26507 | # Generated by Django 3.0.3 on 2020-02-25 18:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 1.75 | 2 |
pyaws/utils/time.py | mwozniczak/pyaws | 0 | 26508 | """
Summary:
- Command-line Interface (CLI) Utilities Module
- Python3
Module Functions:
- convert_strtime_datetime:
Convert human-readable datetime string into a datetime object for
conducting time operations.
- convert_timedelta:
Convert a datetime duration object into human-r... | 3.9375 | 4 |
name_translator.py | MathisBurger/timetable-updater | 0 | 26509 | import json
def translate_name(name):
with open("name_translator.json", "r") as file:
data = json.load(file)
return data[name]
| 2.78125 | 3 |
lista1/156_Ananagrams/156_Ananagrams.py | L30Bola/mab606 | 0 | 26510 | #!/usr/bin/env python
import sys
import collections
listas = list(map(str.split, sys.stdin.readlines()))
entrada = [item for sublist in listas for item in sublist] # simplificando as listas, para facilitar
contador = collections.Counter()
palavras = []
for palavra in entrada:
if palavra == "#":
break
palavr... | 3.765625 | 4 |
tests/test_evaluation.py | manslogic/rasa_core | 1 | 26511 | <filename>tests/test_evaluation.py<gh_stars>1-10
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import imghdr
import os
from rasa_core.evaluate import run_story_evaluation, \
collect_story_predictions
from tests.... | 2.28125 | 2 |
PlatformAgents/com/cognizant/devops/platformagents/agents/deployment/xldeploy/XLDeployAgent3.py | gauravl612/Insights | 1 | 26512 | <gh_stars>1-10
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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 ... | 1.898438 | 2 |
torchsupport/structured/chunkable.py | bobelly/torchsupport | 18 | 26513 | <filename>torchsupport/structured/chunkable.py
import torch
from torch.nn.parallel.scatter_gather import Scatter
def chunk_sizes(lengths, num_targets):
num_entities = len(lengths)
chops = num_entities // num_targets
result = [
sum(lengths[idx * chops:(idx + 1) * chops])
for idx in range(num_targets)
]
... | 2.578125 | 3 |
viz/main.py | YoniSchirris/SimCLR-1 | 1 | 26514 | import torch
from viz.visualizer import Visualizer
from modules.deepmil import Attention
from msidata.dataset_msi_features_with_patients import PreProcessedMSIFeatureDataset
from testing.logistic_regression import get_precomputed_dataloader
import argparse
from experiment import ex
from utils import post_config_hook... | 2.34375 | 2 |
projects/golem_e2e/tests/login/login_missing_password.py | kangchenwei/keyautotest2 | 0 | 26515 | <filename>projects/golem_e2e/tests/login/login_missing_password.py<gh_stars>0
description = 'Verify the user cannot log in if password value is missing'
pages = ['login']
def test(data):
navigate(data.env.url)
send_keys(login.username_input, 'admin')
click(login.login_button)
capture('Verify the corr... | 2.515625 | 3 |
scripts/09-architecture-vgg.py | jmrozanec/white-bkg-classification | 2 | 26516 | <gh_stars>1-10
#TFLearn bug regarding image loading: https://github.com/tflearn/tflearn/issues/180
#Monochromes img-magick: https://poizan.dk/blog/2014/02/28/monochrome-images-in-imagemagick/
#How to persist a model: https://github.com/tflearn/tflearn/blob/master/examples/basics/weights_persistence.py
from __future__ i... | 2.125 | 2 |
client.py | octoi/simple-file-transfer | 0 | 26517 | import socket
s = socket.socket()
host = input(str("Please enter the host address of the sender: "))
port = 8080
s.connect((host, port))
print(f"[+] CONNECTED TO {host}:{port}")
filename = input(str("Please enter filename for the incoming file: "))
file = open(filename, 'wb')
file_data = s.recv(1024)
file.write(fi... | 3.34375 | 3 |
examplesFromForkedLibraries/PhilReinholdPygrape/4 discarded/benchmarks.py | rayonde/yarn | 1 | 26518 | <reponame>rayonde/yarn
import qutip as q
import numpy as np
import scipy.sparse.linalg
from pygrape.cugrape.configure_cugrape import configure, get_hmt_ops
from pygrape.cugrape.almohy import get_taylor_params
from pygrape.setups import StateTransferSetup
from pygrape.cuda_setup import CudaStateTransferSetup
def get_Hs... | 1.398438 | 1 |
annotation/application/document.py | seal-git/chABSA-dataset | 107 | 26519 | <gh_stars>100-1000
import os
import shutil
import json
class Document():
def __init__(self,
doc_id, doc_text, edi_id, company_name,
body, topic):
self.doc_id = doc_id
self.doc_text = doc_text
self.edi_id = edi_id
self.company_name = company_name
... | 2.640625 | 3 |
Server/myLibrary/admin.py | sepehrNorouzi/SemUniLib | 0 | 26520 | from django.contrib import admin
from .models import Book, Favorite
admin.site.register(Book)
admin.site.register(Favorite) | 1.3125 | 1 |
kwickstart/templates/flask/app.py | TxConvergentAdmin/convergent-kwickstart | 1 | 26521 | <gh_stars>1-10
from flask import Flask, jsonify, request
PORT = 5000
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello World'
@app.route('/data')
def data():
return jsonify({'error': False, 'data': 123})
if __name__ == "__main__":
print('Running on http://127.0.0.1:' + str(PORT))
a... | 2.8125 | 3 |
backend/kesaseteli/applications/api/v1/views.py | jannetasa/yjdh | 0 | 26522 | from django.core import exceptions
from django.http import FileResponse
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.exceptions import ValidationError
from rest_framewor... | 1.945313 | 2 |
run.py | tildecross/tildex-txdb | 0 | 26523 | <gh_stars>0
#!env/bin/python3
from app import app
app.run(debug=True, host="localhost", port=8202)
| 1.460938 | 1 |
yiff_image_scraper.py | viktor02/Yiff.party-Image-Scraper | 0 | 26524 | <reponame>viktor02/Yiff.party-Image-Scraper
from bs4 import BeautifulSoup as bs
import requests
import sys
import os
import platform
amountOfLinks = len(sys.argv)-1
urlCounter = 0
urlList = []
missingFiles = []
userAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.... | 2.953125 | 3 |
api.py | klapp101/GOAT | 1 | 26525 | import json
import requests
import time
from discord_webhook import DiscordWebhook, DiscordEmbed
webhook_url = 'https://discordapp.com/api/webhooks/672159508675690497/4UtaClAc7rKMJsEvbR4iYf-Razv4M3ZWtkYDOxBzLfiDzJhI7RSFpoLn6iijBiRcaNOR'
webhook = DiscordWebhook(webhook_url)
pid = '508214-660'
headers = {
'Connecti... | 2.640625 | 3 |
pytai/tests/test_application.py | angea/pytai | 30 | 26526 | """Unit tests for the pytai application.
License:
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
... | 2.046875 | 2 |
project-posenet/pose_opencv.py | vanduc103/coral_examples | 0 | 26527 | <reponame>vanduc103/coral_examples<filename>project-posenet/pose_opencv.py
# Copyright 2019 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
#
# https://www.apache.org/licenses/... | 2.46875 | 2 |
src/fparser/two/tests/fortran2003/test_include_statement.py | sturmianseq/fparser | 33 | 26528 | # Copyright (c) 2019 Science and Technology Facilities Council
# All rights reserved.
# Modifications made as part of the fparser project are distributed
# under the following license:
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condi... | 1.429688 | 1 |
src/common.py | OdatNurd/HyperHelpAuthor | 1 | 26529 | <gh_stars>1-10
import sublime
import os
import textwrap
import hyperhelpcore
from hyperhelpcore.common import log, hh_syntax
from hyperhelpcore.core import help_index_list
###----------------------------------------------------------------------------
def loaded():
"""
Do package setup at package load tim... | 2.15625 | 2 |
player/migrations/0002_remove_music_thumbnail.py | Amoki/Amoki-Music | 3 | 26530 | <gh_stars>1-10
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('player', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='music',
name='thumbnail',
... | 1.429688 | 1 |
build_card_bank.py | lawrencesim/portuguese-verb-cards | 0 | 26531 | import os, csv, time, shutil
from bin import cardbank
from bin import builder
def add_build(add_cards):
'''Build card bank by specifically adding new cards.'''
# process new cards to add
if not add_cards:
return
add_card_map = {}
for card in add_cards:
add_card_map[card["inf"]] = ... | 2.640625 | 3 |
flaskapp/models.py | guillermosainz/instareplic | 53 | 26532 | from mongoengine import StringField, EmailField, BooleanField
from flask.ext.login import UserMixin
import requests
import json
from mongoengine import Document
from social.apps.flask_app.me.models import FlaskStorage
class User(Document, UserMixin):
username = StringField(max_length=200)
password = StringFi... | 2.53125 | 3 |
src/compas_blender/geometry/__init__.py | adacko/compas | 0 | 26533 | """
********************************************************************************
compas_blender.geometry
********************************************************************************
.. currentmodule:: compas_blender.geometry
Object-oriented convenience wrappers for native Blender geometry.
.. autosummary::
... | 1.953125 | 2 |
notes/reference/tutorials/an-introduction-to-asynch-programming-and-twisted/exercises/part3/ex2.py | aav789/study-notes | 43 | 26534 | from twisted.internet import reactor, task
class CounterManager(object):
counters = []
@classmethod
def add_counter(cls, counter):
cls.counters.append(counter)
@classmethod
def has_active_counters(cls):
return all([not c.is_active for c in cls.counters])
class Counter(object):
... | 3 | 3 |
tests/unit/test_validation_builder.py | shashank-google/professional-services-data-validator | 1 | 26535 | # Copyright 2020 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 agreed to in writing, ... | 1.726563 | 2 |
venv/lib/python3.8/site-packages/azureml/_restclient/models/private_endpoint_connection.py | amcclead7336/Enterprise_Data_Science_Final | 0 | 26536 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator 2.3.3... | 1.90625 | 2 |
src/chainalytic_icon/provider/api_bundle.py | yudus-lab/chainalytic-icon | 1 | 26537 | import traceback
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from chainalytic_icon.common import config, util
class ApiBundle(object):
"""
The interface to external consumers/applications
"""
def __init__(self, working_dir: str):
super(ApiBundle, self).__init__()
... | 2.28125 | 2 |
__scraping__/just-eat.fr - robobrowser/main.py | whitmans-max/python-examples | 140 | 26538 | <reponame>whitmans-max/python-examples
# date: 2019.05.05
# author: Bartłomiej 'furas' Burek
import robobrowser
br = robobrowser.RoboBrowser(user_agent='Mozilla/5.0 (X11; Linux i586; rv:31.0) Gecko/20100101 Firefox/31.0')
br.parser = 'lxml'
br.open("https://www.just-eat.fr")
print(br.get_forms())
iframe_src = br.s... | 2.515625 | 3 |
winning_ticket/src/model_utils.py | zankner/WinningTickets | 0 | 26539 | import copy
import torch
from utils import helpers
from utils.layers import conv, linear, batch_norm
def ticketfy(model, split_rate, split_mode="kels"):
conv_layers, linear_layers, bn_layers = helpers.get_layers(model)
for n, _ in conv_layers:
cur_conv = helpers.rgetattr(model, n)
helpers.rs... | 2.140625 | 2 |
tests/test_get_term_list.py | vineetjohn/invest-o-scrape | 5 | 26540 | from utils import scrape_helper
url = "http://www.investopedia.com/terms/1/"
links = scrape_helper.get_term_links_from_page(url)
print(links)
| 2.75 | 3 |
nototools/drop_hints.py | RoelN/nototools | 156 | 26541 | <filename>nototools/drop_hints.py
#!/usr/bin/env python
#
# Copyright 2014 Google Inc. 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/licen... | 2.734375 | 3 |
imapclient/response_lexer.py | maxiimou/imapclient | 0 | 26542 | # Copyright (c) 2014, <NAME>
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
"""
A lexical analyzer class for IMAP responses.
Although Lexer does all the work, TokenSource is the class to use for
external callers.
"""
from __future__ import unicode_literals
from . im... | 2.453125 | 2 |
src/bert_summarizer/data/__init__.py | k-tahiro/bert-summarizer | 8 | 26543 | <reponame>k-tahiro/bert-summarizer<filename>src/bert_summarizer/data/__init__.py
from .data_collator import (
DataCollatorWithPaddingWithAdditionalFeatures,
EncoderDecoderDataCollatorWithPadding,
)
from .datasets import *
| 1.117188 | 1 |
app/api_docs/__init__.py | linrong/flask-server | 0 | 26544 | <reponame>linrong/flask-server<gh_stars>0
# _*_ coding: utf-8 _*_
"""
Created by lr on 2019/08/29.
此模块用来编写flasgger中api列表下的详细操作信息
"""
from app.api_docs.v1 import user, client, token, \
banner, theme, product, category, \
address, order, pay
from app.api_docs.cms import cms_user, file
__author__ = 'lr' | 1.101563 | 1 |
floss/decoding_manager.py | fireeye/flare-floss | 2,067 | 26545 | <filename>floss/decoding_manager.py
# Copyright (C) 2017 Mandiant, Inc. All Rights Reserved.
import logging
from typing import List, Tuple
from dataclasses import dataclass
import viv_utils
import envi.memory
import viv_utils.emulator_drivers
from envi import Emulator
from . import api_hooks
logger = logging.getLog... | 2.3125 | 2 |
data_provider/lanenet_hnet_data_processor.py | aj96/lanenet-lane-detection | 10 | 26546 | <reponame>aj96/lanenet-lane-detection<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 18-5-21 下午3:33
# @Author : <NAME>
# @Site : http://icode.baidu.com/repos/baidu/personal-code/Luoyao
# @File : lanenet_hnet_data_processor.py
# @IDE: PyCharm Community Edition
"""
实现LaneNet中的HNet训练数据流
"... | 2.515625 | 3 |
schedule.py | kw90/drlnd_continuous-control | 1 | 26547 | <filename>schedule.py
#######################################################################
# Copyright (C) 2017 <NAME>(<EMAIL>) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
########################################... | 3.265625 | 3 |
web scrapy/scrapy/criptoprice.py | douguedh/Project | 0 | 26548 |
import requests
import bs4
dateList = []
higlist = []
lowlist= []
r = requests.get(
'https://coinmarketcap.com/currencies/bitcoin/historical-data/')
soup = bs4.BeautifulSoup(r.text, "lxml")
tr = soup.find_all('tr',{'class':'text-right'})
for item in tr:
dateList.append(item.find('td', {'class':'text-left'}... | 3.015625 | 3 |
pyQuARC/code/constants.py | NASA-IMPACT/pyQuARC | 9 | 26549 | import os
from colorama import Fore, Style
from pathlib import Path
DIF = "dif10"
ECHO10 = "echo10"
UMM_JSON = "umm-json"
ROOT_DIR = (
# go up one directory
Path(__file__).resolve().parents[1]
)
SCHEMAS_BASE_PATH = f"{ROOT_DIR}/schemas"
SCHEMAS = {
"json": [
"checks",
"check_messages",
... | 1.960938 | 2 |
src/thresholding/Utilities.py | dsp-uga/Team-kieffer | 0 | 26550 | <filename>src/thresholding/Utilities.py
"""
Author: <NAME> Project: Cilia Segmentation Date: 27 Feb 2019
Course: CSCI 8360 @ UGA Semester: Spring 2019 Module: Utilities.py
Description: This module contains methods and classes that make life easier.
"""
import os
import sys
import numpy as np
import m... | 3.0625 | 3 |
main.py | Jemeni11/Fic-Retriever | 0 | 26551 | <filename>main.py
# This example requires the 'members' and 'message_content' privileged intents
import re
import os
import discord
from discord.ext import commands
from embed_messages.SH_Embed import ScribbleHubEmbed
from embed_messages.AO3_Embed import ArchiveOfOurOwnEmbed
from embed_messages.FF_Embed import FanFi... | 2.34375 | 2 |
utils/__init__.py | MaLiN2223/py_proj_transport | 0 | 26552 | """
This module contains utility classes and methods to be used in tests
""" | 1.289063 | 1 |
zm-jython/jylibs/ldap.py | hernad/zimbra9 | 0 | 26553 | <reponame>hernad/zimbra9
#
# ***** BEGIN LICENSE BLOCK *****
# Zimbra Collaboration Suite Server
# Copyright (C) 2010, 2012, 2013, 2014, 2015, 2016 Synacor, Inc.
#
# This program 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 Softw... | 1.140625 | 1 |
graphite/publishers/generic_publisher.py | bjwhite-fnal/decisionengine_modules | 0 | 26554 | """
Generic publisher for graphana
"""
import abc
import six
from decisionengine.framework.modules import Publisher
import decisionengine_modules.graphite_client as graphite
DEFAULT_GRAPHITE_HOST = 'fermicloud399.fnal.gov'
DEFAULT_GRAPHITE_PORT = 2004
DEFAULT_GRAPHITE_CONTEXT = ""
@six.add_metaclass(abc.ABCMeta)
c... | 2.34375 | 2 |
datadog_checks_base/tests/openmetrics/test_interface.py | vbarbaresi/integrations-core | 663 | 26555 | <filename>datadog_checks_base/tests/openmetrics/test_interface.py
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.base import OpenMetricsBaseCheckV2
from datadog_checks.base.constants import ServiceCheck
from datadog_c... | 1.8125 | 2 |
db_core/env.py | dayvagrant/db_core | 0 | 26556 | """Set of configrations."""
_CONFIGS = {
"postgres": {
"host": "0.0.0.0",
"port": "5432",
"user": <USER>,
"pwd": <<PASSWORD>>,
"db": "postgres",
},
"mongodb": {
"host": "0.0.0.0",
"port": "27017",
"user": <USER>,
"pwd": <<PASSWORD>>,
... | 1.289063 | 1 |
natasha/grammars/name.py | MaksMolodtsov/natasha | 1 | 26557 | <filename>natasha/grammars/name.py
# coding: utf-8
from __future__ import unicode_literals
from yargy import (
rule,
and_, or_, not_,
)
from yargy.interpretation import fact
from yargy.predicates import (
eq, length_eq,
gram, tag,
is_single, is_capitalized
)
from yargy.predicates.bank import Dictio... | 2.234375 | 2 |
script/json2yaml.py | lunzhiPenxil/json2yaml-for-dice | 4 | 26558 | <reponame>lunzhiPenxil/json2yaml-for-dice<filename>script/json2yaml.py<gh_stars>1-10
#!/usr/bin/env python37
# -*- encoding: utf-8 -*-
'''
@File : json2yaml.py
@Time : 2020/01/12 16:44:48
@Author : BenzenPenxil
@Version : 1.0
@Contact : <EMAIL>
@License : (C)Copyright 2017-2020, Penx.Studio
@Desc ... | 2.734375 | 3 |
metagen/utils.py | huaili-cid/metagen_cli | 0 | 26559 | <gh_stars>0
import logging
import os
import math
from metagen.helpers.exceptions import ValidationError
logger = logging.getLogger(__name__)
cli_log = logging.getLogger("metagen.cli")
def key_len(value, type_="ApiKey"):
"""Ensure an API Key or ID has valid length."""
if value is not None and len(value) < 36... | 2.46875 | 2 |
features/steps/common.py | PolySync/kevlar-laces | 3 | 26560 | <reponame>PolySync/kevlar-laces
from behave import *
from hamcrest import *
import subprocess
import shlex
import os
import tempfile
import utils
@given('a local copy of the repo on the {branch} branch')
def step_impl(context, branch):
context.mock_developer_dir = tempfile.mkdtemp(prefix='kevlar')
utils.shel... | 1.835938 | 2 |
src/utils/utils.py | chokyzhou/gym-flappy-bird | 0 | 26561 | <reponame>chokyzhou/gym-flappy-bird
import math
def obs2state(obs, multiplier=1000):
x_pos = int(math.floor(obs[0]*multiplier))
y_pos = int(math.floor(obs[1]*multiplier))
y_vel = y_vel = int(obs[2])
state_string = str(x_pos) + '_' + str(y_pos) + '_' + str(y_vel)
return state_string | 2.703125 | 3 |
python_marketman/__version__.py | LukasKlement/python-marketman | 0 | 26562 | <filename>python_marketman/__version__.py<gh_stars>0
"""Version details for python-marketman
This file shamelessly taken from the requests library"""
__title__ = 'python-marketman'
__description__ = 'A basic Marketman.com REST API client.'
__url__ = 'https://github.com/LukasKlement/python-marketman'
__version__ = '0.1... | 1.835938 | 2 |
discharge_plot.py | amforte/Caucasus_Erosion | 2 | 26563 | <filename>discharge_plot.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Plots exceedance frequency and the relationships between discharge and drainage
area for gauged basins
Written by <NAME> for
"Low variability runoff inhibits coupling of climate, tectonics, and
topography in the Greater Caucasus"
If you... | 2.859375 | 3 |
app/api/__init__.py | gladuo/VideoShow | 0 | 26564 | from flask import Blueprint
api = Blueprint('api', __name__)
from . import authentication, videos, shows, users, comments, errors | 1.539063 | 2 |
openatom/principal_quantum_number.py | 2556-AD/Open-Atom | 1 | 26565 | from openatom.UNIVERSAL_CONSTANTS import *
from openatom.azimuthal_quantum_number import AzimuthalQNum
class PrincipalQNum():
def __init__(self, shellIdx):
self.label = self.assignShellLabel(shellIdx)
self.principalQuantumNumVal = shellIdx + 1
self.azimuthalArray = []
self.azimuthal... | 2.59375 | 3 |
hissw/environment.py | binchensun/hissw | 0 | 26566 | """
Build SSW scripts from Jinja 2 templates
"""
import os
import datetime
import subprocess
import tempfile
from jinja2 import (Environment as Env,
FileSystemLoader,
PackageLoader)
from scipy.io import readsav
from .read_config import defaults
from .util import SSWIDLError, ID... | 2.484375 | 2 |
tools/erd.py | multi-coop/catalogage-donnees | 0 | 26567 | """
Entity-relation diagram (ERD) GraphViz dot-file generator.
Usage:
python -m erd db.json -o db.dot
Then pass the result to the GraphViz `dot` tool:
dot db.dot -T png -o db.png
Inspired by: https://github.com/ehne/ERDot
"""
import argparse
import json
import re
from pathlib import Path
from typing import D... | 2.78125 | 3 |
tests/test_hyponym_detector.py | phlobo/scispacy | 15 | 26568 | # pylint: disable=no-self-use,invalid-name
import unittest
import spacy
from scispacy.hyponym_detector import HyponymDetector
class TestHyponymDetector(unittest.TestCase):
def setUp(self):
super().setUp()
self.nlp = spacy.load("en_core_sci_sm")
self.detector = HyponymDetector(self.nlp, ex... | 2.703125 | 3 |
conftest.py | goalkeeer/boilerplate-django | 0 | 26569 | <reponame>goalkeeer/boilerplate-django
import os
from contextlib import contextmanager
import pytest
from django import setup as django_setup
from django.core.cache import caches
from django.test import TransactionTestCase
# Transaction rollback emulation
# http://docs.djangoproject.com/en/2.0/topics/testing/overvie... | 2.0625 | 2 |
htdocs/plotting/auto/scripts100/p103.py | trentford/iem | 0 | 26570 | """Steps up and down"""
import calendar
import numpy as np
from pandas.io.sql import read_sql
from pyiem import network
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
PDICT = {'spring': '1 January - 30 June',
'fall': '1 July - 31 December'}
def get_description():... | 3.234375 | 3 |
Module8/inheritance/02_task_IterInt.py | xm4dn355x/specialist_python3_2nd_lvl | 0 | 26571 | <gh_stars>0
# Разработать класс IterInt, который наследует функциональность стандартного типа int, но добавляет
# возможность итерировать по цифрам числа
class IterInt(int):
pass
n = IterInt(12346)
for digit in n:
print("digit = ", digit)
# Выведет:
# digit = 1
# digit = 2
# digit = 3
# digit = 4
# digit =... | 3.71875 | 4 |
base/backprop_perceptron.py | tardatio/granary_ai | 0 | 26572 |
def forward(w,s,b,y):
Yhat= w * s + b
output = (Yhat-y)**2
return output, Yhat
def derivative_W(x, output, Yhat, y):
return ((2 * output) * (Yhat - y)) * x # w
def derivative_B(b, output, Yhat, y):
return ((2 * output) * (Yhat - y)) * b #bias
def main():
w = 1.0 #weight
x = 2.0 #samp... | 3.546875 | 4 |
os/pe.py | clayne/gef-extras | 76 | 26573 | import struct
import os
current_pe = None
class PE:
"""Basic PE parsing.
Ref:
- https://hshrzd.wordpress.com/pe-bear/
- https://blog.kowalczyk.info/articles/pefileformat.html
"""
X86_64 = 0x8664
X86_32 = 0x14c
ARM = 0x1c0
ARM64 ... | 2.34375 | 2 |
ecommerce/discounts_test.py | mitodl/mitxonline | 0 | 26574 | <filename>ecommerce/discounts_test.py
import pytest
from decimal import Decimal, getcontext
from ecommerce.factories import ProductFactory, DiscountFactory
from ecommerce.discounts import (
DiscountType,
PercentDiscount,
FixedPriceDiscount,
DollarsOffDiscount,
)
pytestmark = [pytest.mark.django_db]
... | 2.625 | 3 |
web-cloudformation/lambda_function.py | ClarkAtAmazon/aws-media-services-application-mapper | 0 | 26575 | """
This module is the custom resource used by the MSAM's CloudFormation
templates to populate the web bucket with contents of the MSAM web archive.
"""
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import json
import os
from subprocess import call
imp... | 2.0625 | 2 |
tailow/operators/size.py | sourcepirate/tailow | 2 | 26576 | from tailow.operators.base import Operator
class SizeOperator(Operator):
"""
operator to query for arrays by number of elements
"""
def to_query(self, field_name, value):
return {"$size": value}
def get_value(self, field, value):
return field.to_son(value)
| 2.640625 | 3 |
src/cart/migrations/0005_orderitem_quantity.py | Bakhtiyar-Habib/CSE327-Project | 0 | 26577 | <reponame>Bakhtiyar-Habib/CSE327-Project<gh_stars>0
# Generated by Django 2.0.7 on 2020-05-18 05:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cart', '0004_auto_20200518_1139'),
]
operations = [
migrations.AddField(
mod... | 1.539063 | 2 |
odoo-13.0/odoo/addons/base/wizard/base_language_install.py | VaibhavBhujade/Blockchain-ERP-interoperability | 12 | 26578 | <reponame>VaibhavBhujade/Blockchain-ERP-interoperability<filename>odoo-13.0/odoo/addons/base/wizard/base_language_install.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class BaseLanguageInstall(models.TransientModel):
... | 1.648438 | 2 |
DataAnalysis/test.py | yuxiang-zhou/MarketAnalysor | 0 | 26579 | import urllib2
import threading
from bs4 import BeautifulSoup
import re
import json
import sys
import os
import django
from stock_list import getlist, getLSEList
from extract_stock_info import get_info, getLSEInfo
from extract_stock_history import get_historical_info
from extract_sector_history import get_sector_histo... | 2.09375 | 2 |
icpc/2019-10-4/F-gen.py | Riteme/test | 3 | 26580 | <filename>icpc/2019-10-4/F-gen.py
#!/usr/bin/pypy
from sys import *
from random import *
n, m, CMAX, d1, d2 = map(int, argv[1:])
#print randint(0, n)
print 1
x0, y0 = randint(-20, -10), randint(-20, -10)
dx, dy = randint(-d1, -1), randint(1, d1)
x1, y1 = x0 + dx, y0 + dy
dx, dy = -dy, dx
print x0, y0
print x1, y1
pri... | 2.234375 | 2 |
aea/cli/run.py | lrahmani/agents-aea | 0 | 26581 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 1.664063 | 2 |
analyze.py | irenicaa/hh-analytics | 4 | 26582 | <gh_stars>1-10
#!/usr/bin/env python3
import logging
import functools
import argparse
import collections
import fileinput
import json
import csv
import re
import requests
import box
TAX = 0.13
SPECIALIZATION_COLUMNS_INDEXES = {
'salary.average': 1,
'salary.minimum': 2,
'salary.maximum': 3,
'number': ... | 2.671875 | 3 |
src/environment/wrappers/max_frameskip_env.py | Kautenja/playing-mario-with-deep-reinforcement-learning | 57 | 26583 | """An environment to skip k frames and return a max between the last two."""
import gym
import numpy as np
class MaxFrameskipEnv(gym.Wrapper):
"""An environment to skip k frames and return a max between the last two."""
def __init__(self, env, skip: int=4) -> None:
"""
Initialize a new max fr... | 3.546875 | 4 |
mercury/plugin/smart_grid/__init__.py | greenlsi/mercury_mso_framework | 1 | 26584 | from .provider import EnergyProvider
from .pwr_source import PowerSource
from .consumption_manager import ConsumptionManager
| 1.09375 | 1 |
hbaselines/envs/deeploco/envs.py | reufko/h-baselines | 186 | 26585 | """Script containing the DeepLoco environments."""
import gym
import numpy as np
import os
import sys
import cv2
try:
sys.path.append(os.path.join(os.environ["TERRAINRL_PATH"], "simAdapter"))
import terrainRLSim # noqa: F401
except (KeyError, ImportError, ModuleNotFoundError):
pass
class BipedalSoccer(g... | 2.84375 | 3 |
test/__init__.py | LanaMaidenbaum41/test | 0 | 26586 | # -*- coding: utf-8 -*-
"""Top-level package for Test."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.1'
| 0.957031 | 1 |
pyml/crawler/minispider/mini_spider.py | onehao/opensource | 0 | 26587 | # -*- coding:utf-8 -*-
'''
Created on 2015年3月2日
@author: wanhao01
'''
import sys
from crawler.minispider import logerror
import main
reload(sys)
sys.setdefaultencoding('utf-8')
if __name__ == '__main__':
try:
main.main()
except Exception as exception:
logerror("error du... | 2.21875 | 2 |
tensorflow/examples/functions/distributed/distr_fibonacci.py | acharal/tensorflow | 0 | 26588 | <gh_stars>0
import tensorflow as tf
from tensorflow.python.framework import function
cluster = tf.train.ClusterSpec({"local": ["localhost:2222", "localhost:2223"]})
fib = function.Declare("Fib", [("n", tf.int32)], [("ret", tf.int32)])
@function.Defun(tf.int32, func_name="Fib", out_names=["ret"])
def FibImpl(n):
de... | 2.46875 | 2 |
river/tree/hoeffding_tree.py | online-ml/creme | 1,105 | 26589 | <reponame>online-ml/creme<filename>river/tree/hoeffding_tree.py
import collections
import functools
import io
import math
import typing
from abc import ABC, abstractmethod
from river import base
from river.utils.skmultiflow_utils import (
calculate_object_size,
normalize_values_in_dict,
)
from .nodes.branch i... | 2.5 | 2 |
app/app.py | CLARIAH/wp6-missieven | 0 | 26590 | import types
from tf.advanced.app import App
MODIFIERS = """
remark folio note ref emph und super special q num den
""".strip().split()
def fmt_layoutFull(app, n, **kwargs):
return app._wrapHtml(n, ("",))
def fmt_layoutRemarks(app, n, **kwargs):
return app._wrapHtml(n, ("r",))
def fmt_layoutNotes(ap... | 2.484375 | 2 |
services/docker/webrecorder/local.py | rachelaus/perma | 317 | 26591 | import hashlib
import logging
import os
import shutil
import traceback
from contextlib import closing
from pywb.utils.loaders import BlockLoader
from webrecorder.rec.storage.base import BaseStorage
from webrecorder.rec.storage.storagepaths import add_local_store_prefix, strip_prefix
logger = logging.getLogger('wr.io... | 2.4375 | 2 |
password-cracking/leatspeak.py | cyberprogrammer/ctf-stuff | 0 | 26592 | <filename>password-cracking/leatspeak.py
#!/usr/bin/env python3
import sys
from string import ascii_letters
import itertools
def includeDefault(charSet):
for i in range(0,256):
charSet[i] = set([i])
def includeInvertedCases(charSet):
for c in ascii_letters:
charSet[ord(c)] |= set([ord(c.lower(... | 3.578125 | 4 |
tests/unit_tests/community/errors_upload/__init__.py | Trading-Bot/CryptoBot | 9 | 26593 | # This file is part of OctoBot (https://github.com/Drakkar-Software/OctoBot)
# Copyright (c) 2021 Drakkar-Software, All rights reserved.
#
# OctoBot 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
... | 1.835938 | 2 |
SCCSearch.py | FER-NASP/AdvancedAlgorithms | 1 | 26594 | <reponame>FER-NASP/AdvancedAlgorithms
import collections
def SCCSearch(G):
for v in G:
G[v]['n']=G[v]['p']=0
step=0
S=collections.deque()
res=[]
for u in G:
if (G[u]['n']==0):
SCCSearch_r(G,u,step,S,res)
return res
def SCCSearch_r(G,u,step,S,res):
G[u]['p']=G[u]... | 2.703125 | 3 |
tests/unit/test_transformers_token_classification.py | dreasysnail/nlp-recipes | 1 | 26595 | <gh_stars>1-10
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
from utils_nlp.common.pytorch_utils import dataloader_from_dataset
from utils_nlp.models.transformers.named_entity_recognition import TokenClassificationProcessor, TokenClassifier
@pytest.mark.... | 2.359375 | 2 |
doc/examples/plot_peak_local_max.py | Teva/scikits.image | 3 | 26596 | <gh_stars>1-10
"""
===============================================================================
Finding local maxima
===============================================================================
The ``peak_local_max`` function returns the coordinates of local peaks (maxima)
in an image. A maximum filter is used f... | 3.125 | 3 |
TimingPoint/notes_random.py | Fairy-Phy/Relium | 0 | 26597 | <reponame>Fairy-Phy/Relium
import random
from Relium import calcurate, classes, parser, constant
"""
1ラインづつランダムな位置に表示していきます
"""
source_file = r""
target_start_offset = 31999
target_end_offset = 34666
avgbpm = 180
# ノーツの高さの最大値(上げすぎると見えなくなります)
max_laneheight = 370
beat = 4
sample_set = 1
sample_index = 0
volume = 6... | 1.9375 | 2 |
tests/graph_test.py | lwi19/graphe-simple | 0 | 26598 | <reponame>lwi19/graphe-simple
import unittest
"""
graphe_test.py
Created by lwi19
Copyright © 2020 <NAME>. All rights reserved.
"""
"""
Test module for graph_theory
Call method: python3 -m unittest discover -p "*test.py" -s ./tests -v
Graphs are imported in this file,
"""
# import util.graph_lib as ... | 3 | 3 |
fbscraper.py | Woahisme/final_project | 0 | 26599 | <reponame>Woahisme/final_project
import json
from facebook_scraper import get_profile
#pass through name from webpage once issue is fixed
json_data = get_profile("passparam", cookies="./fbcookies.json")
# json_object = json.loads(json_data)
json_formatted = json.dumps(json_data, indent = 2)
print(json_formatted)
... | 2.625 | 3 |