id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3330379 | <filename>Python/025.py
# coding=utf-8
'''
25) [DESAFIO] Crie um programa que leia o tamanho de três segmentos de reta.
Analise seus comprimentos e diga se é possível formar um triângulo com essas
retas. Matematicamente, para três segmentos formarem um triângulo, o comprimento
de cada lado deve ser menor que a soma dos... | StarcoderdataPython |
3350819 | import bpy
from ..goldsrc_shader_base import GoldSrcShaderBase
from ...shader_base import Nodes
from .....library.goldsrc.mdl_v10.structs.texture import MdlTextureFlag
class GoldSrcShaderMode5(GoldSrcShaderBase):
SHADER: str = 'goldsrc_shader_mode5'
def create_nodes(self, material_name: str, rad_info=None):... | StarcoderdataPython |
4825515 | <reponame>aaronbiller/comparator<gh_stars>1-10
import re
from io import open
from setuptools import setup, find_packages
README = 'README.rst'
CHANGES = 'CHANGES.rst'
VERSION_FILE = 'comparator/__init__.py'
def read(path):
with open(path, encoding='utf-8') as f:
return f.read()
def find_version():
... | StarcoderdataPython |
1679727 | """Methods related to sampling and smoothing elevations."""
import time
import numpy as np
from sfrmaker.routing import get_nextupsegs, get_upsegs, make_graph
def smooth_elevations(fromids, toids, elevations, start_elevations=None): # elevup, elevdn):
"""
Parameters
----------
fromids : sequence o... | StarcoderdataPython |
3313048 | #!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, The Spark Structured Playground Project"
__credits__ = []
__license__ = "Apache License"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Education Purpose"
import pandas as pd
from pyspark.sql.types import I... | StarcoderdataPython |
150460 | <filename>ch01-05/05_05-toppings.py
requested_toppings = ['mushrooms', 'extra cheese']
if 'mushrooms' in requested_toppings:
print("Adding mushrooms")
if 'pepperoni' in requested_toppings:
print("Adding pepperoni.")
if 'extra cheese' in requested_toppings:
print("Adding extra cheese.")
print("\nFinished m... | StarcoderdataPython |
131505 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
170512 | <filename>crawler_data_binance.py
from binance.client import Client
import numpy as np
from decimal import *
import time
from config_db import config_db
try:
import mysql.connector as mysql
except :
import MySQLdb as mysql
class crawlerDataBinance(object):
COIN_INFO_IDCOIN = 0
COIN_INFO_SYMBOL = 1... | StarcoderdataPython |
29965 | import os, sys
exp_id=[
"exp1.0",
]
env_source=[
"file",
]
exp_mode = [
"continuous",
#"newb",
#"base",
]
num_theories_init=[
4,
]
pred_nets_neurons=[
8,
]
pred_nets_activation=[
"linear",
# "leakyRelu",
]
domain_net_neurons=[
8,
]
domain_pred_mode=[
"onehot",
]
mse_amp=[
1e-7,
]
simplify_criteria=[
'\("DLs",... | StarcoderdataPython |
87081 | """Test project's batch types list command."""
# pylint: disable=wrong-import-order, import-error
import io
import operator
import sys
from uuid import uuid4
from click import echo
from click.testing import CliRunner
from gencove.client import APIClient, APIClientTimeout # noqa: I100
from gencove.command.projects.cl... | StarcoderdataPython |
182946 | <reponame>lexnederbragt/denovo-assembly-tutorial<gh_stars>1-10
# by <NAME>
from Bio import SeqIO
import sys
class Manifest:
def __init__(self, cols):
self.id = cols[0]
self.path = cols[1]
self.extra = cols[2:]
def read_manifest(fn):
samples = []
... | StarcoderdataPython |
3319051 | import os
from typing import Optional
from _pytest.config import Config
from typepy import Bool, Integer, StrictLevel
from typepy.error import TypeConversionError
from ._const import Default, Option
class DiscordOptRetriever:
def __init__(self, config: Config):
self.__config = config
def retrieve_w... | StarcoderdataPython |
105058 | <filename>spotify_stats/__init__.py
"""
libraries
"""
from .track_details import TrackDetails
from .library import playlist_url_to_id, playlist_id_to_track_list, track_list_to_details
| StarcoderdataPython |
69736 | # *******************************************************************************
# Copyright 2017 Dell 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/L... | StarcoderdataPython |
1633052 | <gh_stars>0
# from flask import Flask, render_template, url_for, flash, redirect
# from flask_sqlalchemy import SQLAlchemy
# # from forms import RegistrationForm, LoginForm
# app = Flask(__name__)
# app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.site'
#... | StarcoderdataPython |
26423 | # Generated by Django 2.0 on 2018-02-24 11:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sky', '0007_auto_20180224_1120'),
]
operations = [
migrations.RemoveField(
model_name='news',
name='label',
),
]
| StarcoderdataPython |
3307427 | <reponame>AlgoveraAI/creations
import gradio as gr
from ocean_lib.config import Config
from ocean_lib.models.btoken import BToken #BToken is ERC20
from ocean_lib.ocean.ocean import Ocean
from ocean_lib.web3_internal.wallet import Wallet
from ocean_lib.web3_internal.currency import from_wei # wei is the smallest denomin... | StarcoderdataPython |
111598 | from kik.messages.message import Message
class FriendPickerMessage(Message):
"""
A friend picker message, as documented at `<https://dev.kik.com/#/docs/messaging#friend-picker-response-object>`_.
"""
def __init__(self, picked=None, chat_type=None, **kwargs):
super(FriendPickerMessage, self).__... | StarcoderdataPython |
1795252 | <filename>prereise/gather/demanddata/bldg_electrification/puma_data_agg.py
# This script develops puma-level data directly from census and aggregated from census tract data
import os
import geopandas as gpd
import numpy as np
import pandas as pd
from prereise.gather.demanddata.bldg_electrification import const
def ... | StarcoderdataPython |
3235065 | <reponame>JCarlos831/python_getting_started_-pluralsight-<filename>module_3_types_statements_and_other_goodies/while_loops.py
x = 0
while x < 10:
print("Count is {0}".format(x))
x += 1
# Infinite Loop
# num = 10
# while True:
# if num == 42:
# break
# print("Hello World") | StarcoderdataPython |
3270548 | #!/opt/anaconda3/bin/python
# What interpretor
'''
#-------------------------------------------------------------------------------
'''
print(" ")
print("-------------------------------------------------------------------")
print("... | StarcoderdataPython |
1702324 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-01-07 10:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('busshaming', '0018_realtimeprogress'),
]
operations = [
mi... | StarcoderdataPython |
3353347 | <reponame>iross/stromatolites_demo<filename>udf/ext_strat_target_distant.py
#==============================================================================
#DEFINE RELATIONSHIP BETWEEN TARGET ENTITIES AND DISTANT STRATIGRAPHIC PHRASES
#==============================================================================
# AC... | StarcoderdataPython |
67362 | # Slate Macro Keypad
#
# UCF Senior Design Project - Group 8
# Summer - Fall '21
#
"""
This version runs on Feather nRF52840 Express with a 3.5" FeatherWing
"""
import time
import displayio
import terminalio
from adafruit_display_text import bitmap_label
from adafruit_displayio_layout.layouts.grid_layout import GridL... | StarcoderdataPython |
1675742 | #coding:utf-8
import caffe
from caffe import layers as L, params as P
def lenet(lmdb, batch_size):
# our version of LeNet: a series of linear and simple nonlinear transformations
n = caffe.NetSpec() # 见详解目录-1
n.data, n.label = L.Data(batch_size=batch_size, backend=P.Data.LMDB, source=lmdb,
... | StarcoderdataPython |
1775636 | <filename>mouseclick_opencv_channelbgr.py<gh_stars>0
import numpy as np
import cv2
def click_event(event,x,y,flags,param):
if event == cv2.EVENT_LBUTTONDOWN:
blue = img[x,y,0]
green =img[x,y,1]
red = img[x,y,2]
cv2.circle(img,(x,y),3,(0,255,255),-1)
mycolorimage = n... | StarcoderdataPython |
3335212 | <filename>tests/exceptions/test_validation_error.py
from flake8_aaa.checker import Checker
from flake8_aaa.exceptions import ValidationError
def test():
result = ValidationError(
line_number=99,
offset=777,
text='__MESSAGE__',
)
assert result.to_flake8(Checker) == (99, 777, '__MES... | StarcoderdataPython |
3300193 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
import binascii
import struct
import re
import requests
from requests.auth import HTTPDigestAuth
import logging
from datetime import datetime
__version__ = '0.2.1'
AUDIOTEKA_API_URL = "https://proxy3.audioteka.com/pl/MobileService.svc/"
... | StarcoderdataPython |
107677 | <filename>apps/slack.py
from talon.voice import Context, Key
from ..utils import text, insert, parse_words, join_words
ctx = Context("slack", bundle="com.tinyspeck.slackmacgap")
emoji_map = {
"thumbs up": ":+1:",
"okay": ":ok_hand:",
"check": ":heavy_check_mark:",
"crossed fingers": ":crossed_fingers:... | StarcoderdataPython |
72320 | <gh_stars>0
#!/usr/bin/env python
"""
Unit test/basic Daemon-Python implementation
"""
import sys
import time
from daemon import Daemon
class TestDaemon(Daemon):
def run(self): #Define what tasks/processes to daemonize
while True:
time.sleep(1)
if __name__ == "__main__":
daemon = TestDaemo... | StarcoderdataPython |
1748454 | <filename>ci/setup.py
"""Instructions and steps to get integration tests up and running
This script will set up the tokens and parameters for easy transfer of the integration data.
Requirements:
The IBL Globus login credentials
A Globus endpoint set up for downloading the integration data
ibllib and iblscr... | StarcoderdataPython |
1679555 | <reponame>Vibrant-Planet/aorist
from . import download_data_from_remote_gcs_location
from . import download_data_from_remote_web_location
from . import download_data_from_remote_pushshift_api_location_to_newline_delimited_json
from . import extract_named_entities_using_spacy
from . import convert_json_to_csv
from . imp... | StarcoderdataPython |
43829 | <gh_stars>0
from multiprocessing.pool import ThreadPool, Pool
from typing import Any, List, Callable, Sequence, TypeVar, Optional, Iterable
from functools import partial
from tqdm import tqdm
T = TypeVar('T')
def apply_map(func: Callable[[T], Any], sequence: Sequence[T],
parallelism: Optional[str], sh... | StarcoderdataPython |
3364351 | <reponame>lyneca/rainbow-table
from datetime import datetime
def date(bad_date):
if not bad_date: return bad_date
good_date = datetime.strptime(bad_date, "%Y-%m-%d")
return good_date.timestamp()
| StarcoderdataPython |
3357712 | <filename>client.py
#!/usr/bin/python3
import socket
import sys
import select
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ip_address = '127.0.0.1'
port = 1234
print('Waiting for connection')
server.connect((ip_address, port))
while True:
sockets_list = [sys.stdin, server]
read_sockets, _ , _ = s... | StarcoderdataPython |
127935 | <reponame>karimbahgat/PyA
import pipy
packpath = "pyagg"
pipy.define_upload(packpath,
name="PyAgg",
description="Simple user-oriented graphics drawing and image manipulation.",
author="<NAME>",
author_email="<EMAIL>",
licen... | StarcoderdataPython |
170996 | <reponame>revalo/hush.mit.edu
if __name__ == '__main__':
from confess.models import db
from confess.models.post import Post
from confess.models.vote import Vote
if raw_input('r u sure? ') == 'y':
Vote.query.delete()
Post.query.delete()
db.session.commit() | StarcoderdataPython |
1615351 | <reponame>oleglite/survival
# -*- coding: utf-8 -*-
SERVER_TICK = 0.05
WORLD_SIZE = (100, 100) # width, height
HUNGER_SPEED = 0.005
ILLNESS_SPEED = 0.05
HEALING_SPEED = 0.02
HUNGER_RESTORED_BY_EATING = 0.1
MAX_FOOD_ON_CELL = 10
MAX_GROW_FOOD_SPEED = 0.1
SEND_USER_PERSPECTIVE_RATE = 1
DATABASE = {
'user':... | StarcoderdataPython |
178192 | <filename>python-exercises-for-beginners/042.py
# Refaça o desafio 35 dos triângulos acrescentando o recurso de mostrar que tipo de triângulo será formado:
# Equilátero
# Escaleno
# Isósceles
l1 = float(input('Lado 1: '))
l2 = float(input('Lado 2: '))
l3 = float(input('Lado 3: '))
if l1 < l2 + l3 and l2 < l3 + l1 and... | StarcoderdataPython |
3373058 | <reponame>Wesselban/CarbonArm<filename>src/importdata_test.py
import unittest
import importdata
class importdatatests(unittest.TestCase):
def test_getLine(self):
self.assertEqual(importdata.splitstringLine("83000000000000006400080700000000000000005500"), "83000000 00000000 6400 08070000 0000 00000000 55... | StarcoderdataPython |
3388972 | <gh_stars>1-10
import tensorflow as tf
a = tf.keras.Input(dtype='float32', name='a', batch_size=1, shape=(2, 3, 4))
b = tf.keras.Input(dtype='float32', name='b', batch_size=1, shape=(2, 3, 5))
c = tf.keras.Input(dtype='float32', name='c', batch_size=1, shape=(2, 3, 6))
# b1 = tf.keras.layers.AveragePooling2D(pool_size... | StarcoderdataPython |
1670170 | def helper(wsgiServerClass, global_conf, host, port, **local_conf):
# I think I can't write a tuple for bindAddress in .ini file
host = host or global_conf.get('host', 'localhost')
port = port or global_conf.get('port', 4000)
local_conf['bindAddress'] = (host, int(port))
def server(application... | StarcoderdataPython |
1627149 |
import requests
class countries:
def __init__(self, base_url, key, secret):
self.base_url = base_url
self.key = key
self.secret = secret
self.headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'sso-ke... | StarcoderdataPython |
1622427 | <reponame>vcarehuman/tf-pose-estimation-master
# -*- coding: utf-8 -*-
"""
Created on Tue May 8 16:44:03 2018
@author: <NAME>
"""
class Example:
name = "Example"
@staticmethod
def static():
print ("%s static() called" % Example.name)
class Offspring1(Example):
name = "Offspring1"
class Off... | StarcoderdataPython |
3287618 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
from oauthlib.common import log
from oauthlib.oauth2.rfc6749 import errors, utils
class GrantTypeBase(object):
error_uri = None
request_validator =... | StarcoderdataPython |
4824263 | #!/bin/env python
#===============================================================================
# NAME: ComponentHVisitor.py
#
# DESCRIPTION: A visitor responsible for the generation of component header
# file.
#
# AUTHOR: reder
# EMAIL: <EMAIL>
# DATE CREATED : Feb 5, 2007
#
# Copyright 2013, Califor... | StarcoderdataPython |
125349 | from visigoth.common.button.button import Button
| StarcoderdataPython |
3204036 | <reponame>timmartin/skulpt
x = 'OK'
print x[0]
| StarcoderdataPython |
1678858 | <filename>autoopt/optim/auto_adagrad.py<gh_stars>0
"""
Copyright 2019 eBay Inc.
Developers/Architects: <NAME>, <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/lice... | StarcoderdataPython |
1782756 | <gh_stars>1-10
import unittest
# import summarize
from pymongo import MongoClient
import datetime
import random
class SummarizeTest(unittest.TestCase):
def test_work_ng(self):
pass
def test_setup_work(self):
db_name = "SewingMachine"
collection_name = "WorkObjectDetection"
... | StarcoderdataPython |
4804830 | # coding=utf-8
"""
系统工具库
System tool library
"""
def clear_mem():
"""
清理系统内存
Clean system memory
:return: None
"""
from .. import dir_char, system
if dir_char == '\\':
print("Not support")
else:
import os
if system.startswith("darwin"):
os.system... | StarcoderdataPython |
3364458 | import re
from model.contact import Contact
def all_phones_on_home_page(app):
if app.contact.count() == 0:
app.contact.create(Contact(first_name="Dorota", last_name="Test"))
name_from_home_page = app.contact.get_contact_list()[0]
name_from_edit_page = app.contact.get_contact_info_from_edit_page(0)... | StarcoderdataPython |
1767586 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import glob
import h5py
import pickle
import ruamel.yaml as yaml
import numpy as np
import random # np.random.choice doesn't like a list of tuples.
from scipy.spatial.transform import Rotation
from torch.utils.data import Dataset
from sklearn.neighbors... | StarcoderdataPython |
193931 | """
MySQL output connector. Writes audit logs to MySQL database
"""
from __future__ import absolute_import, division
import MySQLdb
import json
import subprocess
import os
import sys
import urllib
import urllib2
import urlparse
import hashlib
import time
import threading
import sqlite3
import datetime
from time impor... | StarcoderdataPython |
25620 | <gh_stars>1-10
from pyramid.config import Configurator
from pyramid.view import view_config
@view_config(route_name='index', renderer='templates/index.html.jinja2')
def index(request):
return {}
def create_app():
config = Configurator()
config.include('pyramid_jinja2')
config.add_route('index', '/')... | StarcoderdataPython |
3227888 | # Created by Ethan
from chemlib import Compound
def saltSolubilities(compound):
try:
cmpd = compound
validate = Compound(compound)
temp = validate.occurences
temp = list(temp.keys())
for val in temp:
cmpd = cmpd.replace(val, "")
if len(cmpd) > 0:
... | StarcoderdataPython |
1671103 | <filename>model/network/MT3D.py
import torch
import torch.nn as nn
import numpy as np
from .basic_blocks import SetBlock, BasicConv2d, M3DPooling, FramePooling, FramePooling1, LocalTransform, BasicConv3DB, GMAP, SeparateFC
class MTNet(nn.Module):
def __init__(self, hidden_dim):
super(MTNet, self).__init_... | StarcoderdataPython |
3213383 | #!/bin/python3
import sys
def factorial(x):
if x < 1:
return 1
else:
x = x * factorial(x-1)
return x
n = int(input().strip())
print(factorial(n))
| StarcoderdataPython |
3235665 | import torch
import torch.nn.functional as F
import torch.nn as nn
from utils.rewards import get_scores, get_self_cider_scores
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward):
input = input.gather(2, seq.unsque... | StarcoderdataPython |
1662802 | <filename>Main/SharedTools/FinClasses.py
class stock():
def __init__(self, name, ticker, weight):
self.name = name
self.ticker = ticker
self.weight = weight
def getTicker(self):
return self.ticker
def getWeight(self):
return self.weight
... | StarcoderdataPython |
1723064 | <reponame>BedrockDev/CAU2019<filename>Pre-term/Computational Thinking and Problem Solving/Assignment 2/problem3.py
# problem 3: lottery number generator
import random
freq = [0]*45
recommendation = []
def generate():
return random.randint(1, 45)
def lotto_generator():
numbers = [generate()]
for i in ra... | StarcoderdataPython |
3389158 | from django import forms
from property.models import PropertyEnquiry
class PropertyForm (forms.ModelForm) :
class Meta :
exclude = ('date_added',)
class PropertyTypeForm(forms.ModelForm) :
class Meta :
exclude = ()
class EnquiryForm(forms.Form) :
subject = forms.CharField(required=Tru... | StarcoderdataPython |
3301710 | from collections import deque
import sys
"""
--- Day 15: Beverage Bandits ---
Having perfected their hot chocolate, the Elves have a new problem: the Goblins that live in these caves will do
anything to steal it. Looks like they're here for a fight.
You scan the area, generating a map of the walls (#), open cavern (... | StarcoderdataPython |
1622519 | <gh_stars>1-10
"""
The SQLAlchemy model definition.
revision history:
40 - Move image data to seperate table for speed
39 - Remove SQL insert functions, add dataset row to frequencyband table. Add image data.
38 - add varmetric table
37 - add forcedfits_count column to runningcatalog
36 - switch to SQLAlchemy sc... | StarcoderdataPython |
3386146 | parse_debug = False
record = False
analyzing = False
tst_non_object = True
tst_minimal = True
tst_space = True
tst_some_args = True
# # FIXME: comment or remove before commit... | StarcoderdataPython |
3241084 | """Match functions included as standard in the core."""
from ..ext.match_fun import MatchFun
from ..ext.register import register
@register()
class ReCoreMatchFun(MatchFun):
"""Integer match."""
name = 're'
def __init__(self, regex):
"""Initialise re (regex) match function."""
self.rege... | StarcoderdataPython |
1768104 | ### Functions used during the research project that culminated in SBMClone ###
# Author: <NAME>
from sklearn.mixture import GaussianMixture
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score, confusion_matrix
import graph_tool.inference.minimize as gt_min
import scipy
import numpy as n... | StarcoderdataPython |
155621 | <gh_stars>0
import contextlib
import io
import logging
from typing import ( # noqa: F401
Iterator,
Set
)
from evm import opcode_values
from evm.validation import (
validate_is_bytes,
)
class CodeStream(object):
stream = None
depth_processed = None
logger = logging.getLogger('evm.vm.CodeStre... | StarcoderdataPython |
144217 | <filename>awx/api/views/webhooks.py<gh_stars>1-10
from hashlib import sha1
import hmac
import json
import logging
import urllib.parse
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from rest_framework import st... | StarcoderdataPython |
3364794 | <filename>ProjectApplication/project_core/migrations/0127_allocated_budget_project_status_default_change.py
# Generated by Django 3.0.7 on 2020-06-23 10:20
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project_core', '012... | StarcoderdataPython |
3365512 | <gh_stars>0
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
from setuptools import setup, Command
import os
import re
class RunTestsCommand(Command):
description = "Test command to run testr in virtualenv"
user_options = [
('coverage', 'c',
"Generate code coverage report... | StarcoderdataPython |
1748754 | <reponame>CylonicRaider/Instant
#!/usr/bin/env python3
# -*- coding: ascii -*-
"""
A log-keeping bot for Instant.
"""
import sys, os, re, time
import threading
import bisect
import contextlib
import signal
import json
import sqlite3
import websocket_server
import instabot
NICKNAME = 'Scribe'
VERSION = instabot.VER... | StarcoderdataPython |
105080 | from OpenAttack import substitute
import sys, os
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.abspath(__file__)),
".."
))
import OpenAttack
def get_attackers_on_chinese(dataset, clsf):
triggers = OpenAttack.attackers.UATAttacker.get_triggers(clsf, dataset, clsf.tokenizer)
attackers = ... | StarcoderdataPython |
3237355 | import copy
import datetime
import decimal
import json
import uuid
import pytest
from boto3.dynamodb.types import TypeSerializer
from botocore import stub
from fixtures import context, lambda_module # pylint: disable=import-error
from helpers import compare_dict # pylint: disable=import-error,no-name-in-module
lambda... | StarcoderdataPython |
1625095 | from setuptools import setup
install_requires = [
r.strip() for r in open('requirements.txt')
if r.strip() and not r.strip().startswith('#')
]
setup(
name="aiokafka_rpc",
version="1.3.0",
author='<NAME>',
author_email='<EMAIL>',
description=("RPC over Apache Kafka for Python using asyncio"... | StarcoderdataPython |
110704 | """
Created on 08 Okt. 2021
@author: <NAME>
This example shows how you can use MiP-EGO in order to perform hyper-parameter optimization for machine learning tasks.
"""
#import packages
from sklearn.datasets import load_iris
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score, KFold
import... | StarcoderdataPython |
4811984 | from pickle import loads, dumps
import pytest
from instruct.types import FrozenMapping, FROZEN_MAPPING_SINGLETONS
from instruct.utils import flatten, flatten_fields
def test_frozen_mapping():
# Test identity operations:
assert FrozenMapping() is FrozenMapping(None) is FrozenMapping({})
# Test simple mapp... | StarcoderdataPython |
4809573 | <gh_stars>0
#! /root/anaconda3/bin/python
from threading import current_thread, Thread
import time
print('parent thread %s start' % (current_thread().getName()))
class MyThread(Thread):
def run(self):
print('child thread %s start' % current_thread().getName())
time.sleep(5)
print('child ... | StarcoderdataPython |
1640378 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Membership'
db.create_table('users_membership', (
('id', self.gf('django.db.mode... | StarcoderdataPython |
1784305 | import functools
import string
import typing as t
from mypy.errorcodes import ErrorCode
from mypy.nodes import (
Expression,
FuncDef,
LambdaExpr,
NameExpr,
RefExpr,
StrExpr,
)
from mypy.options import Options
from mypy.plugin import (
MethodContext,
Plugin,
)
from mypy.types import (
... | StarcoderdataPython |
1780577 | <reponame>meow464/pyobjus
__version__ = '1.2.0'
from .pyobjus import *
| StarcoderdataPython |
150815 | '''
URL: https://leetcode.com/problems/delete-node-in-a-linked-list/
Difficulty: Easy
Description: Delete Node in a Linked List
Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly.
It is ... | StarcoderdataPython |
68618 | <reponame>TachikakaMin/envpool
# Copyright 2021 Garena Online Private Limited
#
# 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 re... | StarcoderdataPython |
1642009 | """ With the draw module new schematics ca be created using python code """
from .Dot import Dot
from .Draw import Draw
from .DrawElement import DrawElement
from .Element import Element
from .Label import Label
from .Line import Line
from .NC import NC
| StarcoderdataPython |
100399 | <filename>xfel/ui/components/timeit.py
from __future__ import absolute_import, division, print_function
import time, math
def now():
return "%02d:%02d:%02d" % (time.localtime().tm_hour, time.localtime().tm_min, time.localtime().tm_sec)
def duration(t1, t2):
diff = t2 - t1
seconds = int(math.floor(diff))
frac... | StarcoderdataPython |
3278810 | import numpy as np
# Import dask
import dask
# Use dask jobqueue
from dask_jobqueue import PBSCluster
def get_pbscluster(nthreads):
cluster = PBSCluster(
cores=1, # The number of cores you want
memory='10GB', # Amount of memory
processes=1, # How many processes
queue='casper'... | StarcoderdataPython |
3258843 | """
This module provides functionality for resolving references within an instance
of `oapi.oas.model.OpenAPI`.
For example, the following will replace all references in the Open API
document `open_api_document` with the objects targeted by the `ref` property
of the reference:
```python
from urllib.request import url... | StarcoderdataPython |
182118 | import os
def call_executibles(dps, run_screen=True):
print('calling executible ... ')
for i,dp in enumerate(dps):
run_screen = 1 if run_screen else 0 # 1 - true, 0 - false
os.system('./run.sh ' + dp.model_name + ' ' + dp.run_path + ' ' + str(dp.n_mpi) + ' ' + str(run_screen) + ' ' + dp.pp_ta... | StarcoderdataPython |
3363935 | import sys, os, re, math, random, shutil
from fife import fife
from scripts.objects.baseObject import BaseGameObject, GameObjectTypes
class BaseItem(BaseGameObject):
def __int__(self, gameplay, layer, typeName, baseObjectName, itemType, itemName):
super(BaseItem, self).__init__(gameplay, layer, typeName,... | StarcoderdataPython |
1609843 | <filename>WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/sqlite3/sqlite3_memory.py<gh_stars>0
# Copyright (c) 2010 <NAME>. All rights reserved.
#
"""Working with an in-memory database
"""
# end_pymotw_header
import sqlite3
schema_filename = "todo_schema.sql"
with sqlite3.connect(":memory:") as c... | StarcoderdataPython |
4825421 | from bzt.utils import SoapUIScriptConverter
from tests.unit import BZTestCase, RESOURCES_DIR, ROOT_LOGGER
class TestSoapUIConverter(BZTestCase):
def test_minimal(self):
obj = SoapUIScriptConverter(ROOT_LOGGER)
config = obj.convert_script(RESOURCES_DIR + "soapui/project.xml")
self.assertIn... | StarcoderdataPython |
3218502 | <reponame>sumanyu/ece457b<gh_stars>0
import os
import csv
from sklearn.datasets import fetch_mldata
from sklearn.cross_validation import train_test_split
from sklearn.naive_bayes import MultinomialNB
from DenoisingAutoencoder import DenoisingAutoencoder
from StackedDenoisingAutoencoders import StackedDenoisingAutoenco... | StarcoderdataPython |
31268 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import array
import numpy as np
from numcodecs.compat import buffer_tobytes
def test_buffer_tobytes():
bufs = [
b'adsdasdas',
bytes(20),
np.arange(100),
array.array('l', b'qwertyuiqwertyui'... | StarcoderdataPython |
103984 | <filename>testscripts/RDKB/component/PAM/TS_PAM_CheckLogUploadStatus.py
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2021 RDK Management
#
# Licensed und... | StarcoderdataPython |
3277528 | <filename>gplay_apk_download_multidex/apk_multidex.py
#!/usr/bin/env python3
import subprocess
import os
APKANALYZER = "/Users/amitseal/Android/Sdk/tools/bin/apkanalyzer"
APKANALYZER_COMMAND = "{} dex list {}"
def is_multidex(apk_path: str):
global APKANALYZER
global APKANALYZER_COMMAND
# command = shl... | StarcoderdataPython |
112294 | <reponame>arieltrevisan/python-3-from-scratch-practices
import unittest as ut
"""
https://docs.python.org/3/library/unittest.html#test-discovery
"""
class TestClassOne(ut.TestCase):
@classmethod
def setUpClass(cls):
# print("setupClass")
pass
@classmethod
def tearDownClass(cls):
... | StarcoderdataPython |
1642557 | import numpy as np
class network():
"""
A network class for the neural network which include the following methods:
- feedforward(), for using the network on a given input
- SGD(), for apply Stochastic gradient descent (e.g. training the
network)
- BP(), for apply back... | StarcoderdataPython |
3200640 | <reponame>LBJ-Wade/bilby
import argparse
import logging
import os
import subprocess
from .log import logger
def set_up_command_line_arguments():
""" Sets up command line arguments that can be used to modify how scripts are run.
Returns
=======
command_line_args, command_line_parser: tuple
Th... | StarcoderdataPython |
3361093 | # This function is not intended to be invoked directly. Instead it will be
# triggered by an HTTP starter function.
# Before running this sample, please:
# - create a Durable activity function (default name is "Hello")
# - create a Durable HTTP starter function
# - add azure-functions-durable to requirements.txt
# - ru... | StarcoderdataPython |
1670938 | <gh_stars>0
import RPi.GPIO as GPIO
import time
from libdw import pyrebase
#Database Set-Up
projectid = "cleanbean-9e2f5"
dburl = "https://" + projectid + ".firebaseio.com"
authdomain = projectid + ".firebaseapp.com"
apikey = "<KEY>"
email = "<EMAIL>"
password = "<PASSWORD>"
config = {
"apiKey": apikey,
"aut... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.