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 |
|---|---|---|---|---|---|---|
pkg/vtreat/vtreat_impl.py | sthagen/pyvtreat | 1 | 21100 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 12:07:57 2019
@author: johnmount
"""
from abc import ABC
import math
import pprint
import warnings
import numpy
import pandas
import vtreat.util
import vtreat.transform
def ready_data_frame(d):
orig_type = type(d)
if orig_type == numpy.ndarr... | 2.4375 | 2 |
resqs/core/urls.py | UMass-Rescue/moto | 0 | 21101 | <reponame>UMass-Rescue/moto
from __future__ import unicode_literals
from .responses import MotoAPIResponse
url_bases = ["https?://motoapi.amazonaws.com"]
response_instance = MotoAPIResponse()
url_paths = {
"{0}/resqs-api/$": response_instance.dashboard,
"{0}/resqs-api/data.json": response_instance.model_data... | 1.546875 | 2 |
hammer/tracker.py | mizerlou/hammer | 1 | 21102 | import anydbm, os.path, time, bsddb, sys
class MessageTracker:
def __init__(self, tracker_file):
flag = (os.path.exists(tracker_file) and "w") or "c"
#self.tracker = anydbm.open(tracker_file, flag)
self.tracker = bsddb.hashopen(tracker_file, flag)
def close(self):
self.... | 2.359375 | 2 |
code/glove_bot.py | AmanPriyanshu/Bavardez | 1 | 21103 | import random
import torch
import pandas as pd
import numpy as np
from glove_model import get_model
from intent_initializer import read_all_intents, read_all_responses
from GloVe_helper import GloVeLoader
PATH = './config/'
BOT_NAME = 'Bavardez'
def load_bot():
model_details = torch.load(PATH+'model_details_GloVe.pt... | 2.640625 | 3 |
tests/coworks/biz/test_biz_ms.py | sidneyarcidiacono/coworks | 0 | 21104 | <gh_stars>0
import pytest
import requests
from tests.coworks.biz.biz_ms import BizMS
from tests.coworks.tech.test_ms import SimpleMS
class TestClass:
def atest_ms(self, local_server_factory):
tech = SimpleMS()
with pytest.raises(Exception) as pytest_wrapped_e:
@tech.schedule('rate(1... | 2.25 | 2 |
d3rlpy/iterators/random_iterator.py | YangRui2015/d3rlpy | 1 | 21105 | <gh_stars>1-10
from typing import List, cast
import numpy as np
from ..dataset import Episode, Transition
from .base import TransitionIterator
class RandomIterator(TransitionIterator):
_n_samples_per_epoch: int
_index: int
def __init__(
self,
episodes: List[Episode],
batch_size... | 2.375 | 2 |
src/logger.py | Electronya/rc-mission-operator | 0 | 21106 | <gh_stars>0
import logging
import os
def initLogger() -> object:
"""
Initialize the logger.
"""
logger_level = logging.INFO
if 'APP_ENV' in os.environ:
if os.environ['APP_ENV'] == 'dev':
logger_level = logging.DEBUG
logging.basicConfig(level=logger_level,
... | 2.609375 | 3 |
Photo.py | cpt-majkel/hashhash | 0 | 21107 | class Photo(object):
def __init__(self, photo_id: int, orientation: str, number_of_tags: int, tags: set):
self.id = photo_id
self.orientation = orientation
self.number_of_tags = number_of_tags
self.tags = tags
self.is_vertical = orientation == 'V'
self.is_horizontal =... | 3.25 | 3 |
learn_big_data_on_aws/config.py | MacHu-GWU/learn_big_data_on_aws-project | 0 | 21108 | <filename>learn_big_data_on_aws/config.py
# -*- coding: utf-8 -*-
from s3pathlib import S3Path
class Config:
aws_profile = "aws_data_lab_sanhe"
aws_region = "us-east-2"
# where you store data, artifacts
bucket = "aws-data-lab-sanhe-for-everything-us-east-2"
# s3 folder for data lake
dataset_p... | 1.898438 | 2 |
tests/test_plotter_utils.py | natter1/GEDFReader | 0 | 21109 | """
This file contains tests for plotter_utils.py.
@author: <NAME>
"""
import matplotlib.pyplot as plt
import numpy as np
import pytest
from matplotlib.figure import Figure
from gdef_reporter.plotter_styles import get_plotter_style_histogram
from gdef_reporter.plotter_utils import plot_to_ax, create_plot, plot_z_hist... | 2.40625 | 2 |
eahub/profiles/tests/test_tags_api.py | walambert/eahub.org | 36 | 21110 | <gh_stars>10-100
from typing import Tuple
from rest_framework.test import APITestCase
from eahub.profiles.models import Profile, ProfileTag, ProfileTagTypeEnum
from eahub.tests.cases import EAHubTestCase
class TagsApiTestCase(EAHubTestCase, APITestCase):
def test_creation(self):
profile, _, _, _ = self.... | 2.078125 | 2 |
Task1/chapter14.py | shkhaider2015/AI_Lab_Task | 0 | 21111 | <filename>Task1/chapter14.py<gh_stars>0
# addition will takes place after multiplication and addition
num1 = 1 + 4 * 3 / 2;
# same as 5 * 3 /2
num2 = (1 + 4) * 3 / 2;
# same as 1+12/2
num3 = 1 + (4 * 3) / 2;
print("python follow precedence rules");
# this should produce 7.5
print(num1);
print(num2);
print(num3); | 3.9375 | 4 |
cosypose/simulator/__init__.py | ompugao/cosypose | 202 | 21112 | <filename>cosypose/simulator/__init__.py
from .body import Body
from .camera import Camera
from .base_scene import BaseScene
from .caching import BodyCache, TextureCache
from .textures import apply_random_textures
| 1.265625 | 1 |
python/scorecard/Config.py | opme/SurgeonScorecard | 6 | 21113 | import os
import sys
import configparser
class Config:
def __init__(self):
pass
#
# a simple function to read an array of configuration files into a config object
#
def read_config(self, cfg_files):
if(cfg_files != None):
config = configparser.RawConfigParser()
#... | 2.734375 | 3 |
message_passing_nn/utils/loss_function/loss_functions.py | mathisi-ai/message-passing-neural-network | 0 | 21114 | <reponame>mathisi-ai/message-passing-neural-network<filename>message_passing_nn/utils/loss_function/loss_functions.py
from torch import nn
loss_functions = {
"MSE": nn.MSELoss,
"MSEPenalty": nn.MSELoss,
"L1": nn.L1Loss,
"CrossEntropy": nn.CrossEntropyLoss,
"CTC": nn.CTCLoss,
"NLL": nn.NLLLoss,
... | 1.9375 | 2 |
ex15.py | phyupyarko/python-exercises | 0 | 21115 | from sys import argv
script, filename=argv
txt = open(filename)
print(f"Here's your file {filename}:")
print(txt.read())
print("Type the filename again:")
file_again = input("> ")
txt_again = open (file_again)
print(txt_again.read())
| 3.75 | 4 |
samples/vsphere/vcenter/setup/datacenter.py | restapicoding/VMware-SDK | 589 | 21116 | <gh_stars>100-1000
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2016-2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITION... | 2.34375 | 2 |
chesstab/samples/chessboard.py | RogerMarsh/chesstab | 0 | 21117 | <reponame>RogerMarsh/chesstab
# chessboard.py
# Copyright 2008 <NAME>
# Licence: See LICENCE (BSD licence)
"""Demonstrate chess board class and methods to draw position on board."""
if __name__ == "__main__":
import tkinter
from pgn_read.core.piece import Piece
from pgn_read.core.constants import (
... | 2.796875 | 3 |
fruit.py | mattjraives/citrus | 0 | 21118 | <filename>fruit.py
class Fruit:
def __init__(self,name,parents):
self.name = name
self.parents = parents
self.children = []
self.family = []
self.siblings = []
self.node = None ## Link to node object in graph
def find_children(self,basket): # basket is a list of Fruit objects
for fruit i... | 3.71875 | 4 |
Pandas/8_GroupingAndAggregating .py | ErfanRasti/PythonCodes | 1 | 21119 | # %%
"""
Let's get familiar with Grouping and Aggregating.
Aggregating means combining multiple pieces of data into a single result.
Mean, median or the mod are aggregating functions.
"""
import pandas as pd
# %%
df = pd.read_csv(
"developer_survey_2019/survey_results_public.csv", index_col="Respondent")... | 4.25 | 4 |
code/cantera_tools.py | goldmanm/RMG_isotopes_paper_data | 0 | 21120 | <gh_stars>0
import numpy as np
import pandas as pd
import re
import warnings
import copy
import cantera as ct
def run_simulation(solution, times, conditions=None,
condition_type = 'adiabatic-constant-volume',
output_species = True,
output_reactions = ... | 3.109375 | 3 |
chariquisitor.py | strycore/chariquisitor | 1 | 21121 | <filename>chariquisitor.py
import json
from collections import defaultdict
SEGMENTS = ['workings', 'shinies', 'controls', 'fun']
REVIEWERS = ['venn', 'jordan', 'pedro']
def iter_charis():
with open('charis.json') as charis_file:
charis = json.load(charis_file)
for chari in charis:
if not ch... | 2.890625 | 3 |
dense_main.py | Ale-Ba2lero/CNN-FromScratch | 1 | 21122 | import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import minmax_scale
import matplotlib.pyplot as plt
from model.loss import CategoricalCrossEntropy
from model.layers.dense import Dense
from model.layers.relu import LeakyReLU
from model.layers.softmax import Softmax
fro... | 3.03125 | 3 |
Tools/Scripts/webkitpy/common/interrupt_debugging.py | jacadcaps/webkitty | 6 | 21123 | # Copyright (C) 2019 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | 1.734375 | 2 |
django_watermark_images/items/migrations/0001_initial.py | abarto/django-watermark-images | 11 | 21124 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-10 16:15
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
import items.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | 1.625 | 2 |
cadnano/views/documentwindow.py | mctrinh/cadnano2.5 | 1 | 21125 | from PyQt5.QtCore import Qt
from PyQt5.QtCore import QSettings
from PyQt5.QtCore import QPoint, QSize
from PyQt5.QtWidgets import QGraphicsScene
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QGraphicsItem
from PyQt5.QtWidgets import QAction, QApplication, QWidget
from cadnano import app
from cad... | 1.976563 | 2 |
uhd_restpy/testplatform/sessions/ixnetwork/topology/ospfv3_c029fd7cd4a9e9897b7b4e4547458751.py | Vibaswan/ixnetwork_restpy | 0 | 21126 | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | 1.765625 | 2 |
train/loss/mss_loss.py | jdasam/ddsp-pytorch | 88 | 21127 | <reponame>jdasam/ddsp-pytorch
"""
Implementation of Multi-Scale Spectral Loss as described in DDSP,
which is originally suggested in NSF (Wang et al., 2019)
"""
import torch
import torch.nn as nn
import torchaudio
import torch.nn.functional as F
class SSSLoss(nn.Module):
"""
Single-scale Spectral Loss.
... | 2.4375 | 2 |
tests/test_triton_server.py | jishminor/model_analyzer | 0 | 21128 | <filename>tests/test_triton_server.py<gh_stars>0
# Copyright (c) 2020-2021, NVIDIA CORPORATION. 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.... | 1.96875 | 2 |
modules/help_urls/help_urls.py | xochilt/cousebuilder | 0 | 21129 | <gh_stars>0
# Copyright 2015 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/licenses/LICENSE-2.0
#
# Unless required by applic... | 2.15625 | 2 |
imm/samplers/noncollapsed.py | tscholak/imm | 9 | 21130 | <filename>imm/samplers/noncollapsed.py
# -*- coding: utf-8 -*-
"""
Non-collapsed samplers.
"""
import numpy as np
from .generic import (GenericGibbsSampler, GenericRGMSSampler,
GenericSAMSSampler, GenericSliceSampler)
from ..models import (CollapsedConjugateGaussianMixture,
ConjugateGaussianMixture, ... | 1.96875 | 2 |
api/urls.py | Emmastro/medmer-api | 0 | 21131 | from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('accounts/', include('django.contrib.auth.urls')),
path('', include('home.urls')),
path('admin/', admin.site.urls),
path('registration/medic', include('medic.urls')),
path('registration/patient', include('pa... | 1.6875 | 2 |
src/evolvepy/integrations/__init__.py | EltonCN/evolvepy | 1 | 21132 | <filename>src/evolvepy/integrations/__init__.py
'''
EvolvePy's integrations with other modules.
''' | 0.984375 | 1 |
subdomain.py | ouldevloper/subDomainFinder | 0 | 21133 | import requests
import re
url=input("Enter Url [ex: example.com]: ")
def getSubDomain(url):
url=url.replace("www.","").replace("https://","").replace("http://","")
pattern = "[\w]{1,256}\.[a-zA-Z0-9()]{1,6}"
_l = re.compile(pattern)
if _l.match(url):
response = requests.get(f"https://sonar.omn... | 3.578125 | 4 |
Python/Courses/Python-Tutorials.Telusko/02.Miscellaneous/20.03-File-handling.py | shihab4t/Books-Code | 0 | 21134 | <gh_stars>0
file = open("text.txt", "r")
file2 = open("text2.txt", "w")
for data in file:
file2.write(data)
file.close()
file2.close()
| 3.140625 | 3 |
torch2trt/__init__.py | SnowMasaya/torch2trt | 2 | 21135 | <filename>torch2trt/__init__.py
from .torch2trt import *
from .converters import *
import tensorrt as trt
def load_plugins():
import os
import ctypes
ctypes.CDLL(os.path.join(os.path.dirname(__file__), 'libtorch2trt.so'))
registry = trt.get_plugin_registry()
torch2trt_creators = [c for c in r... | 2.078125 | 2 |
ediel-parser/lib/cli/com.py | sun-labs/ediclue | 3 | 21136 | <filename>ediel-parser/lib/cli/com.py
import os
from lib.EDICommunicator import EDICommunicator
from lib.EDIParser import EDIParser
import lib.cli.tools as tools
from types import SimpleNamespace
def set_args(subparsers):
parser = subparsers.add_parser('com', description='communication between EDI systems')
pa... | 2.28125 | 2 |
04_working_with_list/4_2_animals.py | simonhoch/python_basics | 0 | 21137 | <reponame>simonhoch/python_basics
animals = ['cat', 'dog', 'pig']
for animal in animals :
print (animal + 'would make a great pet.')
print ('All of those animals would makea great pet')
| 4.0625 | 4 |
backend/mytutorials/telegrambot/urls.py | mahmoodDehghan/MyTests | 0 | 21138 | from django.urls import path
from .views import start_bot, end_bot
urlpatterns = [
path('startbot/', start_bot),
path('endbot/', end_bot),
] | 1.421875 | 1 |
tests/performance/cte-arm/tests/csvm_ijcnn1.py | alexbarcelo/dislib | 36 | 21139 | <gh_stars>10-100
import performance
import dislib as ds
from dislib.classification import CascadeSVM
def main():
x_ij, y_ij = ds.load_svmlight_file(
"/fefs/scratch/bsc19/bsc19029/PERFORMANCE/datasets/train",
block_size=(5000, 22), n_features=22, store_sparse=True)
csvm = CascadeSVM(c=10000, ... | 2.21875 | 2 |
py_connect/exceptions.py | iparaskev/py_connect | 5 | 21140 | <reponame>iparaskev/py_connect
"""Exceptions of the library"""
class PyConnectError(Exception):
"""Base class for all exceptions in py_connect."""
class InvalidPowerCombination(PyConnectError):
"""Connection of different power pins."""
class MaxConnectionsError(PyConnectError):
"""Interface has exceed... | 2.625 | 3 |
code/glucocheck/homepage/migrations/0007_auto_20210315_1807.py | kmcgreg5/Glucocheck | 0 | 21141 | <reponame>kmcgreg5/Glucocheck<filename>code/glucocheck/homepage/migrations/0007_auto_20210315_1807.py
# Generated by Django 3.1.7 on 2021-03-15 22:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0006_carbohydrate_glucose_insulin_recording... | 1.726563 | 2 |
models/SnapshotTeam.py | Fa1c0n35/RootTheBoxs | 1 | 21142 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mar 11, 2012
@author: moloch
Copyright 2012 Root the Box
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.a... | 2.28125 | 2 |
src/train.py | DanCh11/virtual-assistant | 0 | 21143 | import json
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from model import NeuralNetwork
from nltk_utils import stem, tokenize, bag_of_words
with open('./data/data.json', 'r') as f:
data = json.load(f)
all_words = []
tags = []
xy = []
for intent... | 2.46875 | 2 |
pythonexercicios/ex101-funcvotacao.py | marroni1103/exercicios-pyton | 0 | 21144 | def voto(num):
from datetime import date
anoatual = date.today().year
idade = anoatual - num
if idade < 16:
return f"Com {idade} anos: NÃO VOTA"
elif 16 <= idade < 18 or idade > 65:
return f'Com {idade} anos: VOTO OPCIONAL'
else:
return f"Com {idade} anos: VOTO OBRIGATORI... | 3.859375 | 4 |
map_objects/tile.py | matteobarbieri/libtcod-tutorial | 1 | 21145 | import random
import libtcodpy as libtcod
GRAY_PALETTE = [
# libtcod.Color(242, 242, 242),
libtcod.Color(204, 204, 204),
libtcod.Color(165, 165, 165),
libtcod.Color(127, 127, 127),
libtcod.Color(89, 89, 89),
]
class Tile:
"""
A tile on a map. It may or may not be blocked, and may or may ... | 3.046875 | 3 |
src/mrnet/utils/reaction.py | hpatel1567/mrnet | 9 | 21146 | <filename>src/mrnet/utils/reaction.py
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from collections import defaultdict
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
from mip import BINARY, CBC, MINIMIZE, Model, xsum
from mrnet.... | 2.8125 | 3 |
test/test_info_api.py | fattureincloud/fattureincloud-python-sdk | 2 | 21147 | """
Fatture in Cloud API v2 - API Reference
Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 400.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol. # noq... | 1.945313 | 2 |
tests/test_year_2018.py | l0pht511/jpholiday | 179 | 21148 | <filename>tests/test_year_2018.py
# coding: utf-8
import datetime
import unittest
import jpholiday
class TestYear2018(unittest.TestCase):
def test_holiday(self):
"""
2018年祝日
"""
self.assertEqual(jpholiday.is_holiday_name(datetime.date(2018, 1, 1)), '元日')
self.assertEqual(j... | 3.5 | 4 |
src/server_3D/API/Rice/miscellaneous/tools.py | robertpardillo/Funnel | 1 | 21149 | <gh_stars>1-10
import numpy
__author__ = 'roberto'
def rad_degrees(type_to, value):
if type_to == 'rad':
value = value*numpy.pi/180
if type_to == 'deg':
value = value*180/numpy.pi
return value | 3 | 3 |
conjur_api/__init__.py | cyberark/conjur-api-python | 1 | 21150 | <gh_stars>1-10
"""
conjur_api
Package containing classes that are responsible for communicating with the Conjur server
"""
__version__ = "0.0.5"
from conjur_api.client import Client
from conjur_api.interface import CredentialsProviderInterface
from conjur_api import models
from conjur_api import errors
from conjur_ap... | 1.195313 | 1 |
examples/test_BoxCutter.py | pompiduskus/pybox2d | 0 | 21151 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# C++ version Copyright (c) 2006-2007 <NAME> http://www.box2d.org
# Python version by <NAME> / sirkne at gmail dot com
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for an... | 1.804688 | 2 |
robot_simulator/grid/positioning.py | darshikaf/toy-robot-simulator | 0 | 21152 | <reponame>darshikaf/toy-robot-simulator
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import math
class Point:
def __init__(self, x: int = 0, y: int = 0):
self.x = x
self.y = y
def __eq__(self, other: object) -> bool:
if isinstance(other, Point):
... | 3.6875 | 4 |
src/utils/zarr_to_netcdf.py | jhkennedy/itslive | 8 | 21153 | """
Script to convert Zarr store to the NetCDF format file.
Usage:
python zarr_to_netcdf.py -i ZarrStoreName -o NetCDFFileName
Convert Zarr data stored in ZarrStoreName to the NetCDF file NetCDFFileName.
"""
import argparse
import timeit
import warnings
import xarray as xr
from itscube_types import Coords, DataVars... | 3.0625 | 3 |
tests/periodicities/Business_Day/Cycle_Business_Day_200_B_24.py | jmabry/pyaf | 0 | 21154 | <gh_stars>0
import pyaf.tests.periodicities.period_test as per
per.buildModel((24 , 'B' , 200));
| 1.4375 | 1 |
conanfile.py | maurodelazeri/conan-cpp-httplib | 0 | 21155 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import os
class CppHttpLibConan(ConanFile):
name = "cpp-httplib"
version = "0.2.1"
url = "https://github.com/zinnion/conan-cpp-httplib"
description = "A single file C++11 header-only HTTP/HTTPS server and client l... | 1.9375 | 2 |
backmarker/api/viewsets/driver_viewset.py | jmp/backmarker | 0 | 21156 | from rest_framework.viewsets import ReadOnlyModelViewSet
from backmarker.api.serializers.driver_serializer import DriverSerializer
from backmarker.models.driver import Driver
class DriverViewSet(ReadOnlyModelViewSet):
queryset = Driver.objects.all()
serializer_class = DriverSerializer
lookup_field = "ref... | 1.9375 | 2 |
shell/response.py | YorkSu/deepgo | 0 | 21157 | <filename>shell/response.py
# -*- coding: utf-8 -*-
"""Response
======
Response Class
"""
from deepgo.core.kernel.popo import VO
class Response(VO):
def __init__(self):
self.code = 0
def json(self):
return self.__dict__
| 2.171875 | 2 |
src/python/pants/option/options_fingerprinter_test.py | bastianwegge/pants | 1,806 | 21158 | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pathlib import Path
import pytest
from pants.option.custom_types import (
DictValueComponent,
ListValueComponent,
UnsetBool,
dict_with_files_option,
dir_option,
... | 1.90625 | 2 |
secondstring.py | Kokouvi/reversorder | 0 | 21159 | <reponame>Kokouvi/reversorder
str = "The quick brown fox jumps over the lazy dog." # initial string
reversed = "".join(reversed(str)) #.join() method merges all of the charactera
print(reversed[0:43:2]) # print the reversed string
| 3.765625 | 4 |
image_extractor.py | IstoVisio/script_image_extractor | 0 | 21160 | import os
import sys
import syglass as sy
from syglass import pyglass
import numpy as np
import tifffile
import subprocess
def extract(projectPath):
project = sy.get_project(projectPath)
head, tail = os.path.split(projectPath)
# Get a dictionary showing the number of blocks in each level
#codebreak()
resolution_... | 2.78125 | 3 |
scaffoldgraph/analysis/enrichment.py | trumanw/ScaffoldGraph | 121 | 21161 | <filename>scaffoldgraph/analysis/enrichment.py
"""
scaffoldgraph.analysis.enrichment
Module contains an implementation of Compound Set Enrichment from the papers:
- Compound Set Enrichment: A Novel Approach to Analysis of Primary HTS Data.
- Mining for bioactive scaffolds with scaffold networks: Improved compound set ... | 2.28125 | 2 |
ejercicio_fichero/ejercicio_fichero1/fichero.py | Ironwilly/python | 0 | 21162 | # Lee el fichero y procésalo de tal manera que sea capaz de mostrar
# la temperatura máxima para una ciudad dada. Esa ciudad la debe poder
# recibir como un argumento de entrada. Si la ciudad no existe, se deberá
# manejar a través de una excepción.
import csv
provincia = input('Diga el nombre de la ciudad: ')
with... | 4.09375 | 4 |
python/brunel/magics.py | Ross1503/Brunel | 306 | 21163 | # Copyright (c) 2015 IBM Corporation and others.
#
# 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... | 2.265625 | 2 |
plugs_newsletter/emails.py | solocompt/plugs-newsletter | 1 | 21164 | """
Plugs Newsletter Emails
"""
from plugs_mail.mail import PlugsMail
class NewsletterSubscribed(PlugsMail):
"""
Email sent to subscriber after newsletter subscription
"""
template = 'NEWSLETTER_SUBSCRIBED'
description = 'Email sent to subscriber after newsletter subscription'
class NewsletterUns... | 2.484375 | 2 |
modules/smsapi/proxy.py | kamilpp/iwm-project | 0 | 21165 | <reponame>kamilpp/iwm-project
# -*- coding: utf-8 -*-
import os
import sys
import mimetypes
from io import BytesIO
try:
from urllib2 import Request, urlopen, URLError
from urllib import urlencode
except ImportError:
from urllib.request import Request, urlopen
from urllib.parse import urlencode
fro... | 2.46875 | 2 |
maverick_api/modules/base/mission/util/srtm/make_dict.py | deodates-dev/UAV-maverick-api | 4 | 21166 | #!/usr/bin/python
import fileinput
import json
url_base = "https://dds.cr.usgs.gov/srtm/version2_1/SRTM3"
regions = [
"Africa",
"Australia",
"Eurasia",
"Islands",
"North_America",
"South_America",
]
srtm_dict = {}
srtm_directory = "srtm.json"
for region in regions:
print("Processing", ... | 3.375 | 3 |
gail/crowd_sim/configs/icra_benchmark/sarl.py | ben-milanko/PyTorch-RL | 0 | 21167 | from configs.icra_benchmark.config import BaseEnvConfig, BasePolicyConfig, BaseTrainConfig, Config
class EnvConfig(BaseEnvConfig):
def __init__(self, debug=False):
super(EnvConfig, self).__init__(debug)
class PolicyConfig(BasePolicyConfig):
def __init__(self, debug=False):
super(PolicyConfig... | 2.234375 | 2 |
backend/bios/apps.py | juanrmv/torre-test | 0 | 21168 | <filename>backend/bios/apps.py
from django.apps import AppConfig
class BiosConfig(AppConfig):
name = 'bios'
| 1.195313 | 1 |
tests/snuba/eventstream/test_eventstream.py | pierredup/sentry | 0 | 21169 | from __future__ import absolute_import
from datetime import datetime, timedelta
import six
import time
import logging
from sentry.utils.compat.mock import patch, Mock
from sentry.event_manager import EventManager
from sentry.eventstream.kafka import KafkaEventStream
from sentry.eventstream.snuba import SnubaEventStre... | 2.21875 | 2 |
modulo.py | Alex9808/py101 | 25 | 21170 | #! /bin/bash/python3
'''Ejemplo de un script que puede ser importado como módulo.'''
titulo = "Espacio muestral"
datos = (76, 81, 75, 77, 80, 75, 76, 79, 75)
def promedio(encabezado, muestra):
'''Despliega el contenido de encabezado,así como el cálculo del promedio de muestra, ingresado en una lista o tu... | 3.34375 | 3 |
experiments/duet_dataloader/input_file_generator.py | 18praveenb/ss-vq-vae | 0 | 21171 | <filename>experiments/duet_dataloader/input_file_generator.py
genres = ['blues', 'classical', 'country', 'disco', 'hiphop', 'jazz', 'metal', 'pop', 'reggae', 'rock']
num_files = 100
with open(f'INPUT_FULL', 'w') as f:
for genre in genres:
for i in range(num_files):
for j in range(6):
... | 2.59375 | 3 |
generate_nginx_config.py | AppScale/appscake | 0 | 21172 | <gh_stars>0
import jinja2
import os
import socket
my_public_ip = os.popen("curl -L http://metadata/computeMetadata/v1beta1/instance/network-interfaces/0/access-configs/0/external-ip").read()
my_private_ip = socket.gethostbyname(socket.gethostname())
template_contents = open('/root/appscake/nginx_config').read()
templ... | 2.328125 | 2 |
VisualizedSorting/Controller.py | lachieggg/Misc | 0 | 21173 | <reponame>lachieggg/Misc
#!/usr/bin/env python3
import sys
from Window import Window
from Constants import *
from Algorithms.MergeSort import MergeSort
from Algorithms.QuickSort import QuickSort
from Algorithms.BubbleSort import BubbleSort
from Algorithms.InsertionSort import InsertionSort
from Algorithms.Selectio... | 3.421875 | 3 |
openslides_backend/presenter/get_forwarding_meetings.py | MJJojo97/openslides-backend | 5 | 21174 | <gh_stars>1-10
from typing import Any
import fastjsonschema
from ..permissions.permission_helper import has_perm
from ..permissions.permissions import Permissions
from ..shared.exceptions import PermissionDenied, PresenterException
from ..shared.patterns import Collection, FullQualifiedId
from ..shared.schema import ... | 2.09375 | 2 |
settings.py | gyyang/olfaction_evolution | 9 | 21175 | """User specific settings."""
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['font.size'] = 7
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
mpl.rcParams['font.family'] = 'arial'
mpl.rcParams['mathtext.fontset'] = 'stix'
seqcmap = mpl.cm.cool_r
try:
import seaborn as sn... | 2.3125 | 2 |
resolver/mindeps/__init__.py | Shivansh-007/python-resolver | 0 | 21176 | <filename>resolver/mindeps/__init__.py<gh_stars>0
# SPDX-License-Identifier: MIT
from resolver.mindeps.__main__ import entrypoint, get_min_deps # noqa: F401
__all__ = ('entrypoint', 'get_min_deps')
| 1.382813 | 1 |
fabfile/data.py | nprapps/linklater | 0 | 21177 | #!/usr/bin/env python
"""
Commands that update or process the application data.
"""
from datetime import datetime
import json
from bs4 import BeautifulSoup
from flask import render_template
from fabric.api import task
from fabric.state import env
from facebook import GraphAPI
from twitter import Twitter, OAuth
from j... | 2.6875 | 3 |
glow/nn/_trainer.py | arquolo/ort | 0 | 21178 | <reponame>arquolo/ort
from __future__ import annotations
__all__ = ['Trainer']
from collections.abc import Callable, Collection, Iterator
from dataclasses import dataclass
import torch
import torch.nn as nn
import torch.optim
from tqdm.auto import tqdm
from .. import ichunked
from .. import metrics as m
from ._load... | 1.882813 | 2 |
trapeza-import.py | davidmreed/trapeza-import | 0 | 21179 | <filename>trapeza-import.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# trapeza-import.py
#
# Copyright 2013-2014 <NAME> <<EMAIL>>
# This file is available under the terms of the MIT License.
#
from itertools import groupby
from operator import itemgetter, attrgetter
import hashlib
import io
import os
impo... | 2.5625 | 3 |
tests/test_yaml.py | janhybs/ci-hpi | 1 | 21180 | #!/bin/python3
# author: <NAME>
import tests
tests.fix_paths()
import yaml
from unittest import TestCase
from cihpc.cfg.config import global_configuration
from cihpc.common.utils import extend_yaml
repeat_yaml = '''
foo: !repeat a 5
'''
range_yaml = '''
foo: !range 1 5
bar: !range 1 2 6
'''
sh_yaml = '''
foo: !... | 2.296875 | 2 |
Greedy.py | victor3r/search-algorithms | 0 | 21181 | from OrderedVector import OrderedVector
class Greedy:
def __init__(self, goal):
self.goal = goal
self.found = False
self.travelled_distance = 0
self.previous = None
self.visited_cities = []
def search(self, current):
current.visited = True
self.visited_... | 3.484375 | 3 |
mlf_core/create/templates/package/package_prediction/{{ cookiecutter.project_slug_no_hyphen }}/{{cookiecutter.project_slug_no_hyphen}}/cli_xgboost.py | mlf-core/mlf-core | 31 | 21182 | import os
import sys
from dataclasses import dataclass
import click
import numpy as np
import xgboost as xgb
from rich import print, traceback
WD = os.path.dirname(__file__)
@click.command()
@click.option('-i', '--input', required=True, type=str, help='Path to data file to predict.')
@click.option('-m', '--model', ... | 2.640625 | 3 |
onnxruntime/python/tools/quantization/operators/direct_q8.py | kimjungwow/onnxruntime-riscv | 18 | 21183 | <reponame>kimjungwow/onnxruntime-riscv
from .base_operator import QuantOperatorBase
from .qdq_base_operator import QDQOperatorBase
from ..quant_utils import QuantizedValue
# For operators that support 8bits operations directly, and output could
# reuse input[0]'s type, zeropoint, scale; For example,Transpose, Reshape,... | 2.453125 | 2 |
b01lers-ctf-2022/extreme_64_part_2/src/levels.py | novafacing/challenges | 0 | 21184 | <reponame>novafacing/challenges
from platform import architecture
from qiling import Qiling
from typing import Union
from asm_practice.coding.challenge import ArchSpec, Challenge, TestCase
challenges = []
amd64 = ArchSpec(
pwntools_arch="amd64",
pwntools_os="linux",
qiling_rootfs="qiling/examples/rootfs/... | 2.234375 | 2 |
lte/gateway/python/magma/enodebd/tr069/tests/models_tests.py | Aitend/magma | 849 | 21185 | <reponame>Aitend/magma
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASI... | 1.945313 | 2 |
saleor/graphql/order/bulk_mutations/draft_orders.py | acabezasg/urpi-master | 1 | 21186 | <filename>saleor/graphql/order/bulk_mutations/draft_orders.py
import graphene
from ....order import OrderStatus, models
from ...core.mutations import ModelBulkDeleteMutation
class DraftOrderBulkDelete(ModelBulkDeleteMutation):
class Arguments:
ids = graphene.List(
graphene.ID,
req... | 2.21875 | 2 |
thread_extensions/callback_thread.py | Sunchasing/python-common | 5 | 21187 | <filename>thread_extensions/callback_thread.py
from threading import Thread
from typing import Any, Iterable, Mapping
from types_extensions import Function, void, safe_type
class CallbackThread(Thread):
"""
An extension to python's threading API allowing for a callback to be executed upon completion of the g... | 3.5625 | 4 |
enthought/traits/ui/wx/button_editor.py | enthought/etsproxy | 3 | 21188 | # proxy module
from traitsui.wx.button_editor import *
| 1.101563 | 1 |
ROSITA/ARMCycleCounterImpl.py | 0xADE1A1DE/Rosita | 10 | 21189 | # Copyright 2020 University of Adelaide
#
# 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.078125 | 2 |
dust/admin.py | MerlinEmris/eBazar | 0 | 21190 | <filename>dust/admin.py
from django.utils.html import format_html
def full_address(self):
return format_html('%s - <b>%s,%s</b>' % (self.address, self.city, self.state))
# null derek yazylmaly hat
admin.site.empty_value_display = '???'
admin.site.register(Item)
# str funksivany ady bilen gorkezyar
class ItemAd... | 2.296875 | 2 |
main.py | Lasx/gb688_downloader | 119 | 21191 | <reponame>Lasx/gb688_downloader<filename>main.py<gh_stars>100-1000
from standard import HDB, NatureStd
if __name__ == "__main__":
hb = HDB('hbba')
db = HDB('dbba')
data = db.search('政务云工程评价指标体系及方法')
print(data)
# first_record = data["records"][0]
# name = f'{first_record["code"]}({first_record... | 2.5625 | 3 |
tests/test_centering.py | chto/redmapper | 0 | 21192 | from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import os
from numpy import random
from redmapper import Cluster
from redmapper import Configuration
from redmapper import CenteringWcenZre... | 2.125 | 2 |
converted_docs/run_pandoc.py | AndrewLoeppky/eoas_tlef | 3 | 21193 | <gh_stars>1-10
"""
usage:
turn all docx files into markdown files
python run_pandoc.py transform-docs
turn all tex files nto markdown files
python run_pandoc.py transform-docs --doctype=tex
move all csv, md, pptx, docx, png, jpeg, jpg etc.
into Book/subdir folders, where subdir is the suffix filename
an... | 2.90625 | 3 |
swim/PIL2/WebPImagePlugin.py | alexsigaras/SWIM | 3 | 21194 | from PIL import Image
from PIL import ImageFile
from io import BytesIO
import _webp
def _accept(prefix):
return prefix[:4] == b"RIFF" and prefix[8:16] == b"WEBPVP8 "
class WebPImageFile(ImageFile.ImageFile):
format = "WEBP"
format_description = "WebP image"
def _open(self):
self.mode = "RGB"... | 2.96875 | 3 |
AI Class/Agents/vacuum_v2.py | e-olang/Drafts | 0 | 21195 | from turtle import Turtle, Screen
from random import choice
from time import sleep
from queue import SimpleQueue
w: int
w, h = (853, 480)
wn = Screen()
wn.screensize(w, h)
wn.bgcolor("#d3d3d3")
Room_state = {"Clean": "#FFFFFF",
"Dirty": "#b5651d"}
cleaned = 0
def filler(t, color, delay=0, vacclean = ... | 3.53125 | 4 |
notebook/dict_keys_values_items.py | vhn0912/python-snippets | 174 | 21196 | <filename>notebook/dict_keys_values_items.py
d = {'key1': 1, 'key2': 2, 'key3': 3}
for k in d:
print(k)
# key1
# key2
# key3
for k in d.keys():
print(k)
# key1
# key2
# key3
keys = d.keys()
print(keys)
print(type(keys))
# dict_keys(['key1', 'key2', 'key3'])
# <class 'dict_keys'>
k_list = list(d.keys())
prin... | 3.21875 | 3 |
flows/tests/settings.py | sergioisidoro/django-flows | 104 | 21197 | <reponame>sergioisidoro/django-flows
import django
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = ['flows', 'flows.statestore.tests', 'django_nose']
SECRET_KEY = 'flow_tests'
if django.VERSION < (1, 6):
TEST_RUNNER = 'django.te... | 1.992188 | 2 |
apps/site/api/serializers/video_serializer.py | LocalGround/localground | 9 | 21198 | <filename>apps/site/api/serializers/video_serializer.py
from rest_framework import serializers
from localground.apps.site.api.serializers.base_serializer import \
BaseSerializer, NamedSerializerMixin, ProjectSerializerMixin, \
GeometrySerializerMixin
from localground.apps.site import models, widgets
from localg... | 2.15625 | 2 |
learning/async/test_async.py | Nephrin/Tut | 2 | 21199 | <filename>learning/async/test_async.py
# Testing out some stuff with async and await
async def hello(name):
print ("hello" + name)
return "hello" + name
# We can use the await statement in coroutines to call
# coroutines as normal functions; i.e. what it implies is that
# if we runt return await func(*ar... | 4.25 | 4 |