id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
5121940
<filename>formee/formTools/fill.py import json from formee.auth.check import check_login from formee.auth.user_jwt import get_user_jwt from formee.formTools.validators import NumberValidator from gql import Client, gql from gql.transport.aiohttp import AIOHTTPTransport from PyInquirer import prompt from rich import pr...
StarcoderdataPython
59613
#Copyright (C) 2011 by <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, dist...
StarcoderdataPython
9744904
<reponame>pravinva/aws-serverless-data-lake-framework<filename>sdlf-foundations/lambda/check-job/src/lambda_function.py import json import logging import datetime as dt import boto3 logger = logging.getLogger() logger.setLevel(logging.INFO) glue = boto3.client('glue') def datetimeconverter(o): if isinstance(o,...
StarcoderdataPython
1916131
<reponame>shubhangini-tripathy/geeks_for_geeks<gh_stars>0 n = int(input()) arr = [int(x) for x in input().split()] arr1 = [int(x) for x in input().split()] for i in range(len(arr)): arr[i] = arr[i]+arr1[i] print(arr)
StarcoderdataPython
12850513
from django.test import TestCase, Client from django.urls import reverse class TestViews(TestCase): def setUp(self): self.client = Client() self.register_url = reverse('register') self.profile_url = reverse('profile') def test_register(self): response = self.client.get(self.register_url) self.assertEqual...
StarcoderdataPython
1678106
import NetworkManager from subprocess import Popen # This can most likely be done just as easily with the python library, # but this works. Why reinvent the wheel? As dirty as this feels, # programming every wifi edge condition into this involves quite a bit # of work with a large error margin. However nmcli already d...
StarcoderdataPython
1678837
<filename>electricpy/visu.py ################################################################################ """ `electricpy.visu` - Support for plotting and visualizations. Filled with plotting functions and visualization tools for electrical engineers, this module is designed to assist engineers visualize their des...
StarcoderdataPython
3544503
<reponame>heavyairship/UselessMachine<filename>useless_machine.py import threading class UselessMachine(object): def __init__(self): self.switches = ["OFF" for x in range(10)] self.queue = [] self.cond = threading.Condition() self.finished = False def flipOn(self, idx): self.cond.acquire() ...
StarcoderdataPython
9680345
import os import re import sys from contextlib import contextmanager import click import click_pathlib import kconfiglib from listconfig import print_tree @contextmanager def quietify(verbose): if verbose: yield None return try: with open(os.devnull, 'w') as devnull: sys...
StarcoderdataPython
11267127
from __future__ import print_function def early_stopping_command_parser(parser): parser.add_argument('--es_m', dest='early_stopping_method', choices=['WorstTimesX', 'StopAfterN', 'None'], help='Early stopping method', default='None') parser.add_argument('--es_n', help='N parameter (for...
StarcoderdataPython
8191981
import logging logger = logging.getLogger(__name__) class Bootstrap: def __init__(self): pass def init(self): logger.info("Boostrap of %s", type(self))
StarcoderdataPython
4892515
# ============================================================================= # ANALIZAR PUNTOS DE RECARGA ESPAÑA # ============================================================================= """ Proceso: Input: - /home/tfm/Documentos/TFM/Datasets/PuntosRecarga/puntos_carga_filt_Espana.csv ...
StarcoderdataPython
8151314
<filename>src/pfmsoft/util/file/csv.py """Utilities for handling csv files Todo: * Write some tests Created on Nov 27, 2017 @author: croaker """ # TODO handle not enough fields, too many fields. import csv import logging from collections import namedtuple from pathlib import Path from typing import ( Any,...
StarcoderdataPython
324032
""" listener.py """ import pybreaker import requests import time import random from retrying import retry #@retry(stop_max_attempt_number=3, wait_exponential_multiplier=3000,wait_jitter_max=500) #def get_time(cb): #try: #response = requests.get('http://localhost:3001/time', timeout=3.0) #except (req...
StarcoderdataPython
3429050
import click from parsec.cli import pass_context, json_loads from parsec.decorators import custom_exception, list_output @click.command('get_group_users') @click.argument("group_id", type=str) @pass_context @custom_exception @list_output def cli(ctx, group_id): """Get the list of users associated to the given gro...
StarcoderdataPython
6464387
import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.optim as optim import numpy as np from torchsummary import summary device = torch.device('cuda:0') def loadtraindata(): train_path = r'E...
StarcoderdataPython
1834733
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython """ from collections import Counter from time import sleep from typing import Callable, Dict # pip install prototools from prototools import progressbar CODIGO: Dict[str, Dict[str, float]] = { "00": {"kg": 0.25, "precio": 300}, "01": {"kg": 0.5, "pr...
StarcoderdataPython
8071160
<reponame>jbrightuniverse/hungarianalg<filename>hungarianalg/alg.py """ Hungarian Algorithm No. 5 by <NAME> Vancouver School of Economics, UBC 8 March 2021 Based on http://www.cse.ust.hk/~golin/COMP572/Notes/Matching.pdf and https://montoya.econ.ubc.ca/Econ514/hungarian.pdf """ import numpy as np class N...
StarcoderdataPython
166464
# TODO: Only require market stats that are being used by ML models # TODO: Allow storage/retrieval of multiple markets """ Allows storage/retrieval for custom market data instead of automatic gathering """ from api import api, db from api.helpers import HTTP_CODES, query_to_dict, validate_db from api.models.market impo...
StarcoderdataPython
12833058
# Copyright (C) 2020 Denso IT Laboratory, Inc. # All Rights Reserved # Denso IT Laboratory, Inc. retains sole and exclusive ownership of all # intellectual property rights including copyrights and patents related to this # Software. import torch import torch.nn as nn import torch.optim as optim import torch.nn.functi...
StarcoderdataPython
5018078
<filename>main.py # This is the example of main program file which imports entities, # connects to the database, drops/creates specified tables # and populate some data to the database from pony.orm import * # or just import db_session, etc. import all_entities # This command make sure that all entities are imported...
StarcoderdataPython
6431058
<reponame>hwakabh/codewars from unittest import TestCase from unittest import main from clock import past class TestClock(TestCase): def test_past(self): ptr = [ (0, 1, 1, 61000), (1, 1, 1, 3661000), (0, 0, 0, 0), (1, 0, 1, 3601000), (1, 0, 0, 3...
StarcoderdataPython
1735887
<gh_stars>0 import pytest import mock from nose.tools import * # noqa PEP8 asserts from website import settings import website.search.search as search from website.search_migration.migrate import migrate from website.search.util import build_query from tests.base import OsfTestCase from tests.utils import run_celer...
StarcoderdataPython
1869601
<filename>aws/translate1.py<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # ライブラリのインポート import boto3 # 翻訳したい文章(英語) input_text = "I like robots." # AWSを使った翻訳の準備 translate = boto3.client(service_name="translate") # 文章を翻訳 translate_text = translate.translate_text( Text=input_text, SourceLanguageCode...
StarcoderdataPython
11307617
# Definition for singly-linked list. # 142+465=607 # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ carr...
StarcoderdataPython
76134
########################################################################## # # Copyright (c) 2010, Image Engine Design 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: # # * Redistribu...
StarcoderdataPython
6447722
<gh_stars>1-10 # Copyright (c) 2018 PaddlePaddle 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
StarcoderdataPython
6428150
<reponame>japonophile/Education4Climate<gh_stars>0 from abc import ABC from pathlib import Path import pandas as pd import scrapy from src.crawl.utils import cleanup from settings import YEAR, CRAWLING_OUTPUT_FOLDER import logging log = logging.getLogger() BASE_URL = 'https://www.z.k.kyoto-u.ac.jp' PROG_DATA_PATH ...
StarcoderdataPython
6496064
import os import shutil import tempfile import logging import time import requests from distutils.dir_util import copy_tree from brdm.NcbiData import NcbiData from brdm.RefDataInterface import RefDataInterface class NcbiTaxonomyData(NcbiData, RefDataInterface): def __init__(self, config_file): """Initial...
StarcoderdataPython
6481731
<reponame>fabaff/penin """Init file for PenIn."""
StarcoderdataPython
3565511
from tkinter import* root = Tk() photo = PhotoImage(file="/home/pi/std_googleAssistant/GUI/Icons/Home.png") label = Label(root, image=photo) label.pack() root.mainloop()
StarcoderdataPython
381752
<reponame>kalpishs/download_kit<gh_stars>1-10 import logging import shutil from urllib import parse from downloadKit.protocol_factory.constants import bufsize from downloadKit.protocol_factory.protocol_template import ProtocolTemplate import paramiko import os class sftpUrlDownloader(ProtocolTemplate): def __ini...
StarcoderdataPython
3358115
<reponame>zsb514/message_bot_plateform from .telebot import TeleBot from .wxbot import WxBot from .dingbot import DingBot def init_bot(bot_token, bot_type, chat_id=None, secret=None): if bot_type == 0: return WxBot(bot_token) elif bot_type == 1: return DingBot(bot_token, secret) elif bot_ty...
StarcoderdataPython
140802
<filename>processing/boundaries/inputs/concat.py from psycopg2.sql import SQL, Identifier from .utils import logging, get_ids, get_ps_ids logger = logging.getLogger(__name__) query_1 = """ DROP TABLE IF EXISTS adm4_polygons_pop_03; CREATE TABLE adm4_polygons_pop_03 AS SELECT {ids}, geom FROM adm4_polygons...
StarcoderdataPython
8033738
<gh_stars>0 import numpy as np import matplotlib from PIL import Image import math from functions import * x = 0 y = 0 nb_pixels_noirs_i1 = 0 nb_pixels_noirs_i2 = 0 nb_pixels_noirs_i = 0 nb_pixels_cercle = 0 i_inconnue = Image.open('images/image1.jpg') i_ar = np.asarray(i_inconnue) x_max_i = len(i_ar) y_max_i = len(i_...
StarcoderdataPython
292673
<reponame>krishna-saravan/linkml<gh_stars>10-100 import re import unittest from functools import reduce from typing import List, Tuple from rdflib import Graph from linkml.generators.owlgen import OwlSchemaGenerator from tests.test_utils.environment import env from tests.utils.compare_rdf import compare_rdf from tes...
StarcoderdataPython
245685
<filename>pe_tree/map.py # # Copyright (c) 2020 BlackBerry Limited. 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/LICE...
StarcoderdataPython
1882821
<gh_stars>100-1000 trick.exec_set_terminate_time(5.2)
StarcoderdataPython
1818889
import pytest @pytest.mark.skip("Already bgpv4 and bgpv6 testcases are available") def test_devices(api, utils): """This is a BGPv4 demo test script with router ranges""" config = api.config() tx, rx = config.ports.port( name="tx", location=utils.settings.ports[0] ).port(name="rx", location=u...
StarcoderdataPython
1820242
<reponame>tracelytics/python-traceview<gh_stars>0 """Tracelytics instrumentation for Django Copyright (C) 2016 by SolarWinds, LLC. All rights reserved. """ # django middleware for passing values to oboe __all__ = ("OboeDjangoMiddleware", "install_oboe_instrumentation") import oboe from oboeware import imports from...
StarcoderdataPython
11345001
<filename>lang/py/cookbook/v2/source/cb2_19_13_exm_4.py for result in fetchsome(cursor): doSomethingWith(result)
StarcoderdataPython
3509116
import json import os """ cd {DanceTrack ROOT}/CenterNet cd data mkdir -p dancetrack_coco_hp/annotations cd dancetrack_coco_hp ln -s ../coco/train2017 coco_train ln -s ../dancetrack/train dancetrack_train cd ../.. """ print('coco_hp is loading...') coco_json = json.load(open('data/coco/annotations/person_keypoints_...
StarcoderdataPython
3574487
import os from unittest import TestCase from image_keras.supports import path class TestPath(TestCase): current_path: str = os.path.dirname(os.path.abspath(__file__)) working_path: str = os.getcwd() test_path: str = os.path.join(working_path, "tests") test_resource_folder_name: str = "test_resources"...
StarcoderdataPython
243986
#!/usr/bin/python # # This program source code file is part of KiCad, a free EDA CAD application. # # Copyright (C) 2012-2014 KiCad Developers, see change_log.txt for contributors. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as publi...
StarcoderdataPython
206489
<reponame>owen800q/execution-trace-viewer import sys import os import functools import traceback from PyQt5 import QtCore, QtGui, QtWidgets, uic from yapsy.PluginManager import PluginManager from core.trace_data import TraceData from core.bookmark import Bookmark from core import trace_files from core.filter_and_find ...
StarcoderdataPython
8013146
from Rules import ASingleRule from Utils import ColorUtil from RectUtils import RectUtil from Rules import TextValidator from Utils import Constants from ocr.OCRTextWrapper import OCRTextWrapper from Utils import GroupUtil from Utils import TextUtils #/** # * # * This word only have one child view, and the child view ...
StarcoderdataPython
79185
# based on tut_mission_B737.py and Vehicle.py from Regional Jet Optimization # # Created: Aug 2014, SUAVE Team # Modified: Aug 2017, SUAVE Team # Modified: Jul 2018, geo # ---------------------------------------------------------------------- # Imports # ------------------------------------------------------------...
StarcoderdataPython
1949585
<reponame>hfhchan/Cantonese """ Created at 2021/1/16 16:23 Last update at 2021/6/6 9:11 The interpret for Cantonese """ import re import sys import io import os from pygame.constants import KEYDOWN """ Get the Cantonese Token List """ def cantonese_token(code : str) -> list: keywords = r'(?P<k...
StarcoderdataPython
3488457
""" Boredom v0.1 错误:直接统计了所有可能的数值a和对应的count,忽视了要求中只影响a-1,a+1两个数,而误认为影响了小于a和大于a的两个数 """ ''' 基本思路: 1. 函数找到每个值及其对应的sum 2. 找到最大sum 的所对应的num,并和周围相邻num-1,num+1对应的sum和比较。如果大于则。。,小于就删掉 3. 加入result,并删除对应值 ''' def find_counts(lists): counts = [] # 排序后方便对元素个数进行计数 lists.sort(reverse=True) while len(lists) != 0: ...
StarcoderdataPython
110209
<gh_stars>0 # Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you ma...
StarcoderdataPython
3225359
class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ if len(s) <= 1: return len(s) longest = 0 left = 0 seen = {} for right in range(len(s)): if s[right] in seen: ...
StarcoderdataPython
9729517
<gh_stars>1-10 import numpy from .utils import mask, condense, pauli_diagonalize1 from .paulialg import Pauli, PauliMonomial, pauli_zero from .stabilizer import (StabilizerState, zero_state, identity_map, clifford_rotation_map, random_clifford_map) class CliffordGate(object): '''Represents a Clifford gate. ...
StarcoderdataPython
3562871
<gh_stars>1-10 # -*- coding: utf-8 -*- from openslides.utils.models import AbsoluteUrlMixin from openslides.utils.test import TestCase class MyModel(AbsoluteUrlMixin): """" Model for testing """ def get_absolute_url(self, link='default'): if link == 'default' or link == 'known': u...
StarcoderdataPython
4942745
# ============================================================================== # Copyright 2019 - <NAME> # # NOTICE: 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, ...
StarcoderdataPython
3525377
<gh_stars>0 from pydub import AudioSegment from pydub.silence import split_on_silence def split(filepath, save_path, time_length): sound = AudioSegment.from_wav(filepath) dBFS = sound.dBFS chunks = split_on_silence(sound, min_silence_len=500, sil...
StarcoderdataPython
1673449
<reponame>gdlg/pytorch_nms<gh_stars>10-100 from setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension setup(name='nms', packages=['nms'], package_dir={'':'src'}, ext_modules=[CUDAExtension('nms.details', ['src/nms.cpp', 'src/nms_kernel.cu'])], cmdclass={'bu...
StarcoderdataPython
3353678
#!\usr\bin\python ''' mjtsai1974@20180603, v1.0, Simple plot ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy.stats as stats import seaborn as sns #Generate a randomized data set #x = np.random.randn(500) #Plot command::Begin #plot(x, y), y v.s. x::Begin #plt.plot(x) #Take the ...
StarcoderdataPython
5124261
<filename>tests/pyflakes_generic_plugins/NoFutureImportTest.py import ast import unittest from pyflakes.checker import Checker from pyflakes_generic_plugins.NoFutureImport import NoFutureImport class NoFutureImportTest(unittest.TestCase): def setUp(self): self.filename = 'NoFutureImport' def check...
StarcoderdataPython
74696
from topaz.module import ClassDef from topaz.objects.objectobject import W_Object from topaz.modules.ffi.function import W_FFIFunctionObject from rpython.rlib import jit class W_VariadicInvokerObject(W_Object): classdef = ClassDef('VariadicInvoker', W_Object.classdef) def __init__(self, space): W_Ob...
StarcoderdataPython
4895033
from math import * # a console is a place where python would output information. which is where the print statement sends our files to. ''' print(" /|") print(" / |") print(" / |") print("/___|") ''' # a variable is like a container that stores for storing data-values.. # which makes it alot easy for us to mana...
StarcoderdataPython
5167142
#!/usr/bin/env python # -*- coding: utf-8 -*- from lib.DlsiteScraper import DlsiteScraper from lib.JsonFile import JsonFile import lib.setting as setting # main import traceback # extract_genre_count import collections import itertools # calculate_inclination # sanpu import matplotlib.pyplot as plt import numpy as ...
StarcoderdataPython
12857558
<reponame>ThaDeveloper/grind<filename>src/api/models/user.py """User model module""" import jwt from datetime import datetime, timedelta from django.db import models from django.utils import timezone from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin from django.conf import settings from django....
StarcoderdataPython
1773286
from util.Docker import Docker class Dredd: image = 'weaveworksdemos/openapi' container_name = '' def test_against_endpoint(self, json_spec, endpoint_container_name, api_endpoint, mongo_endpoint_url, mongo_container_name): self.container_name = Docker().random_contai...
StarcoderdataPython
3246552
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re from Commands.Keys import Button, Direction, Hat from Commands.PythonCommandBase import PythonCommand # import numpy as np from scipy.sparse.csgraph import shortest_path # , floyd_warshall, dijkstra, bellman_ford, johnson from scipy.sparse import csr_matrix se...
StarcoderdataPython
1864620
<reponame>jmnguye/awx_work # output only one occurence of an array groups = ['awx_my_admins','awx_my_users','awx_my_admins'] printed_groups = [] for group in groups: found = False for printed_group in printed_groups: if group == printed_group: found = True if found =...
StarcoderdataPython
9673660
import os os.environ['CUDA_DEVICE_ORDER']='PCI_BUS_ID' os.environ['CUDA_VISIBLE_DEVICES']='' import numpy as np from tensorflow.keras.layers import Input, Dense, SimpleRNN, GRU, LSTM, Bidirectional from tensorflow.keras.models import Model USE_TOY_WEIGHTS = True REC_LAYER = GRU sequence_length = 3 feature_dim = 1 fea...
StarcoderdataPython
8147409
<reponame>svilen-ivanov/sgp<filename>ep2/brute_force.py<gh_stars>1-10 def subset_sum(numbers, target, partial=[], partial_sum=0): if partial_sum == target: yield partial if partial_sum >= target: return for i, n in enumerate(numbers): remaining = numbers[:] yield from subse...
StarcoderdataPython
1969095
from .common import ViewBase from pyramid.view import view_config from datetime import datetime, timedelta from ..schema import * class AdminViews(ViewBase): @view_config(route_name='maintenance', renderer='admin/maintenance.mak', permission='admin', request_method='GET') def maintenance(self): return...
StarcoderdataPython
3380753
import bs4 import base64 previous_scripts = set() class Item: def __init__(self, item): self._item = item def get_req_resp(self, reqresp): try: return base64.b64decode(reqresp.string).decode() except UnicodeDecodeError: print(self._item.host) print(...
StarcoderdataPython
4859653
<reponame>sreenathmmenon/astttproject from django.views import generic from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import tabs from horizon i...
StarcoderdataPython
1993410
from PIL import Image """Wrapper module for converting an OpenGL (vispy) canvas to an image.""" def pixels_to_image(pixels, size, path): """Reads an array of pixels (RGBA) and outputs a png image. Arguments: pixels -- Array of pixel data to read. size -- width and height of the image in a...
StarcoderdataPython
3361728
<filename>tests/unit/test_tempo_client.py<gh_stars>1-10 def test_tempo_client(tempo_client, tempo_request): request = tempo_request.get('/foo') response = tempo_client.get('/foo') assert response.status_code == 200 assert request.called_once assert request.last_request.headers['User-Agent'].startsw...
StarcoderdataPython
8114140
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' tf.random.set_seed(2467) def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.shape[0] pred = tf.math.top_k(output, maxk).indices pred = tf.transpose(pred, perm=[1, 0]) target_ = tf.broadcast_to(t...
StarcoderdataPython
6638436
import pytest import theano import theano.tensor as tt from operator import add from unification import unify, reify, var, variables from kanren.term import term, operator, arguments from symbolic_pymc.meta import mt from symbolic_pymc.utils import graph_equal from symbolic_pymc.unify import (ExpressionTuple, etupl...
StarcoderdataPython
5056586
from mock import Mock, \ MagicMock, \ patch, \ mock_open import itertools from django.test import TestCase from config.settings import PUBLIC_ROLE from core.db.backend.pg import connection_pools, \ _pool_for_credentials, \ ...
StarcoderdataPython
356317
<reponame>nitrictech/python-sdk # # Copyright (c) 2021 Nitric Technologies Pty Ltd. # # This file is part of Nitric Python 3 SDK. # See https://github.com/nitrictech/python-sdk for further info. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the...
StarcoderdataPython
4865031
from .instance import shared_transnet_instance from .account import Account from .exceptions import ProposalDoesNotExistException from .blockchainobject import BlockchainObject import logging log = logging.getLogger(__name__) class Proposal(BlockchainObject): """ Read data about a Proposal Balance in the chain ...
StarcoderdataPython
332769
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
StarcoderdataPython
341803
# -*- coding: utf-8 -*- # Copyright (C) 2015 Mag. <NAME> All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. <EMAIL> # #++ # Name # auto_imports # # Purpose # Automatically import MOM-related modules that are needed during # sphinx run (import when a specific module is documented is too late!) # # R...
StarcoderdataPython
3560952
<reponame>michaelmernin/kafka-topics-message-browser<gh_stars>1-10 from confluent_kafka.schema_registry.avro import AvroDeserializer import constants from config_handler import ConnectionConfig from error_handler import ErrorHandler class Deserializer: directory_avro_schemas = constants.DIRECTORY_AVRO_SCHEMAS ...
StarcoderdataPython
3500942
<reponame>chamsrut/Plagiarism-detector from __future__ import print_function import argparse import os import pandas as pd # sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. # from sklearn.externals import joblib # Import joblib package directly import joblib ## TODO: Import any additiona...
StarcoderdataPython
8097956
class TestBucketeerCLI: """Tests for Bucketeer CLI.""" def test_true(self): """Tests that pytest is setup properly.""" assert True
StarcoderdataPython
9655747
# -*- coding: utf-8 -*- # เรียกใช้งานโมดูล file_name="data2" import codecs from pythainlp.tokenize import word_tokenize #import deepcut from pythainlp.tag import pos_tag from nltk.tokenize import RegexpTokenizer import glob import nltk import re # thai cut thaicut="newmm" # เตรียมตัวตัด tag ด้วย re pattern = r'\[(.*?)\...
StarcoderdataPython
1681151
<gh_stars>0 from scrapy.crawler import CrawlerProcess from scrapy.settings import Settings from jobparser import settings from jobparser.spiders.hh import HhSpider from jobparser.spiders.sj import SjSpider def get_sj_query(string: str): return string.replace(" ", '%20') def get_hh_query(string: str): return...
StarcoderdataPython
4909304
import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 创建一个变量v v = tf.Variable([1, 2]) # 创建一个常量c c = tf.constant([3, 3]) # 增加一个减法OP sub = tf.subtract(v, c) # 增加一个加法OP add = tf.add(v, sub) # 初始化变量操作 init = tf.global_variables_initializer() with tf.Session() as sess: # 下面这一句不能省略,需要执行 s...
StarcoderdataPython
1909259
<filename>ktrain/tests/testenv.py import os #os.environ['TF_KERAS'] = '1' #os.environ['TF_EAGER'] = '0' import sys os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"; os.environ["CUDA_VISIBLE_DEVICES"]="0" sys.path.insert(0,'../..')
StarcoderdataPython
4974922
from .pathway import Pathway from .gene import Gene from .pathwayentry import PathwayEntry
StarcoderdataPython
1887275
import asyncio import random from utilities import * async def fairies(lights): background_color = rgb(32, 32, 255) fairy_colors = [pretty, warm_white] for light in lights: light.set_state(background_color) loop = PeriodicLoop(0.15, 120) indices = [0, 1] while not loop.done(): ...
StarcoderdataPython
3209151
import json def main(): with open("./_data/componentes-curriculares.json", "r") as file: componentes = json.load(file) for componente in componentes: codigo = componente['codigo'] print('Gerando Componente', componente['codigo'], ' - ', componente['nome']) text = f"---\ncodigo:...
StarcoderdataPython
4973347
<reponame>shibing624/rater # -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>) @description: 基于用户的协同过滤算法 """ import math import os import random from sklearn.model_selection import train_test_split import rater from rater.utils.logger import timer class Dataset: """ load data and split data """ de...
StarcoderdataPython
115091
import enpix import numpy as np matrix = np.random.rand(341,765,3) # print(matrix) key="firstname.lastname@<EMAIL>.com-nameofuser-mobilenumber" time=1000000 pic = enpix.encrypt(matrix,key,time) # print(pic) pic2 = enpix.decrypt(pic,key,time) # print(pic2) print((matrix==pic2).all())
StarcoderdataPython
3228877
from asyncio import open_connection import json numbers = [2, 3, 5, 7, 11, 13] filename = 'chapter_10/numbers.json' with open(filename, 'w') as f_object: json.dump(numbers, f_object)
StarcoderdataPython
3203287
from gym.envs.registration import register # Pybullet environment + fixed goal + gym environment register( id='widowx_reacher-v1', entry_point='widowx_env.envs.1_widowx_pybullet_fixed_gymEnv:WidowxEnv', max_episode_steps=100) # Pybullet environment + fixed goal + goal environment register( id='widowx...
StarcoderdataPython
9626289
<reponame>SaVoAMP/stumpy import numpy as np import numpy.testing as npt from stumpy import aamp_stimp, aamp_stimped from dask.distributed import Client, LocalCluster import pytest import naive T = [ np.array([584, -11, 23, 79, 1001, 0, -19], dtype=np.float64), np.random.uniform(-1000, 1000, [64]).astype(np.f...
StarcoderdataPython
320191
<filename>metric-collector/service-readiness/kubeflow-readiness.py<gh_stars>1-10 import argparse from time import sleep, time import logging import google.auth import google.auth.app_engine import google.auth.compute_engine.credentials import google.auth.iam from google.auth.transport.requests import Request import go...
StarcoderdataPython
8161051
from battery.models import db, User, Entry, Comment from flask import render_template, request, session, flash, redirect, url_for from flask import g, jsonify, abort, Blueprint, current_app, send_file from functools import wraps from sqlalchemy.exc import IntegrityError from werkzeug.utils import secure_filename from d...
StarcoderdataPython
6567800
<reponame>Thom1729/st_package_reviewer<filename>st_package_reviewer/check/repo/check_tags.py import re from . import RepoChecker class CheckSemverTags(RepoChecker): def check(self): if not self.semver_tags: msg = "No semantic version tags found" if not self.tags: ...
StarcoderdataPython
390029
<reponame>catseye/Xoomonk #!/usr/bin/env python """Reference interpreter for Xoomonk 1.0. """ from optparse import OptionParser import re import sys DOLLAR_STORE = None class XoomonkError(ValueError): pass class AST(object): def __init__(self, type, children=None, value=None): self.type = type ...
StarcoderdataPython
8038943
<gh_stars>0 import json import datetime from collections import OrderedDict def thodar_form_alter(form, post, entity = None): entitier = IN.entitier texter = IN.texter thodar_name = IN.APP.config.thodar['name'] s_thodar_name = s(thodar_name) if entity: current_entity_id = entity.id current_entity_type =...
StarcoderdataPython
12536
from client import exception, embed_creator, console_interface, discord_manager, file_manager, ini_manager, json_manager, origin, permissions, server_timer from client.config import config as c, language as l from discord.ext import commands, tasks from client.external.hiscores import hiscores_xp from PIL import Image,...
StarcoderdataPython