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 |
|---|---|---|---|---|---|---|
venv/lib/python3.7/site-packages/google/type/postal_address_pb2.py | nicholasadamou/StockBird | 15 | 16200 | <gh_stars>10-100
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/type/postal_address.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.... | 1.632813 | 2 |
dataprep/tests/data_connector/test_integration.py | dylanzxc/dataprep | 1 | 16201 | from ...data_connector import Connector
from os import environ
def test_data_connector() -> None:
token = environ["DATAPREP_DATA_CONNECTOR_YELP_TOKEN"]
dc = Connector("yelp", _auth={"access_token": token})
df = dc.query("businesses", term="ramen", location="vancouver")
assert len(df) > 0
dc.info... | 2.4375 | 2 |
plot_helpers.py | aspuru-guzik-group/QNODE | 14 | 16202 | <filename>plot_helpers.py
import os
import torch
import numpy as np
import math
import matplotlib.pyplot as plt
from matplotlib import cm
from qutip import *
import imageio
plt.rcParams['axes.labelsize'] = 16
from matplotlib import rc
rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
rc('text', usetex=Tru... | 2.4375 | 2 |
state.py | Lekensteyn/wgll | 1 | 16203 | # State tracking for WireGuard protocol operations.
# Author: <NAME> <<EMAIL>>
# Licensed under the MIT license <http://opensource.org/licenses/MIT>.
import base64
import hashlib
import inspect
import socket
import traceback
from noise_wg import NoiseWG, crypto_scalarmult_base, aead_encrypt, aead_decrypt
def calc_m... | 2.1875 | 2 |
BAMF_Detect/modules/dendroid.py | bwall/bamfdetect | 152 | 16204 | from common import Modules, data_strings, load_yara_rules, AndroidParseModule, ModuleMetadata
from base64 import b64decode
from string import printable
class dendroid(AndroidParseModule):
def __init__(self):
md = ModuleMetadata(
module_name="dendroid",
bot_name="Dendroid",
... | 2.59375 | 3 |
corehq/ex-submodules/couchforms/tests/test_analytics.py | caktus/commcare-hq | 0 | 16205 | <reponame>caktus/commcare-hq
import datetime
import uuid
from django.test import TestCase
from mock import patch
from requests import ConnectionError
from couchforms.analytics import (
app_has_been_submitted_to_in_last_30_days,
domain_has_submission_in_last_30_days,
get_all_xmlns_app_id_pairs_submitted_to... | 1.554688 | 2 |
src/pythae/models/svae/svae_config.py | eknag/benchmark_VAE | 1 | 16206 | <gh_stars>1-10
from pydantic.dataclasses import dataclass
from ...models import VAEConfig
@dataclass
class SVAEConfig(VAEConfig):
r"""
:math:`\mathcal{S}`-VAE model config config class
Parameters:
input_dim (int): The input_data dimension
latent_dim (int): The latent space dimension in w... | 2.3125 | 2 |
amck/imat/download_data.py | aaronmckinstry706/imaterialist | 0 | 16207 | <reponame>aaronmckinstry706/imaterialist
# Parts of code taken from https://www.kaggle.com/aloisiodn/python-3-download-multi-proc-prog-bar-resume by Dourado.
# Improvements on the original script:
# * you can choose which dataset to download;
# * uses threads instead of processes;
# * unpacks data into .../label/... | 2.5625 | 3 |
JTP Recap./2.Program_IO/function.py | SNP0301/Study_Python | 0 | 16208 | """
Function
def function_name(arg1, arg2, ...) :
<op 1>
<op 2>
...
Function with undefined amount of input
def fn_name(*args) --> args' elements make tuple.
kwargs = Keyword Parameter
>>> def print_kwargs(**kwargs):
... print(kwargs)
...
>>> print_kwargs(a=1)
{... | 4.5625 | 5 |
tweet/common.py | skiwheelr/URS | 4 | 16209 | all
import tweepy, config, users, re, groupy
from tweepy import OAuthHandler
from tweepy import API
print(tweepy.__version__)
auth = OAuthHandler(config.consumer_key, config.consumer_secret)
auth.set_access_token(config.access_token,config.access_token_secret)
api = tweepy.API(auth)
from groupy.client import Client
cli... | 2.578125 | 3 |
crystalpy/examples/PlotData1D.py | oasys-kit/crystalpy | 0 | 16210 | """
---OK---
"""
from collections import OrderedDict
import copy
import numpy as np
from crystalpy.examples.Values import Interval
class PlotData1D(object):
"""
Represents a 1D plot. The graph data together with related information.
"""
def __init__(self, title, title_x_axis, title_y_axis):
... | 2.921875 | 3 |
src/deep_dialog/usersims/__init__.py | Yuqing2018/tcbot_python3 | 0 | 16211 | from .usersim_rule import *
from .realUser import * | 1.054688 | 1 |
hs_file_types/models/geofeature.py | tommac7/hydroshare | 0 | 16212 | <filename>hs_file_types/models/geofeature.py<gh_stars>0
import os
import logging
import shutil
import zipfile
import xmltodict
from lxml import etree
from osgeo import ogr, osr
from django.core.exceptions import ValidationError
from django.db import models, transaction
from django.utils.html import strip_tags
from dj... | 1.890625 | 2 |
tests/test_node.py | mjholtkamp/py-iptree | 0 | 16213 | import unittest
from iptree import IPNode
class TestIPNode(unittest.TestCase):
def test_node_ipv4(self):
node = IPNode('0.0.0.0/0')
node.add(IPNode('127.0.0.1/32'))
assert '127.0.0.1/32' in node
assert '192.0.2.1/32' not in node
def test_node_ipv6(self):
node = IPNode... | 3.046875 | 3 |
Codewars/8kyu/invert-values/Python/test.py | RevansChen/online-judge | 7 | 16214 | <reponame>RevansChen/online-judge<gh_stars>1-10
# Python - 3.4.3
Test.it('Basic Tests')
Test.assert_equals(invert([1, 2, 3, 4, 5]), [-1, -2, -3, -4, -5])
Test.assert_equals(invert([1, -2, 3, -4, 5]), [-1, 2, -3, 4, -5])
Test.assert_equals(invert([]), [])
| 3.0625 | 3 |
locustfile_create_order.py | Ashutosh-Kaushik/ss-load-test-locust | 1 | 16215 | <filename>locustfile_create_order.py<gh_stars>1-10
import csv
import random
import warnings
import os
from locust import HttpUser, task, between
body = {
"campaignid":"5kXk20gGDISJdM5el5IT",
"walletamount":"0"
}
header = {
"Host": "fkhapi.sastasundar.com",
"Apptype": "N",
"Appversion": "4.0.4",
... | 2.390625 | 2 |
compy/plot/grid.py | tilleyd/compy | 0 | 16216 | <gh_stars>0
"""Contains the grid class to create multiple figures."""
from typing import Optional, Tuple
from .figure import Figure
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
class Grid:
def __init__(
self, rows: int, cols: int, size: Optional[Tuple[float, float]] = None
)... | 3.484375 | 3 |
parallel_accel/shared/parallel_accel/shared/schemas/external.py | google/parallel_accel | 1 | 16217 | # Copyright 2021 The ParallelAccel Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | 2.078125 | 2 |
godot-toolkit/godot_config_file.py | WiggleWizard/godot-toolkit | 0 | 16218 | try:
from configparser import RawConfigParser
except ImportError:
from ConfigParser import RawConfigParser
class GodotConfigFile(RawConfigParser):
def write(self, fp):
"""Write an .ini-format representation of the configuration state."""
if self._defaults:
fp.write("[%s]\n" % D... | 2.640625 | 3 |
DMOJ/CCC/escape room.py | eddiegz/Personal-C | 3 | 16219 | import collections
def cal(num):
i=1
f=factor[num]
while i*i<=num:
if num%i==0 and i<=max(n,m) and num//i<=max(n,m):
f.append(i)
i+=1
return num
def dfs(i,j):
if i==m-1 and j==n-1:
return True
if i>=m and j>=n or grid[i][j] in factor:
... | 3.328125 | 3 |
volume_loader.py | xeTaiz/deep-volumetric-ambient-occlusion | 9 | 16220 | <gh_stars>1-10
import os
import pydicom
import numpy as np
import dicom_numpy
from utils import hidden_errors
from tf_utils import *
from pathlib import Path
def read_dicom_folder(dicom_folder, rescale=None):
''' Reads all .dcm files in `dicom_folder` and merges them to one volume
Returns:
The volume... | 2.515625 | 3 |
sudoku_solver/gui.py | andrewhalle/sudoku_solver | 0 | 16221 | <gh_stars>0
import sys
from PyQt5.QtCore import Qt, QSize, QPoint
from PyQt5.QtWidgets import QApplication, QDialog, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout
from PyQt5.QtGui import QPainter, QColor, QPen, QFont
from .sudoku import Sudoku
class SudokuWidget(QWidget):
def __init__(self, parent=None):
... | 3.15625 | 3 |
swarmlib/util/functions.py | nkoutsov/swarmlib | 0 | 16222 | <filename>swarmlib/util/functions.py
# ------------------------------------------------------------------------------------------------------
# Copyright (c) <NAME>. All rights reserved.
# Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for license information.
# -------------------------... | 2.25 | 2 |
nps/network_entity.py | Dry8r3aD/penta-nps | 6 | 16223 | <reponame>Dry8r3aD/penta-nps<filename>nps/network_entity.py
# -*- coding: UTF-8 -*-
from collections import deque
class NetworkEntity(object):
"""Client or Server simulation network entity"""
def __init__(self, name):
# "client" or "server"
self.name = name
# simulatation packet list... | 2.40625 | 2 |
source/_sample/scipy/interp_spline_interest.py | showa-yojyo/notebook | 14 | 16224 | <filename>source/_sample/scipy/interp_spline_interest.py
#!/usr/bin/env python
"""interp_spline_interest.py: Demonstrate spline interpolation.
"""
from scipy.interpolate import splrep, splev
import numpy as np
import matplotlib.pyplot as plt
# pylint: disable=invalid-name
# Interest rates of Jan, Feb, Mar, Jun, Dec.
... | 3.421875 | 3 |
Pytorch/Scratch CNN and Pytorch/part1-convnet/tests/test_sgd.py | Kuga23/Deep-Learning | 3 | 16225 | <filename>Pytorch/Scratch CNN and Pytorch/part1-convnet/tests/test_sgd.py
import unittest
import numpy as np
from optimizer import SGD
from modules import ConvNet
from .utils import *
class TestSGD(unittest.TestCase):
""" The class containing all test cases for this assignment"""
def setUp(self):
"""D... | 3.078125 | 3 |
Scripts/simulation/tunable_utils/create_object.py | velocist/TS4CheatsInfo | 0 | 16226 | # uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\tunable_utils\create_object.py
# Compiled at: 2020-05-07 00:26:47
# Size of source mod 2**32: 4106 b... | 2.078125 | 2 |
题源分类/LeetCode/LeetCode日刷/python/47.全排列-ii.py | ZhengyangXu/Algorithm-Daily-Practice | 0 | 16227 | <reponame>ZhengyangXu/Algorithm-Daily-Practice
#
# @lc app=leetcode.cn id=47 lang=python3
#
# [47] 全排列 II
#
# https://leetcode-cn.com/problems/permutations-ii/description/
#
# algorithms
# Medium (59.58%)
# Likes: 371
# Dislikes: 0
# Total Accepted: 78.7K
# Total Submissions: 132.1K
# Testcase Example: '[1,1,2]'... | 3.515625 | 4 |
testing/run-tests.py | 8enmann/blobfile | 21 | 16228 | <gh_stars>10-100
import subprocess as sp
import sys
sp.run(["pip", "install", "-e", "."], check=True)
sp.run(["pytest", "blobfile"] + sys.argv[1:], check=True)
| 1.320313 | 1 |
examples/Components/collision/PrimitiveCreation.py | sofa-framework/issofa | 0 | 16229 | import Sofa
import random
from cmath import *
############################################################################################
# this is a PythonScriptController example script
############################################################################################
###################################... | 2.578125 | 3 |
examples/tensorboard/nested.py | dwolfschlaeger/guildai | 694 | 16230 | <filename>examples/tensorboard/nested.py
import tensorboardX
with tensorboardX.SummaryWriter("foo") as w:
w.add_scalar("a", 1.0, 1)
w.add_scalar("a", 2.0, 2)
with tensorboardX.SummaryWriter("foo/bar") as w:
w.add_scalar("a", 3.0, 3)
w.add_scalar("a", 4.0, 4)
with tensorboardX.SummaryWriter("foo/bar/b... | 2.328125 | 2 |
cobalt/__init__.py | NicolasDenoyelle/cobalt | 0 | 16231 | ###############################################################################
# Copyright 2020 UChicago Argonne, LLC.
# (c.f. AUTHORS, LICENSE)
# For more info, see https://xgitlab.cels.anl.gov/argo/cobalt-python-wrapper
# SPDX-License-Identifier: BSD-3-Clause
#########################################################... | 1.734375 | 2 |
anand.py | kyclark/py-grepper | 0 | 16232 | <gh_stars>0
#!/usr/bin/env python3
import os
orderNumbers = open("orders.txt", "r") #Order numbers to match
#Network path to a directory of files that has full details of the order
directoryEntries = os.scandir("")
outputFile = open("matchedData.dat", "w")
for entry in directoryEntries:
print("Currently parsin... | 3.234375 | 3 |
tests/test_manager.py | Vizzuality/cog_worker | 24 | 16233 | import pytest
import rasterio as rio
from rasterio.io import DatasetWriter
from cog_worker import Manager
from rasterio import MemoryFile, crs
TEST_COG = "tests/roads_cog.tif"
@pytest.fixture
def molleweide_manager():
return Manager(
proj="+proj=moll",
scale=50000,
)
@pytest.fixture
def sam... | 1.882813 | 2 |
CLIP/experiments/tagger/main_binary.py | ASAPP-H/clip2 | 0 | 16234 | from train import train_model
from utils import *
import os
import sys
pwd = os.environ.get('CLIP_DIR')
DATA_DIR = "%s/data/processed/" % pwd
exp_name = "non_multilabel"
run_name = "sentence_structurel_with_crf"
train_file_name = "MIMIC_train_binary.csv"
dev_file_name = "MIMIC_val_binary.csv"
test_file_name = "test_b... | 2.4375 | 2 |
persons/urls.py | nhieckqo/lei | 0 | 16235 | from django.urls import path
from . import views
app_name = 'persons'
urlpatterns = [
path('', views.PersonsTableView.as_view(),name='persons_list'),
path('persons_details/<int:pk>',views.PersonsUpdateView.as_view(),name='persons_details_edit'),
path('persons_details/create',views.PersonsCreateView.as_vie... | 1.8125 | 2 |
logxs/__version__.py | minlaxz/logxs | 0 | 16236 | <filename>logxs/__version__.py
__title__ = 'logxs'
__description__ = 'Replacing with build-in `print` with nice formatting.'
__url__ = 'https://github.com/minlaxz/logxs'
__version__ = '0.3.2'
__author__ = '<NAME>'
__author_email__ = '<EMAIL>'
__license__ = 'MIT' | 1.023438 | 1 |
src/PyMud/Systems/system.py | NichCritic/pymud | 0 | 16237 | <reponame>NichCritic/pymud
import time
class System(object):
manditory = []
optional = []
handles = []
def __init__(self, node_factory):
self.node_factory = node_factory
def process(self):
for node in self.get_nodes():
# print(f"{self.__class__.__name__} system got me... | 2.671875 | 3 |
hytra/plugins/transition_feature_vector_construction/transition_feature_subtraction.py | m-novikov/hytra | 0 | 16238 | from hytra.pluginsystem import transition_feature_vector_construction_plugin
import numpy as np
from compiler.ast import flatten
class TransitionFeaturesSubtraction(
transition_feature_vector_construction_plugin.TransitionFeatureVectorConstructionPlugin
):
"""
Computes the subtraction of features in the f... | 2.484375 | 2 |
sprites/player.py | hectorpadin1/FICGames | 0 | 16239 | <filename>sprites/player.py
from matplotlib.style import available
import pygame as pg
from sprites.character import Character
from pygame.math import Vector2
from settings import *
from math import cos, pi
from control import Controler
from sprites.gun import MachineGun, Pistol, Rifle
from managers.resourcemanager imp... | 2.921875 | 3 |
yocto/poky/bitbake/lib/bb/ui/crumbs/__init__.py | jxtxinbing/ops-build | 16 | 16240 | #
# Gtk+ UI pieces for BitBake
#
# Copyright (C) 2006-2007 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
... | 0.839844 | 1 |
mytardisbf/migrations/0001_initial_data.py | keithschulze/mytardisbf | 2 | 16241 | <filename>mytardisbf/migrations/0001_initial_data.py
# -*- coding: utf-8 -*-
from django.db import migrations
from tardis.tardis_portal.models import (
Schema,
ParameterName,
DatafileParameter,
DatafileParameterSet
)
from mytardisbf.apps import (
OMESCHEMA,
BFSCHEMA
)
def forward_func(apps, sc... | 2.171875 | 2 |
ipmanagement/models.py | smilelhong/ip_manage | 0 | 16242 | # -*- coding: utf-8 -*-
from django.db import models
from datetime import datetime
# Create your models here.
class IP_Address(models.Model):
ip = models.GenericIPAddressField(verbose_name=u"IP地址")
gateway = models.GenericIPAddressField(verbose_name=u"网关")
network = models.GenericIPAddressField(verbose_name... | 2.125 | 2 |
tests/scripts/thread-cert/border_router/MATN_05_ReregistrationToSameMulticastGroup.py | kkasperczyk-no/sdk-openthread | 0 | 16243 | <filename>tests/scripts/thread-cert/border_router/MATN_05_ReregistrationToSameMulticastGroup.py
#!/usr/bin/env python3
#
# Copyright (c) 2021, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followi... | 1.5 | 2 |
senseye_cameras/input/camera_pylon.py | senseye-inc/senseye-cameras | 5 | 16244 | import time
import logging
try:
from pypylon import pylon
except:
pylon = None
from . input import Input
log = logging.getLogger(__name__)
# writes the framenumber to the 8-11 bytes of the image as a big-endian set of octets
def encode_framenumber(np_image, n):
for i in range(4):
np_image[0][i+7]... | 2.5625 | 3 |
vise/tests/util/phonopy/test_phonopy_input.py | kumagai-group/vise | 16 | 16245 | # -*- coding: utf-8 -*-
# Copyright (c) 2021. Distributed under the terms of the MIT License.
from phonopy.interface.calculator import read_crystal_structure
from phonopy.structure.atoms import PhonopyAtoms
from vise.util.phonopy.phonopy_input import structure_to_phonopy_atoms
import numpy as np
def assert_same_phon... | 2.375 | 2 |
2020/day15.py | andypymont/adventofcode | 0 | 16246 | """
2020 Day 15
https://adventofcode.com/2020/day/15
"""
from collections import deque
from typing import Dict, Iterable, Optional
import aocd # type: ignore
class ElfMemoryGame:
def __init__(self, starting_numbers: Iterable[int]):
self.appearances: Dict[int, deque[int]] = {}
self.length = 0
... | 3.734375 | 4 |
src/spring-cloud/azext_spring_cloud/_validators_enterprise.py | SanyaKochhar/azure-cli-extensions | 2 | 16247 | <gh_stars>1-10
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------... | 2 | 2 |
fluentql/function.py | RaduG/fluentql | 4 | 16248 | <reponame>RaduG/fluentql
from typing import Any, TypeVar, Union
from types import MethodType, FunctionType
from .base_types import BooleanType, Constant, StringType, Collection, Referenceable
from .type_checking import TypeChecker
AnyArgs = TypeVar("AnyArgs")
NoArgs = TypeVar("NoArgs")
VarArgs = TypeVar("VarArgs")
T... | 2.46875 | 2 |
gqn_v2/gqn_predictor.py | goodmattg/tf-gqn | 0 | 16249 | <reponame>goodmattg/tf-gqn<filename>gqn_v2/gqn_predictor.py
"""
Contains a canned predictor for a GQN.
"""
import os
import json
import numpy as np
import tensorflow as tf
from .gqn_graph import gqn_draw
from .gqn_params import create_gqn_config
def _normalize_pose(pose):
"""
Converts a camera pose into the GQ... | 2.359375 | 2 |
mamba/post_solve_handling.py | xhochy/mamba | 0 | 16250 | # -*- coding: utf-8 -*-
# Copyright (C) 2019, QuantStack
# SPDX-License-Identifier: BSD-3-Clause
from conda.base.constants import DepsModifier, UpdateModifier
from conda._vendor.boltons.setutils import IndexedSet
from conda.core.prefix_data import PrefixData
from conda.models.prefix_graph import PrefixGraph
from conda... | 1.882813 | 2 |
Young Physicist.py | techonair/Codeforces | 0 | 16251 | num = input()
lucky = 0
for i in num:
if i == '4' or i == '7':
lucky += 1
counter = 0
for c in str(lucky):
if c == '4' or c == '7':
counter += 1
if counter == len(str(lucky)):
print("YES")
else:
print("NO")
| 3.65625 | 4 |
snakebids/utils/__init__.py | tkkuehn/snakebids | 0 | 16252 | from snakebids.utils.output import (
Mode,
get_time_hash,
prepare_output,
retrofit_output,
write_config_file,
write_output_mode,
)
from snakebids.utils.snakemake_io import (
glob_wildcards,
regex,
update_wildcard_constraints,
)
__all__ = [
"Mode",
"get_time_hash",
"glob_... | 1.226563 | 1 |
examples/custom_renderer/custom_renderer.py | victorbenichoux/vizno | 5 | 16253 | <reponame>victorbenichoux/vizno<gh_stars>1-10
import pydantic
from vizno.renderers import ContentConfiguration, render
from vizno.report import Report
class CustomObject(pydantic.BaseModel):
parameter: int
class CustomRenderConfiguration(ContentConfiguration):
parameter: int
@render.register
def _(obj: C... | 2.375 | 2 |
coregent/net/core.py | landoffire/coregent | 1 | 16254 | import abc
import collections.abc
import socket
__all__ = ['get_socket_type', 'get_server_socket', 'get_client_socket',
'SocketReader', 'SocketWriter', 'JSONReader', 'JSONWriter']
def get_socket_type(host=None, ip_type=None):
if ip_type is not None:
return ip_type
if host and ':' in host... | 2.921875 | 3 |
hackdayproject/urls.py | alstn2468/Naver_Campus_Hackday_Project | 1 | 16255 | <gh_stars>1-10
from django.urls import path, include
from django.contrib import admin
import hackdayproject.main.urls as main_urls
import hackdayproject.repo.urls as repo_urls
urlpatterns = [
path('admin/', admin.site.urls),
path('oauth/', include('social_django.urls', namespace='social')),
path('', includ... | 1.609375 | 2 |
tests/test_ciftify_recon_all.py | lgrennan/ciftify | 0 | 16256 | #!/usr/bin/env python
import unittest
import logging
import importlib
import copy
import os
from mock import patch
from nose.tools import raises
logging.disable(logging.CRITICAL)
ciftify_recon_all = importlib.import_module('ciftify.bin.ciftify_recon_all')
class ConvertFreesurferSurface(unittest.TestCase):
meshe... | 2.15625 | 2 |
Wrangle OSM Dataset.py | Boykai/Project-3-Wrangle-OpenStreetMap-Dataset | 1 | 16257 | <reponame>Boykai/Project-3-Wrangle-OpenStreetMap-Dataset
# -*- coding: utf-8 -*-
'''
Created on Tue Jan 17 16:19:36 2017
@author: Boykai
'''
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import xml.etree.cElementTree as ET # Use cElementTree or lxml if too slow
from collections import defaultdict
import re
import p... | 2.34375 | 2 |
Wrapping/Python/vtkmodules/__init__.py | cads-build/VTK | 1 | 16258 | <reponame>cads-build/VTK
r"""
Currently, this package is experimental and may change in the future.
"""
from __future__ import absolute_import
#------------------------------------------------------------------------------
# this little trick is for static builds of VTK. In such builds, if
# the user imports this Pyt... | 1.671875 | 2 |
Financely/basic_app/models.py | Frostday/Financely | 8 | 16259 | <filename>Financely/basic_app/models.py
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Client(models.Model):
user = models.OneToOneField(User,null=True,blank= True,on_delete=models.CASCADE)
name = models.CharField(max_length=100, null=True)
# def _... | 2.546875 | 3 |
lims/models/shipping.py | razorlabs/BRIMS-backend | 1 | 16260 | from django.db import models
"""
ShipmentModels have a one to many relationship with boxes and aliquot
Aliquot and Box foreign keys to a ShipmentModel determine manifest contents
for shipping purposes (resolved in schema return for manifest view)
"""
class ShipmentModel(models.Model):
carrier = model... | 2.53125 | 3 |
part-2/2-iterators/Example-consuming_iterators_manually.py | boconlonton/python-deep-dive | 0 | 16261 | """
Consuming Iterator manually
"""
from collections import namedtuple
def cast(data_type, value):
"""Cast the value into a correct data type"""
if data_type == 'DOUBLE':
return float(value)
elif data_type == 'STRING':
return str(value)
elif data_type == 'INT':
return int(value... | 3.71875 | 4 |
instance_server/services/startpage.py | Geierhaas/developer-observatory | 4 | 16262 | <filename>instance_server/services/startpage.py
#! Copyright (C) 2017 <NAME>
#!
#! This software may be modified and distributed under the terms
#! of the MIT license. See the LICENSE file for details.
from flask import Flask, redirect, request, make_response
from shutil import copyfile
import json
import req... | 2.46875 | 2 |
utils/linalg.py | cimat-ris/TrajectoryInference | 6 | 16263 | import numpy as np
import math
import logging
from termcolor import colored
# Check a matrix for: negative eigenvalues, asymmetry and negative diagonal values
def positive_definite(M,epsilon = 0.000001,verbose=False):
# Symmetrization
Mt = np.transpose(M)
M = (M + Mt)/2
eigenvalues = np.linalg.eigvals(... | 3.28125 | 3 |
problemsets/Codeforces/Python/A1020.py | juarezpaulino/coderemite | 0 | 16264 | """
*
* Author: <NAME>(coderemite)
* Email: <EMAIL>
*
"""
I=lambda:map(int,input().split())
f=abs
n,_,a,b,k=I()
while k:
p,q,u,v=I()
P=[a,b]
if a<=q<=b:P+=[q]
if a<=v<=b:P+=[v]
print([min(f(q-x)+f(v-x)for x in P)+f(p-u),f(q-v)][p==u])
k-=1 | 2.71875 | 3 |
get_tweet.py | Na27i/tweet_generator | 0 | 16265 | import json
import sys
import pandas
args = sys.argv
if len(args) == 1 :
import main as settings
else :
import sub as settings
from requests_oauthlib import OAuth1Session
CK = settings.CONSUMER_KEY
CS = settings.CONSUMER_SECRET
AT = settings.ACCESS_TOKEN
ATS = settings.ACCESS_TOKEN_SECRET
t... | 2.953125 | 3 |
idact/detail/config/validation/validate_scratch.py | intdata-bsc/idact | 5 | 16266 | """This module contains a function for validating a scratch config entry."""
import re
from idact.detail.config.validation.validation_error_message import \
validation_error_message
VALID_SCRATCH_DESCRIPTION = 'Non-empty absolute path, or environment' \
' variable name.'
VALID_SCRATC... | 2.875 | 3 |
paramak/parametric_components/blanket_fp.py | zmarkan/paramak | 0 | 16267 |
import warnings
from typing import Callable, List, Optional, Union
import mpmath
import numpy as np
import paramak
import sympy as sp
from paramak import RotateMixedShape, diff_between_angles
from paramak.parametric_components.tokamak_plasma_plasmaboundaries import \
PlasmaBoundaries
from scipy.interpolate import... | 2.609375 | 3 |
3.7.1/solution.py | luxnlex/stepic-python | 1 | 16268 | s=str(input())
a=[]
for i in range(len(s)):
si=s[i]
a.append(si)
b=[]
n=str(input())
for j in range(len(n)):
sj=n[j]
b.append(sj)
p={}
for pi in range(len(s)):
key=s[pi]
p[key]=0
j1=0
for i in range(0,len(a)):
key=a[i]
while j1<len(b):
bj=b[0]
if key in p:
p[k... | 2.984375 | 3 |
airbyte-integrations/connectors/source-plaid/source_plaid/source.py | OTRI-Unipd/OTRI-airbyte | 2 | 16269 | #
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import datetime
import json
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Union
import plaid
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources import AbstractSou... | 2.046875 | 2 |
demo/demo.py | taewhankim/DeepHRnet | 0 | 16270 | <reponame>taewhankim/DeepHRnet
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import csv
import os
import shutil
from PIL import Image
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torc... | 1.726563 | 2 |
feemodeldata/plotting/plotwaits.py | bitcoinfees/bitcoin-feemodel-data | 2 | 16271 | <reponame>bitcoinfees/bitcoin-feemodel-data
from __future__ import division
import sqlite3
from bisect import bisect_left
import plotly.plotly as py
from plotly.graph_objs import Scatter, Figure, Layout, Data, YAxis, XAxis
from feemodel.util import DataSample
from feemodel.app.predict import PVALS_DBFILE
from feemo... | 2.46875 | 2 |
utils/pytorch_utils.py | shoegazerstella/BTC-ISMIR19 | 1 | 16272 |
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import os
import math
from utils import logger
use_cuda = torch.cuda.is_available()
# utility
def to_var(x, dtype=None):
if type(x) is np.ndarray:
x = torch.from_numpy(x)
elif type(x) is list:
... | 2.515625 | 3 |
ecosante/users/schemas/__init__.py | betagouv/recosante-api | 3 | 16273 | from dataclasses import field
from marshmallow import Schema, ValidationError, post_load, schema
from marshmallow.validate import OneOf, Length
from marshmallow.fields import Bool, Str, List, Nested, Email
from flask_rebar import ResponseSchema, RequestSchema, errors
from ecosante.inscription.models import Inscription
... | 2.171875 | 2 |
Course 01 - Getting Started with Python/Extra Studies/Basics/ex022.py | marcoshsq/python_practical_exercises | 9 | 16274 | <reponame>marcoshsq/python_practical_exercises
import math
# Exercise 017: Right Triangle
"""Write a program that reads the length of the opposite side and the adjacent side of a right triangle.
Calculate and display the length of the hypotenuse."""
# To do this we will use the Pythagorean theorem: a^2 = b^2 + c^2
#... | 4.34375 | 4 |
annuaire/commands/__init__.py | djacomy/layer-annuaire | 0 | 16275 | <reponame>djacomy/layer-annuaire<filename>annuaire/commands/__init__.py
"""Package groups the different commands modules."""
from annuaire.commands import download, import_lawyers
__all__ = [download, import_lawyers]
| 1.65625 | 2 |
eventsourcing/application/actors.py | vladimirnani/eventsourcing | 1 | 16276 | import logging
from thespian.actors import *
from eventsourcing.application.process import ProcessApplication, Prompt
from eventsourcing.application.system import System, SystemRunner
from eventsourcing.domain.model.events import subscribe, unsubscribe
from eventsourcing.interface.notificationlog import RecordManager... | 2.1875 | 2 |
sudoku/board.py | DariaMinieieva/sudoku_project | 5 | 16277 | <reponame>DariaMinieieva/sudoku_project
"""This module implements backtracking algorithm to solve sudoku."""
class Board:
"""
Class for sudoku board representation.
"""
NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9]
def __init__(self, board):
"""
Create a new board.
"""
sel... | 4.0625 | 4 |
openfl/component/ca/ca.py | saransh09/openfl-1 | 0 | 16278 | <reponame>saransh09/openfl-1<filename>openfl/component/ca/ca.py<gh_stars>0
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Aggregator module."""
import base64
import json
import os
import platform
import shutil
import signal
import subprocess
import time
import urllib.request
from... | 2.09375 | 2 |
bin/optimization/cosmo_optimizer_hod_only.py | mclaughlin6464/pearce | 0 | 16279 | <reponame>mclaughlin6464/pearce
from pearce.emulator import OriginalRecipe, ExtraCrispy
import numpy as np
training_file = '/home/users/swmclau2/scratch/PearceRedMagicWpCosmo.hdf5'
em_method = 'gp'
split_method = 'random'
a = 1.0
z = 1.0/a - 1.0
fixed_params = {'z':z, 'cosmo': 1}#, 'r':0.18477483}
n_leaves, n_over... | 2 | 2 |
tests/test_xmllint_map_html.py | sthagen/python-xmllint_map_html | 0 | 16280 | <reponame>sthagen/python-xmllint_map_html<filename>tests/test_xmllint_map_html.py
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring,unused-import,reimported
import json
import pytest # type: ignore
import xmllint_map_html.xmllint_map_html as xmh
def test_parse_ok_minimal():
job = ['[]']
parser = x... | 1.9375 | 2 |
apps/transmissions/views/transmissions.py | felipebarraza6/amamaule | 0 | 16281 | from rest_framework import mixins, viewsets, status
from rest_framework.permissions import (
AllowAny,
IsAuthenticated
)
from apps.transmissions.models import Transmission
from apps.transmissions.serializers import TransmissionModelSerializer, CommentModelserializer
from django_filters import rest_framework a... | 2.015625 | 2 |
amstramdam/events/game.py | felix-martel/multigeo | 3 | 16282 | <gh_stars>1-10
from amstramdam import app, socketio, timers, manager
from flask import session
from flask_socketio import emit
from .types import GameEndNotification, GameEndPayload
from .utils import safe_cancel, wait_and_run
from ..game.types import GameName, Coordinates
def terminate_game(game_name: GameName) -> ... | 2.328125 | 2 |
src/glod/unittests/in_out/test_statement_csv.py | gordon-elliott/glod | 0 | 16283 | <gh_stars>0
__copyright__ = 'Copyright(c) <NAME> 2017'
"""
"""
from datetime import date
from decimal import Decimal
from io import StringIO
from unittest import TestCase
from glod.model.statement_item import StatementItem
from glod.model.account import Account
from glod.in_out.statement_item import statement_item... | 2.5 | 2 |
ExifExtractor.py | MalwareJunkie/PythonScripts | 0 | 16284 | <reponame>MalwareJunkie/PythonScripts
# Tested with Python 3.6
# Install Pillow: pip install pillow
""" This script extracts exif data from JPEG images """
from PIL import Image
from PIL.ExifTags import TAGS
import sys
def getExif(img):
res = {}
exif = img._getexif()
if exif == None:
p... | 2.921875 | 3 |
nbgrader/nbgraderformat/__init__.py | FrattisUC/nbgrader | 2 | 16285 | SCHEMA_VERSION = 2
from .common import ValidationError, SchemaMismatchError
from .v2 import MetadataValidatorV2 as MetadataValidator
from .v2 import read_v2 as read, write_v2 as write
from .v2 import reads_v2 as reads, writes_v2 as writes
| 1.046875 | 1 |
testFiles/test_script.py | Janga-Lab/Penguin-1 | 0 | 16286 | import h5py
from ont_fast5_api.conversion_tools import multi_to_single_fast5
from ont_fast5_api import fast5_interface
import SequenceGenerator.align as align
import SignalExtractor.Nanopolish as events
from testFiles.test_commands import *
import os, sys
import subprocess
#todo get basecall data
def bas... | 2.34375 | 2 |
channels/italiaserie.py | sodicarus/channels | 0 | 16287 | <reponame>sodicarus/channels
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand-pureita.- XBMC Plugin
# Canale italiaserie
# http://www.mimediacenter.info/foro/viewtopic.php?f=36&t=7808
# ------------------------------------------------------------
import re
from c... | 2.046875 | 2 |
setup.py | jeffleary00/greenery | 0 | 16288 | from setuptools import setup
setup(
name='potnanny-api',
version='0.2.6',
packages=['potnanny_api'],
include_package_data=True,
description='Part of the Potnanny greenhouse controller application. Contains Flask REST API and basic web interface.',
author='<NAME>',
author_email='<EMAIL>',
... | 1.40625 | 1 |
cpp-linux/Release/envcpp.py | thu-media/Comyco | 40 | 16289 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.0
#
# 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 as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | 1.851563 | 2 |
eda_rf.py | lel23/Student-Performance-Prediction | 1 | 16290 | <filename>eda_rf.py
"""
Final Project
EDA
"""
import pandas as pd
import matplotlib.pyplot as plt
from mlxtend.plotting import scatterplotmatrix
import numpy as np
import seaborn as sns
from imblearn.over_sampling import SMOTE
from sklearn.utils import resample
from mlxtend.plotting import heatmap
from sklearn.ensemb... | 2.78125 | 3 |
feastruct/fea/utils.py | geosharma/feastruct | 37 | 16291 | <gh_stars>10-100
import numpy as np
def gauss_points(el_type, n):
"""Returns the Gaussian weights and locations for *n* point Gaussian integration of a finite
element. Refer to xxx for a list of the element types.
:param string el_type: String describing the element type
:param int n: Number of Gauss... | 3.109375 | 3 |
webscrap.py | ircykk/webscrap | 0 | 16292 | <filename>webscrap.py
import requests
import time
import argparse
import sys
import os
from bs4 import BeautifulSoup
from urllib.parse import urlparse
def is_url(url):
try:
result = urlparse(url)
return all([result.scheme, result.netloc])
except ValueError:
return False
def fetch_urls(page):
r = requ... | 3.078125 | 3 |
lib/recipetool/shift_oelint_adv/rule_base/rule_var_src_uri_checksum.py | shift-left-test/meta-shift | 2 | 16293 | <filename>lib/recipetool/shift_oelint_adv/rule_base/rule_var_src_uri_checksum.py<gh_stars>1-10
from shift_oelint_parser.cls_item import Variable
from shift_oelint_adv.cls_rule import Rule
from shift_oelint_parser.helper_files import get_scr_components
from shift_oelint_parser.parser import INLINE_BLOCK
class VarSRCUr... | 2.328125 | 2 |
verba/apps/auth/backends.py | nhsuk/verba | 0 | 16294 | <reponame>nhsuk/verba<filename>verba/apps/auth/backends.py
from github import User as GitHubUser
from github.auth import get_token
from github.exceptions import AuthValidationError
from . import get_user_model
class VerbaBackend(object):
"""
Django authentication backend which authenticates against the GitHu... | 2.34375 | 2 |
examples/apds9960_color_simpletest.py | tannewt/Adafruit_CircuitPython_APDS9960 | 0 | 16295 | <reponame>tannewt/Adafruit_CircuitPython_APDS9960
import time
import board
import busio
import digitalio
from adafruit_apds9960.apds9960 import APDS9960
from adafruit_apds9960 import colorutility
i2c = busio.I2C(board.SCL, board.SDA)
int_pin = digitalio.DigitalInOut(board.A2)
apds = APDS9960(i2c)
apds.enable_color = T... | 2.921875 | 3 |
abc/abc205/abc205b.py | c-yan/atcoder | 1 | 16296 | N, *A = map(int, open(0).read().split())
A.sort()
for i in range(N):
if i == A[i] - 1:
continue
print('No')
break
else:
print('Yes')
| 3.046875 | 3 |
CPAC/cwas/tests/features/steps/base_cwas.py | Lawreros/C-PAC | 1 | 16297 | <filename>CPAC/cwas/tests/features/steps/base_cwas.py
from behave import *
from hamcrest import assert_that, is_not, greater_than
import numpy as np
import nibabel as nib
import rpy2.robjects as robjects
from rpy2.robjects.numpy2ri import numpy2ri
from rpy2.robjects.packages import importr
robjects.conversion.py2ri = ... | 2.265625 | 2 |
Analysis/CardioVascularLab/ExVivo/exvivo.py | sassystacks/TissueMechanicsLab | 0 | 16298 | <reponame>sassystacks/TissueMechanicsLab
import sys
sys.path.append('..')
from Analyzer.TransitionProperties import ProcessTransitionProperties
from tkinter import *
from tkinter import messagebox, ttk, filedialog
# from tkFileDialog import *
import uniaxanalysis.getproperties as getprops
from uniaxanalysis.plotdata ... | 2.171875 | 2 |
cats/cats.py | BrandtH22/CAT-admin-tool | 1 | 16299 | import click
import aiohttp
import asyncio
import re
import json
from typing import Optional, Tuple, Iterable, Union, List
from blspy import G2Element, AugSchemeMPL
from chia.cmds.wallet_funcs import get_wallet
from chia.rpc.wallet_rpc_client import WalletRpcClient
from chia.util.default_root import DEFAULT_ROOT_PATH... | 1.796875 | 2 |