id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1660908
import requests import string import time BASIC_AUTH_USER = 'natas17' BASIC_AUTH_PASSWORD = '<PASSWORD>' def generate_characters_dictionary(): alpha_numeric_string = string.ascii_letters + string.digits dictionary = [] for single_character in alpha_numeric_string: username_like = 'natas18" and pas...
StarcoderdataPython
1787914
"""Class mixins.""" from __future__ import annotations import logging from contextlib import suppress from typing import TYPE_CHECKING, cast if TYPE_CHECKING: from runway._logging import RunwayLogger LOGGER = cast("RunwayLogger", logging.getLogger(f"runway.{__name__}")) class DelCachedPropMixin: """Mixin t...
StarcoderdataPython
63977
from __future__ import unicode_literals from django.db import models # Create your models here. class feedback_data(models.Model): improvements=models.CharField(max_length=500) complain=models.CharField(max_length=500)
StarcoderdataPython
159090
import numpy as np import pandas as pd import itertools import matplotlib.pyplot as plt from sklearn.model_selection import cross_val_predict,cross_val_score,train_test_split from sklearn.metrics import classification_report,confusion_matrix,roc_curve,auc,precision_recall_curve,roc_curve import pickle #raw_df = pd.r...
StarcoderdataPython
1678265
import os from django import template from django.shortcuts import reverse from django.utils.html import format_html, escape from django.utils.http import urlencode import html2text from project.models import AccessPolicy from notification.utility import mailto_url register = template.Library() @register.filter(n...
StarcoderdataPython
3285840
<reponame>monokrome/tensorflow<filename>tensorflow/contrib/predictor/saved_model_predictor.py # Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of th...
StarcoderdataPython
140719
<reponame>lvsl-deactivated/go-to #!/usr/bin/env python ''' Start new ec2 instance with open ssh port ''' __author__ = "<NAME>, <<EMAIL>>" import json import os import sys import time from datetime import datetime import boto import boto.ec2 # based on http://cloud-images.ubuntu.com/releases/precise/release/ INSTA...
StarcoderdataPython
1633335
class RecLibrary1(object): def keyword_only_in_library_1(self): print "Keyword from library 1" def keyword_in_both_libraries(self): print "Keyword from library 1" def keyword_in_all_resources_and_libraries(self): print "Keyword from library 1" def keyword_everywhere(s...
StarcoderdataPython
1783666
import json import requests from time import sleep, time, ctime import sys import subprocess import socket def fuzzyLookup(key, word_list): from difflib import SequenceMatcher as sm max_ratio = 0. best_match = "" for ind in range(len(word_list)): ratio = sm(None,key,word_list[ind]).ratio() ...
StarcoderdataPython
3307077
# -*- coding: utf-8 -*- import binascii import os from flask import abort from flask import request from flask import session def check_csrf_protection(): """Make sure POST requests are sent with a CSRF token unless they're part of the API. In the future we might want to think about a system where we can dis...
StarcoderdataPython
19025
<reponame>lamas1901/telegram__pdf-bot from ..utils import get_env_var from pathlib import Path BASE_DIR = Path(__file__).parent.parent TG_TOKEN = get_env_var('TG_TOKEN') YMONEY_TOKEN = get_env_var('YTOKEN') PROMO_CODE = get_env_var('PROMO_CODE')
StarcoderdataPython
1643648
from __future__ import print_function import os import datetime import argparse import itertools from torch.utils.data import DataLoader from torch.autograd import Variable import torch from utils import ReplayBuffer from utils import LambdaLR from utils import weights_init_normal from utils import mask_gene...
StarcoderdataPython
4825780
<filename>mtoolbox/autoname.py # -*- coding: utf-8 -*- """Access an object's name as a property Autoname is a data-descriptor, which automatically looks up the name under which the object on which the descriptor is accessed is known by. Import the descriptor using ``from mtoolbox.autoname import Autoname``. Example...
StarcoderdataPython
1693803
<gh_stars>0 import unittest import yammpy NAN = float('nan') INF = float('inf') NINF = float('-inf') class YammpyTests(unittest.TestCase): def testConstants(self): self.assertEqual(yammpy.pi, 3.141592653589793238462643) self.assertEqual(yammpy.e, 2.718281828459045235360287) self.assertEqu...
StarcoderdataPython
43902
# coding: utf-8 # Copyright 2016 Vauxoo (https://www.vauxoo.com) <<EMAIL>> # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). import re from odoo import models, api, fields, _ class AccountJournal(models.Model): _inherit = 'account.journal' @api.model def _prepare_liquidity_account(self, na...
StarcoderdataPython
144492
"""This module is used for preprocessing user inputs before further analysis. The user utterance is broken into tokens which contain additional information about the it. """ from typing import Text, List, Optional import string from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk.tokeni...
StarcoderdataPython
1662228
<reponame>DevinTDHa/spark-nlp-workshop import json import os with open('license.json') as f: license_keys = json.load(f) # Defining license key-value pairs as local variables locals().update(license_keys) # Adding license key-value pairs to environment variables os.environ.update(license_keys) from pyspark.ml ...
StarcoderdataPython
3378767
def fatorial(num: int) -> int: """ num E Naturais ( Números *Inteiros* e *positivos* ) :param num: int :return: int """ if num <= 1: return 1 return num*(fatorial(num-1)) print(fatorial(5))
StarcoderdataPython
1742886
<gh_stars>0 # -*- coding: utf-8 -*- """ ******************************** reslib.data.merges ******************************** This module contains code to merge common datasets (e.g. add permnos to gvkeys, etc.) :copyright: (c) 2019 by <NAME>. :license: MIT, see LICENSE for more details. """
StarcoderdataPython
1747574
# Copyright <NAME> 2011-2017 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) #------------------------------------------------------------------------------- # Boost Library Methods #-------...
StarcoderdataPython
1638099
# -*- coding: utf-8 -*- from bio2bel import get_data_dir MODULE_NAME = 'nextprot' DATA_DIR = get_data_dir(MODULE_NAME) # This file is a list of terms; one per line ACCESSIONS_URL = 'ftp://ftp.nextprot.org/pub/current_release/ac_lists/nextprot_ac_list_all.txt' # CV files each have their own specification described a...
StarcoderdataPython
1765306
<filename>adminacttools/actadmcmds/actadmcmds.py<gh_stars>0 # # Copyright (C) 2010-2012 Opersys 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/LI...
StarcoderdataPython
134479
import pytest from uint import Uint def test_positive_overflow(): u = Uint(0b11111111, 8) u += 1 assert u.raw == 0b00000000 def test_negative_overflow(): u = Uint(0b00000000, 8) u -= 1 assert u.raw == 0b11111111 def test_logical_shift(): u = Uint(0b10100101, 8) u <<= 1 assert u...
StarcoderdataPython
183637
""" byceps.blueprints.admin.webhook.forms ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2021 <NAME> :License: Revised BSD (see `LICENSE` file for details) """ from __future__ import annotations from flask_babel import lazy_gettext from wtforms import BooleanField, SelectMultipleField, StringField from wtfor...
StarcoderdataPython
138575
<gh_stars>1-10 # ============================================================================= # Federal University of Rio Grande do Sul (UFRGS) # Connectionist Artificial Intelligence Laboratory (LIAC) # <NAME> - <EMAIL> # ============================================================================= # Copyright (c) 20...
StarcoderdataPython
127789
<gh_stars>1-10 #!/usr/bin/python3 from sympy import * init_printing() q00, q01, q02, q03 = symbols('q_00 q_01 q_02 q_03') q11, q12, q13 = symbols('q_11 q_12 q_13') q22, q23 = symbols('q_22 q_23') q33 = symbols('q_33') allQ = [q00, q01, q02, q03, q11, q12, q13, q22, q23, q33] Pix0, Pix1, Pix2, Pix3 = symbols('zR_x0,...
StarcoderdataPython
111560
from src.db import db from src.models.base import BaseModel, BaseSchema class Node(BaseModel): dataset_id = db.Column(db.Integer, db.ForeignKey('dataset.id'), nullable=False) dataset = db.relationship('Dataset', backref=db.backref('nodes', cascade="all, delete-orphan")) name = db.Column(db.String) class...
StarcoderdataPython
142568
<reponame>praekeltfoundation/seed-services-client from demands import JSONServiceClient, HTTPServiceClient class AuthApiClient(object): """ Client for Auth Service. :param str email: An email address. :param str password: <PASSWORD>. :param str api_url: The full URL of...
StarcoderdataPython
143548
<filename>solvebio/resource/__init__.py from __future__ import absolute_import from .apiresource import ListObject from .user import User from .dataset import Dataset from .datasetfield import DatasetField from .datasetimport import DatasetImport from .datasetexport import DatasetExport from .datasetcommit import Data...
StarcoderdataPython
3301090
<filename>handlers/__init__.py from common_handler import * from main_handler import *
StarcoderdataPython
17260
import OIL.color import OIL.label import OIL.parser import OIL.tools import OIL.errors
StarcoderdataPython
1760319
#!/usr/bin/env python3 import random import time values = [15,20,25]*4 # default 20 degrees, 3 sensors in 4 locations while True: values = list(map(lambda x: x+random.uniform(-0.5,0.5), values)) for value in values: # print('{:0.2f}'.format(value)+';', end='') print('{:0.2f}'.format(value).re...
StarcoderdataPython
3264256
import os from pysaurus.application import exceptions from pysaurus.core.components import AbsolutePath from pysaurus.core.functions import package_dir from pysaurus.core.modules import System try: BIN_PATH = AbsolutePath.join( package_dir(), "bin", System.get_identifier() ).assert_dir() ALIGNMENT...
StarcoderdataPython
1691134
<reponame>sNoDliD/SecondTerm<gh_stars>0 import requests import datetime from functools import wraps from .my_config import TOKEN def debug(func): @wraps(func) def wrapper_debug(*args, **kwargs): args_repr = list(map(repr, args)) kwargs_repr = list(f"{k}={v!r}" for k, v in kwargs.items()) ...
StarcoderdataPython
137483
<filename>python/data_utils.py import time import os import random import numpy as np import torch import torch.utils.data import commons from mel_processing import spectrogram_torch from utils import load_wav_to_torch, load_filepaths_and_text from text import text_to_sequence, cleaned_text_to_sequence #add from ret...
StarcoderdataPython
3202727
class Games(): """ A general representation of an abstract game """ fun_level = 5 def __init__(self, player1='Alice', player2='Bob'): self.rounds = 2 self.current_round = 0 self.player1 = player1 self.player2 = player2 self.player1_score = 0 s...
StarcoderdataPython
3368502
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- @Name: adder3.py @Desc: @Author: <EMAIL> @Create: 2020.05.13 9:38 ------------------------------------------------------------------------------- @Change: 2020...
StarcoderdataPython
1659061
<gh_stars>0 #!/usr/bin/env python3 import json import subprocess import sys def main(): # Get UAN Nodes from HSM cmd = "cray hsm state components list --role Application --subrole UAN --format json".split() raw_result = subprocess.run(cmd, stdout=subprocess.PIPE) result = json.loads(raw_result.stdout...
StarcoderdataPython
1736449
import sys tests = """ >>> from django.utils.translation.trans_real import parse_accept_lang_header >>> p = parse_accept_lang_header # # Testing HTTP header parsing. First, we test that we can parse the values # according to the spec (and that we extract all the pieces in the right order). # Good headers. >>> p('de'...
StarcoderdataPython
1789136
word = input("enter a word: ") """number = len(word) - 1 while(number >= 0): # base condition print(word[number], end = "") number -=1 """ def reverse(word, num): print(word[num], end = "") if len(word) == 1: return else: word = word[:-1] return reverse(word,...
StarcoderdataPython
163666
<reponame>isaachenrion/jets<gh_stars>1-10 import torch import torch.nn as nn import torch.nn.functional as F from ..utils import AnyBatchGRUCell from ..utils import BiDirectionalTreeGRU class GRNNTransformSimple(nn.Module): def __init__(self, features=None, hidden=None,**kwargs): super().__init__() ...
StarcoderdataPython
60451
<filename>quokka/utils/custom_vars.py # coding: utf-8 from dynaconf.utils.parse_conf import parse_conf_data def parse_data(data): """Return converted data from @int, @float, @bool, @json markers""" return parse_conf_data(data) def custom_var_dict(cvarlist): cvarlist = cvarlist or [] return { ...
StarcoderdataPython
166025
<reponame>vreon/figment<gh_stars>10-100 from figment import Component class Important(Component): """An item that can't be dropped or taken."""
StarcoderdataPython
1715385
class Config: ''' General configuration parent class ''' NEWS_SOURCES_BASE_URL = 'https://newsapi.org/v2/sources?category={}&apiKey={}' NEWS_NEWS_API_BASE_URL = 'https://newsapi.org/v2/everything?language=en&sources={}&apiKey={}' pass class ProdConfig(Config): ''' Production co...
StarcoderdataPython
3385935
# -*- coding:utf-8 -*- # -------------------------------------------------------- # Copyright (C), 2016-2021, lizhe, All rights reserved # -------------------------------------------------------- # @Name: my_money.py # @Author: lizhe # @Created: 2021/9/14 - 22:12 # --------------------------------------...
StarcoderdataPython
1783890
<filename>lib/oci_utils/migrate/image_types/vmdk.py # oci-utils # # Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown # at http://oss.oracle.com/licenses/upl. """ Module to handle VMDK formatted virtual disk images. """ import l...
StarcoderdataPython
3378276
<filename>pagetags/urls.py # -*- coding: utf-8 -*- """ URL dispatcher config for Pagetags Django CMS plugin. """ from django.conf.urls import patterns, include, url from pagetags import views urlpatterns = patterns('', url(r'^$', views.list_tags), )
StarcoderdataPython
1711878
<gh_stars>100-1000 import torch import torch.nn as nn class ConvGRU(nn.Module): def __init__(self, h_planes=128, i_planes=128): super(ConvGRU, self).__init__() self.do_checkpoint = False self.convz = nn.Conv2d(h_planes+i_planes, h_planes, 3, padding=1) self.convr = nn.Conv2d(h_plan...
StarcoderdataPython
43726
# -*- coding: utf-8 -*- """ An example url status checker implementation consumes urls from a queue. """ import threading import queue import requests class StatusChecker(threading.Thread): """ The thread that will check HTTP statuses. """ #: The queue of urls url_queue = None #: The queue o...
StarcoderdataPython
3253918
<filename>microcosm_flask/tests/conventions/fixtures.py """ Testing fixtures (e.g. for CRUD). """ from copy import copy from enum import Enum, unique from uuid import uuid4 from marshmallow import Schema, fields from microcosm_flask.decorators.schemas import SelectedField, add_associated_schema from microcosm_flask....
StarcoderdataPython
3372271
<reponame>imfiver/Sec-Tools from django.contrib import admin from django.urls import path from . import views from dirscan import views, search2, target urlpatterns = [ path('dir-result/', views.dirresult, name="dir-result"), path('dir-search/', search2.search_post, name="dir-search"), path('get-ta...
StarcoderdataPython
3265367
# coding=utf-8 """ Provides an implementation of a reporting mode for human readers. """ import os from comply.rules.rule import RuleViolation from comply.reporting.base import Reporter from comply.printing import printout, Colors class HumanReporter(Reporter): """ Provides reporting output (including sugges...
StarcoderdataPython
1799951
""" Data objects in group "Energy Management System" """ from collections import OrderedDict import logging from pyidf.helper import DataObject logger = logging.getLogger("pyidf") logger.addHandler(logging.NullHandler()) class EnergyManagementSystemSensor(DataObject): """ Corresponds to IDD object `EnergyMana...
StarcoderdataPython
3281238
#!/usr/bin/env python """ _SetBlockFiles_ Oracle implementation of DBS3Buffer.SetBlockFiles """ from WMComponent.DBS3Buffer.MySQL.SetBlockFiles import SetBlockFiles as MySQLSetBlockFiles class SetBlockFiles(MySQLSetBlockFiles): pass
StarcoderdataPython
1737816
import anyio import pytest from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.responses import JSONResponse from starlette.testclient import TestClient from starlette.websockets import WebSocket, WebSocketDisconnect mock_service = Starlette() @mock_service.route(...
StarcoderdataPython
1736971
#!/usr/bin/python import sys, traceback, threading, socket, signal, re, commands, os, time, string, random, uuid from random import randint from resources import getFrontEnds from netInterfaceStatus import getServerIP from scanning import getChList from subprocess import Popen, PIPE # global session # global dvblastR...
StarcoderdataPython
1612371
from django.core.management.base import NoArgsCommand from django.db import transaction, connection from django.conf import settings PATH_DIGITS = getattr(settings, 'COMMENT_PATH_DIGITS', 10) SQL = """ INSERT INTO threadedcomments_comment ( comment_ptr_id, parent_id, last_child_id, tree_path, t...
StarcoderdataPython
174318
import numpy as np import tensorflow as tf from tensorflow.keras.layers import Dense, Input from tensorflow.keras.models import Model def build_model(bert_layer, max_len=512): input_word_ids = Input(shape=(max_len, ), dtype=tf.int32, name='input_word_ids') input_mask = Input(shape=(max_len, ), dtype=tf.int32...
StarcoderdataPython
4815517
<reponame>sergio-ivanuzzo/idewave-core<gh_stars>1-10 from struct import pack from World.Object.Unit.Player.PlayerManager import PlayerManager from World.WorldPacket.Constants.WorldOpCode import WorldOpCode from Server.Connection.Connection import Connection class Logout(object): def __init__(self, **kwargs): ...
StarcoderdataPython
3366591
#a index=0 smallest=L[0] for i in range(1,len(L)): if L[i] < smallest: smallest=L[i] index = i #b def min_index(L: list) -> tuple: """ (list) -> (object, int) Return a tuple containing the smallest item from L and its index. >>> min_index([4, 3, 2, 4, 3, 6, 1, 5]) (1, 6) """ ...
StarcoderdataPython
1779154
<reponame>Erebuxy/project_euler<filename>000-100/039/main.py #!/usr/bin/env python3 import sys import math sys.path.insert(0, '../../') import util if __name__ == '__main__': limit = 1000 max_count = 0 max_p = -1 for p in range(4, limit+1, 2): count = 0 for i in range(int(p/3), mat...
StarcoderdataPython
1654168
<gh_stars>0 class BankAccount: account_number = 0 name = "" balance_amount = 0 def account_creation(self): self.account_number = int(input("Enter the account number\t")) self.name = input("Enter the account holder name\t") def amount_deposition(self, amount): self...
StarcoderdataPython
1774116
#!/usr/bin/python # -*- coding: utf-8 -*- import pexpect import time from datetime import datetime uuid_pre = "F000" uuid_pos = "-0451-4000-B000-000000000000" #format: handle = [data, config] temp_uuid = ["AA01", "AA02"] move_uuid = ["AA81", "AA82"] humd_uuid = ["AA21", "AA22"] baro_uuid = ["AA41", "AA42"] opti_uuid ...
StarcoderdataPython
182675
<reponame>taddes/AlgoChallenge def merge(left, right): results = [] while(len(left) and len(right)): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right...
StarcoderdataPython
10704
<filename>ink2canvas/GradientHelper.py from ink2canvas.lib.simpletransform import parseTransform class GradientHelper(object): def __init__(self, abstractShape): self.abstractShape = abstractShape def hasGradient(self, key): style = self.abstractShape.getStyle() if ...
StarcoderdataPython
1616713
<reponame>xRocketPowerx/python-sel-dedicated<filename>sel_dedicated/configuration.py # coding: utf-8 """ Seido User REST API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 2.4.8 Generated by...
StarcoderdataPython
27329
<reponame>jeroenubbink/commercetools-python-sdk # DO NOT EDIT! This file is automatically generated import typing from commercetools._schemas._shopping_list import ( ShoppingListDraftSchema, ShoppingListPagedQueryResponseSchema, ShoppingListSchema, ShoppingListUpdateSchema, ) from commercetools.helpers...
StarcoderdataPython
17018
import logging import os import cltl.combot.infra.config.local as local_config logger = logging.getLogger(__name__) K8_CONFIG_DIR = "/cltl_k8_config" K8_CONFIG = "config/k8.config" class K8LocalConfigurationContainer(local_config.LocalConfigurationContainer): @staticmethod def load_configuration(config_fi...
StarcoderdataPython
4827416
# Copyright 2001 by <NAME>. All rights reserved. # Modifications Copyright 2010 <NAME>. All rights reserved. # # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Handle the SCOP CLAssification file,...
StarcoderdataPython
1743006
import bson from env import pymongo_env class SinglePymongoDocument(object): """A database accessor for a single document.""" def __init__(self, doc_id=None, id_field=None, document=None, collection=None): """Initializes the SinglePymongoDocument. The document with id 'doc_id' is used from the given 'col...
StarcoderdataPython
3346418
<filename>desktop/core/ext-py/guppy-0.1.10/guppy/sets/__init__.py #._cv_part guppy.sets from setsc import BitSet # base bitset type from setsc import ImmBitSet # immutable bitset type from setsc import immbit # immutable bitset singleton constructor from setsc import immbitrange # immutable bitset range constructor fr...
StarcoderdataPython
1754423
# 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
3236060
<filename>categorical.py import math import pandas as pd class CategoricalConverter: """ Create a categorical converter based on supplied values. Parameters ---------- binary (boolean) : transform binary categoricals [True] Attributes ---------- binary_length_ : size of each c...
StarcoderdataPython
1627963
"""User app."""
StarcoderdataPython
3339958
<gh_stars>0 #!/usr/bin/env python3 import csv import subprocess def determine_distro(): global current_distro from platform import system assert system() == "Linux", "Non-Linux platforms are not supported" if current_distro != None: # The distro is already known return current_distro = sub...
StarcoderdataPython
3326175
<filename>je_editor/ui/ui_utils/editor_content/content_save.py import json import os from pathlib import Path from threading import Lock from je_editor.utils.exception.je_editor_exceptions import JEditorContentFileException cwd = os.getcwd() lock = Lock() editor_data = { "last_file": None } def read_output_con...
StarcoderdataPython
1706127
<filename>src/blog/urls.py from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from posts.views import index, blog, post, search, category_search, contact, map, ranking from decouple import config urlpatterns = [ path(...
StarcoderdataPython
166148
<gh_stars>0 # Generated by Django 2.2.10 on 2022-03-22 19:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('watch', '0001_initial'), ] operations = [ migrations.AlterField( model_name='notif...
StarcoderdataPython
117923
""" WSGI config for TeaRoom project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TeaRoom.settings.production") from dj...
StarcoderdataPython
194356
#!/usr/bin/env python # stdlib import sys, logging, os from zipfile import ZipFile # config import path sys.path.append('/Users/david/dev/docxperiments') # local modules from docxperiments.pathutils import mkpath, ls # set up logger log_format = 'undx: %(message)s' logging.basicConfig(level=logging.INFO, format=log...
StarcoderdataPython
75322
#!/usr/bin/env python # coding: utf-8 import time import atexit import weakref import pybullet import threading from qibullet.tools import * from qibullet.controller import Controller class BaseController(Controller): """ Class describing a robot base controller """ # _instances = set() FRAME_WO...
StarcoderdataPython
3307919
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # Copyright 2013 IBM Corp. # # 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/...
StarcoderdataPython
1725653
""" ============================= Plotting reliability diagrams ============================= This example illustrates how to visualise the reliability diagram for a binary probabilistic classifier. """ # Author: <NAME> <<EMAIL>> # License: new BSD print(__doc__) #####################################################...
StarcoderdataPython
36415
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = ["quadratic_2d"] import numpy as np def quadratic_2d(data): """ Compute the quadratic estimate of the centroid in a 2d-array. Args: data (2darray): two dimensional data array Returns ce...
StarcoderdataPython
1615169
<reponame>krishna13052001/LeetCode #!/usr/bin/python3 """ Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. Example: Given a binary tree ...
StarcoderdataPython
3209975
<reponame>tristanbrown/resolwe-bio-py """Util decorators for ReSDK.""" from __future__ import absolute_import, division, print_function import wrapt @wrapt.decorator def return_first_element(wrapped, instance, args, kwargs): """Return only the first element of the list returned by the wrapped function. Rais...
StarcoderdataPython
152160
# -*- coding: utf-8 -*- """ Created on Mon Sep 9 13:27:16 2019 @author: <NAME> and <NAME> """ import os import numpy as np from osgeo import gdal #datagen = ImageDataGenerator() #TASK TO DO. #THERE ARE TWO IMAGES TO LOAD HERE. 1 IS THE MAIN SAT IMAGE AND THE OTHER IS THE WATER IMAGE. def load_data(batch...
StarcoderdataPython
1740344
<reponame>kikuomax/vosk-api<gh_stars>1-10 import os import sys import setuptools from setuptools import Extension from setuptools.command.build_py import build_py as _build_py import distutils.dir_util import distutils.log class build_py(_build_py): def run(self): self.run_command("build_ext") retu...
StarcoderdataPython
3356016
<filename>setup.py from setuptools import setup, find_packages setup( name='Connection Leak cather service', version='0.1.0', description='This service is created for catching leak dabase connection.', author='<NAME>', author_email='<EMAIL>', url='<URL>',#Give Valid URL at <URL> install_req...
StarcoderdataPython
1370
# python version 1.0 DO NOT EDIT # # Generated by smidump version 0.4.8: # # smidump -f python ZYXEL-GS4012F-MIB FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib" MIB = { "moduleName" : "ZYXEL-GS4012F-MIB", "ZYXEL-GS4012F-MIB" : { "nodetype" : "module", "language" : "SMIv2", "organizat...
StarcoderdataPython
3338270
import numpy as np def rmse(predictions, targets): return np.sqrt(((predictions-targets)**2).mean())
StarcoderdataPython
1765942
# -*- coding: utf-8 -*- ### required - do no delete import sys import os import shutil import gluon.contrib.simplejson from datetime import datetime sys.path.append(os.path.abspath('./../')) from modules import fflock_globals from modules import fflock_utility master_color = "#317b80" storage_color = "#609194" warnin...
StarcoderdataPython
1648528
def get_newcases(cases, new): c = newcases = newcasesmedia = 0 newst = [] record = [] for row in cases: record.append(row) for row in record: if c == 14: break if c == 0: newcases = int(row.totcasos) newst.append(row.totcasos) newst.insert(0, new['confirmados']) if...
StarcoderdataPython
3395568
<reponame>AktanKasymaliev/django-video-hosting from django.urls import path from . import consumers websocket_urlpatterns = [ path('ws/video/<int:video_id>/', consumers.CommentsConsumer.as_asgi()), ]
StarcoderdataPython
165941
<reponame>douglasnaphas/cryptopals-py import unittest from set1.challenge2_fixed_XOR.s1c2 import S1C2 from parameterized import parameterized class TestS1C2(unittest.TestCase): @parameterized.expand([ ( "1c0111001f010100061a024b53535009181c", "686974207468652062756c6c277320657965", "746...
StarcoderdataPython
1743921
import numpy as np from .. import tools from ..algo import Algo class DynamicCRP(Algo): # use logarithm of prices PRICE_TYPE = "ratio" def __init__(self, n=None, min_history=None, **kwargs): self.n = n self.opt_weights_kwargs = kwargs if min_history is None: if n is N...
StarcoderdataPython
149911
<gh_stars>1-10 import numpy as np import paddle.fluid.dygraph as D from ernie.tokenizing_ernie import ErnieTokenizer from ernie.modeling_ernie import ErnieModel D.guard().__enter__() # activate paddle `dygrpah` mode model = ErnieModel.from_pretrained('ernie-1.0') # Try to get pretrained model from server, make sur...
StarcoderdataPython
3332221
<reponame>agral/CompetitiveProgramming #!/usr/bin/env python3 """ MIT License Copyright (c) 2017 <NAME> (<EMAIL>) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including w...
StarcoderdataPython
3301873
<reponame>mcvine/mcvine #!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # <NAME> # California Institute of Technology # (C) 2007 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~...
StarcoderdataPython
3220431
<reponame>li195111/PyChat import socket HOST = "localhost" PORT = 9999 client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(("localhost", 9999)) print (f"Start Connect ... {HOST}:{PORT}") done = False msg = '' msg_send = '' while not done: try: msg_send = input("Message: ") ...
StarcoderdataPython