id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
327285 | <gh_stars>1-10
"""
MultiEn/Microsoft's DialogGPT chatbot (Conversational NLU).
"""
__all__ = ['ChatbotDialoggptEnMultiWrapper']
from .chatbot_dialoggpt_en import ChatbotDialoggptEn
from .translator_marian import TranslatorMarian
class ChatbotDialoggptEnMultiWrapper(ChatbotDialoggptEn):
"""
MultiEn/Micro... | StarcoderdataPython |
5158121 | <gh_stars>10-100
import json
import argparse
import gzip
import os
def parse_cve_file(filename, save_file):
cve_dict = {}
with gzip.open(filename, "rt", encoding="utf-8") as f:
cve_data = json.load(f)
for item in cve_data["CVE_Items"]:
cpes = set()
cwes = set()
... | StarcoderdataPython |
5035002 | import random
import re
print('---------------------------------')
print(' GUESS THAT PRIMER GAME')
print('---------------------------------')
print()
primer_length = 5
goal = ''.join(random.choice(['A', 'C', 'G', 'T']) for idx in range(primer_length))
print(goal)
guess = ''
name = input('Player what is your name... | StarcoderdataPython |
3339518 | <gh_stars>0
numero = int(input('Digite um número para calcular seu fatorual: '))
contador = numero
fatorial = 1
while contador > 0:
print('{}'.format(contador), end='')
print(' x ' if contador >1 else ' = ', end='')
fatorial *= contador
contador -=1
print('{}'.format(fatorial))
| StarcoderdataPython |
250787 | <reponame>dev-japo/potion-client
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import codecs
from setuptools import setup
setup(
name='Potion-client',
version='2.5.1',
packages=[str('potion_client')], # https://bugs.python.org/issue13943
url='https://github.com/biosustain/potion-cl... | StarcoderdataPython |
8145396 | <filename>src/keyframes.py<gh_stars>0
#!/usr/bin/env python3
# scenedetect
from scenedetect import VideoManager, SceneManager
from scenedetect.detectors import ContentDetector
def keyframe_detection_with_aom_first_pass(parameters):
pass
def keyframe_detection_with_scenedetect(parameters):
video = VideoManager([pa... | StarcoderdataPython |
6446836 | import pytest
from lxml import etree
from tests.utils import assert_nodes_equal, load_xml, render_node
from zeep import xsd
def test_build_occurs_1():
custom_type = xsd.Element(
etree.QName('http://tests.python-zeep.org/', 'authentication'),
xsd.ComplexType(
xsd.Sequence([
... | StarcoderdataPython |
3388602 | <gh_stars>1-10
#
# 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 writing... | StarcoderdataPython |
1810610 |
#def test_marker_login(app):
# username = app.username
# password = <PASSWORD>
# app.session.ensure_login_marker(username, password)
# user = app.session.get_logged_user_marker()
# assert username == user
def test_marker_login(app):
username = app.username
password = <PASSWORD>
app.session... | StarcoderdataPython |
6415201 | import sys, os, re, time
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as InterFun
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
# Define folder path for csvs
FOLDER_PATH... | StarcoderdataPython |
11330761 | # -*- coding: utf-8 -*-
#
# comparison_schemes.py
#
"""
Features selection and classifications
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
from scipy.stats import randint as sp_randint
from scipy.stats import uniform as sp_uniform
from skfeature.function.similarity_based.fisher_score import fisher_score
from sk... | StarcoderdataPython |
192783 | <gh_stars>0
from nltk import tokenize
import re
def test():
"""Driver"""
filename = 'test.txt'
with open(filename, 'r') as f:
data = f.read()
data = data.replace('Fig.', 'Figure')
sentences = tokenize.sent_tokenize(data)
print(sentences)
# erroneously splits on "Fig. 3"
assert l... | StarcoderdataPython |
11329436 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import csv
import re
import os
import mwparserfromhell as wparser
import string
import pywikibot
import datetime
import requests
import pymysql
import random
from urllib.parse import quote
from wikidataStuff.WikidataStuff import WikidataStuff as wds
site_cache = {... | StarcoderdataPython |
3513676 | <reponame>JonathanGailliez/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by M... | StarcoderdataPython |
12831692 | <gh_stars>1-10
from collections import namedtuple
import json
from os import listdir, makedirs
from os.path import join as p, isdir, isfile
import transaction
from unittest.mock import patch
from tempfile import TemporaryDirectory
import pytest
import rdflib
from rdflib.term import URIRef
from owmeta_core.bundle impo... | StarcoderdataPython |
9697042 | <filename>nistscraper/utils.py
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 3 10:50:01 2020
@author: 21EthanD
"""
import numpy as np
import matplotlib.pyplot as plt
def ideal_gas_law(T, Vm):
"""
Calculates the pressure in atm of a gas given the temperature in K and the molar volume in L/mol using the ideal... | StarcoderdataPython |
236534 | <reponame>seongsujeong/GEOSAK
#!/usr/bin/env python3
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import grwt
import sys
#To plot the real numbered array
def plot_real(raster_in,range=None,cmap='viridis'):
if type(raster_in)==grwt.raster:
arr_to_plot=raster_in.z
if raster_in... | StarcoderdataPython |
9706214 | <reponame>cfginn/sap-simulation-package<filename>utils/boilerplate/test_hippo.py
import unittest
from pysapets.hippo import Hippo
from pysapets.animal import Animal
import pysapets.constants as constants
from unittest.mock import patch
from io import StringIO
from copy import deepcopy
class HippoTest(unittest.TestCas... | StarcoderdataPython |
9659518 | <reponame>hoangperry/pytorch-ts<gh_stars>0
from typing import List, Optional
import torch
import torch.nn as nn
from gluonts.core.component import validated
from gluonts.dataset.field_names import FieldName
from gluonts.model.predictor import Predictor
from gluonts.torch.model.predictor import PyTorchPredictor
from g... | StarcoderdataPython |
4954513 | # Devices taken from
# https://github.com/mgp25/Instagram-API/blob/master/src/Devices/GoodDevices.php
DEFAULT_DEVICE = 'samsung_galaxy_s9_plus'
DEVICES = {
# Released on March 2016
'samsung_galaxy_s7': {
'instagram_version': '26.0.0.10.86',
'android_version': 24,
'android_release': '7.0'... | StarcoderdataPython |
6568091 | <reponame>e11it/hue-1
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (th... | StarcoderdataPython |
1808231 | class RootException(Exception):
"""
Base class for all custom exceptions.
"""
| StarcoderdataPython |
1982691 | from __future__ import unicode_literals
TRANSACTION_APPROVED = '0'
SUMMARY_CODES = {
TRANSACTION_APPROVED: 'Transaction Approved',
'1': 'Transaction Declined',
'2': 'Transaction Erred',
'3': 'Transaction Rejected',
}
EFT_RESPONSE_CODES = {
'00': 'Approved or completed successfully',
'01': 'R... | StarcoderdataPython |
5153707 | <filename>env/lib/python3.10/site-packages/Quartz/QuickLookUI/_metadata.py
# This file is generated by objective.metadata
#
# Last update: Wed Aug 4 11:44:15 2021
#
# flake8: noqa
import objc, sys
if sys.maxsize > 2 ** 32:
def sel32or64(a, b):
return b
else:
def sel32or64(a, b):
return a
... | StarcoderdataPython |
4981993 | <gh_stars>0
# Copyright 2019, The Johns Hopkins University Applied Physics Laboratory LLC
# All rights reserved.
# Distributed under the terms of the Apache 2.0 License.
import abc
import collections
import contextlib
import functools
import inspect
import io
import logging
import re
from .core import DocType, Entity... | StarcoderdataPython |
1720162 | import facetracker_custom as fc
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import load_model
jiung = "jiung"
frameCnt = 0
landmarks = []
toMotionNum = 400
fromMotionNum = 1
model = load_model("output_02.h5")
model.summary() # model Info
frameCnt = 0
for points in fc.run(visualize=1, max... | StarcoderdataPython |
8138935 | <reponame>SimonTheVillain/connecting_the_dots
import torch
import torch.utils.data
import numpy as np
class TestSet(object):
def __init__(self, name, dset, test_frequency=1):
self.name = name
self.dset = dset
self.test_frequency = test_frequency
class TestSets(list):
def append(self, name, dset, test_... | StarcoderdataPython |
1714372 | <filename>tools/android/find_unused_resources.py<gh_stars>1-10
#!/usr/bin/python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Lists unused Java strings and other resources."""
import optparse
im... | StarcoderdataPython |
3241351 | <gh_stars>1-10
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.analyses.derating.models.inductor_unit_test.py is part of The
# RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for the inductor ... | StarcoderdataPython |
2571 | <filename>frontends/PyCDE/test/polynomial.py
# RUN: %PYTHON% %s 2>&1 | FileCheck %s
from __future__ import annotations
import mlir
import pycde
from pycde import (Input, Output, Parameter, module, externmodule, generator,
types, dim)
from circt.dialects import comb, hw
@module
def PolynomialComp... | StarcoderdataPython |
5126273 | from ._op_item_type_registry import op_register_item_type
from ._op_items_base import OPAbstractItem
# {
# "uuid": "zjc6s5ri3rhcxploofa67jamze",
# "templateUuid": "003",
# "trashed": "N",
# "createdAt": "2021-03-19T23:27:12Z",
# "updatedAt": "2021-03-19T23:30:10Z",
# "changerUuid": "RAXCWKNRRN... | StarcoderdataPython |
6584524 | <filename>tests/utils.py
import base64
def create_basic_auth_header(username, password):
payload = b":".join((username.encode("utf-8"), password.encode("utf-8")))
return {
"Authorization": "Basic {base64}".format(
base64=base64.b64encode(payload).decode("utf-8")
)
}
def crea... | StarcoderdataPython |
9728225 | import torch
import torch.nn as nn
from torch.nn.modules.loss import _WeightedLoss
import torch.nn.functional as F
class InfoNCE_Loss(nn.Module):
"""Performs predictions and InfoNCE Loss
Modified From:
https://github.com/loeweX/Greedy_InfoMax/blob/master/GreedyInfoMax/vision/models/InfoNCE_Loss.py
htt... | StarcoderdataPython |
1794967 | <filename>src/bio2bel/io/pykeen.py
# -*- coding: utf-8 -*-
"""Entry points for PyKEEN.
PyKEEN is a machine learning library for knowledge graph embeddings that supports node clustering,
link prediction, entity disambiguation, question/answering, and other tasks with knowledge graphs.
It provides an interface for regi... | StarcoderdataPython |
5191735 | # -*- coding: utf-8 -*-
"""
Web API
~~~~
ref: web_api.yaml
:copyright: (c) 2017-2018 by Baidu, Inc.
:license: Apache, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from flask import g
from v1.services import DataService
from .resource import Resource
c... | StarcoderdataPython |
6642116 | # -*- test-case-name: twisted.test.test_web -*-
# Copyright (c) 2004 Divmod.
# See LICENSE for details.
"""I deal with static resources.
"""
# System Imports
import os, string, time
import io
import traceback
import warnings
from io import StringIO
from zope.interface import implementer
try:
from twisted.web.res... | StarcoderdataPython |
11235955 | # Check if a lepton is also 'loose'.
from Treemaker.Treemaker import cuts
numJets = 3
bMassMax = 50
def setup(variables, isData):
return variables
def createCuts(cutArray):
description = "Is this a loose lepton event (electron or muon)?"
cutArray["isLoose"] = cuts.Cut("Is Loose Lepton", description)
return cutA... | StarcoderdataPython |
1848277 | <reponame>vsevolodpohvalenko/home-assistant
"""Click-based interface for Songpal."""
import ast
import asyncio
import json
import logging
import sys
from functools import update_wrapper
import click
from songpal import Device, SongpalException
from songpal.common import ProtocolType
from songpal.containers import Set... | StarcoderdataPython |
149476 | from electionguard_tools.scripts import sample_generator
from electionguard_tools.scripts.sample_generator import (
DEFAULT_NUMBER_OF_BALLOTS,
DEFAULT_SPOIL_RATE,
DEFAULT_USE_ALL_GUARDIANS,
DEFAULT_USE_PRIVATE_DATA,
ElectionSampleDataGenerator,
)
__all__ = [
"DEFAULT_NUMBER_OF_BALLOTS",
"D... | StarcoderdataPython |
1876818 | from ..base.base_connector import BaseConnector
from stix2matcher.matcher import Pattern
from stix2matcher.matcher import MatchListener
from stix2validator import validate_instance
import json, requests
class Connector(BaseConnector):
def __init__(self, connection, configuration):
self.is_async = False
... | StarcoderdataPython |
29563 | <filename>handler.py<gh_stars>1-10
import torch
import os
import logging
import json
from abc import ABC
from ts.torch_handler.base_handler import BaseHandler
from transformers import T5Tokenizer, T5ForConditionalGeneration
logger = logging.getLogger(__name__)
class TransformersSeqGeneration(BaseHandler, ABC):
_... | StarcoderdataPython |
291253 | <filename>deps/lib/python3.5/site-packages/openzwave/node.py
# -*- coding: utf-8 -*-
"""
.. module:: openzwave.node
This file is part of **python-openzwave** project https://github.com/OpenZWave/python-openzwave.
:platform: Unix, Windows, MacOS X
:sinopsis: openzwave API
.. moduleauthor: bibi21000 aka <NAME> ... | StarcoderdataPython |
5197319 | <reponame>return-main/stocksight
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""SeekAlphaListener.py - get headline sentiment from SeekingAlpha and add to
Elasticsearch.
See README.md or https://github.com/shirosaidev/stocksight
for more information.
Copyright (C) <NAME> 2018-2019
Copyright (C) Allen (<NAME>) Xie 20... | StarcoderdataPython |
11308850 | <gh_stars>1-10
class Solution:
def solve(self, words):
words = sorted(list(set(words)), key = lambda x: len(x))
words_set = set(words)
ans = 0
seen = set()
for i,word in enumerate(words):
if word in seen: continue
seen.add(word)
... | StarcoderdataPython |
1645829 | import numpy as np
from trackers.tracker import Tracker
from trackers.kalman_filter import KalmanFilter
from utils.hyper_params import default_params
from utils import util
class Sort(Tracker):
def __init__(
self,
min_score_thresh=default_params['min_score_thresh'],
max_age=def... | StarcoderdataPython |
11355727 | <filename>python/domain/quality_plan/content/requirements.py
"""
requirements - define requirements in the document
"""
from ..model import Requirement
from .sources import S1, S2
R1 = Requirement(
identifier="R1",
description="This is requirement 1",
sources=[S1],
)
R2 = Requirement(
identifier=... | StarcoderdataPython |
8058428 | # -*- coding: utf-8 -*-
# DO NOT CHANGE THIS FILE!
# Changes will be overwritten on: boat pull
#
# Enable the plugin by adding it to ansible.cfg's [defaults] section:
#
# callback_whitelist = longboat
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
... | StarcoderdataPython |
3369038 | <reponame>4thel00z/rq-dashboard
# flake8: noqa
from .web import setup
| StarcoderdataPython |
4974608 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 7 13:58:58 2017
@author: konodera
"""
import pandas as pd
import numpy as np
import utils
utils.start(__file__)
#==============================================================================
# load
#==============================================... | StarcoderdataPython |
9717090 | import asyncio
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from functools import partial
import requests
import json
queue = asyncio.Queue()
path_root = "/home/user/workspace/Scraper/"
"""
Producer, simplely takes the urls and dump them into the queue
"""
async def produce(queu... | StarcoderdataPython |
3273705 | <filename>covid/models/SEIRD_renewal.py
import jax
import jax.numpy as np
from jax.random import PRNGKey
import numpyro
import numpyro.distributions as dist
from ..compartment import SEIRDModel
from .util import observe, observe_nb2, ExponentialRandomWalk, LogisticRandomWalk, frozen_random_walk, clean_daily_obs
from ... | StarcoderdataPython |
4959704 | import os
from collections import defaultdict
import dpath.util
from voluptuous import Any
from dvc.dependency.local import LocalDependency
from dvc.exceptions import DvcException
from dvc.hash_info import HashInfo
from dvc.utils.serialize import LOADERS, ParseError
class MissingParamsError(DvcException):
pass
... | StarcoderdataPython |
4811033 | """
This module represents the
entry point to Discard(tm)
"""
import controllers.cmdcontroller as CmdController
import views.cmdview as CmdView
import common.viewutil as ViewUtil
import common.game as Game
def main():
controller = CmdController([CmdView, ViewUtil], Game)
controller.main()
if __name__ == '__mai... | StarcoderdataPython |
1946386 | <filename>data/studio21_generated/interview/0335/starter_code.py
class Solution:
def tallestBillboard(self, rods: List[int]) -> int:
| StarcoderdataPython |
4859398 | <reponame>peppasd/LIT<filename>projects/views.py
from django.shortcuts import render, get_object_or_404
from .models import Project, Photo, Member, Label, Value
from .forms import ProjectForm, LabelForm
from django.http import HttpResponseRedirect, HttpResponse
from django.urls import reverse
from django.conf import se... | StarcoderdataPython |
82367 | import configparser
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class SettingsDialog(Gtk.Dialog):
def __init__(self, parent, config_file):
buttons = (Gtk.STOCK_OK, Gtk.ResponseType.OK)
Gtk.Dialog.__init__(self, "Settings", parent, 0, buttons)
# Load defaults f... | StarcoderdataPython |
5192868 | <reponame>FelixVi/Bedrock<filename>dsp/digaree/cgen_srf.py
#!/usr/bin/python
# SRF cavity analog state computer
# Takes in cavity field, forward, and reverse vector measurements
# and computes the cavity detune frequency, decay parameter, and
# power imbalance for the purposes of a tuning loop and quench detector.
# K... | StarcoderdataPython |
11362264 | """API for SpatioTemporal Asset Catalog items."""
import os
import re
from typing import Any, Dict, List, Optional, Union
from urllib.parse import urlencode
from rasterio.transform import from_bounds
from rio_tiler_crs import STACReader
from titiler.api import utils
from titiler.api.deps import (
CommonImagePara... | StarcoderdataPython |
11254427 | # -*- coding: utf-8 -*-
__version__ = '1.0'
__title__ = 'webbot'
__description__ = 'webbot'
__url__ = 'https://github.com/joelee2012/webbot'
__author__ = '<NAME>'
__author_email__ = '<EMAIL>'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2021 Joe Lee'
__documentation__ = ''
| StarcoderdataPython |
6568914 | from config import BOTNAME,BOTTOKEN,DEBUG,PROXY,PY
from api import GetUserInfo,ChangeUserInfo
import requests
reqChange=requests.Session()
reqSender=requests.Session()
reqUpdater=requests.Session()
reqCallback=requests.Session()
req=requests.Session()
if len(PROXY)>0:
reqChange.proxies={"http":PROXY,"https":PROXY... | StarcoderdataPython |
237404 | <reponame>jasondelaat/ticklish_ui
from ticklish_ui import *
app = Application(
'Progressbar',
[Progressbar().options(name='pb1')],
[Progressbar('indeterminate').options(name='pb2')]
)
app.nametowidget('.row1.pb1').start(1)
app.nametowidget('.row2.pb2').start(1)
app.mainloop()
| StarcoderdataPython |
3530991 | <reponame>rizkhita/Algorithms
# i used libraries that need to be installed first
import pandas as pd
# read string sebagai file
from io import StringIO
import string
from Sastrawi.StopWordRemover.StopWordRemoverFactory import StopWordRemoverFactory
from string import punctuation
from sklearn.feature_extraction.text imp... | StarcoderdataPython |
1805224 | <gh_stars>1-10
import numpy as np
import attitude_utils as attu
from triangle_ray_intersect import Triangle_ray_intersect
class Landing_icgen(object):
def __init__(self,
attitude_parameterization=None,
position_r=(900,1100) , position_theta=(0, np.pi/2), position_phi=(-np.pi,... | StarcoderdataPython |
1689925 | #!/usr/bin/env python
#encoding=utf-8
import sys
import codecs
import json
if len(sys.argv) < 3:
print("Please select input and output file")
sys.exit()
in_file = codecs.open(sys.argv[1], encoding="utf-8")
out_file = codecs.open(sys.argv[2], "w", encoding="utf-8")
for line in in_file:
text = json.loads(... | StarcoderdataPython |
1648044 | <reponame>MLH-Fellowship/LarynxCode
class TRParseMode(object):
"""
type | replacement location
------------------------------------------------------
ANY | specs, extras, or defaults
SPEC | specs only
EXTRA | extras only
DEFAULT | defaults only
NOT_SPECS ... | StarcoderdataPython |
6576971 | <gh_stars>0
from gym.envs.registration import register
from gym_xmanage.xmanage_errors import *
register(
id='xmanageTSC-v0',
entry_point='gym_xmanage.envs:XmanageTSCEnv',
)
register(
id='xmanageCVTSC-v0',
entry_point='gym_xmanage.envs:XmanageCVTSCEnv',
) | StarcoderdataPython |
11363031 | import numpy as np
from ..base.indiv import Individual
################################################################################
# スカラー化関数
################################################################################
class ScalarError(Exception):
pass
def scalar_weighted_sum(indiv, weight, ref_point)... | StarcoderdataPython |
9707023 | from pathlib import Path
from tempfile import gettempdir
from bets.utils import sys_util
from bets.utils import log
log.init()
FILE_PATH = Path(__file__).absolute()
FILE_NAME = FILE_PATH.name
def test_get_temp_location():
temp_file = Path(sys_util.get_tmp_location(str(FILE_PATH)))
assert temp_file.parent =... | StarcoderdataPython |
8176942 | <reponame>AyumiizZ/Grad_school_work
"""
File name: 5.py
Author: AyumiizZ
Date created: 2020/10/04
Python Version: 3.8.5
About: Find kth smallest element in union set of two sorted arrays problem
"""
from random import randint
from time import sleep
DEBUG = False
def generate_data(n: int, min_dat... | StarcoderdataPython |
9606126 | from PreprocessData.all_class_files.Reservation import Reservation
import global_data
class FoodEstablishmentReservation(Reservation):
def __init__(self, additionalType=None, alternateName=None, description=None, disambiguatingDescription=None, identifier=None, image=None, mainEntityOfPage=None, name=None, p... | StarcoderdataPython |
11210331 | from django.test import TestCase
from authenticate.models import User
from flight.models import Flight, Seat
class TestFlight(TestCase):
def setUp(self):
self.user = User.objects.create_user(
email="<EMAIL>",
password="<PASSWORD>#",
date_of_birth="1900-11-19",
... | StarcoderdataPython |
192636 | # from util_content_hash import content_hash
#from python.common.util_mimetype import get_mimetype, mimetypes, validate_mimetype
#from schemas.schema_aligned_cfs import metadata
#from schemas.schema_floorplan_master_cfs import metadata_schema
# from . import cfs_schema
import copy
import hashlib
import io
import json... | StarcoderdataPython |
1844827 | from genericpath import exists
import os
import configparser
from sqlite3 import Connection, OperationalError
import sqlite3
import sys
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(PROJECT_ROOT)
from pytest import raises
from lib.tools import check_ini_files_and_re... | StarcoderdataPython |
3467464 | from .containers.spectrum import Spectrum
from .containers.collection import Collection, df_to_collection, proximal_join
from .readers import read
# __all__ = ['spectrum', 'collection', 'reader']
| StarcoderdataPython |
3564656 | <filename>Website-Status.py
#!/usr/bin/python
# -*- coding: UTF-8 -*
import sys
import requests
import urllib
from colorama import Fore, Back, Style
if len(sys.argv)==1:
print "Invalid domain"
else:
try:
urllib.urlopen('http://' + sys.argv[1])
print( u"\u2713" +" Up")
except:
print... | StarcoderdataPython |
5065558 | import http.client
import http.cookiejar
import json
import random
import re
import ssl
import time
import unittest
from xml.dom import minidom
import logging
logger = logging.getLogger(__name__)
__unittest = True
PROXYHOST = ""
PROXYPORT = ""
PROXYHTTPSPORT = ""
'''
Based on https://stackoverflow.com/questions/61... | StarcoderdataPython |
8165534 | import tkinter as tk
root = tk.Tk()
root.title("Hallo Welt!")
root.mainloop() | StarcoderdataPython |
11231352 | # -*- coding:utf-8 -*-
from torcms.core import tools
from torcms.model.entity_model import MEntity
class TestMEntity():
def setup(self):
print('setup 方法执行于本类中每条用例之前')
self.uid = tools.get_uu4d()
self.path = 'path'
def test_create_entity(self):
uid = self.uid
post_data... | StarcoderdataPython |
3240734 | <filename>tests/test_beam.py
from __future__ import absolute_import, division, print_function
import os
import dxtbx
from dxtbx.model.beam import BeamFactory
def test_beam():
dxtbx_dir = dxtbx.__path__[0]
image = os.path.join(dxtbx_dir, "tests", "phi_scan_001.cbf")
assert BeamFactory.imgCIF(image)
| StarcoderdataPython |
9636389 | """
This is the init file for WindSE. It handle importing all the
submodules and initializing the parameters.
"""
import os
import __main__
### Get the name of program importing this package ###
if hasattr(__main__,"__file__"):
main_file = os.path.basename(__main__.__file__)
else:
main_file = "ipython"
from... | StarcoderdataPython |
44146 | <gh_stars>10-100
import collections
class Solution:
def largestMultipleOfThree(self, digits: List[int]) -> str:
count = collections.Counter(digits)
remain1Count = count[1] + count[4] + count[7]
remain2Count = count[2] + count[5] + count[8]
total = sum(digits)
if total... | StarcoderdataPython |
364579 | <gh_stars>0
# All members to be imported
from api_view import APIView, route, api_action
from error import APIError
from schema_mixin import SchemaMixin
# Miscellaneous
SUCCESS_RESP = {"status": "success"}
| StarcoderdataPython |
5123734 | from time import time
from rich import print
t = time()
def len(l, bnH):
x = l**2 + (bnH) ** 2
return x == (int(x ** (1 / 2))) ** 2
ans = 1975
M = 100
while ans < 1_000_000:
for bnH in range(3, 2 * M):
if len(M, bnH):
if bnH > M:
ans += M - bnH // 2 + 1 if bnH % 2 =... | StarcoderdataPython |
98065 | class Solution:
def kLengthApart(self, nums: List[int], k: int) -> bool:
| StarcoderdataPython |
95529 | #!/usr/bin/python
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | StarcoderdataPython |
83230 | import uuid
import datetime
from typing import List, Union, Dict
from plugins.adversary.app.engine.database import EncryptedDictField
from plugins.adversary.app.engine.objects import Log
from plugins.adversary.app.util import tz_utcnow
version = 1.1
class Operation(dict):
def __init__(self):
super().__i... | StarcoderdataPython |
3425106 | import csv
import random
days = 31
orders = 100
def randomTime():
hrs = str(random.randint(0, 23))
mins = str(random.randint(0, 59))
if(int(mins) < 10):
mins = "0" + mins
if(int(hrs) < 10):
hrs = "0" + hrs
return hrs + ":" + mins
with open('database.csv', 'w', newline='') as csvfile:
fieldnames = ['id', 'd... | StarcoderdataPython |
398878 | <gh_stars>100-1000
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
import logging as log
# Disable B410: import_lxml - the library is used for writing
from lxml import etree as ET # nosec, lxml has proper XPath implementation
from datumaro.components.annotation import (
Annotation, ... | StarcoderdataPython |
1693058 | <gh_stars>1-10
import time
from Config import *
from Logger import logger
from AllFundCrawler import *
from FundTradeCrawler import *
from FundStockShare import *
from FundDividendCrawler import *
from FundReviewCrawler import *
from FundIndustryCrawler import *
from FundManagerHistoryCrawler import *
from FundBasicCra... | StarcoderdataPython |
1785092 | import asyncio
from datetime import datetime
loop = asyncio.get_event_loop()
asyncio.set_event_loop(loop)
from asyncdb import AsyncDB, AsyncPool
from asyncdb.providers.pg import pg, pgPool
params = {
"user": "troc_pgdata",
"password": "<PASSWORD>",
"host": "127.0.0.1",
"port": "5432",
"database":... | StarcoderdataPython |
108913 | #! /usr/bin/env python3
import os
from datetime import timedelta
import flask
from module.Interface import *
app = flask.Flask(__name__, template_folder="./static/html")
app.config['SECRET_KEY'] = os.urandom(24)
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=30)
@app.route('/', methods=["GET", "POST"])... | StarcoderdataPython |
1683850 | from torch.optim.lr_scheduler import CosineAnnealingLR, _LRScheduler
from torch.optim.optimizer import Optimizer
__all__ = [
'CosineDecayWithWarmupScheduler',
]
# Inspired by https://github.com/seominseok0429/pytorch-warmup-cosine-lr/blob/master/warmup_scheduler/scheduler.py
class CosineDecayWithWarmupScheduler(... | StarcoderdataPython |
6567524 | """
画出下列代码内存图
找出打印结果
"""
g01 = 100
g02 = 100
g03 = [100]
def func01():
g01 = 200# 创建一个局部变量
g03[0] = 200 # 修改的是列表中元素(读取全局变量)
def func02():
global g02
g02 = 200
func01()
print(g01) # 100
print(g03) # 200
func02()
print(g02) # 200
class MyClass:
cls01 = 300 # 饮水机
def __init__(self)... | StarcoderdataPython |
5161729 | <reponame>JarryChou/etsi-qkd-api<gh_stars>1-10
"""Class implementing the Key Management Entity (KME).
"""
import random
from api import helper
import configparser
from typing import List
from api import crawler
class KME:
"""
Class for the KME on each node. This class also defines the related methods for mani... | StarcoderdataPython |
34930 | #!/usr/bin/env python
from setuptools import find_packages, setup
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
setup(
name="tplink-wr-api",
version="0.2.1",
url="https://github.com/n1k0r/tplink-wr-api",
author="n1k0r",
author_email="<EMAIL>",
description=... | StarcoderdataPython |
3324493 | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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 |
9786267 | class data(object):
number=16
name="whwl"
| StarcoderdataPython |
3423646 | <filename>batch/batch/driver/instance_collection/job_private.py
from typing import List, Tuple
import random
import json
import logging
import asyncio
import sortedcontainers
from gear import Database
from hailtop import aiotools
from hailtop.utils import (
Notice,
run_if_changed,
WaitableSharedPool,
t... | StarcoderdataPython |
1706795 | import json
import numpy as np
from ..utils import *
from .. import logger
class Randomizer:
def __init__(self, randomization_config_fp='default_dr.json', default_config_fp='default.json'):
try:
with open(get_file_path('randomization/config', randomization_config_fp, 'json'), mode='r') as f:
... | StarcoderdataPython |
4822535 | import asyncio
from PyPSocket.util import *
from PyPSocket.exception import *
__all__ = [
# Classes
"Client",
"ClientEventHandler"
]
class Client:
def __init__(self, address_info, option):
self._address_info = address_info
self._option = option
self._closed = False
se... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.