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 |
|---|---|---|---|---|---|---|
streams/blog/migrations/0012_auto_20200928_1212.py | Engerrs/ckan.org | 1 | 9300 | <filename>streams/blog/migrations/0012_auto_20200928_1212.py
# Generated by Django 3.1.1 on 2020-09-28 12:12
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0011_blogpostpage_featured'),
]
operations = [
migratio... | 1.609375 | 2 |
opac/webapp/main/views.py | rafaelpezzuto/opac | 0 | 9301 | # coding: utf-8
import logging
import requests
import mimetypes
from io import BytesIO
from urllib.parse import urlparse
from datetime import datetime, timedelta
from collections import OrderedDict
from flask_babelex import gettext as _
from flask import (
render_template,
abort,
current_app,
request,
... | 2.03125 | 2 |
create_read_write_1/Writing/to_csv.py | CodeXfull/Pandas | 0 | 9302 | """
Converter um DataFrame para CSV
"""
import pandas as pd
dataset = pd.DataFrame({'Frutas': ["Abacaxi", "Mamão"],
"Nomes": ["Éverton", "Márcia"]},
index=["Linha 1", "Linha 2"])
dataset.to_csv("dataset.csv") | 3.390625 | 3 |
venv/Lib/site-packages/pygsheets/client.py | 13rilliant/Python-CMS | 1 | 9303 | <filename>venv/Lib/site-packages/pygsheets/client.py
# -*- coding: utf-8 -*-.
import re
import warnings
import os
import logging
from pygsheets.drive import DriveAPIWrapper
from pygsheets.sheet import SheetAPIWrapper
from pygsheets.spreadsheet import Spreadsheet
from pygsheets.exceptions import SpreadsheetNotFound, N... | 2.453125 | 2 |
model/group_contact.py | NatalyAristova/Training_python | 0 | 9304 | from sys import maxsize
class Group_contact:
def __init__(self,firstname=None, middlename=None, lastname=None, nickname=None, title=None, company=None,
address=None, home=None, mobile=None, work=None, fax=None, email=None, email2=None, email3=None, byear=None,
address2=None, pho... | 2.96875 | 3 |
test/manual/documents/test_iter_documents.py | membranepotential/mendeley-python-sdk | 103 | 9305 | <gh_stars>100-1000
from itertools import islice
from test import get_user_session, cassette
from test.resources.documents import delete_all_documents, create_document
def test_should_iterate_through_documents():
session = get_user_session()
delete_all_documents()
with cassette('fixtures/resources/docume... | 2.234375 | 2 |
demo.py | cbsudux/minimal-hand | 0 | 9306 | <reponame>cbsudux/minimal-hand<filename>demo.py
import argparse
import cv2
import keyboard
import numpy as np
import open3d as o3d
import os
import pygame
from transforms3d.axangles import axangle2mat
import config
from hand_mesh import HandMesh
from kinematics import mpii_to_mano
from utils import OneEuroFilter, imr... | 2.34375 | 2 |
test_project/settings.py | incuna/incuna-groups | 1 | 9307 | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
ALLOWED_HOSTS = []
ROOT_URLCONF = 'groups.tests.urls'
STATIC_URL = '/static/'
SECRET_KEY = '<KEY>'
PASSWORD_HASHERS = ('django.contrib.auth.hashers.MD5PasswordHasher',)
DATABASES = {
'default':... | 1.75 | 2 |
tests/test_akismet.py | cclauss/akismet | 9 | 9308 | <gh_stars>1-10
import datetime
import os
import sys
import unittest
from unittest import mock
import akismet
class AkismetTests(unittest.TestCase):
api_key = os.getenv("TEST_AKISMET_API_KEY")
blog_url = os.getenv("TEST_AKISMET_BLOG_URL")
api_key_env_var = "PYTHON_AKISMET_API_KEY"
blog_url_env_var = ... | 2.875 | 3 |
experimenting/dataset/datamodule.py | gaurvigoyal/lifting_events_to_3d_hpe | 19 | 9309 | <filename>experimenting/dataset/datamodule.py
import pytorch_lightning as pl
from torch.utils.data import DataLoader, Dataset
from .core import BaseCore
from .factory import BaseDataFactory
class DataModule(pl.LightningDataModule):
def __init__(
self,
dataset_factory: BaseDataFactory,
cor... | 2.390625 | 2 |
sevn-interface/SEVN/resources/SEVN_walkthrough/running_folder/analysis_3_pandas.py | giulianoiorio/PeTar | 0 | 9310 | <filename>sevn-interface/SEVN/resources/SEVN_walkthrough/running_folder/analysis_3_pandas.py
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
#Load file
dt=pd.read_csv("sevn_output/output_0.csv")
#Give a look to the columns
print(dt.columns)
#Consider only the final states
dt=dt.drop_duplicates([... | 3.046875 | 3 |
apps/tg_bot/apps.py | VladimirLazor/Lohika | 0 | 9311 | from django.apps import AppConfig
class TgBotConfig(AppConfig):
name = 'apps.tg_bot'
| 1.0625 | 1 |
office365/sharepoint/portal/group_site_manager.py | rikeshtailor/Office365-REST-Python-Client | 0 | 9312 | <reponame>rikeshtailor/Office365-REST-Python-Client
from office365.runtime.client_object import ClientObject
from office365.runtime.client_result import ClientResult
from office365.runtime.http.http_method import HttpMethod
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office3... | 2.234375 | 2 |
tests/errors/e_tuple_args_T692.py | smok-serwis/cython | 2 | 9313 | <reponame>smok-serwis/cython
# ticket: 692
# mode: error
def func((a, b)):
return a + b
_ERRORS = u"""
4:9: Missing argument name
5:11: undeclared name not builtin: a
5:15: undeclared name not builtin: b
"""
| 2.203125 | 2 |
ble.py | Ladvien/esp32_upython_env | 0 | 9314 | import bluetooth
import time
bt = bluetooth.BLE() # singleton
bt.active(True) # activate BT stack
UART_UUID = bluetooth.UUID('6E400001-B5A3-F393-E0A9-E50E24DCCA9E')
UART_TX = (bluetooth.UUID('6E400003-B5A3-F393-E0A9-E50E24DCCA9E'), bluetooth.FLAG_READ | bluetooth.FLAG_NOTIFY,)
UAR... | 2.3125 | 2 |
examples/custom-generator/customer.py | luxbe/sledo | 4 | 9315 | <filename>examples/custom-generator/customer.py
from random import randint
from sledo.generate.field_generators.base import FieldGenerator
values = ("Austria",
"Belgium",
"Bulgaria",
"Croatia",
"Cyprus",
"Czech Republic",
"Denmark",
"Estonia",
... | 3.171875 | 3 |
status-uncertain/baseline_model.py | crawftv/CRAwTO | 1 | 9316 | <reponame>crawftv/CRAwTO
#!/usr/bin/env python3
from sklearn.metrics import r2_score
import numpy as np
class BaselineModel(object):
def get_params(self):
return None
def predict(self, X):
return np.ones_like(X.index.values) * self._y_pred
def score(self, X, y):
y_true = y
... | 2.796875 | 3 |
aligner/grow_diag_final.py | ecalder6/MT-HW2 | 0 | 9317 | import optparse
import sys
def make_set(data, s, e_vocab, f_vocab, aligned, reverse):
for pair in data.split():
cur = pair.split('-')
if reverse:
e_vocab.add(int(cur[1]))
f_vocab.add(int(cur[0]))
aligned.add(int(cur[0]))
s.add((int(cur[1]), int(cur[0]... | 2.828125 | 3 |
tests/test_tbears_db.py | Transcranial-Solutions/t-bears | 35 | 9318 | # -*- coding: utf-8 -*-
# Copyright 2017-2018 ICON Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 2.15625 | 2 |
src/exabgp/bgp/message/update/attribute/bgpls/link/mplsmask.py | pierky/exabgp | 1,560 | 9319 | # encoding: utf-8
"""
mplsmask.py
Created by <NAME> on 2016-12-01.
Copyright (c) 2014-2017 Exa Networks. All rights reserved.
"""
from exabgp.bgp.message.notification import Notify
from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState
from exabgp.bgp.message.update.attribute.bgpls.linkstate import ... | 1.25 | 1 |
tests/test_cecum.py | hsorby/scaffoldmaker | 0 | 9320 | import unittest
from opencmiss.utils.zinc.finiteelement import evaluateFieldNodesetRange
from opencmiss.utils.zinc.general import ChangeManager
from opencmiss.zinc.context import Context
from opencmiss.zinc.element import Element
from opencmiss.zinc.field import Field
from opencmiss.zinc.result import RESULT_OK
from s... | 2.125 | 2 |
samples/destroy_vm.py | jm66/pyvmomi-community-samples | 4 | 9321 | #!/usr/bin/env python
# Copyright 2015 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 2.53125 | 3 |
helpers/Screen.py | 1000monkeys/MastermindRedux | 0 | 9322 | import sys
class Screen:
def __init__(self) -> None:
pass
def handle_events(self, events):
for event in events:
if event.type == self.pygame.QUIT:
sys.exit()
def draw(self, screen):
pass | 2.625 | 3 |
VirtualStage/BackgroundMatting/fixed_threshold.py | chris-han/ailab | 0 | 9323 | <filename>VirtualStage/BackgroundMatting/fixed_threshold.py
import os
def fixed_split(videos, thresholds, mask_suffix, overlap=0, background_path="/"):
# crop target background video frames
backgrounds = [os.path.join(background_path, f[:-4]) for f in os.listdir(background_path) if f.endswith(".mp4")]
p... | 2.65625 | 3 |
hn2016_falwa/utilities.py | veredsil/hn2016_falwa | 0 | 9324 | import numpy as np
from math import pi,exp
def static_stability(height,area,theta,s_et=None,n_et=None):
"""
The function "static_stability" computes the vertical gradient (z-derivative)
of hemispheric-averaged potential temperature, i.e. d\tilde{theta}/dz in the def-
inition of QGPV in eq.(3) of Huang ... | 3.09375 | 3 |
src/command_modules/azure-cli-iot/azure/cli/command_modules/iot/_params.py | JennyLawrance/azure-cli | 0 | 9325 | <filename>src/command_modules/azure-cli-iot/azure/cli/command_modules/iot/_params.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for licens... | 1.75 | 2 |
metrics-calculator/tests/integration/test_s3.py | nhsconnect/prm-practice-migration-dashboard | 0 | 9326 | <reponame>nhsconnect/prm-practice-migration-dashboard<filename>metrics-calculator/tests/integration/test_s3.py<gh_stars>0
import boto3
import gzip
from moto import mock_s3
import pytest
import os
from chalicelib.s3 import read_object_s3, write_object_s3, objects_exist
from tests.builders.file import build_gzip_csv
@... | 2.09375 | 2 |
image_analogy/losses/patch_matcher.py | kaldap/image-analogies | 3,722 | 9327 | import numpy as np
import scipy.interpolate
import scipy.ndimage
from sklearn.feature_extraction.image import extract_patches_2d, reconstruct_from_patches_2d
def _calc_patch_grid_dims(shape, patch_size, patch_stride):
x_w, x_h, x_c = shape
num_rows = 1 + (x_h - patch_size) // patch_stride
num_cols = 1 + (... | 2.890625 | 3 |
muni_portal/core/migrations/0030_remove_servicerequest_mobile_reference.py | desafinadude/muni-portal-backend | 1 | 9328 | <filename>muni_portal/core/migrations/0030_remove_servicerequest_mobile_reference.py<gh_stars>1-10
# Generated by Django 2.2.10 on 2021-02-24 09:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0029_auto_20210224_0936'),
]
operations = [
... | 1.3125 | 1 |
rllib/agents/ppo/tests/test_appo.py | noahshpak/ray | 2 | 9329 | <filename>rllib/agents/ppo/tests/test_appo.py
import unittest
import ray
import ray.rllib.agents.ppo as ppo
from ray.rllib.utils.test_utils import check_compute_single_action, \
framework_iterator
class TestAPPO(unittest.TestCase):
@classmethod
def setUpClass(cls):
ray.init()
@classmethod
... | 2.21875 | 2 |
ezeeai/utils/hooks.py | jmarine/ezeeai | 19 | 9330 | <reponame>jmarine/ezeeai<filename>ezeeai/utils/hooks.py<gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.training import session_run_hook
from tensorflow.python.training.basic_session_run_hooks import NeverTriggerTimer, ... | 2.140625 | 2 |
tests/factory_fixtures/dummy_resource.py | whiletrace/dwellinglybackend | 15 | 9331 | <filename>tests/factory_fixtures/dummy_resource.py
from flask import request
from flask_restful import Resource
from utils.gatekeeper import allowed_params
class DummyResource(Resource):
dummy_params = set()
@allowed_params(dummy_params)
def put(self):
return request.json
| 1.976563 | 2 |
quizzes/00.organize.me/hackerrank/sorted_set/server2.py | JiniousChoi/encyclopedia-in-code | 2 | 9332 | #!/usr/bin/env python3
import socket, threading
from queue import Queue
import sys, struct
# NOTE: Use this path to create the UDS Server socket
SERVER_SOCKET_PATH = "./socket";
class Result:
def __init__(self):
self._evt = threading.Event()
self._result = None
def set_result(self, value... | 2.78125 | 3 |
vnpy/gateway/rohon/__init__.py | funrunskypalace/vnpy | 323 | 9333 | from .rohon_gateway import RohonGateway
| 1.070313 | 1 |
dnd/mobile/urls.py | dndtools2/dndtools2 | 0 | 9334 | <filename>dnd/mobile/urls.py<gh_stars>0
from django.conf.urls import patterns, url, include
from .views import force_desktop_version, return_to_mobile_version
app_name = 'mobile'
urlpatterns = [
# force desktop
url(r'^force-desktop-version/$', force_desktop_version, name='force_desktop_version'),
# retur... | 1.757813 | 2 |
ros_aruco.py | esteng/guiding-multi-step | 69 | 9335 | """
Calibrate with the ROS package aruco_detect
"""
import rospy
import roslib
from geometry_msgs.msg import Transform
class ROSArUcoCalibrate:
def __init__(self, aruco_tag_len=0.0795):
print("Please roslaunch roslaunch aruco_detect aruco_detect.launch before you run!")
self.aruco_tf_topic = "/f... | 2.53125 | 3 |
utils/utils.py | mmalandra-kb4/service-metrics-gatherer | 0 | 9336 | <gh_stars>0
"""
* Copyright 2019 EPAM Systems
*
* 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... | 2.21875 | 2 |
OSAnalysisHelper.py | nassermarafi/SRCSWArchetypes | 7 | 9337 | from __future__ import absolute_import
__author__ = 'marafi'
def SolutionAlgorithim(OData, Dt, Tol, Steps):
#Insert within the While loop, make sure parameter "ok" is defined
import OpenSeesAPI
OData.AddObject(OpenSeesAPI.TCL.TCLScript('if {$ok != 0} {'))
OData.AddObject(OpenSeesAPI.TCL.TCLScript('put... | 2.359375 | 2 |
unityparser/commands.py | socialpoint-labs/unity-yaml-parser | 76 | 9338 | <gh_stars>10-100
import re
from argparse import ArgumentParser
from multiprocessing import Pool, Manager, Process
from pathlib import Path
from .utils import UnityDocument
YAML_HEADER = '%YAML'
class UnityProjectTester:
"""
Class to run tests on a given Unity project folder
"""
AVAILABLE_COMMANDS = ... | 2.578125 | 3 |
DP/Leetcode 221. Maximal Square.py | kaizhengny/LeetCode | 31 | 9339 | class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
if not matrix: return 0
m, n = len(matrix), len(matrix[0])
dp = [[0]*n for _ in range(m)]
res = 0
for i in range(m):
dp[i][0] = int(matrix[i][0])
for j in range(n):
dp[0][... | 3 | 3 |
dokang/harvesters/__init__.py | Polyconseil/dokang | 6 | 9340 | # -*- coding: utf-8 -*-
# Copyright (c) Polyconseil SAS. All rights reserved.
import hashlib
import json
import logging
import os
import re
from .html import html_config, HtmlHarvester # pylint: disable=unused-import
from .sphinx import ( # pylint: disable=unused-import
sphinx_config, sphinx_rtd_config,
Sph... | 2.203125 | 2 |
__init__.py | semccomas/string-method-gmxapi | 6 | 9341 | __all__ = ["stringmethod"]
| 1.234375 | 1 |
carPooling/migrations/0018_auto_20190521_1651.py | yangtao4389/pinche | 1 | 9342 | # Generated by Django 2.0.4 on 2019-05-21 16:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('carPooling', '0017_carpoolingrecunbook'),
]
operations = [
migrations.AlterField(
model_name='carpoolinguserconf',
n... | 1.53125 | 2 |
src/fuckbot/ticker.py | Zer0-One/fuckbot | 0 | 9343 | import discord
import logging
TRADING_API_URL='https://cloud.iexapis.com/stable/stock/{0}/quote'
TRADING_API_ICON='https://iextrading.com/favicon.ico'
def ticker_embed(symbol):
ticker = discord.Embed(title=f"{symbol}".upper(), type="rich", color=3029236, url=TRADING_API_URL.format(symbol))
ticker.set_author(n... | 2.265625 | 2 |
minos/lib/util/StateSet.py | johny-c/minos | 1 | 9344 | import bz2
import csv
import collections
import math
from enum import Enum
class Select(Enum):
FIRST = 'first'
RANGE_KEY = 'range_key'
RANGE_VALUE = 'range_value'
class SelectPolicy:
def __init__(self, policy, field=None):
self.policy = policy
self.field = field
class StateSet:
... | 2.65625 | 3 |
pagetags/configuration/development.py | pmatigakis/pagetags | 0 | 9345 | <reponame>pmatigakis/pagetags
DEBUG = True
TESTING = False
| 0.871094 | 1 |
hpcrocket/pyfilesystem/factory.py | SvenMarcus/hpc-rocket | 7 | 9346 | from hpcrocket.core.filesystem import Filesystem, FilesystemFactory
from hpcrocket.core.launchoptions import Options
from hpcrocket.pyfilesystem.localfilesystem import LocalFilesystem
from hpcrocket.pyfilesystem.sshfilesystem import SSHFilesystem
class PyFilesystemFactory(FilesystemFactory):
def __init__(self, o... | 2.15625 | 2 |
cqlsh_tests/cqlsh_tools.py | vincewhite/cassandra-dtest | 0 | 9347 | <gh_stars>0
import csv
import random
import cassandra
from cassandra.cluster import ResultSet
from typing import List
class DummyColorMap(object):
def __getitem__(self, *args):
return ''
def csv_rows(filename, delimiter=None):
"""
Given a filename, opens a csv file and yields it line by line.... | 2.8125 | 3 |
tests/unit/sagemaker/tensorflow/test_estimator_init.py | LastRemote/sagemaker-python-sdk | 1,690 | 9348 | # Copyright Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... | 1.765625 | 2 |
testing.py | sofwerx/mycroft-articlekeyword-skill | 0 | 9349 |
import subprocess
proc = subprocess.Popen(['python3', 'articlekeywords.py', 'aih.txt' , '5'], stdout=subprocess.PIPE )
#print(type(proc.communicate()[0]))
# path = '/opt/mycroft/skills/mycroft-bitcoinprice-skill/'
text = proc.stdout.read()
rows = text.splitlines()
#print(text.splitlines())
count = 0
s = ""
for ... | 2.875 | 3 |
slcyGeneral.py | mirrorcoloured/slcypi | 0 | 9350 | # Python 2.7.1
import RPi.GPIO as GPIO
from twython import Twython
import time
import sys
import os
import pygame
APP_KEY='zmmlyAJzMDIntLpDYmSH98gbw'
APP_SECRET='<KEY>'
OAUTH_TOKEN='<KEY>'
OAUTH_TOKEN_SECRET='<KEY>'
applepislcy = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
### GENERAL ###
def Clea... | 3 | 3 |
python/pyarmnn/scripts/generate_docs.py | PetervdPerk-NXP/pyarmnn-release | 7 | 9351 | <reponame>PetervdPerk-NXP/pyarmnn-release<gh_stars>1-10
# Copyright © 2019 Arm Ltd. All rights reserved.
# Copyright 2020 NXP
# SPDX-License-Identifier: MIT
import os
import tarfile
import pyarmnn as ann
import shutil
from typing import List, Union
from pdoc.cli import main
package_dir = os.path.join... | 2.125 | 2 |
tests/gejun_sum.py | jeffzhengye/pylearn | 2 | 9352 | __author__ = 'jeffye'
def sum_consecutives(s):
i = 1
li = []
if i < len(s):
n = 1
while s[i] != s[i + 1] and s[i] != s[i - 1]:
sum = s[i]
i = i + 1
return sum
while s[i] == s[i + 1]:
n = n + 1
sum = s[i] * n
i = i + 1
return sum
... | 3.40625 | 3 |
PySDDP/term.py | tscher/PySDDP | 9 | 9353 | <filename>PySDDP/term.py
class term(object):
# Dados de cadastro das usinas termeletrica (presentes no TERM.DAT)
Codigo = None
Nome = None
Potencia = None
FCMax = None
TEIF = None
IP = None
GTMin = None
# Dados Adicionais Especificados no arquivo de configuracao termica (CONFT)
... | 2.328125 | 2 |
plerr/__main__.py | b2bs-team/pylint-errors | 2 | 9354 | """plerr entrypoint"""
from plerr import cli
if __name__ == '__main__':
cli.main()
| 1.210938 | 1 |
code/send.py | CamouOkau/messenger_new_years_bot | 0 | 9355 | <filename>code/send.py
import sys
import time
from datetime import datetime
from bot import FbMessengerBot
if __name__ == "__main__":
if len(sys.argv) < 3:
print("No email or password provided")
else:
bot = FbMessengerBot(sys.argv[1], sys.argv[2])
with open("users.txt", "r") as file:
... | 2.625 | 3 |
senlin_tempest_plugin/api/policies/test_policy_update_negative.py | ghanshyammann/senlin-tempest-plugin | 0 | 9356 | # 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, software
# distributed under t... | 1.71875 | 2 |
boa3_test/test_sc/interop_test/contract/DestroyContract.py | hal0x2328/neo3-boa | 25 | 9357 | <gh_stars>10-100
from boa3.builtin import public
from boa3.builtin.interop.contract import destroy_contract
@public
def Main():
destroy_contract()
| 1.273438 | 1 |
tests/test_vmax.py | qinfeng2011/wltp | 0 | 9358 | <reponame>qinfeng2011/wltp<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
impor... | 2.015625 | 2 |
util/canonicaljson.py | giuseppe/quay | 2,027 | 9359 | <reponame>giuseppe/quay
import collections
def canonicalize(json_obj, preserve_sequence_order=True):
"""
This function canonicalizes a Python object that will be serialized as JSON.
Example usage: json.dumps(canonicalize(my_obj))
Args:
json_obj (object): the Python object that will later be ser... | 3.390625 | 3 |
datasette_plugin_geo/inspect.py | russss/datasette-geo | 9 | 9360 | from datasette import hookimpl
from datasette.utils import detect_spatialite
from shapely import wkt
def get_spatial_tables(conn):
if not detect_spatialite(conn):
return {}
spatial_tables = {}
c = conn.cursor()
c.execute(
"""SELECT f_table_name, f_geometry_column, srid, spatial_index_... | 2.359375 | 2 |
microcosm_pubsub/context.py | Sinon/microcosm-pubsub | 5 | 9361 | """
Message context.
"""
from typing import Dict
from microcosm.api import defaults, typed
from microcosm.config.types import boolean
from microcosm_logging.decorators import logger
from microcosm_pubsub.constants import TTL_KEY, URI_KEY
from microcosm_pubsub.message import SQSMessage
@defaults(
enable_ttl=typ... | 2.28125 | 2 |
azure_ml/pytorch_classifier/train_parameterized.py | murdockcrc/python-tricks | 0 | 9362 | <gh_stars>0
import os
import argparse
import torch
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from model import Net
from azureml.core import Run
run = Run.get_context()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
'--data... | 2.4375 | 2 |
src/tests/test_app_db.py | kazqvaizer/arq-sqlalchemy-boilerplate | 6 | 9363 | import pytest
from app.db import session_scope
pytestmark = pytest.mark.asyncio
async def test_engine_configured(env):
async with session_scope() as session:
assert str(session.bind.engine.url) == env("SQLALCHEMY_DATABASE_URI")
| 2.0625 | 2 |
catalyst/core/callbacks/formatters.py | cgarciae/catalyst | 1 | 9364 | <gh_stars>1-10
from abc import ABC, abstractmethod
from datetime import datetime
import json
import logging
from catalyst import utils
from catalyst.core import _State
class MetricsFormatter(ABC, logging.Formatter):
"""
Abstract metrics formatter
"""
def __init__(self, message_prefix):
"""
... | 2.875 | 3 |
fuzzy/fuzzy.py | Suraj1127/fuzzy-matcher | 0 | 9365 | #!/usr/bin/env python3
"""
Description: Python script to append the common columns in one sheet from another sheet using fuzzy matching.
"""
import pip
def import_or_install(package):
try:
__import__(package)
except ImportError:
pip.main(['install', package])
import os
import sys
im... | 3.71875 | 4 |
exoatlas/visualizations/panels/BubblePanel.py | zkbt/exopop | 4 | 9366 | <filename>exoatlas/visualizations/panels/BubblePanel.py<gh_stars>1-10
from .Panel import *
__all__ = ['BubblePanel']
default_size = plt.matplotlib.rcParams['lines.markersize']**2
class BubblePanel(Panel):
'''
BubblePanel is a general wrapper for making scatter plots
where planets are represented as bubbl... | 3.125 | 3 |
venv/lib/python2.7/dist-packages/landscape/sysinfo/load.py | pengwu/scapy_env | 0 | 9367 | import os
from twisted.internet.defer import succeed
class Load(object):
def register(self, sysinfo):
self._sysinfo = sysinfo
def run(self):
self._sysinfo.add_header("System load", str(os.getloadavg()[0]))
return succeed(None)
| 2.078125 | 2 |
src/boh_api/viewsets.py | dougmorato/bag-of-holding | 0 | 9368 | <filename>src/boh_api/viewsets.py
from rest_framework import viewsets
from boh import models
from . import serializers
class OrganizationViewSet(viewsets.ModelViewSet):
queryset = models.Organization.objects.all()
serializer_class = serializers.OrganizationSerializer
class ApplicationViewSet(viewsets.Mode... | 1.875 | 2 |
githubintro-fe2d832af2bad7d6b27d036c205cc9d8414b2183/CommunicationAnimation.py | TatendaNoreen/Python | 0 | 9369 | import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot
import agentframework
import csv
import matplotlib.animation
#create environment in which agents will operate
environment=[]
#read csv downloaded file
f = open('in.txt', newline='')
reader = csv.reader(f, quoting=csv.QUOTE_NONNUMERIC)
for row in ... | 3.71875 | 4 |
external/model-preparation-algorithm/tests/conftest.py | opencv/openvino_training_extensions | 775 | 9370 | <reponame>opencv/openvino_training_extensions<filename>external/model-preparation-algorithm/tests/conftest.py
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
try:
import e2e.fixtures
from e2e.conftest_utils import * # noqa
from e2e.conftest_utils import pytest_addopt... | 1.710938 | 2 |
ibis/udf/validate.py | rtpsw/ibis | 986 | 9371 | """Validation for UDFs.
Warning: This is an experimental module and API here can change without notice.
DO NOT USE DIRECTLY.
"""
from inspect import Parameter, Signature, signature
from typing import Any, Callable, List
import ibis.common.exceptions as com
from ibis.expr.datatypes import DataType
def _parameter_c... | 3.1875 | 3 |
packages/stattik/stattik/schema/schema.py | stattikcms/stattik | 1 | 9372 | import inspect
from ariadne import make_executable_schema, QueryType, MutationType, SubscriptionType
from .resolver import *
#
# Schema
#
class GrammarError(Exception):
pass
keywords = ['query', 'mutation', 'subscription', 'source']
class SchemaMetaDict(dict):
'''
Dictionary that allows decorated sche... | 2.328125 | 2 |
toontown/battle/DistributedBattleBaseAI.py | DankMickey/Project-Altis-Educational-Source | 1 | 9373 | import random
from otp.ai.AIBase import *
from direct.distributed.ClockDelta import *
from toontown.battle.BattleBase import *
from toontown.battle.BattleCalculatorAI import *
from toontown.toonbase.ToontownBattleGlobals import *
from toontown.battle.SuitBattleGlobals import *
from pandac.PandaModules import *
from too... | 1.765625 | 2 |
tracking_test.py | HsunGong/Augmented-Advertisement | 5 | 9374 | # Copyright (c) Group Three-Forest SJTU. All Rights Reserved.
from tracking.tracking import *
# a = tracking_video_rectangle("video/","1.mp4",[[273,352],[266,616],[412,620],[416,369]])
a = tracking_video_rectangle_tovideo("video/","1.mp4", "1.png", [[273,352],[266,616],[412,620],[416,369]], result = 'result__.a... | 1.601563 | 2 |
gym_flock/envs/old/flocking_position.py | katetolstaya/gym-flock | 19 | 9375 | import gym
from gym import spaces, error, utils
from gym.utils import seeding
import numpy as np
from scipy.spatial.distance import pdist, squareform
import configparser
from os import path
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
font = {'family' : 'sans-serif',
'weight' : 'bold',
... | 2.234375 | 2 |
conf/constants.py | codingwangfeng/GoodGoodName | 0 | 9376 | # -*-coding:utf-8-*-
# from functools import reduce
from functools import reduce
SANCAI_jixiang = [1, 3, 5, 7, 8, 11, 13, 15, 16, 18, 21, 23, 24, 25, 31, 32, 33, 35, 37, 39, 41, 45, 47, 48, 52, 57, 61,
63,
65, 67, 68, 81] # 吉祥运暗示数(代表健全,幸福,名誉等)
SANCAI_xiaoji = [6, 17, 26, 27, 29, 30,... | 2.09375 | 2 |
main/migrations/0006_labourer_allproj.py | kevinmuturi5/farm-Management-system | 1 | 9377 | <filename>main/migrations/0006_labourer_allproj.py
# Generated by Django 3.1.2 on 2020-10-18 16:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0005_auto_20201018_1902'),
]
operations = [
migrations.AddField(
mode... | 1.46875 | 1 |
bzt/modules/blazemeter/blazemeter_reporter.py | beachwood23/taurus | 0 | 9378 | <reponame>beachwood23/taurus
"""
Module for reporting into http://www.blazemeter.com/ service
Copyright 2015 BlazeMeter 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.or... | 1.6875 | 2 |
nitorch/nn/losses/_spatial.py | wyli/nitorch | 1 | 9379 | """
Losses that assume an underlying spatial organization
(gradients, curvature, etc.)
"""
import torch
import torch.nn as tnn
from nitorch.core.pyutils import make_list, prod
from nitorch.core.utils import slice_tensor
from nitorch.spatial import diff1d
from ._base import Loss
class LocalFeatures(tnn.Module):
"... | 2.4375 | 2 |
items/models.py | roberthtamayose/digitalmenu | 0 | 9380 | <reponame>roberthtamayose/digitalmenu<gh_stars>0
from django.db import models
from django.utils import timezone
class Categoria(models.Model):
nome = models.CharField(max_length=255)
def __str__(self):
return self.nome
class Item(models.Model):
nome = models.CharField(max_length=255)
data_c... | 2.203125 | 2 |
app/services/__init__.py | zeroday0619/XenXenXenSe | 1 | 9381 | from app.services.console import Console
from app.services.server import Server
__main__ = ["server", "console"]
| 1.125 | 1 |
launch/twist_mux_launch.py | nuclearsandwich-ros/twist_mux-release | 31 | 9382 | #!/usr/bin/env python3
# Copyright 2020 Gaitech Korea Co., Ltd.
#
# 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 appli... | 1.929688 | 2 |
Tests/testLiveService.py | psu-capstone-teamD/ElementalAuth | 2 | 9383 | import sys
import unittest
import requests_mock
from mock import patch
sys.path.append('services/LiveService')
from LiveService import LiveService
L = LiveService()
baseURL = "https://yanexx65s8e1.live.elementalclouddev.com/api"
class LiveServiceTest(unittest.TestCase):
'''@patch('services.LiveService.LiveSe... | 2.671875 | 3 |
tests/models/test_stacking.py | LionelMassoulard/aikit | 0 | 9384 | <reponame>LionelMassoulard/aikit
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 11:49:10 2018
@author: <NAME>
"""
import pytest
import numpy as np
import pandas as pd
from sklearn.base import is_regressor, is_classifier
from sklearn.exceptions import NotFittedError
from sklearn.model_selection import KFold
from... | 2.296875 | 2 |
employee/views/check_rental.py | odrolliv13/Hex-Photos | 0 | 9385 | <reponame>odrolliv13/Hex-Photos
from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from manager import models as pmod
from . import templater
from django.conf import settings
import decimal, datetime
# This view will display all users a... | 2.359375 | 2 |
jupyter/settings.py | nguyenngtt/GSE---TEAM-A | 3 | 9386 | import pandas as pd
import numpy as np
import os
import logging
# suppress warnings
import warnings;
warnings.filterwarnings('ignore');
from tqdm.autonotebook import tqdm
# register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
tqdm.pandas()
# https://pandas.pydata.org/pandas-docs/stable/user_g... | 2.15625 | 2 |
var/spack/repos/builtin/packages/py-cyvcf2/package.py | jeanbez/spack | 0 | 9387 | <filename>var/spack/repos/builtin/packages/py-cyvcf2/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyCyvcf2(PythonPackage... | 1.578125 | 2 |
pset_functions/db_search/p1.py | mottaquikarim/pydev-psets | 5 | 9388 | """
GPA Calculator
"""
# Write a function called "simple_gpa" to find GPA when student enters a letter grade as a string. Assign the result to a variable called "gpa".
"""
Use these conversions:
A+ --> 4.0
A --> 4.0
A- --> 3.7
B+ --> 3.3
B --> 3.0
B- --> 2.7
C+ --> 2.3
C --> 2.0
C- --> 1.7
D+ --> 1.3
D --> 1.0
D- -->... | 3.78125 | 4 |
test_soundcard.py | flying-sheep/SoundCard | 1 | 9389 | import sys
import soundcard
import numpy
import pytest
ones = numpy.ones(1024)
signal = numpy.concatenate([[ones], [-ones]]).T
def test_speakers():
for speaker in soundcard.all_speakers():
assert isinstance(speaker.name, str)
assert hasattr(speaker, 'id')
assert isinstance(speaker.channels... | 2.40625 | 2 |
Last 3 digits of 11^x.py | jaiveergill/Last-Three-Digits-of-11-x | 0 | 9390 | # This is a simple program to find the last three digits of 11 raised to any given number.
# The main algorithm that does the work is on line 10
def trim_num(num):
if len(str(num)) > 3: # no need to trim if the number is 3 or less digits long
return str(num)[(len(str(num)) - 3):] # trims the number
ret... | 4.28125 | 4 |
osr_odometry/scripts/osr_odom_ackerman2.py | ljb2208/osr-rover-code | 0 | 9391 | <filename>osr_odometry/scripts/osr_odom_ackerman2.py
#!/usr/bin/env python
import time
from osr_msgs.msg import Joystick, Commands, Encoder, RunStop
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Point, Pose, Quaternion, Twist, Vector3
import rospy
import tf
import math
import numpy
class Odometry2():... | 2.140625 | 2 |
src/simulation-conditioning/utilities/data-generation-scripts/Wavefield_Marmousi_pml_401x301_1000-1287_120-232_4k_20kp100_A_train.py | alisiahkoohi/importance-of-transfer-learning | 0 | 9392 | import numpy as np
import h5py
import os
from devito.logger import info
from devito import TimeFunction, clear_cache
from examples.seismic.acoustic import AcousticWaveSolver
from examples.seismic import Model, RickerSource, Receiver, TimeAxis
from math import floor
from scipy.interpolate import griddata
import argparse... | 1.859375 | 2 |
facto.py | divine-coder/CODECHEF-PYTHON | 0 | 9393 | <reponame>divine-coder/CODECHEF-PYTHON
import math
if __name__=='__main__':
n=(int)(input())
for abc in range(n):
t=(int)(input())
print math.factorial(t)
| 3.40625 | 3 |
setup.py | johnmartingodo/pyKinematicsKineticsToolbox | 0 | 9394 | from setuptools import setup
setup(name="pykinematicskineticstoolbox",
version="0.0",
description="Installable python package which collects useful kinematics and kinetics functions",
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
packages=["pykinematicskineticstoolbox"],
install_requires... | 1.03125 | 1 |
summary/summary_avail.py | bit0fun/plugins | 173 | 9395 | from datetime import datetime
# ensure an rpc peer is added
def addpeer(p, rpcpeer):
pid = rpcpeer['id']
if pid not in p.persist['peerstate']:
p.persist['peerstate'][pid] = {
'connected': rpcpeer['connected'],
'last_seen': datetime.now() if rpcpeer['connected'] else None,
... | 2.453125 | 2 |
terrascript/dns/r.py | hugovk/python-terrascript | 4 | 9396 | # terrascript/dns/r.py
import terrascript
class dns_a_record_set(terrascript.Resource):
pass
class dns_aaaa_record_set(terrascript.Resource):
pass
class dns_cname_record(terrascript.Resource):
pass
class dns_mx_record_set(terrascript.Resource):
pass
class dns_ns_record_set(terrascript.Resource... | 1.851563 | 2 |
JumpscaleCore/clients/tcprouter/TCPRouterFactory.py | gneumann333/jumpscaleX_core | 1 | 9397 | <filename>JumpscaleCore/clients/tcprouter/TCPRouterFactory.py<gh_stars>1-10
from Jumpscale import j
from .TCPRouterClient import TCPRouterClient
JSConfigs = j.baseclasses.object_config_collection
class TCPRouterFactory(JSConfigs):
__jslocation__ = "j.clients.tcp_router"
_CHILDCLASS = TCPRouterClient
de... | 2.15625 | 2 |
nmrglue/fileio/spinsolve.py | miguelarbesu/nmrglue | 0 | 9398 | """
Functions for reading Magritek Spinsolve binary (dx/1d) files and
parameter (acqu.par/proc.par) files.
"""
import os
from warnings import warn
import numpy as np
from . import fileiobase
from . import jcampdx
__developer_info__ = """
Spinsolve is the software used on the Magritek benchtop NMR devices.
A spect... | 2.65625 | 3 |
src/navigation_analytics/navigation_data.py | mielgosez/navigation_analytics | 0 | 9399 | <reponame>mielgosez/navigation_analytics
import logging
import copy
import pickle
import pandas as pd
class BaseClass:
def __init__(self,
input_data: pd.DataFrame,
logger: logging.Logger,
metadata: dict):
self.__input_data = input_data
self.__logg... | 2.265625 | 2 |