id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1799982
from octopus.arch.wasm.cfg import WasmCFG # Eos smart contract == wasm module class EosCFG(WasmCFG): def __init__(self, module_bytecode): WasmCFG.__init__(self, module_bytecode=module_bytecode) def visualize_instrs_per_funcs(self, show=True, save=True, ...
StarcoderdataPython
3205764
import os import PIL from rect import Rect _imageFolder = '' def setImageFolder(path): ''' set a path to image folder simplifies the path definition for SpriteSheets and SheetImages ''' global _imageFolder _imageFolder = path class CssProp: def __init__(self, selector, pos=(0,0)): ...
StarcoderdataPython
197910
from astropy.io import fits from astropy import units as u import sys, os, pickle # this version switches to filfinder2D (from filfind_class::fil_finder_2D) gitpaths=['/Users/remy/lustre/naasc/users/rindebet/github/lmc-alma-analysis/'] for gitpath in gitpaths: if not gitpath in sys.path: sys.path.insert(0...
StarcoderdataPython
4821034
import os import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from enum import Enum from collections import deque, defaultdict class PDN: def __init__(self, L, C, R, VDC, CLK): self.L = L self.C = C self.R = R self.VDC = VDC self.CLK...
StarcoderdataPython
107713
"""List view for model news.""" from django.views.generic import ListView from news.models import News # Create your views here. class NewsListView(ListView): """List view for model list.""" model = News template_name = "list.html" context_object_name = "post_list" paginate_by = 3
StarcoderdataPython
1692296
import torch from torch import nn from torch.nn import functional as F from torchvision.models import resnet50 class DummyBackbone(nn.Module): def __init__(self, input_dim: int, hidden_dim: int, num_classes: int): super().__init__() self.hidden = nn.Linear(input_dim, hidden_dim) self.fc ...
StarcoderdataPython
42749
import functools import inspect import pandas as pd import awkward1 as ak from .series import AwkwardSeries from .dtype import AwkardType funcs = [n for n in dir(ak) if inspect.isfunction(getattr(ak, n))] @pd.api.extensions.register_series_accessor("ak") class AwkwardAccessor: def __init__(self, pandas_obj): ...
StarcoderdataPython
4820755
<filename>tests/demo.py<gh_stars>1-10 #!/usr/bin/env python3 """ python module exporting some dummy functions for use in testing replacement.py (c) 2018 <NAME> """ from io import StringIO def ret_kwargs(**kwargs): """ Return kwargs as a dictionary. """ return kwargs def ret_a_dict(existing): ""...
StarcoderdataPython
194384
#!/usr/bin/env python atoms = ['*char_', 'eps', '-int_'] infix_ops = ['>>', '|'] unary_ops = ['-'] atoms_4 = [] atom_parts = [None, None, None, None] for i in range(len(atoms)): atom_parts[0] = atoms[i] for j in range(len(atoms)): atom_parts[1] = atoms[j] for k in range(len(atoms)): ...
StarcoderdataPython
1608477
<filename>src/cpp_Obj/conditionalObject.py from cpp_Obj.varObject import VarObject from cpp_Obj.builtinObject import BuiltinObject from cpp_Obj.returnObject import ReturnObject import cpp_Obj.loopObject class ConditionalObject: def __init__(self, source_ast, nesting_count): self.exec_str = "" self...
StarcoderdataPython
1689341
<filename>GMX_TEST/GXG/test_all_dip.py from pmx import * res_ids =[ 'A', 'G', 'I', 'L', 'P', 'V', 'F', 'W', 'Y', 'D', 'E', 'R', 'H', 'K', 'S', 'T', 'C', 'M', 'N', 'Q', ] print(len(res_ids)) num = 0 for i in res_ids: num = num +1 print(num) sequence = "A%sA"%(i) c = Chain().create( sequence ) c.wri...
StarcoderdataPython
70948
<filename>notion_scholar/config.py<gh_stars>0 import shutil import keyring # https://askubuntu.com/a/881212 Solve issues of keyring with WSL from typing import Any from typing import Dict from typing import List from typing import Tuple from typing import Optional from pathlib import Path from configparser import Conf...
StarcoderdataPython
3225877
# -*- coding: UTF-8 -*- import torch import torch.nn as nn import numpy as np import pandas as pd from utils import utils from models.BaseModel import GeneralModel from helpers.KGReader import KGReader class CFKG(GeneralModel): reader = 'KGReader' @staticmethod def parse_model_args(parser): par...
StarcoderdataPython
24725
<reponame>LaudateCorpus1/oci-python-sdk<gh_stars>0 # coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at ht...
StarcoderdataPython
3264764
import os import sys import time import json import base64 import urllib2 from alice.utility import * from alice.utility import LOG as L from alice.script import testcase class TestCase(testcase.TestCase_Base): pass
StarcoderdataPython
3282197
from __future__ import with_statement from cgi import parse_qs from cStringIO import StringIO import functools import logging import re from urlparse import urlparse from django.conf import settings from django.core.cache import cache from django.core.urlresolvers import reverse, resolve import django.db.models.signa...
StarcoderdataPython
14666
import pytest from billy.utils.search import google_book_search class TestGoogleBookSearch(object): def test_search_returns_200(self, mock): """Ensure a basic search returns a 200 request""" assert google_book_search("<NAME>")["status"] == 200 def test_search_body_returns_dict(self, mock): ...
StarcoderdataPython
1697802
from flask import Blueprint, current_app, request, jsonify from .model import City from .serializer import CitySchema from requests import get, post import json from datetime import date, datetime from sqlalchemy import desc, func from unidecode import unidecode bp_citys = Blueprint('citys', __name__) @bp_citys....
StarcoderdataPython
1795610
<filename>DFS_BFS/backtracking/combination_sum.py """ Leetcode 39. Combination Sum 经典回溯。DFS,递归即可。 """ class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: ans = [] def dfs(n, can_set, cur_ans): if n == 0: ans.append(cur_ans) ...
StarcoderdataPython
1733062
# -*- coding: utf-8 -*- # Author <NAME>@<EMAIL> def extract_missing_tiles(): file_all = 'tuiles_swissimages_nord_vaudois.csv' #file_existing = 'ortho.csv' #file_existing = 'lidar.csv' file_existing = 'mnt.csv' with open(file_existing) as fe, open(file_all) as fa: data_fa = fa.rea...
StarcoderdataPython
3324690
#!/usr/bin/env python #The MIT License (MIT) #Copyright (c) 2016 <NAME> # #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIG...
StarcoderdataPython
3201557
RESUME = False
StarcoderdataPython
3369338
<filename>src/soda/sodac.py #!/usr/bin/python3 import argparse import logging import os import sys import textx from haoda import util from soda import core, grammar from soda.codegen.frt import core as frt from soda.codegen.intel import opencl as iocl from soda.codegen.xilinx import opencl as xocl from soda.model im...
StarcoderdataPython
1743753
from networkx.algorithms.bipartite import hopcroft_karp_matching from networkx.algorithms.cycles import find_cycle from networkx.algorithms.matching import is_perfect_matching from networkx.exception import NetworkXNoCycle from networkx import DiGraph, connected_components, weakly_connected_components, is_directed from...
StarcoderdataPython
1748581
import torch class Net(torch.nn.Module): def __init__(self): super(Net, self).__init__() self.linear1 = torch.nn.Linear(1, 2) self.dropout = torch.nn.Dropout(0.5) self.batchnorm = torch.nn.BatchNorm1d(2) self.linear2 = torch.nn.Linear(2, 1) def forward(self, x): ...
StarcoderdataPython
1613523
<reponame>t0930198/OAI_nb_IoT #/* # * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more # * contributor license agreements. See the NOTICE file distributed with # * this work for additional information regarding copyright ownership. # * The OpenAirInterface Software Alliance licenses this file...
StarcoderdataPython
14394
import json import os def qald(in_folder, out_folder): train = json.load(open(os.path.join(in_folder, "qald-7-train-en-wikidata.json"))) test = json.load(open(os.path.join(in_folder, "qald-7-test-en-wikidata-withoutanswers.json"))) train_q = [] test_q = [] for qs in train["questions"]: fo...
StarcoderdataPython
78159
# -*- coding: utf-8 -*- from odoo.tests import common import odoo GIF = b"R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs=" class test_ir_http_mimetype(common.TransactionCase): def test_ir_http_mimetype_attachment(self): """ Test mimetype for attachment """ attachment = self.env['ir.attachment'...
StarcoderdataPython
4802612
from graphene import ObjectType, Float, String, Int, Field, DateTime, List, __version__, Schema class TestGraphene: package = "graphene" version = __version__ def __init__(self, allow_extra): class Location(ObjectType): latitude = Float() longitude = Float() class...
StarcoderdataPython
1617172
"""Support for Extreme SLX.""" import time from netmiko.cisco_base_connection import CiscoSSHConnection class ExtremeSlxSSH(CiscoSSHConnection): """Support for Extreme SLX.""" def enable(self, *args, **kwargs): """No enable mode on Extreme SLX.""" pass def exit_enable_mode(self, *args, *...
StarcoderdataPython
3220838
#! /bin/env python # utility to add GSSAuthName, NFSv4Name, NFSv4RemoteGroup to ldap # given userid will lookup uid/gidNumber. # intentionally a little backwards in requiring GSS name because it is useless # in our context to have a name mapping without the GSS attribute # LDAP object doesn't require GSS attr but ...
StarcoderdataPython
70227
<gh_stars>1-10 # encoding: utf-8 '''Tests regarding the smisk.mvc module '''
StarcoderdataPython
1630271
<reponame>RideGreg/LeetCode class Solution(object): def reachingPoints(self, sx, sy, tx, ty): ''' if sx == tx and sy == ty: return True import collections used = {} used[(sx,sy)] = True q = collections.deque([(sx,sy)]) while q: x, y = q...
StarcoderdataPython
3390210
<gh_stars>0 # coding: utf-8 """ Emby Server API Explore the Emby Server API # noqa: E501 OpenAPI spec version: 4.1.1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import re # noqa: F401 # python 2 and python 3 compatibility lib...
StarcoderdataPython
3378553
<reponame>developbiao/pythonbasics #!/usr/bin/env python3 #-*- coding: utf-8 -*- L = [('Bob', 75), ('Adam', 92), ('Bart', 66), ('Lisa', 88)] def by_name(t): return t[0] def by_score(t): return t[1] L2 = sorted(L, key=by_score, reverse=False) print(L2)
StarcoderdataPython
3247821
<filename>tests/test_create_oxog_intervals.py """Tests the ``gdc_filtration_tools.tools.create_oxog_intervals`` module. """ import tempfile import unittest import pysam from gdc_filtration_tools.__main__ import main from gdc_filtration_tools.tools.create_oxog_intervals import create_oxog_intervals from tests.utils im...
StarcoderdataPython
3284939
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
85655
import os import uuid import re import mimetypes from django.shortcuts import render from .forms import FormUserCreation, FormLogin, FormJobPost, FormApply, FormUploadImage, FormUploadResume, FormApplicantsInfo from django.http import HttpResponse, JsonResponse from django.core.mail import send_mail from django.templat...
StarcoderdataPython
1618103
import os import logging from flask import Flask, g, request, jsonify, render_template, abort import requests import captain import json import random import string import shutil import time from combine.graph.type_graph import TypeGraph logging.basicConfig(level=logging.INFO) LOG_LVL = logging.INFO logger = logging.g...
StarcoderdataPython
1788364
"""Add future kline 1min Revision ID: 9c2dcdde9 Revises: <PASSWORD> Create Date: 2017-02-23 02:58:32.227072 """ # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '2<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): op.create_table( 'future_kline_1min', ...
StarcoderdataPython
1750521
<filename>cogs/memes/imagine.py import io from typing import cast from PIL import Image, ImageDraw, ImageFont from ditto import CONFIG as BOT_CONFIG import discord from discord.ext import commands from discord.utils import MISSING from ditto.config import CONFIG CONFIG = BOT_CONFIG.EXTENSIONS[__name__] IMAGE = "r...
StarcoderdataPython
3392563
"""Constants""" BASE_URL = "http://www.wienerlinien.at/ogd_realtime/monitor?rbl={}" DEPARTURES = { "1st": {"key": 0, "name": "{} 1st departure"}, "2nd": {"key": 1, "name": "{} 2nd departure"}, "3rd": {"key": 2, "name": "{} 3rd departure"}, "4th": {"key": 3, "name": "{} 4th departure"}, }
StarcoderdataPython
1794457
<filename>scripts/get_nltk_usage.py from module_dependencies import Module import pickle import json # module = Module("nltk", count="all", lazy=False) # with open("app/static/data/nltk_module.pickle", "wb") as f: # pickle.dump(module, f) with open("app/static/data/nltk_module.pickle", "rb") as f: module = ...
StarcoderdataPython
4804429
<gh_stars>0 import sqlite3 import random conn = sqlite3.connect('pokemon.db') c = conn.cursor() # xingge nature_attack_plus = ['Hardy', 'Lonely', 'Adamant', 'Naughty', 'Brave'] nature_defense_plus = ['Bold', 'Docile', 'Impish', 'Lax', 'Relaxed'] nature_sp_plus = ['Modest', 'Mild', 'Bashful', 'Rash', 'Quiet'] nature_s...
StarcoderdataPython
3336855
n,x0=[int(s) for s in input().split()] left=[0]*n right=[0]*n for i in range(n): a=[int(s) for s in input().split()] a.sort() left[i],right[i]=a a=max(left) b=min(right) if a>b: print(-1) else: if a<=x0<=b: print(0) else: print(min(abs(a-x0),abs(b-x0)))
StarcoderdataPython
3269267
#! /usr/bin/env python # -*- coding: utf-8 -*- """ First, a few callback functions are defined. Then, those functions are passed to the Dispatcher and registered at their respective places. Then, the bot is started and runs until we press Ctrl-C on the command line. Usage: Example of a bot-user conversation using Conve...
StarcoderdataPython
161823
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-06-07 08:38 from __future__ import unicode_literals from django.db import migrations import django.db.models.manager class Migration(migrations.Migration): dependencies = [ ('protector', '0002_auto_20160607_0827'), ] operations = [ ...
StarcoderdataPython
135111
# coding: utf-8 import pprint import re import six class FreeResourceDetail: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value...
StarcoderdataPython
1717397
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You m...
StarcoderdataPython
78351
from django.urls import path from . import views app_name = 'tickets' urlpatterns = [ path('', views.ticket_list, name='list'), path('detail/<int:id>', views.ticket_detail, name='detail'), path('create/', views.ticket_create, name='create'), path('edit/<int:id>', views.ticket_edit, name='edit'), p...
StarcoderdataPython
1742683
from flask import Flask, request, jsonify, json, render_template from get_path import get_path import os import shelve app = Flask(__name__) db_path = os.environ['DB_PATH'] @app.route('/path', methods=['GET']) def path(): waypoints = request.args.get('waypoints') waypoints = json.loads(waypoints) p...
StarcoderdataPython
1647461
<filename>tests/r/test_bomregions2012.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.bomregions2012 import bomregions2012 def test_bomregions2012(): """Test module bomregions2012.py by dow...
StarcoderdataPython
3241322
<reponame>astamminger/aiida_core<gh_stars>0 # -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...
StarcoderdataPython
121728
<reponame>bionanek/ByTheWay-API<gh_stars>0 from django.contrib.auth.models import User from django.db import models class LogoUpload(models.Model): created = models.DateTimeField(auto_now_add=True) owner = models.ForeignKey(User, to_field='id', on_delete=models.CASCADE) datafile = models.FileField() cla...
StarcoderdataPython
150051
import json def readConfig(): with open('conf.json') as conf: jconf = conf.read() conf = json.loads(jconf) return conf
StarcoderdataPython
3374945
<reponame>salliewalecka/sparkling-water # # 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, Versi...
StarcoderdataPython
14567
import logging import os import random import time import datetime import sys import math from screen import Screen from scorer import Scorer from trigger import Trigger from psychopy import core, event, sound from psychopy.hardware import keyboard from pupil_labs import PupilCore from datalog import Datalog from conf...
StarcoderdataPython
1664198
# -*- coding: utf-8 -*- import pygame import math import datetime import time from core.weapon import * # hero class - player class HeroSprite(pygame.sprite.Sprite): def __init__(self, screen, x, y): super(HeroSprite, self).__init__() self.screen = screen self.left, self.right, self.up, sel...
StarcoderdataPython
141650
<reponame>ml4wireless/gr-echo #!/usr/bin/env python # -*- coding: utf-8 -*- # # <NAME> <<EMAIL>> # 2019 09 13 # # Copyright 2018 <+YOU OR YOUR COMPANY+>. # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation...
StarcoderdataPython
3366063
<filename>predict.py import random import torch from torch.autograd import Variable from train_util import variable_from_sentence class ModelPredictor(object): def __init__(self, encoder, decoder, input_lang, output_lang, max_length): self.encoder = encoder self.decoder = decoder self.i...
StarcoderdataPython
195332
<gh_stars>0 import inspect from functools import wraps from inspect import signature from types import FunctionType from typing import Callable, Generic, Optional, Type, Union from apischema.typing import get_type_hints from apischema.utils import PREFIX, T, get_origin_or_type2 MethodOrProperty = Union[Callable, prop...
StarcoderdataPython
1782923
import socket class PyCololight: COMMAND_PREFIX = "535a30300000000000" COMMAND_CONFIG = "20000000000000000000000000000000000100000000000000000004010301c" COMMAND_EFFECT = "23000000000000000000000000000000000100000000000000000004010602ff" CUSTOM_EFFECT_COLOURS = { "Breath": { "decima...
StarcoderdataPython
20954
<filename>src/wildfires/cache/same_call.py # -*- coding: utf-8 -*- """Decorator guaranteeing uniform function calls.""" from inspect import Parameter, signature def extract_uniform_args_kwargs(f, *args, ignore=None, **kwargs): """Extract uniform arguments given a function and the parameters it is called with. ...
StarcoderdataPython
3240134
#!/usr/bin/env python3 from collections import defaultdict import sys # func_dict = {func_name: (start_line, end_line, lines)} # def get_lines(filename='battleship.go'): # with open(filename) as in_file: # return [line.strip() for line in in_file] def funcs(filename='battleship.go'): # pass one w...
StarcoderdataPython
3308273
<reponame>manoj153/firstRPIworkshop import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(40, GPIO.OUT) GPIO.setwarnings(False) #You can import any required modules here #This can be anything you want moduleName = "turnON" #All of the words must be heard in order for this module to be executed com...
StarcoderdataPython
45696
<reponame>ryosuke0825/atcoder_python n, a, b = map(int, input().split()) ans = 0 for i in range(1, n+1): str_i = str(i) sum = 0 for j in range(len(str_i)): sum += int(str_i[j]) if a <= sum <= b: ans +=i print(ans)
StarcoderdataPython
3358580
#!/usr/bin/python from scipy.optimize import * from scipy.integrate import * import distributions import mytime ln = distributions.LogNormal (0, 1) N = 100000 tmr = mytime.timeit() for i in xrange(N): root = brenth (ln.dx_lpdf, 0.1, 25) print "root was %.10f" % root elapsed = tmr.total("Time for %d root-fi...
StarcoderdataPython
3361287
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """This file contains the tests for the generic text parser.""" import unittest import pyparsing from plaso.parsers import text_parser from tests.parsers import test_lib class PyparsingConstantsTest(test_lib.ParserTestCase): """Tests the PyparsingConstants text par...
StarcoderdataPython
3384381
import tensorflow as tf try: tf.enable_eager_execution() except: pass from tf_supervised_inference.distributions import ImproperMultivariateNormal import numpy as np class ImproperMultivariateNormalTest(tf.test.TestCase): def setUp(self): tf.set_random_seed(42) np.random.seed(42) def ...
StarcoderdataPython
29513
<filename>openpype/hosts/hiero/plugins/publish/integrate_version_up_workfile.py<gh_stars>10-100 from pyblish import api import openpype.api as pype class IntegrateVersionUpWorkfile(api.ContextPlugin): """Save as new workfile version""" order = api.IntegratorOrder + 10.1 label = "Version-up Workfile" ...
StarcoderdataPython
78598
import sys import random def printList(a): strn='' for item in a: strn+=str(item)+' ' return strn def swap(a,p1,p2): a[p1],a[p2]=a[p2],a[p1] return a def Partition(a,p,q): x=a[q] i=p-1 for j in range(p,q): if a[j]<=x: i=i+1 swap(a,i,j) swap(a,i+1,q) return i+1 def RandomPartition(a,p,q): r=ra...
StarcoderdataPython
3240944
<filename>PyTrackX/__init__.py from .module import * __version__ = '0.7'
StarcoderdataPython
3384718
<reponame>yousong/python_yunionsdk # Copyright 2012 OpenStack LLC. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/L...
StarcoderdataPython
1778290
<reponame>zconnect-iot/ibm-iot-emulator<filename>zconnect-mqtt-auth/zconnectmqttauth/connection.py import logging from .api import parse_connection from .auth.mongodb import VMQAuth logger = logging.getLogger(__name__) class MQTTConnection: def __init__(self, api, auth): self._api = api self._a...
StarcoderdataPython
1602215
<filename>Python/6013.py #!/usr/bin/env python3 # @Date : 2022/2/20 # @Filename : 6013.py # @Tag : # @Autor : <NAME> # @Difficulty : from heapq import * from typing import List, Optional from collections import defaultdict, deque, Counter from itertools import product,combinations,permutations,ac...
StarcoderdataPython
1642948
# Generated by Django 3.1.7 on 2021-04-18 10:06 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('index', '0007_auto_20210327_1831'), ] operations = [ migrations.RemoveField( model_name='course...
StarcoderdataPython
4807189
from p5 import * def setup(): size(360, 360) no_loop() def draw(): circle((165, 200), 198) run()
StarcoderdataPython
186882
"""Project exceptions""" class ProjectImportError (Exception): """Failure to import a project from a repository.""" pass
StarcoderdataPython
1650247
'''Algoritmo de Busca Binária''' def bb(val): lo,hi=0,(n-1) while hi>=lo: mid=(hi+lo)//2 if vetor[mid]==val: return mid if vetor[mid]<val: lo=mid+1 else: hi=mid-1 return -1 '''Inicialização''' n=int(input()) vetor=[int(x) for x in input().s...
StarcoderdataPython
3219930
<gh_stars>0 # -*- coding: utf-8 -*- # Copyright 2020 CISCO. All rights reserved. # Copyright 2021 <NAME>. All rights reserved. # # The contents of this file are 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 t...
StarcoderdataPython
3290105
<gh_stars>0 from django import forms from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.models import User from .models import Profile class LoginForm(forms.Form): username = forms.CharField(max_length=30, required=True) password = forms.CharField(widget=forms.Pass...
StarcoderdataPython
3205710
import collections import json import os from ..common import Manager from copy import deepcopy from pymongo.cursor import Cursor from datacatalog.jsonschemas import JSONSchemaBaseObject from datacatalog.extensible import ExtensibleAttrDict from datacatalog.identifiers import typeduuid from datacatalog.linkedstores.ass...
StarcoderdataPython
189336
import pytest as pytest from main import select_tasks from task_selector.taskexceptions import EmptyFileException, \ JSONMissingFieldsExepction def test_empty_json_list(): assert select_tasks("[]") == "[]" @pytest.mark.parametrize('json_str,exception', [ ("" , EmptyFileException), ("[{'name': 'A...
StarcoderdataPython
1675028
""" Hadoop Blueprint """ from calm.dsl.builtins import ref, basic_cred from calm.dsl.builtins import action from calm.dsl.builtins import CalmTask from calm.dsl.builtins import CalmVariable from calm.dsl.builtins import Service, Package, Substrate from calm.dsl.builtins import Deployment, Profile, Blueprint from calm...
StarcoderdataPython
4838638
<filename>patron/tests/unit/api/openstack/test_api_version_request.py # Copyright 2014 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/lic...
StarcoderdataPython
3206340
<reponame>Sunshengjin/RoboWare-Studio<filename>extensions/RichardHe.you-complete-me-1.0.36/ycmd/ycmd/tests/rust/subcommands_test.py #!/usr/bin/env python # # Copyright (C) 2015 ycmd contributors. # # This file is part of ycmd. # # ycmd is free software: you can redistribute it and/or modify # it under the terms of the ...
StarcoderdataPython
122433
import pandas as pd # change this def filter_func(x): return x['credit'] >= 5 data = pd.read_csv('output/courses.csv') df = data[data.apply(filter_func, axis=1)] #data.iloc[0,:].to_csv('output/query.csv', header=False, index=False) df.to_csv('output/query.csv', index=False)
StarcoderdataPython
3377893
<filename>dvorfs/process_genewise.py #!/usr/bin/env python3 import sys, argparse, os import pandas as pd import numpy as np from collections import defaultdict from . import parse_genewise # NOTE for sequence arithmetic: records use BED-style index def target_overlap(h1,h2): # uses bed index overlap = min(h1['te...
StarcoderdataPython
61111
from pkg_resources import resource_string import json proto_info = None try: proto_json = resource_string(__name__, 'proto.json') proto_info = json.loads(proto_json) except Exception: pass
StarcoderdataPython
3386776
<filename>cyberbattle/agents/baseline/notebooks/notebook_dql.py # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # -*- coding: utf-8 -*- # %% """Deep Q-learning agent (notebook) This notebooks can be run directly from VSCode, to generate a traditional Jupyter Notebook to open in your browser ...
StarcoderdataPython
1699349
''' Code for HackerRank Interview Preparation Kit <NAME> ############### problem ############### There are a number of people queued up, and each person wears a sticker indicating their initial position in the queue Initial positions increment by 1 from 1 at the front of the line to n at the back Any person in the que...
StarcoderdataPython
3241167
import mitsuba import pytest import enoki as ek from enoki.dynamic import UInt32 @pytest.fixture(scope="module") def interaction(): from mitsuba.core import Frame3f from mitsuba.render import SurfaceInteraction3f si = SurfaceInteraction3f() si.t = 0.1 si.p = [0, 0, 0] si.n = [0, 0, 1] si.s...
StarcoderdataPython
55678
from steem import Steem from datetime import datetime, date, timedelta from math import ceil, log, isnan import requests API = 'https://api.steemjs.com/' def tag_filter(tag, limit = 10): tag_search = Steem() tag_query = { "tag":tag, "limit": limit } tag_filters = tag_search.get_dis...
StarcoderdataPython
1605384
# Description: Performs a sed-like substitution on the last message by the # calling user # Author: <NAME> <<EMAIL>> # Website: http://pacopablo.com # License: BSD # # BHJTW: ported to JSONBOT 27-8-2012 __author__ = '<NAME> <<EMAIL>>' __license__ = "BSD" __status__ = "seen" ## jsb imports from jsb.lib....
StarcoderdataPython
4923
import tensorflow as tf @tf.function def BinaryAccuracy_Infiltrates(y_true, y_pred, i=0): return tf.keras.metrics.binary_accuracy(y_true[:, i], y_pred[:, i]) @tf.function def BinaryAccuracy_Pneumonia(y_true, y_pred, i=1): return tf.keras.metrics.binary_accuracy(y_true[:, i], y_pred[:, i]) @tf.function def...
StarcoderdataPython
3389342
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Mon Jul 22 21:47:01 2019 @author: zejiran. """ import year_analyzer_module as mod def ejecutar_analizar_anio() -> None: anio = int(input("Ingrese el año que desea analizar: ")) resultado = mod.analizar_anio(anio) print(resultado) de...
StarcoderdataPython
3270464
class TweetCounter(object): def __init__(self, **kwargs): self.counter = 0 def add_tweet(self,tweet): self.counter += 1 def get(self): return [(self.counter,self.get_name())] def get_name(self): return 'TweetCounter' def combine(self,new): self.counter += new....
StarcoderdataPython
3386889
# -*- coding: utf-8 -*- """ Created on Mon Aug 1 14:44:28 2016 @author: poyu Data Pre-processing for Feature Representation """ import os import nibabel as nib import numpy as np #def load_dataset(): def normalized_3d(inputs): inputs=np.copy(inputs) x_dim, y_dim, z_dim = inputs.shape number_non_zer...
StarcoderdataPython
3289601
from more_one_memo.web import web from more_one_memo.web.model import WebConfig import click @click.command(context_settings={'auto_envvar_prefix': 'MORE_ONE_MEMO_WEB'}) @click.option('--mongo-uri', help='MongoDB URI. Database name must be included', type=str, required=True, show_envvar=True) @click.option('--slack-...
StarcoderdataPython
26852
<reponame>mmiyajima2/django-kantanoidc from logging import getLogger from django.http import HttpResponseRedirect from django.views.generic.base import View from django.contrib.auth import login from django.contrib.auth import get_user_model from django.urls import reverse from .client import client from .errors import...
StarcoderdataPython