id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8158169 | <gh_stars>0
"""Classes and functions to perform encoding."""
from __future__ import annotations
# pylint: disable=cyclic-import
from remoteprotocols import codecs
def encode_rule(
rule: codecs.RuleDef, args: list[int], timings: codecs.TimingsDef
) -> list[int]:
"""Convert a single rule into signal pulses.""... | StarcoderdataPython |
5058083 | <reponame>stevepiercy/pycon
import random
import factory
import factory.django
import factory.fuzzy
from django.contrib.auth import models as auth
from pycon.models import PyConProposalCategory, PyConProposal, \
PyConTalkProposal, PyConTutorialProposal
from symposion.proposals.tests.factories import ProposalKin... | StarcoderdataPython |
12844159 | # pylint: disable=unused-import
import pytest
import tests.helpers.constants as constants
from tests.helpers.utils import *
from geckordp.rdp_client import RDPClient
from geckordp.actors.root import RootActor
from geckordp.actors.descriptors.tab import TabActor
from geckordp.actors.accessibility.accessibility import Ac... | StarcoderdataPython |
3297669 | # -*- coding: utf-8 -*-
from acrylamid.utils import Metadata, neighborhood
import attest
tt = attest.Tests()
class TestMetadata(attest.TestBase):
@attest.test
def works(self):
dct = Metadata()
dct['hello.world'] = 1
assert dct['hello']['world'] == 1
assert dct.hello.world ... | StarcoderdataPython |
3423036 | <gh_stars>0
# emailstore.py
# Copyright 2014 <NAME>
# Licence: See LICENCE (BSD licence)
"""Email selection collection application."""
if __name__ == "__main__":
from . import APPLICATION_NAME
try:
from solentware_misc.gui.startstop import (
start_application_exception,
stop_... | StarcoderdataPython |
8073783 | <reponame>toptive/generator-toptive-python
# -*- coding: utf-8 -*-
"""Top-level package for <%= projectName %>."""
__author__ = '<%= projectAuthor %>'
__email__ = '<%= authorEmail %>'
__version__ = '<%= projectVersion %>'
| StarcoderdataPython |
4921554 | #!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
Solve a given moment matrix using various ways.
"""
from cvxopt import matrix, sparse, spmatrix, spdiag
import cvxopt.solvers as cvxsolvers
cvxsolvers.options['maxiters'] = 150
cvxsolvers.options['feastol'] = 1e-6
cvxsolvers.options['abstol'] = 1e-7
cvxsolvers.optio... | StarcoderdataPython |
8037381 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | StarcoderdataPython |
8189611 | <filename>gcnlive/main.py
import os
import sys
import voeventparse
import twitter
import voeventparse
def tweet(text, key_path):
with open(key_path, 'r') as f:
keys = f.read().splitlines()
api = twitter.Api(consumer_key=keys[0],
consumer_secret=keys[1],
acces... | StarcoderdataPython |
9716797 | <reponame>vishalbelsare/PySyft<filename>packages/hagrid/hagrid/win_bootstrap.py
# coding=utf-8
# stdlib
import subprocess
from typing import Callable
from typing import List
# one liner to use bootstrap script:
# CMD: curl https://raw.githubusercontent.com/OpenMined/PySyft/dev/packages/hagrid/hagrid/win_bootstrap.py >... | StarcoderdataPython |
1677050 | <filename>core/entities/poll.py
'''
Entity that sets the questions and manage the expiration of the survey
'''
from typing import Optional, List
from dataclasses import dataclass
from datetime import datetime
import public # type: ignore
from . import question # pylint: disable=unused-import
@public.add
@dataclass
cla... | StarcoderdataPython |
3248739 | <gh_stars>1-10
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
# Command line :
# python -m benchmark.HIGGS.explore.tau_effect
import os
import datetime
import numpy as np
import pandas as pd
import ... | StarcoderdataPython |
3522397 | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) Qotto, 2019
""" StoreRecordHandler class
This class was call when store consumer receive an new StoreRecord event and store msg in local & global store
"""
from tonga.models.store.base import BaseStoreRecordHandler
from tonga.models.store.store_record import Stor... | StarcoderdataPython |
306219 | __author__ = 'achamseddine'
import os
import csv
import time
import json
def read_docx():
# import sys
# import docx
from docx import Document
path = os.path.dirname(os.path.abspath(__file__))
path2file = path+'/HACT_TDH-it_Arsal_Center_100419.docx'
document = Document(path2file)
for p... | StarcoderdataPython |
3451304 | import RPi.GPIO as GPIO
import time
import smtplib
import thread
import cred
import imaplib
import email
import os
from PCF8574 import PCF8574_GPIO
from Adafruit_LCD1602 import Adafruit_CharLCD
try:
need_clean = False
#Message Template
MSG = '\nDoor was '
DOOR_MSG = {True:'opened', False:'closed'}
... | StarcoderdataPython |
11329454 | from django.core.management.base import BaseCommand
from ...data_integrity_checks import ObservationDataChecks
class Command(BaseCommand):
help = 'Check observation data.'
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
observation_checks = ObservationDataCheck... | StarcoderdataPython |
9734532 | <filename>test5.py
#!/usr/bin/env python
#some _string
~
#
| StarcoderdataPython |
3257427 | <reponame>leonell147/oci-swarm-cluster
import abc
import datetime
from typing import Dict, Any
from actions.procesamiento.tarea import Tarea
from actions.procesamiento.fase import Fase
class CalculationStrategy(metaclass=abc.ABCMeta):
"""Interfaz que define el comportamiento basico requerido por una estrategia
... | StarcoderdataPython |
5012388 | import pytest
from ferret.extractors.content_extractor import ContentExtractor
def _get_contents_of(file_path):
try:
with open(file_path) as file:
return file.read()
except IOError:
return None
@pytest.mark.parametrize("language,website_acronym", [
("pt", "r7"),
("pt", "t... | StarcoderdataPython |
9733007 | '''
【システム】BOAT_RACE_DB2
【ファイル】140_mkcsv_t_info_h.py
【機能仕様】直前情報HTMLファイルからレース情報タイトルテーブル「t_info_h」のインポートCSVファイルを作成する
【動作環境】macOS 11.1/Raspbian OS 10.4/python 3.9.1/sqlite3 3.32.3
【来 歴】2021.02.01 ver 1.00
'''
import os
import datetime
from bs4 import BeautifulSoup
#インストールディレクトの定義
BASE_DIR = '/home/pi/BOAT_RACE_DB'
'''
【関... | StarcoderdataPython |
1883950 | <reponame>lizhongguo/pytorch-b3d<filename>CompactBilinearPoolingFourStream.py<gh_stars>1-10
import types
import torch
import torch.nn as nn
from torch.autograd import Function
def CountSketchFn_forward(h, s, output_size, x, force_cpu_scatter_add=False):
x_size = tuple(x.size())
s_view = (1,) * (len(x_size)-1... | StarcoderdataPython |
8129085 | <gh_stars>0
# DRUNKWATER TEMPLATE(add description and prototypes)
# Question Title and Description on leetcode.com
# Function Declaration and Function Prototypes on leetcode.com
#522. Longest Uncommon Subsequence II
#Given a list of strings, you need to find the longest uncommon subsequence among them. The longest unco... | StarcoderdataPython |
3524229 | <filename>Python/Fundamentals/Dictionaries(lab-exercises)/Exercises/Force Book.py
forceBook={}
while True:
command=input()
if command!="Lumpawaroo":
if "|" in command:
command=command.split(" | ")
isThereSuchUser=False
for j in forceBook:
for k... | StarcoderdataPython |
5121084 | <gh_stars>1-10
from typing import NamedTuple, Mapping, Dict, Any, List, Optional
from resync.fields import Field, ForeignKeyField, ReverseForeignKeyField
from resync.manager import Manager
from resync.utils import RegistryPatternMetaclass
from resync.diff import DiffObject
ModelMeta = NamedTuple(
'Meta',
[('t... | StarcoderdataPython |
3558770 | import argparse
from glob import glob
import numpy as np
import pandas as pd
def parse_arguments(parser):
parser.add_argument('--data_dir', type=str, default=None)
parser.add_argument('--output_dir', type=str, default=None)
parser.add_argument('--mode', type=str, default='test')
parser.add_argument('... | StarcoderdataPython |
4866049 | <filename>app/main/views.py
from flask import Blueprint, render_template
from app.models import EditableHTML, UsefulLink
main = Blueprint('main', __name__)
@main.route('/')
def index():
useful_links = UsefulLink.query.all()
return render_template('main/index.html',
useful_links=useful_links
)
... | StarcoderdataPython |
176169 | from setuptools import setup
setup(
name='padacioso',
version='0.1.1',
packages=['padacioso'],
url='https://github.com/OpenJarbas/padacioso',
license='apache-2.0',
author='jarbasai',
author_email='<EMAIL>',
install_requires=["simplematch"],
description='dead simple intent parser'
)
| StarcoderdataPython |
6633769 | <reponame>mmfausnaugh/tica<filename>wcs_build/mast_filter_conesearch.py<gh_stars>0
import numpy as np
import sys
import json
import time
try: # Python 3.x
from urllib.parse import quote as urlencode
from urllib.request import urlretrieve
from urllib.parse import urlencode as dict_urlencode
from urllib.... | StarcoderdataPython |
3313450 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-10-03 16:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
# Django 2.0 requires this for renaming models in SQLite
# https://stackoverflow.com/questions/48549068/django-db-utils-not... | StarcoderdataPython |
8011587 | <gh_stars>10-100
"""
Extract a set of doc ids from the pubmed xml files.
"""
import argparse
import glob
import gzip
import multiprocessing
import os
from functools import partial
from multiprocessing import Pool
import sys
from lxml import etree
def parse_pubmeds(pmids: list, file: str) -> str:
"""
:param ... | StarcoderdataPython |
9614570 | <reponame>HW-AARC-CLUB/DensE
#!/usr/bin/python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import logging
import os
import random
import numpy as np
import torch
from torch.utils.data import DataLoader
from torch.optim.lr_... | StarcoderdataPython |
8024558 | from itertools import combinations, product
from qaml.qubo import QUBO
# Create a "Number" that is fixed point, by default a standard integer.
# This number supports operations with other number objects and Python
# integers and floats.
class Number:
def __init__(self, circuit, bit_indices, exponent, signed, const... | StarcoderdataPython |
352047 | import requests
import random
import string
import json
import re
import config
import helpers
import boto3
import os
from bs4 import BeautifulSoup
#temp
# import logging
# logger = logging.getLogger()
# logger.setLevel(logging.INFO)
def lambda_handler(event, context):
for record in event['Records']:
cal... | StarcoderdataPython |
179192 | <reponame>KamilLoska/HeroAttack
def remove_if_exists(mylist, item):
""" Remove item from mylist if it exists, do nothing otherwise """
to_remove = []
for i in range(len(mylist)):
if mylist[i] == item:
to_remove.append(mylist[i])
for el in to_remove:
mylist.remo... | StarcoderdataPython |
9713986 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# 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 ... | StarcoderdataPython |
200090 | <filename>dealsengine/apps.py
from django.apps import AppConfig
class DealsengineConfig(AppConfig):
name = 'dealsengine'
| StarcoderdataPython |
4931394 | <filename>detect_secrets/core/common.py
from .baseline import format_baseline_for_output
def write_baseline_to_file(filename, data):
"""
:type filename: str
:type data: dict
:rtype: None
"""
with open(filename, 'w') as f: # pragma: no cover
f.write(format_baseline_for_output(data) + '... | StarcoderdataPython |
1953217 | from flask import Blueprint
from flask import request
from model import QuestionResult
from model2 import Question
from flask import jsonify
import threading
import kashgari
import jieba
import traceback
import tensorflow as tf
from keras import backend as kb
graph = tf.get_default_graph()
sess = tf.Session()
kb.set_... | StarcoderdataPython |
11247587 | #Escreva um programa que pergunte a quantidade de KM percorridos por carro alugado e a quantidade de dias pelos quais foi alugado.
#Calcule o preço a pagar , sabendo que o carro custa R$60 por dia e R$0,15 por Km rodado.
dias = int(input('Quantos dias alugados ? '))
km = float(input('Quantos KM rodados ? '))
valtotal ... | StarcoderdataPython |
3289243 | from acondbs.db.sa import sa
##__________________________________________________________________||
def test_import():
assert sa
##__________________________________________________________________||
| StarcoderdataPython |
170051 | from scipy.stats import beta
from matplotlib import pyplot as plt
import numpy as np
def samples(a, b, success, trials, num_episodes=100):
'''
:param a: the shape param for prior dist
:param b: the shape param for prior dist
:param success: num success in the experiments
:param trials: num trails... | StarcoderdataPython |
11289882 | # Copyright (C) 2019 <NAME>
#
# Distributed under terms of the MIT license.
IOTLAB_DOMAIN = "iot-lab.info"
| StarcoderdataPython |
12827281 | # Create your views here.
from django.shortcuts import render
from django.http import HttpResponse
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import pgettext_lazy as __
def index(request):
msg = _('안녕하세요요요')
# "구어"는 구분자 이다(아무거나 해... | StarcoderdataPython |
4934907 | <reponame>maykinmedia/drf-polymorphic<filename>testapp/urls.py
from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import SpectacularYAMLAPIView
from .views import PetView
urlpatterns = [
path("admin/", admin.site.urls),
path(
"api/",
include(
... | StarcoderdataPython |
6597415 | from unittest.mock import patch
import shaystack
from shaystack import Quantity, Grid, VER_3_0, Ref
from shaystack.ops import HaystackHttpRequest
from shaystack.providers import ping
@patch.object(ping.Provider, 'point_write_write')
def test_point_write_write_with_zinc(mock) -> None:
# GIVEN
"""
Args:
... | StarcoderdataPython |
213777 | import os
import subprocess
import sys
from pathlib import Path
from threading import RLock
from typing import List, Optional
import distro
import i18n
from . import print_utils
BRAINFRAME_GROUP_ID = 1337
"""An arbitrary group ID value for the 'brainframe' group. We have to specify
the ID of the group manually to en... | StarcoderdataPython |
9679731 | import matplotlib.pyplot as plt
class Path:
def __init__(self,
times=None,
links=None,
):
"""
A basic constructor for a ``Path`` object
:param times : A list of times corresponding to the links (first time = beginning ; last time = ending... | StarcoderdataPython |
154641 | """Test_qpushbutton module."""
import unittest
class TestQPushButton(unittest.TestCase):
"""TestQPushButton Class."""
def test_enabled(self) -> None:
"""Test if the control enabled/disabled."""
from pineboolib.q3widgets import qpushbutton
button = qpushbutton.QPushButton()
... | StarcoderdataPython |
5161669 | <reponame>Ugtan/spdx-online-tools
# -*- coding: utf-8 -*-
# Copyright (c) 2017 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless ... | StarcoderdataPython |
384470 | <gh_stars>10-100
class ServiceReviewHistory:
def __init__(self, org_uuid, service_uuid, service_metadata, state, reviewed_by, reviewed_on, created_on,
updated_on):
self._org_uuid = org_uuid
self._service_uuid = service_uuid
self._service_metadata = service_metadata
s... | StarcoderdataPython |
4824012 | from torch import nn as nn
import torch
from .initialized_conv1d import Initialized_Conv1d
class Highway(nn.Module):
def __init__(self, dropout, layer_num, size):
super().__init__()
self.n = layer_num
self.linear = nn.ModuleList([Initialized_Conv1d(size, size, relu=False, bias=True) for _... | StarcoderdataPython |
6483760 | # Copyright (c) 2017, Fundacion Dr. <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and... | StarcoderdataPython |
1632843 | import argparse
import os
import os.path as osp
import mmcv
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, init_dist, load_checkpoint
from mmpose.apis import multi_gpu_test, single_gpu_test
from mmpose.core import wrap_fp16_model
from mmpose.dat... | StarcoderdataPython |
1649528 | <reponame>zhmsg/dms
#! /usr/bin/env python
# coding: utf-8
__author__ = 'ZhouHeng'
from TableTool import DBTool
dbt = DBTool("127.0.0.1")
dbt.create_from_dir(".")
# dbt.init_data_from_dir("Data")
| StarcoderdataPython |
258083 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from logging import getLogger
from unittest import TestCase
from conda.base.context import context
from conda.common.compat import text_type
from conda.models.channel import Channel
from conda.models.index_record... | StarcoderdataPython |
1938384 | # ----------
# Background
#
# A robotics company named Trax has created a line of small self-driving robots
# designed to autonomously traverse desert environments in search of undiscovered
# water deposits.
#
# A Traxbot looks like a small tank. Each one is about half a meter long and drives
# on two continuous metal ... | StarcoderdataPython |
9707666 | __all__ = ['load', 'noise']
from . import load | StarcoderdataPython |
153734 | <filename>polyjuice/generations/create_blanks.py<gh_stars>10-100
import numpy as np
from ..helpers import unify_tags, flatten_fillins
from .special_tokens import BLANK_TOK
def create_blanked_sents(doc, indexes=None):
if indexes:
if type(indexes[0]) == int:
indexes = [indexes]
indexes_l... | StarcoderdataPython |
369372 | <filename>Machine learning/ML/supervised_ML_Deep_learning/tf_1.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from sklearn.metrics import mean_squared_error
# ---------------------------
# let's c... | StarcoderdataPython |
135758 | _iterable = ['danilo', 'daniel', 'lucas', 'matheus', 'luana', 'claudiane', 'luan']
alfa = [chr(l) for l in range(ord('a'), ord('z')+1]
for name1 in range(len(_iterable)):
for name2 in range(name1+1, len(_iterable)):
c = 0
while True:
if alfa.index(_iterable[name1][c]) != alfa.index(_ite... | StarcoderdataPython |
6662291 | import importlib
import numpy as np
from copy import deepcopy
from types import ModuleType
# from .utils import get_logger
# logger = get_logger(__name__)
import logging
logger = logging.getLogger(__name__)
import thermal_history as th
from .model_classes import ThermalModel
def setup_model(parameters, core_method ... | StarcoderdataPython |
3206042 | <reponame>mrillusi0n/compete
def digit_set(n):
ds = set()
while n:
ds.add(n % 10)
n //= 10
return ds
def get_next(n):
global NUMS
discarded = digit_set(n)
res = 0
while res in NUMS or digit_set(res).intersection(discarded):
# print(f'Checking {res}...')
... | StarcoderdataPython |
4845930 | <filename>experiments/__init__.py
import os
import pkgutil
import importlib
from core.experiments import Experiment
experiments_by_name = {}
pkg_dir = os.path.dirname(__file__)
for (module_loader, name, ispkg) in pkgutil.iter_modules([pkg_dir]):
importlib.import_module('.' + name, __package__)
all_subclasses = E... | StarcoderdataPython |
4872218 | #encoding: utf-8
#
# Unit tests for function_utils.py
#
from fn_qradar_integration.util import function_utils
def test_query_string():
"""
test the make_query_string function and verify that the substitution works fine
:return:
"""
# One test with real data
input_string = "SELECT %param1% FRO... | StarcoderdataPython |
6574922 | import pytest
from eth_utils import to_checksum_address
from raiden.api.python import RaidenAPI
from raiden.exceptions import (
DepositMismatch,
InvalidSettleTimeout,
TokenNotRegistered,
UnexpectedChannelState,
UnknownTokenAddress,
)
from raiden.tests.utils.detect_failure import raise_on_failure
fr... | StarcoderdataPython |
6531316 | <gh_stars>1-10
"""The __init__.py for 'routes' which contains the only permit for functions' sharing.
"""
from .base import setup_routes
# Admitting permit for usage in other modules to the setup_routes only.
__all__ = ('setup_routes',) | StarcoderdataPython |
4979937 | # Author: <NAME>
# Date : 2022/03/28
"""Package containing jinja templates used by mdev.project."""
| StarcoderdataPython |
5195604 | #!/usr/bin/python
# author luke
import re
ret = re.match("[A-Z][a-z]*","MM")
print(ret.group())
ret = re.match("[A-Z][a-z]*","MnnM")
print(ret.group())
ret = re.match("[A-Z][a-z]*","Aabcdef")
print(ret.group())
print('-'*50)
# 需求:匹配出,变量名是否有效
names = ["name1", "_name", "2_name", "__name__"]
for name in names:
... | StarcoderdataPython |
3241869 | #!/usr/bin/env python2
from __future__ import print_function
import roslib
import sys
import rospy
import numpy as np
import datetime
import time
from geometry_msgs.msg import PoseArray
from geometry_msgs.msg import Pose
from geometry_msgs.msg import PoseWithCovariance
from nav_msgs.msg import Odometry
from dse_msgs.ms... | StarcoderdataPython |
3483717 | <gh_stars>10-100
class Queue:
# initialize your data structure here.
def __init__(self):
self.q1 = []
self.q2 = []
# @param x, an integer
# @return nothing
def push(self, x):
self.q1.append(x)
# @return nothing
def pop(self):
if self.q2:
self.q2.... | StarcoderdataPython |
17040 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | StarcoderdataPython |
1830329 | <gh_stars>10-100
import os
from openpyxl import load_workbook
entity_database_path = os.path.join("/Users/FabianFalck/Documents/[03]PotiticalCompass_PAPER/SPC/Paper/Code/Data_pipe", "entities_without_duplicates.xlsx")
newspaper_database_path = os.path.join("/Users/FabianFalck/Documents/[03]PotiticalCompass_PAPER/SPC/... | StarcoderdataPython |
3506008 | """PyTorch utilities for the UC Irvine course on
'ML & Statistics for Physicists'
"""
import functools
import copy
import numpy as np
import torch.nn
def sizes_as_string(tensors):
if isinstance(tensors, torch.Tensor):
return str(tuple(tensors.size()))
else:
return ', '.join([sizes_as_string(... | StarcoderdataPython |
5149884 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | StarcoderdataPython |
5045181 | <gh_stars>0
# standard libary
import threading
# term ticker
import commands
import tools.rss_tools as rss_tools
import tools.twitter_tools as twitter_tools
class TermTickerThreadManager():
"""
"""
def __init__(self, termticker_dict):
self.window_dict = {
'monitor' : 'monitor_thread',
... | StarcoderdataPython |
3388134 | # Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioTaskRouterClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "<KEY>"
auth_token = "<PASSWORD>"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
worker_sid = "WKXXXXXXXXXXXXXXXXXXX... | StarcoderdataPython |
12829014 | <gh_stars>0
import wrapt
import logging
from ..utils.event import Eventful
logger = logging.getLogger(__name__)
class OSException(Exception):
pass
@wrapt.decorator
def unimplemented(wrapped, _instance, args, kwargs):
cpu = getattr(getattr(_instance, "parent", None), "current", None)
addr = None if cpu ... | StarcoderdataPython |
9747482 | <gh_stars>0
from django.apps import AppConfig
from django.contrib.admin.apps import AdminConfig
class BlogAdminConfig(AdminConfig):
default_site = "blog.admin.BlogAdminArea"
class BlogConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'blog'
| StarcoderdataPython |
3450675 | <filename>Scripts/Miscellaneous/GUI Password Generator/passwordGenerator.py
from tkinter import *
import string
import random
root = Tk()
root.title("Password Generator - By Rohit")
root.geometry("1000x700")
root.wm_iconbitmap("pass.ico")
# Function to generate a password
def generate():
if passLen.get() == 0:
... | StarcoderdataPython |
6676783 | import random
import keyboard
import pyautogui
import time
#IMPORT THE HELL OUT OF THE CODE HAHHAHAHAHAHHA
keysss=['up','down','left','right']
#This can be changed according to the emulator settings
def loop():
for x in range(3):
sus=random.choice(keysss)
#sussy
pyautogui.keyD... | StarcoderdataPython |
6538583 | # Version 4.0
#!/usr/bin/env python
# nmap -p 80,8000,8080,8088 tiny.splunk.com
# nmap -sP -T insane -oG foo mcdavid/24
#
# grepable = -oG
# OS = -O
#
# sudo nmap tiny
# sudo nmap -O tiny/24
# sudo nmap -sX -O tiny
# nmap -v -O tiny
#
import os, time, stat, re, sys, subprocess
import crawl
import logging as lo... | StarcoderdataPython |
6562062 | <reponame>pinkieli/nodepy<gh_stars>0
"""
**Examples**::
>>> import nodepy.linear_multistep_method as lm
>>> ab3=lm.Adams_Bashforth(3)
>>> ab3.order()
3
>>> bdf2=lm.backward_difference_formula(2)
>>> bdf2.order()
2
>>> bdf2.is_zero_stable()
True
>>> bdf7=lm.backward_difference_fo... | StarcoderdataPython |
8097961 | from chembee.graphics import polar_plot
from chembee.processing import load_data
import os
import sys
import pytest
from pathlib import Path
@pytest.fixture(scope="module")
def script_loc(request):
"""Return the directory of the currently running test script"""
return Path(request.fspath).parent
def test_... | StarcoderdataPython |
355794 | <filename>SourceCode/ModelSystem/Models/hyperopt.py
from sklearn.model_selection import cross_val_score
from hyperopt import hp,STATUS_OK,Trials,fmin,tpe
from sklearn.ensemble import RandomForestClassifier
import pickle
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import... | StarcoderdataPython |
9798586 | <filename>egg/zoo/gym-game/models/compute_loss.py
import argparse
import numpy as np
import torch
import random
import comm_game_config as configs
from modules.model import AgentModule
from modules.random_model import RandomAgentModule
from modules.comm_game import GameModule
from collections import defaultdict
import ... | StarcoderdataPython |
6506549 | from .torch_model import TorchModel
from .training import Train | StarcoderdataPython |
8063495 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from indico.modules.events.management.views import WPEventManagement
from indico.modules.events.views impo... | StarcoderdataPython |
12830676 | <filename>OLD THINGS/prac.py
#!/usr/bin/python
#
# Copyright 2018 BIG VISION LLC ALL RIGHTS RESERVED
#
from __future__ import print_function
import sys
import cv2
from random import randint
import argparse
import numpy as np
import cv2 as cv
from yolo_utils import infer_image
#Amir
from mtcnn.mtcnn import MTCNN
from s... | StarcoderdataPython |
147804 | import paddle
from paddle.autograd import PyLayer
class EntmaxBisectFunction(PyLayer):
@classmethod
def _gp(cls, x, alpha):
return x ** (alpha - 1)
@classmethod
def _gp_inv(cls, y, alpha):
return y ** (1 / (alpha - 1))
@classmethod
def _p(cls, X, alpha):
return cls._g... | StarcoderdataPython |
391661 | import subprocess
import os
import shutil
from send_attachment import send_attachment
from threading import Thread
import time
class Malware:
def __init__(self, em1, pass1, download_link):
self.email = em1
self.userpass = pass1
self.download_link = download_link
def create_malware(sel... | StarcoderdataPython |
8100699 | <reponame>steffakasid/RPi-Jukebox-RFID
#!/usr/bin/env python3
import os.path
import sys
import json
from evdev import InputDevice, list_devices
path = os.path.dirname(os.path.realpath(__file__))
device_name_path = path + '/deviceName.txt'
button_map_path = path + '/buttonMap.json'
def all_devices():
return [In... | StarcoderdataPython |
173967 | import numpy as np
from sequentia.classifiers import HMM
# Create some sample data
X = [np.random.random((10 * i, 3)) for i in range(1, 4)]
# Create and fit a left-right HMM with random transitions and initial state distribution
hmm = HMM(label='class1', n_states=5, topology='left-right')
hmm.set_random_initial()
hmm... | StarcoderdataPython |
5023792 | #!/usr/bin/python
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# 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 retain the above copyright
# no... | StarcoderdataPython |
3591123 | <filename>Python/LinkedList/List2Pointer/Rotate List.py<gh_stars>10-100
"""
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
"""
from Python.Level4.LinkedList import Node, Traverse
class Solution:
def ... | StarcoderdataPython |
11330780 | <filename>test/test_del_group.py
# -*- coding: utf-8 -*-
from model.group import Group
import random
import allure
def test_delete_some_group(app, db, check_ui):
old_groups = given_non_empty_group_list(app, db)
group = random_group(old_groups)
delete_group(app, group)
new_groups = db.get_group_list()
... | StarcoderdataPython |
297110 | import ldap3
def auth_ad(user, password, domain_server, domain_prefix, base_dn):
try:
server = ldap3.Server(domain_server, get_info=ldap3.ALL)
connection = ldap3.Connection(server, user=domain_prefix + '\\' + user, password=password, authentication=ldap3.NTLM, auto_bind=True)
_filter = '(... | StarcoderdataPython |
4848913 | <gh_stars>1-10
import re
from typing import List, Dict, Union
from nonebot import on_command
# from nonebot.log import logger
from nonebot.permission import SUPERUSER
from nonebot.typing import T_State
from nonebot.adapters.onebot.v11 import Message, MessageSegment, Bot, GroupMessageEvent, ActionFailed
other_type_te... | StarcoderdataPython |
5181463 | """
Import as:
import dataflow.system.research_dag_adapter as dtfsredaad
"""
import core.config as cconfig
import dataflow.core as dtfcore
import dataflow.system.source_nodes as dtfsysonod
class ResearchDagAdapter(dtfcore.DagAdapter):
"""
Adapt a DAG builder for the research flow (batch execution, no OMS).
... | StarcoderdataPython |
5158771 | from pprint import pprint as pp
from scout.load.hgnc_gene import (load_hgnc_genes, load_hgnc)
def test_load_hgnc_genes(adapter, genes37_handle, hgnc_handle, exac_handle,
mim2gene_handle, genemap_handle, hpo_genes_handle):
# GIVEN a empty database
assert sum(1 for i in adapter.all_genes()) == 0
... | StarcoderdataPython |
1696898 | from django.http import JsonResponse
from rest_framework.response import Response
from rest_framework.generics import (
ListAPIView,
CreateAPIView,
RetrieveAPIView,
UpdateAPIView,
DestroyAPIView
)
from rest_framework.permissions import (
AllowAny,
IsAuthenticated,
IsAdminUser,
IsAuth... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.