id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
1690926
from time import perf_counter import atexit from performer.formatter import Formatter class benchmark(object): _instance = None funcs = [] loop_counts = [] logs = [] def __init__(self, loop_count): self.loop_counts.append(loop_count) def __new__(cls, *args, **kwargs): ...
StarcoderdataPython
3277103
<gh_stars>10-100 from kdbinsert import KdbInsert from optparse import OptionParser import sys from aselite import read_any from config import * from local_db import LocalDB class LocalInsert(KdbInsert): def __init__(self): pass # This function will overload the default insert_into_db function def...
StarcoderdataPython
1676106
<filename>monkNamespace.py #!/usr/bin/python import monkDebug as debug import monkNode as Node class Namespace(Node.Node): def __init__(self, stack=[], file="", lineNumber=0, documentation=[]): if len(stack) != 2: debug.error("Can not parse namespace : " + str(stack)) Node.Node.__init__(self, 'namespace', stac...
StarcoderdataPython
6584730
""" @author: <NAME> @since: 5/11/2017 https://www.hackerrank.com/challenges/delete-a-node-from-a-linked-list/problem Passed :) """ def Delete(head, position): # position guaranteed to be in range of the list. if position == 0: # Remember to handle the edge cases. return head.next node = head ...
StarcoderdataPython
5124482
# __init__.py from .responses import * from .distributions import * __all__ = ['responses', 'distributions']
StarcoderdataPython
11224972
from unittest.mock import MagicMock import pytest import snowflake.connector as sf from prefect.tasks.snowflake import SnowflakeQuery class TestSnowflakeQuery: def test_construction(self): task = SnowflakeQuery( account="test", user="test", password="<PASSWORD>", warehouse="test" ) ...
StarcoderdataPython
3409284
<reponame>Kookabura/scrapyd import unittest from datetime import datetime from decimal import Decimal from scrapy.http import Request from scrapyd.sqlite import SqlitePriorityQueue, JsonSqlitePriorityQueue, \ PickleSqlitePriorityQueue, SqliteDict, JsonSqliteDict, PickleSqliteDict class SqliteDictTest(unittest.Te...
StarcoderdataPython
113412
<filename>core/utils/network/sms.py from twilio.rest import TwilioRestClient # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "AC32a3c49700934481addd5ce1659f04d2" auth_token = "" client = TwilioRestClient(account_sid, auth_token) message = client.sms.messages.create(body="Jenny please?! I lo...
StarcoderdataPython
4961156
<reponame>marctrommen/docarchive_scan_client<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Update meta data of existing PDF document from JSON file, therfore in the # background do ... # ... check if PDF file exists and dele...
StarcoderdataPython
6519668
<reponame>LeKSuS-04/Capture-The-Flag n = 0x9ffa2a58ad286990fc5fe97b669e8cb2752e81fafa5ac774ea856d8ca124089ba4b06fe21a5d588c1dcb9602838d32cd70e50b85dec21fa79944543176c7a3b8b804ab754af2978f23b09f2905103dd5a4c748df8d9e9a079a5b38f6f69051b3c6582ebc2d2d199b3a97cb7e58af79b90fe08884626d188e194816bd51960a45 e = 0x3 c = 0x10652c...
StarcoderdataPython
6691284
# Copyright 2018 <NAME> and <NAME> # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # dis...
StarcoderdataPython
11329532
directions = { "up": {"x": 0, "y": 1}, "down": {"x": 0, "y": -1}, "right": {"x": 1, "y": 0}, "left": {"x": -1, "y": 0} }
StarcoderdataPython
6516077
from django.apps import AppConfig class LoggedConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "logged"
StarcoderdataPython
9640909
# # !/usr/bin/python3 # # -*- coding: utf-8 -*- # """ # @Author : <NAME> # @Version : # ------------------------------------ # @File : models.py # @Description : # @CreateTime : 2022/2/14 12:39 # ------------------------------------ # @ModifyTime : # """ # from tortoise import fie...
StarcoderdataPython
4836467
import requests, json from unittest import TestCase from tests.config import * class TestNPCAPI(TestCase): """Test the NPC endpoint - where it differs from the PC endpoint""" headers = {"Content-Type": "application/json"} player_headers = {"Content-Type": "application/json"} @classmethod def setU...
StarcoderdataPython
129906
<filename>aiida/transport/__init__.py # -*- coding: utf-8 -*- import aiida.common from aiida.common.exceptions import InternalError from aiida.common.extendeddicts import FixedFieldsAttributeDict import os,re,fnmatch,sys # for glob commands __copyright__ = u"Copyright (c), 2015, ECOLE POLYTECHNIQUE FEDERALE DE LAUSAN...
StarcoderdataPython
5177970
<reponame>Plamenna/proba<filename>python/configGenieGenerator.py import ROOT # configure the GenieGenerator def config(GenieGen): fGeo = ROOT.gGeoManager top = fGeo.GetTopVolume() # positions for nu events inside the nutau detector volume muSpectrometer = top.FindNode("volMagneticSpectrometer_1") muSpectromete...
StarcoderdataPython
1911355
#!/usr/bin/env python # -*- encoding: utf-8 -*- from scaelum.registry import HOOKS from ..hooks import Hook @HOOKS.register_module class DistributedTimerHelperHook(Hook): def before_run(self, runner): runner._timer.clean_prev_file() def after_run(self, runner): runner._timer.clean_prev_fil...
StarcoderdataPython
81377
# https://docs.aws.amazon.com/code-samples/latest/catalog/python-secretsmanager-secrets_manager.py.html import boto3 from abc import ABC import logging import json class SecretsManager(ABC): def __init__(self, secret_id: str): self._secret_id = secret_id self._logger = logging.getLogger(SecretsMan...
StarcoderdataPython
295423
<gh_stars>1-10 import os import shutil import subprocess import sys import pytest from kaggle_runner import utils from kaggle_runner.runners import coordinator @pytest.fixture(scope="module") def runner_configs(): return [ {"port":23454, "size": 384, "network": "intercept", "AMQPURL": utils.AMQPURL()}, ...
StarcoderdataPython
72769
<filename>hypha/apply/flags/templatetags/flag_tags.py from django import template register = template.Library() @register.filter def flagged_by(submission, user): return submission.flagged_by(user) @register.filter def flagged_staff(submission): return submission.flagged_staff
StarcoderdataPython
9670478
""" 24. Faça um Programa que leia 2 números e em seguida pergunte ao usuário qual operação ele deseja realizar. O resultado da operação deve ser acompanhado de uma frase que diga se o número é: par ou ímpar; positivo ou negativo; inteiro ou decimal. """ numeros = list() resultado = None while True: if ...
StarcoderdataPython
3318221
<filename>scripts/read_infoclimat_data.py # -*- coding: utf-8 -*- """ Created on Fri Oct 22 15:33:13 2021 @author: User """ import netCDF4 import numpy as np for year in range(1980, 2022): # filepath = 'C:/Users/jean-/Downloads/PREC_2020.nc' filepath = f'D:/Data/GrilleInfoClimat2021/PREC_{year}.nc' netcdf...
StarcoderdataPython
8082800
<reponame>jlehrer1/ConvNeXt-lightning import comet_ml import pandas as pd import pytorch_lightning as pl from pytorch_lightning import Trainer from pytorch_lightning.loggers import CometLogger from pl_bolts.datamodules import CIFAR10DataModule, ImagenetDataModule from convnextpl import Convnext import pathlib, os he...
StarcoderdataPython
4934596
<gh_stars>0 import matrices as Matrices from excel_file_extration import ExcelExtractor def main(): file_name = "data.xlsx" extractor = ExcelExtractor(file_name) extracted_matrix = extractor.extract_matrix() matrice = Matrices.Matrice(len(extracted_matrix), len(extracted_matrix[0])) matrice.matric...
StarcoderdataPython
115787
# -*- coding: utf-8 -*- """Utility functionality."""
StarcoderdataPython
3561310
<filename>release/stubs.min/System/Drawing/__init___parts/SystemIcons.py class SystemIcons(object): """ Each property of the System.Drawing.SystemIcons class is an System.Drawing.Icon object for Windows system-wide icons. This class cannot be inherited. """ Application=None Asterisk=None Error=None Exclamatio...
StarcoderdataPython
11325231
# -*- coding: utf-8 -*- """ Created on Sat May 20 07:20:05 2017 @author: <NAME> <<EMAIL>> """ import random def partition(A, p, r): """ Particiona o vetor. """ x = A[r] i = p - 1 for j in range(p, r): # de p a r-1 if A[j] <= x: i += 1 A[i], A[j] = A[j], A[i] # ...
StarcoderdataPython
1702278
#!/usr/bin/env python # -*-coding:utf-8 -*- import rospy import threading import time import numpy as np from modbus.modbus_nex_api import ModbusNexApi from modbus.msg import peripheralCmd from PyQt5 import QtWidgets, QtGui from PyQt5.QtCore import QTimer, QThread, pyqtSignal from main_ui import Ui_MainWindow import s...
StarcoderdataPython
1689263
import os from tinydb import TinyDB from deduplify.hash_files import hashfile, restart_run def test_hashfile(): path = os.path.join("tests", "assets", "test_infile.json") md5_hash, outpath = hashfile(path) assert md5_hash == "f3fb257d843b252bdc0442402552d840" assert outpath == path def test_rest...
StarcoderdataPython
11252547
import datetime import discord from discord.ext import commands from discord.ext.commands import Bot from cogs.core.config.config_botchannel import botchannel_check from cogs.core.config.config_embedcolour import get_embedcolour from cogs.core.config.config_prefix import get_prefix_string from cogs.core.defaults.defa...
StarcoderdataPython
8046407
import re import csv import unicodecsv import xlrd from bs4 import BeautifulSoup from openelex.base.load import BaseLoader from openelex.models import RawResult from openelex.lib.text import ocd_type_id, slugify from .datasource import Datasource class LoadResults(object): """Entry point for data loading. D...
StarcoderdataPython
12852299
<gh_stars>1-10 from django.http import HttpResponse def index(request): return HttpResponse(request.get_full_path())
StarcoderdataPython
3480475
<gh_stars>1-10 class AuthenticateError(Exception): ''' Raised when the authentication failed.''' pass class InputParameterError(Exception): """Raised when the both input options are provided.""" pass
StarcoderdataPython
6416633
import os from decouple import config # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run wit...
StarcoderdataPython
4948377
<gh_stars>0 # pylint: disable=line-too-long """This app is based on the [`FastGridTemplate`]\ (https://panel.holoviz.org/reference/templates/FastGridTemplate.html#templates-gallery-fastgridtemplate) and the *Fast Components* provided by the <fast-anchor href="https://awesome-panel.readthedocs.io/en/latest/packages/awes...
StarcoderdataPython
4919407
#!/usr/bin/python2.7 from flask import Flask, render_template, request, json, jsonify from flask_sqlalchemy import SQLAlchemy from sqlalchemy import or_ import subprocess app = Flask (__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True db = SQLAlch...
StarcoderdataPython
3315358
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Functions to create expect scripts """ from __future__ import print_function, absolute_import, with_statement import re import os import subprocess import pexpect import struct import fcntl import termios import signal import sys import requests import hammercloud from hamme...
StarcoderdataPython
6653043
<gh_stars>0 """ Credits: Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise) Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise) Copyright (c) 2017-2019 <NAME>, <NAME> (Sinergise) This source code is licensed under the MIT license found in the LICENSE file in the root dire...
StarcoderdataPython
8015293
<gh_stars>100-1000 import os import FWCore.ParameterSet.Config as cms from Alignment.APEEstimation.ApeEstimatorSummary_cfi import * ApeEstimatorSummaryBaseline = ApeEstimatorSummary.clone( setBaseline = True, apeWeight = "entriesOverSigmaX2", #sigmaFactorFit = 2.5, ) ApeEstimatorSummaryIter = ApeEst...
StarcoderdataPython
3462910
# Generated by Django 2.2.7 on 2020-03-27 07:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('forum', '0072_communityinvitation'), ] operations = [ migrations.AddField( model_name='community', name='nice_name',...
StarcoderdataPython
1977509
<reponame>subhadarship/nlp4if-2021 import logging from typing import List from data_utils import LabelField logger = logging.getLogger(__name__) def postprocess_labels(labels: List[List[int]], label_fields: List[LabelField]) -> List[List[str]]: """Postprocess labels. First convert ints to corresponding strings....
StarcoderdataPython
3227576
# Copyright 2017 AT&T Intellectual Property. All other 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...
StarcoderdataPython
5125264
<filename>AnimationPlot.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import animatplot as amp #グラフの描画 def plot_animation(ref_df): #X軸・Y軸のデータ取得 X_data = 0 Y_data = 0 #refの経路描画 time_data_np = np.array...
StarcoderdataPython
4870095
<reponame>bjascob/SmartLMVocabs #!/usr/bin/python3 # Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
StarcoderdataPython
6532377
from aries_cloudagent.messaging.base_handler import BaseHandler, BaseResponder, RequestContext from ..messages.read_all_data_agreement_template_response import ReadAllDataAgreementTemplateResponseMessage import json class ReadAllDataAgreementTemplateResponseHandler(BaseHandler): """Handle for data-agreements/1....
StarcoderdataPython
1734997
import requests import json # response = requests.get("http://pokeapi.co/api/v2/pokemon/charizard") pokemon_name = raw_input("What Pokemon do you want info about? ") response = requests.get("https://api.pokemontcg.io/v1/cards?name={}&pageSize=2".format(pokemon_name)) #TODO: if response.text["cards"] is empty; return e...
StarcoderdataPython
1788159
####################################################################### # # InfoBar Tuner State for Enigma-2 # Coded by betonme (c) 2011 <glaserfrank(at)gmail.com> # Support: http://www.i-have-a-dreambox.com/wbb2/thread.php?threadid=162629 # # This program is free software; you can redistribute it and/or # ...
StarcoderdataPython
1770097
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # Dataset available at: https://www.kaggle.com/c/house-prices-advanced-regression-techniques def get_cat_num_columns(data): categorical_columns = list() numerical_columns = list() for column in data.columns: ...
StarcoderdataPython
8128928
<filename>tree_model_files/tree_model.py import joblib import pandas as pd from sklearn.calibration import CalibratedClassifierCV from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import roc_curve, roc_auc_score from sklearn.model_selection import train_test_split import game GBM_MODEL = jo...
StarcoderdataPython
5052609
<gh_stars>0 from App_Login.forms import ProfilePic, SignUpForm from django.shortcuts import render, HttpResponseRedirect from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm from django.contrib.auth import login, authenticate, logout from django.urls import reverse from django....
StarcoderdataPython
9654229
<reponame>FrancoBenner/archon-dex<filename>mom/mom_public.py """ tokenmom API client API docs https://docs.tokenmom.com """ import requests base_url = "https://api.tokenmom.com/" def markets(): r = requests.get(base_url + "market/get_markets") j = r.json() markets = j["markets"] for m in markets[:]...
StarcoderdataPython
1976737
# 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 applicable law or agreed ...
StarcoderdataPython
4975217
<filename>src/ggrc/automapper/rules.py # Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> import itertools from collections import namedtuple from logging import getLogger from ggrc import models Attr = namedtuple('Attr', ['name']) type_ordering = [['Aud...
StarcoderdataPython
4880266
from mock import MagicMock import mock from django.test import override_settings from tests.utilities.utils import SafeTestCase from tests.utilities.ldap import get_ldap_user_defaults from accounts.models import ( User, AccountRequest, Intent ) from projects.models import Project from projects.receivers im...
StarcoderdataPython
9645765
import sys import numpy as np import matplotlib.pyplot as plt from mlportopt.util.helperfuncs import gen_real_data, train_test, merge_clusters, get_full_weights from mlportopt.preprocessing.preprocessing import preprocess from mlportopt.flatcluster.flatcluster import DPGMM, TFSOM, GPcluster from mlporto...
StarcoderdataPython
9724032
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import abc import sys import copy import time import datetime import importlib from pathlib import Path from concurrent.futures import ThreadPoolExecutor, as_completed import fire import requests import numpy as np import pandas as pd from tqdm ...
StarcoderdataPython
238478
<reponame>PrzemyslawSalek/9eats from .models import Eats from rest_framework import serializers class EatsSerializers(serializers.ModelSerializer): class Meta: model = Eats fields = ['id', 'name', 'price', 'ingredients', 'timestamp']
StarcoderdataPython
11227166
from contributions import Contribution from elections import ( Election, Candidate, Office, Proposition, PropositionFiler ) from expenditures import Expenditure from filers import Filer, Committee from filings import Filing, Cycle, Summary __all__ = ( 'Contribution', 'Election', 'Candid...
StarcoderdataPython
4832897
import copy import logging import functools from ptsemseg.loss.loss import cross_entropy2d from ptsemseg.loss.loss import cross_entropy1d from ptsemseg.loss.loss import bootstrapped_cross_entropy2d from ptsemseg.loss.loss import multi_scale_cross_entropy2d from ptsemseg.loss.loss import mse from ptsemseg.loss.loss imp...
StarcoderdataPython
6585896
<gh_stars>1-10 import numpy as np # B-Felsstärke für verschiedene Tiefe der Hallsonde in dem Elektromagneten B = np.array([0, 0, 0, 1, 1, 1, 2, 4, 7, 13, 23, 43, 84, 166, 272, 351, 393, 413, 416, 423, 421, 426, 421, 422, 414, 411, 389, 343, 249, 136, 67, 35, 19, 10, 6, 3, 2, 1, 1, 0]) # Tiefe der Hallsonde in dem Ele...
StarcoderdataPython
4929975
<gh_stars>1-10 from anime2021.anime import AShape, RollingPolygon, AImage import IPython sinamon="https://pics.prcm.jp/647a40a3a449f/85207406/png/85207406.png" shape = AImage(100,100,image=sinamon) IPython.display.Image(test_shape(shape)) class GuruGurusinamon(AShape): def __init__(self,width=50, height=None, cx=N...
StarcoderdataPython
1825586
<reponame>co2meal/-bnpy-dev """ The :mod:`viz` module provides visualization capability """ import BarsViz import BernViz import GaussViz import SequenceViz import PlotTrace import PlotELBO import PlotK import PlotHeldoutLik import PlotParamComparison import PlotComps import JobFilter import TaskRanker __all__ = [...
StarcoderdataPython
327827
## Python imports import boto3 from botocore.exceptions import EndpointConnectionError, ClientError import botocore import collections import csv import json import smtplib import os, hmac, hashlib, sys import pprint import logging from sys import exit import time import res.utils as utils import config # Consul imp...
StarcoderdataPython
11338467
# coding: utf-8 # Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department # Distributed under the terms of "New BSD License", see the LICENSE file. import unittest import os from pyiron.base.project.generic import Project class TestGenericJob(unittest.TestCase): ...
StarcoderdataPython
5107983
import os import os.path as osp import argparse import glob import lmdb import pickle import random import cv2 import numpy as np from tqdm import tqdm import sys sys.path.append(os.getcwd()) from codes.utils.base_utils import recompute_hw def create_lmdb(dataset, raw_dir, lmdb_dir, filter_file='', downscale_facto...
StarcoderdataPython
3519800
<gh_stars>0 import numpy as np from \ kgmk.dsa.algebra.modular \ .matrix.jit \ import ( mdot, matpow, ) def test(): mod = 10 ** 9 + 7 a = np.arange( 1, 10001, ).reshape((100, 100)) a = matpow(a, 1 << 8, mod) print(a) a = matpow(a, 0, mod) print(a) if __name__ == '__main__': test()
StarcoderdataPython
6416574
from typing import List from pydantic import validator from fastapi import HTTPException from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY from fidesops.schemas.base_class import BaseSchema from fidesops.api.v1.scope_registry import SCOPE_REGISTRY class UserPermissionsCreate(BaseSchema): """Data required...
StarcoderdataPython
392611
""" New Providers Command """ from masonite.commands import BaseScaffoldCommand class ProviderCommand(BaseScaffoldCommand): """ Creates a new Service Provider provider {name : Name of the Service Provider you want to create} """ scaffold_name = 'Service Provider' base_directory = 'ap...
StarcoderdataPython
6630348
# Global paths glob_lib_paths = [r'C:\Git\pyDMPC\pyDMPC\ModelicaModels\ModelicaModels', r'C:\Git\modelica-buildings\Buildings', r'C:\Git\AixLib\AixLib'] glob_res_path = r'C:\TEMP\Dymola' glob_dym_path = r'C:\Program Files\Dymola 2018 FD01\Modelica\Library\python_interface\dymola.egg' # Workin...
StarcoderdataPython
1619945
#desafio 8: conversor de medidas m = float(input('Digite um valor em metros: ')) km = m / 1000 hm = m / 100 dam = m / 10 dm = m * 10 cm = m * 100 mm = m * 1000 print(f'A medida de {m}m corresponde a: \n {km:.5}km \n {hm}hm \n {dam}dam \n {dm}dm \n {cm:.0f}cm \n {mm:.0f}mm')
StarcoderdataPython
11205847
#!/usr/bin/env python2 # -- coding: utf-8 -- import urllib, os, json, datetime, requests, urlparse import utils url = utils.API_URL token = utils.get_api_key() headers = utils.get_headers(token) user = raw_input('Username to export (case sensitive):') # user = "USERNAME" #<--- Put username here. Case sensitive. # r...
StarcoderdataPython
1877379
<reponame>FynnBe/typed-argparse # type: ignore import json from pathlib import Path from setuptools import find_namespace_packages, setup # Get the long description from the README file ROOT_DIR = Path(__file__).parent.resolve() long_description = (ROOT_DIR / "README.md").read_text(encoding="utf-8") VERSION_FILE = ROO...
StarcoderdataPython
8152177
#!/usr/bin/python import os import sys import math import struct import socket #for sockets import shutil time = 0 scoreLeft = 0 scoreRight = 0 agentsLeftStart = [False]*11 agentsRightStart = [False]*11 agentsLeftExisted = [False]*11 agentsRightExisted = [False]*11 agentsLeftHere = [False]*11 agentsRightHere = [Fal...
StarcoderdataPython
1935122
<filename>Lib/distutils/version.py # # distutils/version.py # # Implements multiple version numbering conventions for the # Python Module Distribution Utilities. # # written by <NAME>, 1998/12/17 # # $Id$ # """Provides classes to represent module version numbers (one class for each style of version numbering). There ...
StarcoderdataPython
6595186
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Tue Aug 13 20:00:24 2019 @author: <NAME> """ #coding:utf-8 import os import requests import pic_snapshots import time BASE_DIR = os.path.dirname(os.path.abspath(__file__)) while(1): file_name = pic_snapshots.snapshot_fun() path=os.path.join(BASE_DIR,'snap...
StarcoderdataPython
5092147
<gh_stars>0 import pytest from numpy.random import randint, rand import numpy as np import scipy.io as sio from helpers import * from helpers_jpeg import * @pytest.fixture(scope="module") def X(): '''Return the lighthouse image X''' return sio.loadmat('test_mat/lighthouse.mat')['X'].astype(float) @pytest.f...
StarcoderdataPython
1711078
import cv2 as cv import numpy as np from Step_2_normalize_data import normalize_data from Step_6_load_model import load_model from Step_7_predict import predict frame = np.zeros((400, 400, 1)) model, labels = load_model("model") def do_predict(): global frame, model, labels image = frame image = cv.res...
StarcoderdataPython
11234288
<filename>from_python_community/find_values.py # Условие: # Ваша задача — написать функцию, которая принимает неограниченное количество массивов и возвращает только те элементы, что есть в каждом списке. # Пример: # find_values([11, 10, 3], [10, 3, 5, 11], [11, 10]) -> [11, 10] # find_values([8, 4, 7, "hi"], [8, "hi...
StarcoderdataPython
4813081
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-unsafe import unittest from unittest.mock import MagicMock from ..get_exit_nodes import ExitNodeGenerator from .test_functions impo...
StarcoderdataPython
8101771
<filename>mlnn1hl_script.py<gh_stars>10-100 from sklearn.model_selection import ParameterGrid from model.main.traditional_ffnn import Mlnn1HL from utils.IOUtil import read_dataset_file from utils.SettingPaper import mlnn1hl_paras_final as param_grid from utils.SettingPaper import ggtrace_cpu, ggtrace_ram, ggtrace_multi...
StarcoderdataPython
4870301
<filename>django_pages/admin.py # -*- encoding: utf-8 -*- """ This file just imports admins from all packages so Django finds them """ from django.contrib import admin from django_pages.comments.models import Comment from django_pages.feed.models import FeedSettings from django_pages.language.models import Language ...
StarcoderdataPython
4888078
import time from typing import List, Optional, Tuple, Union import headers import requests field: List[List[Optional[Union[int, str]]]] = [[]] def get_node() -> Tuple[str, str]: r = requests.post('http://localhost/start') assert r.status_code == 201, r print('Got Node') time.sleep(2) print('Star...
StarcoderdataPython
8024122
import tensorflow as tf # configure as needed input_model_dir = "nudenet/default" frozen_model_dir = "nudenet/frozen" saved_model_dir = "nudenet/saved" # from "saved_model_cli show --dir nudenet/default --all" tag = "serve" signature = "predict" # tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY is default input_node...
StarcoderdataPython
12801904
<reponame>SimonLovskog/SolarManager-HA """Constants for the SolarManager integration.""" DOMAIN = "solarmanager"
StarcoderdataPython
183501
<filename>core/lexers/lexers.py<gh_stars>1-10 from PyQt5.Qsci import * __all__ = ['get_lexer_by_ext', 'set_lexer_by_menu'] LEXERS = { ('AVS', QsciLexerAVS): (), ('Bash', QsciLexerBash): ('sh', 'ksh', 'bash', 'ebuild', 'eclass', 'exheres-0', 'exlib'), ('Batch', QsciLexerBatch): ('cmd', 'btm'), ('Cmake'...
StarcoderdataPython
336602
<filename>processing/pcap.py #!/usr/bin/python # Cuckoo Sandbox - Automated Malware Analysis # Copyright (C) 2010-2011 Claudio "nex" Guarnieri (<EMAIL>) # http://www.cuckoobox.org # # This file is part of Cuckoo. # # Cuckoo is free software: you can redistribute it and/or modify # it under the terms of the GNU General...
StarcoderdataPython
8176285
<reponame>SolbiatiAlessandro/xbot """core e2e translation logic""" import ast import logging from typing import Iterator from dataclasses import asdict import xbot.constants import xbot.utils import xbot.templates def parse_source_code( filename: str, from_library = xbot.constants.LIBRARIES.PYTHON_T...
StarcoderdataPython
6451545
<reponame>JonathanFromm/HackerspaceTemplatePackage from django.template import Library register = Library() @register.filter def landingpage(text, language): from django.template.loader import get_template try: return get_template('translations/landingpage/'+language+'.html').render({ 'wor...
StarcoderdataPython
8076181
<gh_stars>0 """Tests for Wolk.""" # Copyright 2020 WolkAbout Technology s.r.o. # # 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 # #...
StarcoderdataPython
3371284
<reponame>VadymV/clinica def eddy_fsl_pipeline(low_bval, use_cuda, initrand, name="eddy_fsl"): """Use FSL eddy for head motion correction and eddy current distortion correction.""" import nipype.interfaces.utility as niu import nipype.pipeline.engine as pe from nipype.interfaces.fsl.epi import Eddy ...
StarcoderdataPython
3437551
<filename>walle/views.py # -*- coding: utf-8 -*- from app import app from flask import render_template @app.route('/') def index(): websocket_url = 'ws://172.16.58.3:5001' return render_template('index.html', websocket_url=websocket_url)
StarcoderdataPython
5072535
from config_utils import user_enter, function_maker, is_type, get_command_type, get_command_definition, on_not_valid_type, type_to_input_functions import constants import data_types.did_do as bool_lib def build_if_yes_function(definition): """ Builds a function given a conditional bool response to a question t...
StarcoderdataPython
3254747
from htun.args import args from htun.tools import stop_running, create_iptables_rules, \ delete_ip_tables_rules from htun.http_server import run_server from htun.tun_iface import TunnelServer import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) if args.uri: is_serve...
StarcoderdataPython
11395139
''' @author: <NAME> ''' from utils.dictionare import * from domeniu.entitati import Numar from erori.exceptii import RepoError class Repo(object): def __init__(self): ''' Functie care creeaza un obiect de tip Repo Input: - Output: - ''' pass def add(sel...
StarcoderdataPython
3225272
from typing import Any, Union, Type from enum import Enum from pydantic import BaseModel, validator, validate_arguments, FilePath, HttpUrl, Field from .main import app class Photo(BaseModel): name: str file: Any @validator("file") def valid_file(self, v, vv): """ Meta valid file ...
StarcoderdataPython
9610016
<gh_stars>0 """ @apiDefine ProductGetParams @apiSuccess title @apiQueryParam model @apiQueryParam purchasable @apiQueryParam manufacturedAt """ class Product: def get(self): """ @api {get} /product Get all products @apiVersion 1.0.0 @apiGroup Product @apiPermission god ...
StarcoderdataPython
3475280
<gh_stars>1-10 from typing import Callable, Optional from gi.repository import Gtk from gaphas.handlemove import HandleMove from gaphas.item import Item from gaphas.move import MoveType from gaphas.view import GtkView FactoryType = Callable[[], Item] def placement_tool( view: GtkView, factory: FactoryType, han...
StarcoderdataPython
6651605
from .sandbox import * # noqa OSCARAPI_BLOCK_ADMIN_API_ACCESS = True
StarcoderdataPython
4863403
# author: <NAME> import json import glob import os import sys import gc import collections def openMiners(): minersList = {} addressList = {} count = 0 firstBlock = input('first') lastBlock = input('last') listofDirectories = [] a = os.listdir('./') interval = [] for i in range(firstBlock, lastBlock+1): ...
StarcoderdataPython