id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3207230 | <reponame>Sajadrahimi/arvan-client
import logging
from arvan_client.arvan.api import Arvan
from arvan_client.dns.domain import Domain
class DNS(Arvan):
get_domains_url = 'https://napi.arvancloud.com/cdn/4.0/domains'
def get_domains(self, query_params: dict = None):
r = self._send_request('GET', self.get_domains... | StarcoderdataPython |
1766510 | import unittest
import numpy as np
from bio_rtd.chromatography import bt_curve, bt_load
from bio_rtd.core import ChromatographyLoadBreakthrough
from bio_rtd_test.aux_bio_rtd_test import TestLogger
class DummyChromatographyLoadBreakthrough(ChromatographyLoadBreakthrough):
POSSIBLE_KEY_GROUPS = []
OPTIONAL_KE... | StarcoderdataPython |
112219 | <reponame>aadhityasw/Competitive-Programs
def leaders(A,N):
lead = []
ma = A[-1]
for num in reversed(A) :
if num >= ma :
ma = num
lead.append(ma)
return reversed(lead)
# The below code will result in the same answer but will take a lot more time in the process becaus... | StarcoderdataPython |
15231 | <gh_stars>0
import serial
ser = serial.Serial('COM7',115200, timeout=1)
while True:
print("R: ", ser.readline()) | StarcoderdataPython |
1610919 | <reponame>Petro-Viron/django-notification
from __future__ import print_function
import logging
import pynliner
from django.apps import apps
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.c... | StarcoderdataPython |
3370976 | <reponame>idiot-ag/youtubepy<gh_stars>1-10
"""
"""
from multiprocessing import Pool
def init_driver():
"""
:return:
"""
if __name__ == "__main__":
P = Pool(cnt)
P.map(self.init_driver, zip(drivers, url_passing)) | StarcoderdataPython |
4814507 | import urllib.request
import json
def paper_titles_for_id(person_id):
url = f'https://api.labs.cognitive.microsoft.com/academic/v1.0/evaluate?expr=Composite(AA.AuId={person_id})&attributes=DN&subscription-key=a6f4e6b22dd9422cb40d0e8c2ef8eb3c&count=99999999'
output = json.load(urllib.request.urlopen(url))
... | StarcoderdataPython |
3290735 | <filename>docs/autogen.py
import os
import pathlib
import six
# From https://github.com/keras-team/keras/blob/0a0ac3fa5462cf4a72636ca4498a0a82ac91fc32/docs/autogen.py
def get_module_docstring(filepath):
"""Extract the module docstring.
Also finds the line at which the docstring ends.
"""
co = compil... | StarcoderdataPython |
3323272 | <gh_stars>0
# Generated by Django 2.2.12 on 2020-05-28 01:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('websites', '0002_website_status'),
]
operations = [
migrations.AddField(
model_name='website',
name='ap... | StarcoderdataPython |
3295762 | import os
import subprocess
from avatar2 import *
filename = "a.out"
GDB_PORT = 1234
# This is a bare minimum elf-file, gracefully compiled from
# https://github.com/abraithwaite/teensy
tiny_elf = (
b"\x7f\x45\x4c\x46\x02\x01\x01\x00\xb3\x2a\x31\xc0\xff\xc0\xcd\x80"
b"\x02\x00\x3e\x00\x01\x00\x00\x00\x08\x00... | StarcoderdataPython |
1691627 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Implements key derivation routines. These are mostly meant to be used as
modifiers for multibin expressions that can be passed as key arguments to
modules in `refinery.units.crypto.cipher`.
"""
import importlib
from refinery.units import arg, Unit
from refinery.lib.ar... | StarcoderdataPython |
1616029 | dt_alt = dt_true.copy()
print(f'before: {dt_true.shape[0]} observations, {dt_true.shape[1]} variables')
dt_true.drop('ratio',axis=1,inplace=True)
I = dt_true['income'] > 1.5
dt_true.drop(dt_true[I].index,inplace=True)
dt_true.drop(dt_true.loc[:5].index,inplace=True)
print(f'after: {dt_true.shape[0]} observations, {dt_... | StarcoderdataPython |
191405 | <filename>utils/pool.py<gh_stars>0
from multiprocessing import Process, Queue
from time import sleep
from typing import Callable, Iterable
def __worker(work, time_sleep, task_queue, done_queue):
"""
:param work:
:type work: Callable[[object], (bool, object)]
:param time_sleep:
:type time_sleep: f... | StarcoderdataPython |
3219100 | <filename>airmap_airspace_example.py
#!/usr/bin/env python3
from airmap import AirMapAPI
token = input("Enter your API Token for airmap: ")
airmap_api = AirMapAPI(token)
# geo map coordinates for ASU Tempe Campus
geo_json = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"... | StarcoderdataPython |
4805968 | __author__ = '<NAME>'
__version__ = '0.1.0'
__license__ = 'MIT'
import csv, sys
class Json:
def __init__(self, json_data):
self.json_data = json_data
self.rows_list = []
def recursive_json(self, data, store_list = [], level = 0, key = None):
# code for dictionary
if type(data) == type({}):
# for each ke... | StarcoderdataPython |
1798279 | <filename>application/routers/projects.py
"""VBR Project routes"""
from typing import Dict
from fastapi import APIRouter, Body, Depends, HTTPException
from vbr.api import VBR_Api
from vbr.utils.barcode import generate_barcode_string, sanitize_identifier_string
from ..dependencies import *
from .models import Project,... | StarcoderdataPython |
1716468 | <reponame>wnzhang/rtb-unbiased-learning
#!/usr/bin/python
import sys
from collections import defaultdict
print 'Begin to build Kaplan Meier estimator based on', ((sys.argv[1]).split('/'))[-1], 'and', ((sys.argv[3]).split('/'))[-1], 'for', ((sys.argv[2]).split('/'))[-1]
#build zb dictionary
bo_dict = defaultdict(list)
... | StarcoderdataPython |
1745044 | # coding:utf-8
"""
A corpus parser for preparing data for a tensorflow chatbot
"""
import os
import random
from ast import literal_eval
from tqdm import tqdm
DELIM = ' +++$+++ '
"""分隔符"""
SIZE = 3000
movie_lines_filepath = 'data/cornell-movie-dialogs-corpus/movie_lines.txt'
movie_conversations = 'data/cornell-movie-di... | StarcoderdataPython |
1650888 | <filename>official/cv/c3d/export.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 req... | StarcoderdataPython |
1688321 | <filename>kingbird/drivers/openstack/sdk.py<gh_stars>0
# Copyright 2016 Ericsson 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
#
# U... | StarcoderdataPython |
81116 | <filename>code/tests/test_prepare/test_pmi.py<gh_stars>1-10
import os.path
from unittest import TestCase
from code.cli import PARAMS_DIR, TESTS_DIR
from code.prepare.base import load_data
from code.prepare.lexstat import set_schema
from code.prepare.pmi import *
from code.prepare.params import load_params
FIXTURE... | StarcoderdataPython |
1675540 | <reponame>Kh4L/gluon-cv<filename>gluoncv/model_zoo/action_recognition/c3d.py
"""C3D, implemented in Gluon. https://arxiv.org/abs/1412.0767"""
# pylint: disable=arguments-differ,unused-argument
__all__ = ['C3D', 'c3d_kinetics400']
from mxnet import init
from mxnet.context import cpu
from mxnet.gluon.block import Hybri... | StarcoderdataPython |
83312 | <reponame>sirca/bdkd_datastore<gh_stars>1-10
# Copyright 2015 Nicta
#
# 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 a... | StarcoderdataPython |
155835 | <gh_stars>0
import warnings
import random
import string
from collections import OrderedDict
from decimal import Decimal
from ..generic.general_methods import aedt_exception_handler, generate_unique_name
from ..modeler.Object3d import EdgePrimitive, FacePrimitive, VertexPrimitive
try:
import clr
clr.AddReference... | StarcoderdataPython |
1788190 | import datetime
class Employee:
raise_amount = 1.04
def __init__(self, first_name: str, last_name: str, age: int):
self.first_name = first_name
self.last_name = last_name
self.age = age
def full_name(self) -> str:
return f'{self.first_name} {self.last_name}'
@classme... | StarcoderdataPython |
3327816 | <filename>setup.py
from setuptools import setup
from setuptools import find_packages
setup(
name='bugswarm-client',
version='0.1.6',
url='https://github.com/BugSwarm/client',
author='BugSwarm',
author_email='<EMAIL>',
description='The official command line client for the BugSwarm artifact data... | StarcoderdataPython |
4810627 | class OdbJobTime:
"""The OdbJobTime object stores the analysis time of a job.
Attributes
----------
systemTime: str
A float specifying the systemtime for the analysis. This attribute is read-only.
userTime: str
A float specifying the usertime for the analysis. This attribute is read... | StarcoderdataPython |
3397605 | <filename>rubikenv/rubikgym.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 15:51:06 2018
@author: adrien
"""
import numpy as np
import pandas as pd
import gym
from gym import spaces
class rubik_cube:
"""
This is a rubik's cube class simulator
Attributes :
- s... | StarcoderdataPython |
3352340 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by <NAME> and contributors.
:license: BSD, see LI... | StarcoderdataPython |
1705737 | import sys
from typeguard.importhook import install_import_hook
def pytest_addoption(parser):
group = parser.getgroup("typeguard")
group.addoption(
"--typeguard-packages",
action="store",
help="comma separated name list of packages and modules to instrument for "
"type checkin... | StarcoderdataPython |
3318621 | <filename>Pyrado/scripts/training/omo_a2c.py
import torch as to
import pyrado
from pyrado.algorithms.step_based.a2c import A2C
from pyrado.algorithms.step_based.gae import GAE
from pyrado.environments.pysim.one_mass_oscillator import OneMassOscillatorSim
from pyrado.logger.experiment import setup_experiment
from pyrad... | StarcoderdataPython |
24246 |
""" config.py
Microsimulation config for mulit-LAD MPI simulation
"""
import numpy as np
import glob
import neworder
# define some global variables describing where the starting population and the parameters of the dynamics come from
initial_populations = glob.glob("examples/people_multi/data/ssm_*_MSOA11_ppp_2011.cs... | StarcoderdataPython |
1777467 | <filename>text-classification/a05_Seq2seqWithAttention/a1_seq2seq_attention_predict.py
# -*- coding: utf-8 -*-
#prediction using model.
#process--->1.load data(X:list of lint,y:int). 2.create session. 3.feed data. 4.predict
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import tensorflow as tf
import numpy as np... | StarcoderdataPython |
3350521 | <reponame>jaggernod/bedtime-stories<filename>etl/src/data_classes.py
from dataclasses import dataclass
import datetime
@dataclass
class Model:
current_temperature: float
num_tea_boils: int
wake_up_time: datetime.datetime
outside_temperature: dict
| StarcoderdataPython |
1640654 | '''
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
'''
# Write your code here
n = int(input())
arr = [int(i) for i in inp... | StarcoderdataPython |
19433 | <filename>python/tests/test_tree_intersection.py
from challenges.tree_intersection.tree_intersection import find_intersection
from challenges.tree.tree import BinarySearchTree
def test_find_intersection():
tree1 = BinarySearchTree()
tree1.add(1)
tree1.add(2)
tree1.add(3)
tree1.add(4)
tree1.add(... | StarcoderdataPython |
3288666 | <filename>sdk/python/pulumi_azure_nextgen/documentdb/_enums.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'BackupPolicyType',
'CompositePathSortOrder',... | StarcoderdataPython |
1702525 | <gh_stars>0
class CompanyStaffDefault:
# https://www.django-rest-framework.org/community/3.11-announcement/#validator-default-context
requires_context = True
def __call__(self, serializer_field):
return serializer_field.context['request'].user.companystaff
| StarcoderdataPython |
1669005 | """
This script creates individual 3D views for each room in the active view. The active view must be a 3D view.
"""
# pylint: disable=import-error,invalid-name,broad-except
import clr
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
from pyrevit import revit
from pyrevi... | StarcoderdataPython |
3311339 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | StarcoderdataPython |
3231115 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn.functional as F
import math
import torch.nn as nn
def js_div(p_output, q_output, get_softmax=True):
"""
Function that measures JS divergence between target and output logits:
"""
KLDivLoss... | StarcoderdataPython |
131367 | import requests
import re
import time
import datetime
import numpy as np
"""
Prerequisite: Create access tokens
You need private access token to have full access to Github search
API.
Generate your access token in [here](https://github.com/settings/tokens)
you don't need to tick on any access permission because you ar... | StarcoderdataPython |
1725137 | <filename>basic/016_3Sum_Closest.py
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
# result
res = 0
diff = 2**31 - 1 # inf
nums.sort()
n = len(nums)
for i in range(0, n - 2):
# edge case
if i > 0 and nums[i] == ... | StarcoderdataPython |
3362016 | # coding=utf-8
import re
import random
import base64
import itertools
import concurrent.futures
import difflib
import logging
from urllib import parse
from lib.sqldb import Sqldb
from lib.settings import *
from lib.cli_output import *
from lib.Requests import Requests
class Cartesian(object):
def __init__(self):... | StarcoderdataPython |
1715121 | """Unfriendly.
A tool for unfollowing inactive friends on Twitter.
"""
import unfriendly.app
__author__ = '<NAME>'
__version__ = '1.0.0'
APP_NAME = 'Unfriendly'
def main():
"""Application entry point."""
unfriendly.app.main(APP_NAME, __version__)
if __name__ == '__main__':
main(... | StarcoderdataPython |
1697193 | <reponame>Valmarelox/auto_struct
from .base_type import BaseType
from .base_single_value_type import BaseSingleValueType
from .base_struct import BaseStruct
| StarcoderdataPython |
1607543 | <reponame>neilschark/ba-website<filename>performance_tests/pyplot_files/database_string_25_rps.py
import matplotlib.pyplot as plt
import sys
from ExtractDataCsv import extract_data_csv
from TableDataGenerator import write_table_data
import copy
timestamp = sys.argv[1]
data_type = sys.argv[2]
test_type = "database_stri... | StarcoderdataPython |
1794136 | <filename>contenttype/tree/TestParsonalTree_BlackBox.py<gh_stars>0
import unittest
from SubTypeTree import SubTypeTreeFactory
from SubTypeTree import VenderTreeFactory
from SubTypeTree import SubTypeTree
from SubTypeTree import VenderTree
from SubTypeTree import GitHubVenderTree
from SubTypeTree import StandardTree
fro... | StarcoderdataPython |
3376680 | <reponame>radiosmersh/gsquery<filename>gsquery/colorizer.py
OUTPUT_TEXT = 0
OUTPUT_HTML = 1
OUTPUT_ANSI = 2
class none:
def __init__(self):
self.mode = OUTPUT_TEXT
def parse(self, string):
return string
class q3(none):
COLORS_HTML = {
"0": "000000",
"1": "DA0120",
"2": "00B906",
"3": "E8FF19",
"4"... | StarcoderdataPython |
121851 | <gh_stars>0
import pytest
from eth_keys import keys
from cytoolz import (
merge,
)
from evm.exceptions import ValidationError
from evm.auxiliary.user_account_contract.transaction import (
UserAccountTransaction,
UnsignedUserAccountTransaction
)
VALID_PARAMS = {
"chain_id": 1,
"shard_id": 2,
... | StarcoderdataPython |
3350940 | from .BaseProvisioner import BaseProvisioner
from .DiggLpMetaFarmProvisioner import DiggLpMetaFarmProvisioner
from .SushiDiggWbtcLpOptimizerProvisioner import SushiDiggWbtcLpOptimizerProvisioner
from .DiggRewardsProvisioner import DiggRewardsProvisioner
from .BadgerRewardsProvisioner import BadgerRewardsProvisioner
fro... | StarcoderdataPython |
3398989 | <filename>gaia-sdk-python/gaia_sdk/http/tests/test_hmactokenbuilder.py
import unittest
from gaia_sdk.api.GaiaCredentials import HMACCredentials
from gaia_sdk.api.client_options import ClientOptions
from gaia_sdk.http.HMACTokenBuilder import HMACTokenBuilder
class TestHMACTokenBuilder(unittest.TestCase):
def tes... | StarcoderdataPython |
1683899 | <reponame>jambondeau1967/BackupMacOS
'''
depends on lib libLogger
'''
import os
import sys
import logging
import glob
import json
logger = logging.getLogger('libConfig')
def folder_exists(folder):
'''
check if folder exists
'''
present = False
if os.path.isdir(folder):
logging.debug(f'fol... | StarcoderdataPython |
3353727 | '''
title : app.py
description : Streamlit app that compares Messi and Ronaldo's stats and shows their positions on the pitch.
author : <NAME>
date_created : 20200521
date_modified : 20200613
version : 1.0
usage : streamlit run app.py
python_version : 3.7.6
'''
import dat... | StarcoderdataPython |
4811365 | # -*- coding: UTF-8 -*-
# File: __init__.py
# Author: <NAME> <<EMAIL>>
from pkgutil import walk_packages
import os
"""
Common utils.
These utils should be irrelevant to tensorflow.
"""
def _global_import(name):
p = __import__(name, globals(), None, level=1)
lst = p.__all__ if '__all__' in dir(p) else dir(... | StarcoderdataPython |
1658000 | from django.conf import settings
from django.utils import timezone
class TimezoneMiddleware(object):
def process_request(self, request):
if request.user.is_authenticated():
tz = request.session.get('django_timezone',
default=request.user.profile.time_zone)... | StarcoderdataPython |
3379336 | <filename>tests/trainers/lightning/test_loop_conditions.py<gh_stars>1-10
# Copyright (c) Facebook, Inc. and its affiliates.
import unittest
from unittest.mock import patch
from tests.trainers.test_utils import get_lightning_trainer
class TestLightningTrainer(unittest.TestCase):
def test_epoch_over_updates(self)... | StarcoderdataPython |
41809 | #!/usr/bin/env python
# coding: utf-8
import os
import unittest
from yalign.wordpairscore import WordPairScore
class TestWordPairScore(unittest.TestCase):
def setUp(self):
self.word_pair_score = self._create_word_pair_score('test_word_scores.csv')
def _create_word_pair_score(self, filename):
... | StarcoderdataPython |
20412 | #!/usr/bin/env python3
"""awspfx
Usage:
awspfx.py <profile>
awspfx.py [(-c | --current) | (-l | --list) | (-s | --swap)]
awspfx.py token [(-p | --profile) <profile>]
awspfx.py sso [(login | token)] [(-p | --profile) <profile>]
awspfx.py -h | --help
awspfx.py --version
Examples:
awspfx.py ... | StarcoderdataPython |
3358283 | <reponame>YuOZW/pyGSM
from .conjugate_gradient import conjugate_gradient
from .eigenvector_follow import eigenvector_follow
from .lbfgs import lbfgs
from ._linesearch import backtrack,NoLineSearch
from .beales_cg import beales_cg
| StarcoderdataPython |
86440 | <reponame>Jay4C/Python-Macros-For_FreeCAD
import FreeCAD, Part, Drawing, math, Mesh, importDXF
DOC = FreeCAD.activeDocument()
DOC_NAME = "part_rotor"
def clear_doc():
# Clear the active document deleting all the objects
for obj in DOC.Objects:
DOC.removeObject(obj.Name)
def setview():
# Rearra... | StarcoderdataPython |
1784409 | <reponame>cds-snc/url-shortener
"""create short_urls table
Revision ID: cd33c5fd06d2
Revises: 9<PASSWORD>
Create Date: 2022-01-20 04:46:42.628093
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = N... | StarcoderdataPython |
4801162 | import os
import unittest
from datetime import datetime
from intuitquickbooks.auth import Oauth1SessionManager
from intuitquickbooks.client import QuickBooks
from intuitquickbooks.objects.term import Term
class TermTest(unittest.TestCase):
def setUp(self):
self.session_manager = Oauth1SessionManager(
... | StarcoderdataPython |
1623173 | <filename>meshpy/tools/test_stable_pose.py
"""
Regressive test for stable poses. Qualitative only.
Author: <NAME>
"""
import IPython
import numpy as np
import os
import random
import sys
from autolab_core import Point, RigidTransform
from meshpy import ObjFile, Mesh3D
from visualization import Visualizer3D as vis
if ... | StarcoderdataPython |
3238027 | # -*- coding: utf-8 -*-
# @Author: chandan
# @Date: 2016-12-11 08:41:58
# @Last Modified by: chandan
# @Last Modified time: 2016-12-11 08:41:58
| StarcoderdataPython |
134247 | <reponame>theapricot/oppapp2<gh_stars>0
from models import *
connected = {}
# FUNCTION DEFINITIONS #
def allcansignup():
# returns true if property "cansignup" is true for all users
# (used for sign-ups open/closed switch on editor page)
return all([a[0] for a in Users.query.with_entities(Users.cansignup... | StarcoderdataPython |
1638779 | # -*- coding: utf-8 -*-
"""
Defines unit tests for :mod:`colour.colorimetry.photometry` module.
"""
import unittest
from colour.colorimetry import (SDS_ILLUMINANTS, SDS_LIGHT_SOURCES,
luminous_flux, luminous_efficiency,
luminous_efficacy, sd_zeros)
__au... | StarcoderdataPython |
1647110 | from django.conf.urls import url
from sic_financeiro.usuarios import views as usuario_view
urlpatterns = [
url(r'^login/$', usuario_view.do_login, name='usuario_login'),
url(r'^logout/$', usuario_view.do_logout, name='usuario_logout'),
url(r'^signup/$', usuario_view.signup, name='usuario_signup'),
url... | StarcoderdataPython |
3276327 | import random
from typing import Callable
from turnable import Game, HookType, build_game
from turnable.chars import PlayableEntity, Entity
from turnable.state import States
from turnable.streams import CommandResponse
from turnable.helpers.text import clear_terminal
class PoisonousCharacter(PlayableEntity):
""... | StarcoderdataPython |
3237983 | <reponame>Katsutoshii/adversarial-epidemics
'''
File: __init__.py
Project: src
File Created: Monday, 10th February 2020 4:26:45 pm
Author: <NAME> (<EMAIL>)
-----
Last Modified: Thursday, 27th February 2020 4:34:33 pm
Modified By: <NAME> (<EMAIL>)
'''
| StarcoderdataPython |
3326335 | from boxme_user.models import AbstractBoxmeUser
class MyCustomBoxmeUser(AbstractBoxmeUser):
class Meta(AbstractBoxmeUser.Meta):
verbose_name = "MyCustomBoxmeUserVerboseName"
verbose_name_plural = "MyCustomBoxmeUserVerboseNamePlural"
| StarcoderdataPython |
1753769 | import collections
import unittest
from unittest.mock import call, MagicMock
from .. import slurm_engine
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.process_runner = MagicMock()
self.process_runner.CalledProcessError = Exception
self.engine = self.generate_engine()
d... | StarcoderdataPython |
67772 | <reponame>fakhrirofi/twit-webhook<gh_stars>1-10
from dotenv import load_dotenv
from pprint import pprint
from webhook import Event
import os
import json
from threading import Thread
from pyngrok import ngrok
from time import sleep
from twitivity import Activity
load_dotenv(".env")
http = ngrok.connect(8080, bind_tls=... | StarcoderdataPython |
115542 | <filename>ebcli/operations/platform_version_ops.py
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.... | StarcoderdataPython |
30097 | # Generated by Django 3.2.5 on 2021-07-26 18:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('myhood', '0009_business_created_on'),
]
operations = [
migrations.RemoveField(
model_name='neighborhood',
name='occupants_co... | StarcoderdataPython |
1793544 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
import tensorflow as tf
tf.enable_eager_execution()
def get_type_id(tgt_len, tgt_idx, type_val):
tgt_idx_left_shift = tgt_idx[:-1]
type_val_right_shift = type_val[1:]
new_type_id_sh... | StarcoderdataPython |
1688744 | <reponame>foxsi/foxsi-smex<filename>pyfoxsi/scripts/convolve.py
from pyfoxsi.psf import convolve
from sunpy.map import Map
import matplotlib.pyplot as plt
f = '/Users/schriste/Google Drive/Work/FOXSI SMEX/Data/hsi_image_20050513_164526to164626_pixon_3arcsecx64_25to50kev_d1to9.fits'
hsi = Map(f)
foxsi_map = convolve(h... | StarcoderdataPython |
3336391 | import sys
from rimp.installer import install_repl, update_cache, already_installed
from rimp.fetcher import collect_files
def load_repl(name: str, project: str, force_reinstall: bool = False, verbose: bool = True):
if sys.platform == "win32":
if ".rimp/Lib/site-packages" not in sys.path:
sys... | StarcoderdataPython |
1692433 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import month_diff, getdate
from frappe.model.document import Document
from one_fm.one_fm.doctype.indemnity_allocati... | StarcoderdataPython |
1715899 | import sqlite3
import logging
import os
class DBEngine(object):
def __init__(self, connectstring):
self.connectstring = connectstring
self.connection = None
def open(self):
if not self.connection:
try:
self.connection = sqlite3.connect(self.con... | StarcoderdataPython |
3367215 | import csv
import requests
import os
csv.field_size_limit(2147483647)
possible_ingredients = set()
BASE_URL = "https://world.openfoodfacts.org"
INPUT_FILE = 'en.openfoodfacts.org.products.csv'
OUTPUT_FILE = 'raw_ingredients.txt'
COUNTRIES = ['United Kingdom',
'United States',
'United-states... | StarcoderdataPython |
1690214 | a = int(input())
b = int(input())
if a * b > 0: print(3 if a < 0 else 1)
else: print(4 if a > 0 else 2)
| StarcoderdataPython |
1705011 | <filename>checking/utils/test_checking.py<gh_stars>0
import os
import shutil
import tempfile
import unittest
from checking.utils import resolve_config, strip_config
class TestChecking(unittest.TestCase):
def setUp(self):
self.home = tempfile.mkdtemp()
self.no_file = os.path.join(self.home, 'no_f... | StarcoderdataPython |
1693151 | """Retrieves text posts from reddit using the reddit API, and saves them in a csv format.
Authors: <NAME>, <NAME>, <NAME>, <NAME>
"""
import datetime
import argparse
import requests
import pathlib
import csv
TODAY = datetime.datetime.utcnow()
ONE_MONTH_DELTA = datetime.timedelta(days=30)
MINUS_ONE_MONTH = TODAY - O... | StarcoderdataPython |
1211 | def nearest_mid(input_list, lower_bound_index, upper_bound_index, search_value):
return lower_bound_index + (
(upper_bound_index - lower_bound_index)
// (input_list[upper_bound_index] - input_list[lower_bound_index])
) * (search_value - input_list[lower_bound_index])
def interpolation_search(o... | StarcoderdataPython |
3238880 | from ridewithgps import APIClient
class RideWithGPS(APIClient):
BASE_URL= 'https://ridewithgps.com/' | StarcoderdataPython |
3291041 | # -*- coding: utf-8 -*-
from collections import defaultdict
class Annotation(object):
"""This class represents an annotation."""
def __init__(self, id, representation, spans, labels=()):
"""
Create an annotation object.
:param id: (string) The id of the current annotation.
:p... | StarcoderdataPython |
1776950 | <reponame>triplejberger/Queue
import datetime
def get_readable_time_from_ingame_timestamp(ingame_time):
return str(datetime.timedelta(milliseconds=ingame_time)) | StarcoderdataPython |
1688585 | <reponame>computationalmodelling/fidimag<gh_stars>10-100
from fidimag.extensions.common_clib import normalise
from fidimag.extensions.common_clib import init_scalar
from fidimag.extensions.common_clib import init_vector
from fidimag.extensions.common_clib import init_vector_func_fast
import fidimag.extensions.clib as c... | StarcoderdataPython |
3280989 | <gh_stars>0
# https://www.acmicpc.net/problem/2753
a = input()
a = int(a)
if (a % 4 == 0):
if (a % 100 == 0):
if (a % 400 == 0):
print("1")
else:
print("0")
else:
print("1")
else:
print("0")
| StarcoderdataPython |
48753 | <gh_stars>1-10
import logging
from dataclasses import dataclass
from telliot_core.dtypes.value_type import ValueType
from telliot_core.queries.abi_query import AbiQuery
logger = logging.getLogger(__name__)
@dataclass
class Snapshot(AbiQuery):
"""Returns the result for a given option ID (a specific proposal) on ... | StarcoderdataPython |
4800841 | <reponame>sages-pl/2022-01-pythonsqlalchemy-aptiv<gh_stars>0
"""
* Assignment: OOP Relations HasPosition
* Complexity: medium
* Lines of code: 18 lines
* Time: 8 min
English:
1. Define class `Point`
2. Class `Point` has attributes `x: int = 0` and `y: int = 0`
3. Define class `HasPosition`
4. In `HasPo... | StarcoderdataPython |
1769651 | import string
from kivy.app import App
from task_widgets.task_base.intro_hint import IntroHint
from utils import import_kv
from .find_in_table_dynamic import FindInTableDynamic
import_kv(__file__)
class IntroHintFindLetterDynamic(IntroHint):
pass
class FindLetterDynamic(FindInTableDynamic):
SIZE = 5
T... | StarcoderdataPython |
164424 | from socketio.namespace import BaseNamespace
from socketio.mixins import RoomsMixin, BroadcastMixin
from socketio.sdjango import namespace
from collections import defaultdict
import redis
from gevent import Greenlet
def home_redis_worker():
r = redis.StrictRedis(host='localhost', port=6379, db=0)
... | StarcoderdataPython |
3380336 | # -*- coding: utf-8 -*-
# @Author: gunjianpan
# @Date: 2019-03-26 10:21:05
# @Last Modified by: gunjianpan
# @Last Modified time: 2019-08-10 16:56:44
import aiohttp
import asyncio
import codecs
import json
import logging
import os
import re
import shutil
import struct
import sys
import time
from collections import... | StarcoderdataPython |
3227735 | <gh_stars>10-100
# class PersonMentionInlineBlock:
# pass
#
#
# class PageMentionInlineBlock:
# pass
#
#
# class DateInlineBlock:
# pass
#
#
# class EmojiInlineBlock:
# pass
#
#
# class EquationInlineBlock:
# pass
#
#
## TODO: smelly? why here? why so much code?
# class NotionDateBlock:
#
# start = No... | StarcoderdataPython |
3310394 | import cherrypy
import json
class Freeboard(object):
exposed=True
def GET(self,*uri,**params):
return open("./freeboard/index.html","r").read()
class Save(object):
exposed=True
def POST(self,*uri,**params):
data=json.loads(params['json_string'])
with open("./freeboard/dashboard/... | StarcoderdataPython |
3282754 | <reponame>yogesh-kamble/mozillians
from django.db.models import signals
from django.dispatch import receiver
from django.conf import settings
from django.contrib.auth.models import User
from multidb.pinning import use_master
from mozillians.users.models import ExternalAccount, UserProfile, Vouch
from mozillians.users... | StarcoderdataPython |
1757250 | <reponame>firefalcon73/Color_Detection
import cv2
import pandas as pd
import numpy as np
img = cv2.imread("colorpic.jpg")
imgWidth = img.shape[1] - 40
index = ['color', 'color_name', 'hex', 'R', 'G', 'B']
df = pd.read_csv("colors.csv", header=None, names=index)
r = g = b = xpos = ypos = 0
def getRGBvalue(event, x,... | StarcoderdataPython |
95755 | import os
# data processing
def get_basic_config(feature_type, label_type, SPLITS, HOLDOUT):
config = {}
config['feature_type'] = feature_type #input_type to feature_type
config['label_type'] = label_type
config['SPLITS'] = SPLITS
config['HOLDOUT'] = HOLDOUT
config['DATA_PATH'] = '.' + os.se... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.