id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
9744632
from ._version import __version__ from ._version import version_info
StarcoderdataPython
1633003
from abc import ABC, abstractmethod from typing import Iterator, Tuple from nmm import CStep, SequenceABC class Fragment(ABC): """ Fragment of a sequence. Fragment is path with homology information. Parameters ---------- homologous : `bool` Fragment homology. """ def __init...
StarcoderdataPython
151265
<filename>tests/resources/test_comments.py import pytest @pytest.fixture(scope='module') def resource(): return { 'text': 'Wow this is an amazing comment!', } @pytest.fixture def comment(): return { 'text': 'Comments within comments... woah!', } @pytest.fixture(scope='module') def c...
StarcoderdataPython
3479189
<gh_stars>0 import sys, gzip, os, re from Bio import SeqIO inputtype=str(sys.argv[1]) if inputtype=='arg': filepath=str(sys.argv[2]) elif inputtype=='stdin': filepaths=sys.stdin elif inputtype=='stdin_headersasis': filepaths=sys.stdin else: sys.exit('unknown inputtype argument provided to editfastahead...
StarcoderdataPython
354847
<filename>elfi/visualization/interactive.py<gh_stars>0 """This module contains functions for interactive ("iterative") plotting.""" import logging import matplotlib.pyplot as plt import numpy as np logger = logging.getLogger(__name__) def plot_sample(samples, nodes=None, n=-1, displays=None, **options): """Plo...
StarcoderdataPython
11380157
<filename>01 Basics/010 - Importing module/010 -f- sys_argv.py<gh_stars>0 #!/usr/local/bin/python # -*- coding: utf-8 -*- # # Copyright 2018 <NAME> # All rights reserved. # # Author: <NAME> """ - IMPORTING MODULES - - SYS - Docs Instruction! RUN in cmd.exe python "010 -f- sys_argv.py"...
StarcoderdataPython
6530372
import logging from pathlib import Path from typing import Tuple, List import torch from torch.utils.data import Dataset from torch.nn.utils.rnn import pad_sequence from ..utils.io import fopen, progress_bar from ..vocabulary import Vocabulary logger = logging.getLogger('pysimt') class TextDataset(Dataset): "...
StarcoderdataPython
6651435
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('jssmanifests', '0005_auto_20150515_0818'), ] operations = [ migrations.AlterField( model_name='jsscomputerattrib...
StarcoderdataPython
9780027
# Copyright 2016-2018 Yubico AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
StarcoderdataPython
1707557
<reponame>pedroaugustosmribeiro/TINT """ tint.grid_utils =============== Tools for pulling data from pyart grids. """ import datetime import numpy as np import pandas as pd from scipy import ndimage def parse_grid_datetime(grid_obj): """ Obtains datetime object from pyart grid_object. """ dt_string = gri...
StarcoderdataPython
3285488
# _*_ coding: utf-8 _*_ import xgboost as xgb import numpy as np import matplotlib.pyplot as plt from scipy import stats from sklearn import metrics, cross_validation from sklearn.pipeline import Pipeline from sklearn.grid_search import GridSearchCV, RandomizedSearchCV from sklearn.cross_validation import train_test_sp...
StarcoderdataPython
12840165
import os import pathlib def get_data_path(file): prefix = pathlib.Path(__file__).parent.resolve() return os.path.abspath(os.path.join(prefix, file)) if __name__ == '__main__': print(get_data_path('data/name.txt'))
StarcoderdataPython
3473765
import json from utils import call_sub class NeutronIF(): """ Interface to the neutron api using command line orders. The methods names are the same as the commands from neutron. Ex: router-delete is called by router_delete """ def __init__(self, encoding='utf-8'): self.encoding = enc...
StarcoderdataPython
4860453
<filename>tests.py import json import re from autobahn.websocket.types import ConnectionDeny import pytest import txaio from shampoo import shampoo txaio.use_asyncio() @pytest.fixture(scope='function') def ws_request(): class Request: peer = '' path = 'path' protocols = ['shampoo'] ...
StarcoderdataPython
5009948
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: book_store.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _re...
StarcoderdataPython
1903447
<gh_stars>0 # -*- coding: utf-8 -*- """ANNtf2_algorithmEIANN.py # Requirements: Python 3 and Tensorflow 2.1+ # License: MIT License # Usage: see ANNtf2.py # Description Define fully connected excitatory/inhibitory artificial neural network (EIANN) - Author: <NAME> - Copyright (c) 2020-2021 Baxter AI (baxterai.co...
StarcoderdataPython
8013163
<filename>tests/test_real_random_address.py """ Tests for random_address module """ from random_address import real_random_address from random_address import real_random_address_by_state from random_address import real_random_address_by_postal_code def test_real_random_address(): """ Test default return as TR...
StarcoderdataPython
185588
from django.test import TestCase from django.template import Template, Context FAKE_COMPONENT = """ {% load megamacros %} {% definecomponent button flat=False cta=False %} <div class="input-field"> <button class="btn {% if flat %}btn-flat{% endif %} {% if cta %}btn-primary{% endif %}"> {% defineslot button_content %}...
StarcoderdataPython
361711
<filename>models/blip_nlvr.py from models.med import BertConfig from models.nlvr_encoder import BertModel from models.vit import interpolate_pos_embed from models.blip import create_vit, init_tokenizer, is_url from timm.models.hub import download_cached_file import torch from torch import nn import torch.nn.functiona...
StarcoderdataPython
8003056
import numpy as np from .box_utils import calc_iou from .base import Tracker, Track import logging logger = logging.getLogger() class MaxScoreTrack(Track): """Single box tracker, maintains max score""" def __init__(self, det): """ Args: det: Detection object """ s...
StarcoderdataPython
3354181
# -*- encoding: utf-8 -*- """ Created by eniocc at 11/10/2020 """ from py_dss_interface.models.Base import Base class ActiveClassS(Base): """ This interface can be used to read/modify the properties of the ActiveClass Class where the values are strings. The structure of the interface is as follows: ...
StarcoderdataPython
1751664
import time import app from app.utils import readable from app.dao.items.webcomicDao import WebcomicDao from app.crawlers.xkcd_crawler import XkcdComic def create_comic(comic_id, initial_data): dao = WebcomicDao() webcomicObj = dao.create_comic(comic_id, initial_data) return webcomicObj def get_comic(...
StarcoderdataPython
3488240
<filename>train_impala.py " IMPALA for Atari" from __future__ import absolute_import from __future__ import division from __future__ import print_function import contextlib import functools import os import sys # sys.path.append('../') #from more_itertools import one # from utils import * from utils import atari_ut...
StarcoderdataPython
4869627
#!/usr/bin/python # -*- coding: UTF-8 -*- """ Description [] Created by yifei on 2018/2/7. """ from flask_restful import Resource class AuthorAPI(Resource): def get(self, id): pass def put(self, id): pass def delete(self, id): pass class AuthorListAPI(Resource): def get...
StarcoderdataPython
12843612
<reponame>LoipesMas/pyCraft from minecraft.networking.packets import Packet from minecraft.networking.types import ( Short, BitFieldEnum ) class HeldItemChangePacket(Packet, BitFieldEnum): @staticmethod def get_id(context): return 0x25 if context.protocol_version >= 738 else \ 0x24 if...
StarcoderdataPython
3330006
#!/usr/bin/env python3 # Details for at_ repos import os, sys, json, requests, yaml # Color constants # Reference: https://gist.github.com/chrisopedia/8754917 COLERR="\033[0;31m" COLINFO="\033[0;35m" COLRESET="\033[m" baseurl = 'https://pub.dev/api' headers = {"Content-Type": "application/json", "Accept": "applicati...
StarcoderdataPython
8025997
<gh_stars>0 from pynput import keyboard import car from car.motors import set_throttle, set_steering import music import threading key_to_speed = {'w': 20, 's': -20} key_to_speed_caps = {'w': 30, 's': -30} key_to_steer = {'a': +45, 'd': -45} speedy = False def on_press(key): global speedy if key == keyboard...
StarcoderdataPython
9617053
# Copyright (c) <NAME> <<EMAIL>> # See LICENSE file. from _sadm.utils import builddir def build(env): env.log('build') testing_error = env.settings.get('testing', 'testing.error', fallback = '') if testing_error == 'env_session_error': env.session.start() with builddir.create(env, 'sadm.testing') as fh: fh.wr...
StarcoderdataPython
5101556
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding:utf-8 -*- """ Given a graph and a source vertex src in graph, find shortest paths from src to all vertices in the given graph. The graph may contain negative weight edges. Time complexity of Bellman-Ford is O(VE), which is more than Dijkstra. Algorithm: Input: Gr...
StarcoderdataPython
3230878
from .discriminative_lm import DiscLMTrainingModule, DiscLMTrainingModuleConfig # noqa: F401 from .lm import LMTrainingModule, LMTrainingModuleConfig # noqa: F401
StarcoderdataPython
151594
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver departments=[('Cardiologist','Cardiologist'), ('Dermatologist','Dermatologist'), ('Emergency Medicine Specialist','Emergency Medicine Specialist'), ('Allergist/I...
StarcoderdataPython
3260951
<filename>darts/darts_config.py # Constants for DARTS training configuration. These should be constant for a # complete set of experiments. # TRAIN BATCH_SIZE = 64 LR = 0.025 MOMENTUM = 0.9 WD = 3e-4 INIT_CHANNELS = 16 LAYERS = 8 GRAD_CLIP = 5 DROPPATH_PROB = 0.2 # Probability of dropping a path CUTOUT_LENGTH = 16 AU...
StarcoderdataPython
6576147
<filename>Packs/HealthCheck/Scripts/HealthCheckAnalyzeLargeInvestigations/HealthCheckAnalyzeLargeInvestigations.py import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 import dateutil.relativedelta THRESHOLDS = { 'numberofincidentswithmorethan500entries': 300, 'numberofin...
StarcoderdataPython
6699848
import tweepy auth = tweepy.OAuthHandler("API CONSUMER KEY HERE", "API CONSUMER SECRET KEY HERE") auth.set_access_token("ACCESS TOKEN HERE", "ACCESS TOKEN SECRET HERE") api = tweepy.API(auth) tweet = input("") api.update_status(status=(tweet)) print("Successfully tweeted...
StarcoderdataPython
6638808
<reponame>krkaufma/Electron-Diffraction-CNN import abc import typing import keras class Model(abc.ABC): def __init__(self, *args, height=246, width=299, depth=1, n_labels=1, **kwargs): self.height = height self.width = width self.depth = depth self.shape = (self.height, self.width...
StarcoderdataPython
8120717
import numpy as np import torch from simpletransformers.language_representation import RepresentationModel from simpletransformers.language_representation.representation_model import batch_iterable, mean_across_all_tokens, \ concat_all_tokens from tqdm import tqdm class CustomRepresentationModel(RepresentationMo...
StarcoderdataPython
1959731
<gh_stars>0 # thanks to https://www.gitmemory.com/issue/matterport/Mask_RCNN/218/466497448 import os import sys import keras.backend as K import tensorflow as tf # I needed to add this sess = tf.Session() K.set_session(sess) ROOT_DIR = os.path.abspath("../../") sys.path.append(ROOT_DIR) from mrcnn import model as ...
StarcoderdataPython
158219
import os import time from celery.utils.collections import OrderedDict from django.template import loader from contents.models import ContentCategory from goods.models import GoodsChannel from meiduo_mall import settings from meiduo_mall.settings import dev def generate_static_index_html(): """生成静态的首页""" pri...
StarcoderdataPython
5007594
# -*- coding: utf-8 -*- """ Adds projection and RPC tags to an image from its metadata files, and them orthorectifies it using the RPC data and a DEM image. If no DEM is provided, a DEM from SRTM is used (1-arc second / 30m aprox GSD). """ import argparse import logging import os import sys import shutil from perus...
StarcoderdataPython
313100
<filename>HW2-CNN/codes/show.py import numpy as np from PIL import Image, ImageDraw, ImageFont def floatToInt(data): data_min = np.min(data) data_max = np.max(data) data = (data - data_min) / (data_max - data_min) * 255.0 return data.astype('uint8') def drawOne(i, input, output, file_name): input ...
StarcoderdataPython
4908182
# coding: utf8 __version__ = '0.1'
StarcoderdataPython
1621003
<filename>test/countries/test_france.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and...
StarcoderdataPython
5106297
#!/usr/bin/env python3 import tvcheck.pyfs pyfs.main()
StarcoderdataPython
8052885
# Copyright (C) 2019 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause import unittest import logging from codebasin import config, finder, walkers from codebasin.walkers.platform_mapper import PlatformMapper class TestExampleFile(unittest.TestCase): """ Test of handling for disjoint code bases: ...
StarcoderdataPython
3314257
from django.conf.urls import url from . import views from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url('^$', views.index, name='home'), url(r'^search/', views.search_results, name='search_results'), url(r'^singleimage/(\d+)', views.single_photo, name='singleIma...
StarcoderdataPython
9632701
<filename>model/experiment/gradient_boosting_basic.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Experiment with a basic gradient boosting model """ __author__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright 2019, <NAME>" __license__ = "Creative Commons Attribution-ShareAlike 4.0 International ...
StarcoderdataPython
4890003
""" This is the module for the LookUp class. <NAME> ---- TO DO: --- Make testingsoup a daum file and class we want to separate the dictionaries to make it easier to use with other programs ---Add this API http://mymemory.translated.net/doc/spec.php --- Make all Null values None - Add support for if url blocks urlo...
StarcoderdataPython
8044583
import sys input = sys.stdin.readline # 부모 노드 탐색 def find(x): if parent[x] < 0: # x가 루트 노드 return x p = find(parent[x]) parent[x] = p return p # 두 트리를 합침 def union(x,y): x = find(x) y = find(y) # 이미 같은 트리에 속한 노드일 경우 if x == y: return # 두 노드가 속한 트리 중 높이가 낮은 트리를 높은 트리에 합침 ...
StarcoderdataPython
685
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import json from pathlib import Path import numpy as np import torch from PIL import Image from panopticapi.utils import rgb2id # from util.box_ops import masks_to_boxes from .construction import make_construction_transforms import logging def...
StarcoderdataPython
3201847
<reponame>rknop/amuse<filename>examples/simple/grid_potential.py # -*- coding: ascii -*- from __future__ import print_function from amuse.units import units, nbody_system from amuse.datamodel import Particle from amuse.community.athena.interface import Athena from amuse.community.hermite.interface import Hermite from ...
StarcoderdataPython
9702588
<gh_stars>0 import questionary import loading_files # Data science imports import pandas as pd import numpy as np from bokeh.plotting import figure, output_file, show def get_file_information(): filename = loading_files.browse_file_search() filetype = loading_files.select_file_type() return loading_file...
StarcoderdataPython
6403027
# The piwheels project # Copyright (c) 2017 <NAME> <https://github.com/bennuttall> # Copyright (c) 2017 <NAME> <<EMAIL>> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must ...
StarcoderdataPython
9792900
"""CLI for working with Python packages and BUILD files in a Pants monorepo""" __version__ = "1.30.5"
StarcoderdataPython
1755652
<reponame>oi-analytics/oia-transport-archive # -*- coding: utf-8 -*- """vtra """ import pkg_resources __author__ = "Oxford Infrastructure Analytics and Contributors" __copyright__ = "Oxford Infrastructure Analytics and Contributors" __license__ = "mit" try: __version__ = pkg_resources.get_distribution(__name__).v...
StarcoderdataPython
9647923
from DebateWiki.versions.v1 import users
StarcoderdataPython
4906445
# coding=utf-8 # Copyright 2019 Google LLC # 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 ...
StarcoderdataPython
4847219
from pathlib import Path from setuptools import find_packages, setup with open("README.md", "r") as file: LONG_DESCRIPTION = file.read() with open("requirements.txt", "r") as file: ALL_REQS = file.read().split("\n") ALL_REQS = [req for req in ALL_REQS if req] # to-do: separate dev requirements IN...
StarcoderdataPython
3357070
OPTIONS = [ ('train-batch', 64, 'Batch size at training.'), ('train-crop', 224, 'Input image size at training.'), ('train-epoch', 300, 'Number of epochs at training.'), ('train-warmup', 5, 'Number of epochs for warmup at training.'), ('train-lr', 0.025, 'Initial learning rate at training'), ...
StarcoderdataPython
8007196
from django.test import TestCase # importation of models from .models import Image,Location,Category # Create your tests here. class LocationTestClass(TestCase): """ Test class for testing location model """ # setup method def setUp(self): """ setup method creating instance of lo...
StarcoderdataPython
8056763
<gh_stars>0 import os import json import numpy as np import pandas as pd from data_fetching import get_trx_dates # 导入原始的基金持仓数据 fundHoldData = pd.read_pickle('./data/fund_holding_data.pkl') # 筛选基金持仓数据 if not os.path.exists('./output'): os.makedirs('./output') # default value FILTERED_DATA_PATH = './output/fund_...
StarcoderdataPython
1936539
<reponame>Indexical-Metrics-Measure-Advisory/watchmen-data-processor<filename>watchmen/report/engine/dataset_engine.py import logging import time import traceback from pypika import functions as fn, AliasedQuery, Field, JoinType from watchmen.common.pagination import Pagination from watchmen.common.presto.presto_clie...
StarcoderdataPython
1600027
import logging,os class OneLineExceptionFormatter(logging.Formatter): def formatException(self, exc_info): return super().formatException(exc_info) def format(self, record): result = super().format(record) if record.exc_text: result = result.replace("\n", "") return...
StarcoderdataPython
6460534
<gh_stars>1-10 # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
StarcoderdataPython
9741659
from .admin import admin_bp from .feedback import feedback_bp from .user import user_bp admin_bp = admin_bp feedback_bp = feedback_bp user_bp = user_bp
StarcoderdataPython
5193011
<filename>wow_monitor/admin.py<gh_stars>0 from django.contrib import admin from .models import Character, SimcRank class SimcRankAdmin(admin.ModelAdmin): readonly_fields = ('rating_time',) admin.site.register(Character) admin.site.register(SimcRank, SimcRankAdmin)
StarcoderdataPython
3458120
<gh_stars>100-1000 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from .base_modifier import BaseWeaponModifier, Modifier, BaseArmourModifier class BaseErosionModifier(...
StarcoderdataPython
6683434
#!/usr/bin/env python """Climesync - CLI TimeSync Frontend Usage: climesync [options] [<command> [<args>... ]] Options: -h --help Print this dialog -c <baseurl> --connect=<baseurl> TimeSync Server URL -u <username> --username=<username> Username of ...
StarcoderdataPython
3499357
<filename>Exercises/053.py<gh_stars>0 # Develop a program that reads any sentence # and says if it is a palindrome, disregarding spaces. phrase = str(input('Write a phrase: ')).strip().upper() word = phrase.split() togheter = ''.join(word) reverse = togheter[::-1] print(reverse) if reverse == togheter: print('Thi...
StarcoderdataPython
1984871
<filename>tests/functional/testdata/tests_with_generic_section.py<gh_stars>1-10 import pytest def doc_generic(funcarg, funcval): return [":{}: {}".format(funcarg, funcval)] # @pytest.hookimpl(hookwrapper=True) # def pytest_runtest_call(item): # # If we're using pytest-docgen, we'll have a doc collector # ...
StarcoderdataPython
1986795
<reponame>Akasan/TorchUtils<filename>TorchUtils/DatasetGenerator/FromFolder.py from PIL import Image from glob import glob import torch import numpy as np import os import random from torchvision.datasets import ImageFolder import torchvision.transforms as transforms from ._LoaderGenerator import generate_dataloader as...
StarcoderdataPython
1667538
<filename>preprep/constant.py DUMP_CSV = "csv" DUMP_FEATHER = "feather" DUMP_PICKLE = "pickle" MODE_FIT = "fit" MODE_PRED = "predict"
StarcoderdataPython
1640850
<gh_stars>1-10 import numpy as np import pandas as pd import cocotb from cocotb.clock import Clock from cocotb.triggers import Timer, FallingEdge #module fm_generator_wb_slave (i_clk, i_reset, i_wb_cyc, i_wb_stb, i_wb_we, i_wb_addr, i_wb_data, o_wb_ack, o_wb_stall, o_wb_data, o_sample); @cocotb.test() async def fm...
StarcoderdataPython
379435
<reponame>alexdelprete/hass_nuki_ng<gh_stars>0 from homeassistant.components.binary_sensor import BinarySensorEntity import logging from . import NukiEntity from .constants import DOMAIN _LOGGER = logging.getLogger(__name__) async def async_setup_entry( hass, entry, async_add_entities ): entities = ...
StarcoderdataPython
1781546
#Calculate GCD using Euclid's Algorithm def gcd(a,b): while (b != 0): t = a a = b b = t % b return a def gcd1(): pass print(gcd(20,8)) print(gcd(65,28))
StarcoderdataPython
4897596
from botocore.vendored import requests import boto3 import json import os import io import re import zipfile BATCH_RESULTS_URL = 'https://batch.geocoder.cit.api.here.com/6.2/jobs/%s/result' HERE_APP_ID = os.environ.get('HERE_APP_ID') HERE_APP_CODE = os.environ.get('HERE_APP_CODE') SNS_SUCCESS_ARN = os.environ.get('SNS...
StarcoderdataPython
9739597
<filename>wagtailplus/wagtaillinks/forms.py """ Contains application form definitions. """ from django import forms from wagtailplus.wagtaillinks.models import Link class EmailLinkForm(forms.models.ModelForm): """ Form for email link instances. """ class Meta(object): model = Link f...
StarcoderdataPython
4801590
<filename>modeling/hf_head/modeling_roberta_parsing.py # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except...
StarcoderdataPython
3203147
<reponame>tayyipcanbay/solidity-uzerine-denemeler from brownie import FundMe, MockV3Aggregator, network, config from scripts.helpful_scripts import ( deploy_mocks, get_account, deploy_mocks, LOCAL_BLOCKCHAIN_ENVIROMENTS, ) from web3 import Web3 def deploy_fund_me(): account = get_accoun...
StarcoderdataPython
8110044
<reponame>AggarwalAnshul/pythonLab<filename>Program 4 - maximum of list.py """Program to find the maximum of list""" print(max(list(map(int, input("enter the element of the list\n>> ").split()))))
StarcoderdataPython
57190
from django.contrib.auth import get_user_model from django.db import models from ordered_model.models import OrderedModel class Rule(OrderedModel): """Represents a subreddit rule to which a moderator action may be link.""" name = models.CharField(max_length=255, help_text='The name of the rule') descripti...
StarcoderdataPython
3393344
<gh_stars>1-10 import requests from bs4 import BeautifulSoup def ask_anna(text="who are you"): url = "https://www.pandorabots.com/pandora/talk?botid=e6b3d89abe37ba83" data = { "input": text, "botcust2": "b170873d9e664911"} html = requests.post(url, data).text soup = BeautifulSoup(html,...
StarcoderdataPython
3208053
import logging from ignition.service.framework import ServiceRegistration from ignition.boot.config import BootProperties from ignition.boot.configurators.utils import validate_no_service_with_capability_exists from ignition.service.messaging import MessagingProperties, InboxCapability, DeliveryCapability, PostalCapabi...
StarcoderdataPython
5122360
#!/usr/bin/python # -*- coding: utf-8 -*- # TABLES TO ADD # payments # driving # THINGS TO ADD # The Club # Who paid for an event # Parsing # Rounding errors # QUESTIONS # How is best to parse the date input? # import sqlite3 as lite import sys import math class DatabaseHandler: def __init__(self, con): ...
StarcoderdataPython
3477103
n = int(input()) s = input() def binaryToDecimal(num): d,i = 0,0 while (num!=0): dec = num%10 d = d + dec*pow(2,i) num = num//10 i+=1 return d sum = binaryToDecimal(int(s)) def decimalToBinary(num): l = [] while (num!=0): l.append(str(num%2)) ...
StarcoderdataPython
6405479
# Work with Python 3.6 import discord #import discord.voice_client import time import random from discord.ext import commands client = discord.Client() TOKEN= #token goes here @client.event async def on_message(message): # we do not want the bot to reply to itself if message.author == client....
StarcoderdataPython
3281402
from swamp import log logger = log.get_logger() class AppException(Exception): msg_fmt = "An unknown exception occurred." def __init__(self, message=None, **kwargs): self.kwargs = kwargs if not message: try: message = self.msg_fmt % kwargs except Exce...
StarcoderdataPython
3449311
#!/usr/bin/env python # 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 # # Authors: # - <NAME>, <EMAIL>, 2019 from __future__ import print_function ...
StarcoderdataPython
8035472
import os from shutil import rmtree import numpy as np import z5py from z5py.dataset import Dataset import z5py.util BENCH_DIR = 'bench_dir' def set_up(): """ Make the tmp directory and load the test image """ if os.path.exists(BENCH_DIR): rmtree(BENCH_DIR) os.mkdir(BENCH_DIR) im =...
StarcoderdataPython
216758
import os import ssl import time import urllib.request from datetime import datetime import certifi import yaml from pycti import OpenCTIConnectorHelper, get_config_variable from stix2 import TLP_WHITE, URL, Bundle, ExternalReference class VXVault: def __init__(self): # Instantiate the connector helper f...
StarcoderdataPython
4897566
<gh_stars>0 import xml.etree.ElementTree as ET import itertools import codecs, os, spacy, json import pandas as pd import numpy as np import networkx as nx import matplotlib.pyplot as plt from pathlib import Path from afinn import Afinn from nltk.tokenize import sent_tokenize from sklearn.feature_extraction.text import...
StarcoderdataPython
1801175
<filename>superglue/models/rte.py import sys from functools import partial from modules.bert_module import BertLastCLSModule, BertModule from task_config import SuperGLUE_LABEL_MAPPING, SuperGLUE_TASK_METRIC_MAPPING from torch import nn from emmental.scorer import Scorer from emmental.task import EmmentalTask from ....
StarcoderdataPython
79519
import os import logging from .paths import get_path _FORMAT = '%(asctime)s:%(levelname)s:%(lineno)s:%(module)s.%(funcName)s:%(message)s' _formatter = logging.Formatter(_FORMAT, '%H:%M:%S') _handler = logging.StreamHandler() _handler.setFormatter(_formatter) logging.basicConfig(filename=os.path.join(get_path(), 'sp...
StarcoderdataPython
9771413
# Generated by Django 3.0.7 on 2020-07-06 14:32 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('portfolio', '0053_auto_20200706_1310'), ] operations = [ migrations.AlterUniqueTogether( name='baseentry', unique_together=s...
StarcoderdataPython
9681143
<reponame>szwieback/BayesianTripleCollocation ''' Created on Jun 1, 2017 @author: zwieback ''' import pymc3 as pm import theano.tensor as tt import numpy as np def model_setup(visible,normalized_weights,estimateexplanterms={},estimatesdexplanterms={},inferenceparams={}): nsensors=visible['y'].shape[0] n=visibl...
StarcoderdataPython
1609480
import redis import discord import asyncio import time from threading import Thread ids = [424863503887630337,424863531612110848,424863554366210059,424863574200942593,428230754888056852] queues = { 'hub': 0, 'survival': 1, 'creative': 2, 'zombies': 3, 'build': 4 } servers = ['hu...
StarcoderdataPython
3274272
<filename>feibonacii.py n=int(input("需要第几项\n")) a=0 b=1 i=2 if n==1: print(a) elif n==2: print(b) else: while(i<n): result=a+b a=b b=result i+=1 print(result)
StarcoderdataPython
9798273
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ..minc import Volcentre def test_Volcentre_inputs(): input_map = dict( args=dict(argstr="%s",), centre=dict(argstr="-centre %s %s %s",), clobber=dict(argstr="-clobber", usedefault=True,), com=dict(argstr="-com",), e...
StarcoderdataPython
1634513
<gh_stars>0 import cocos from cocos.actions import MoveBy, Repeat, Place from cocos.layer import Layer from cocos.sprite import Sprite class ParallaxBackground(Layer): def __init__(self, box, sprites, time, delay): super(ParallaxBackground, self).__init__() self.batch = cocos.batch.BatchNode() ...
StarcoderdataPython
282683
#! /usr/bin/env python3 # # Copyright (c) 2016, <NAME> <<EMAIL>> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" ...
StarcoderdataPython
289549
<reponame>itsuna/MicrosoftFormsAutomaticInput import json import os import sys from factory.input_processor_factory import InputProcessorFactory def _load_config(path: str): """ コンフィグファイルを読み込む Load config file """ with open(path, 'r', encoding='utf-8') as f: config = json.load(f) re...
StarcoderdataPython