id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1788982
<filename>pogo/pogoBot/pogoAPI/api.py from .custom_exceptions import GeneralPogoException from .location import Location from .pgoapi import pgoapi from .session import PogoSession from .util import get_encryption_lib_path # Callbacks and Constants API_URL = 'https://pgorelease.nianticlabs.com/plfe/rpc' LOGIN_URL = 'ht...
StarcoderdataPython
104226
# Create dummy variables for categorical features with less than 5 unique values import pandas as pd from sklearn.preprocessing import LabelEncoder import gc import datetime import calendar import xgboost as xgb # import logger.py from logger import logger # set iteration iteration = '3' logger.info('Start data_pre...
StarcoderdataPython
1665579
<gh_stars>10-100 import os import subprocess import sys import io import shutil import json import django from port.models import LastPortIndexUpdate import config from settings import BASE_DIR sys.path.append(BASE_DIR) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' os.environ.setdefault("DJANGO_SETTINGS_MODULE",...
StarcoderdataPython
4803335
<reponame>sfstpala/v6wos import unittest.mock import tornado.testing import v6wos.tests import v6wos.model.hosts class HostsTest(v6wos.tests.TestCase): @unittest.mock.patch("couch.AsyncCouch.view") @unittest.mock.patch("v6wos.model.hosts.Hosts.put") @unittest.mock.patch("v6wos.model.hosts.Hosts.delete") ...
StarcoderdataPython
113200
<reponame>BaDTaG/tacticalrmm from django.urls import path from . import views from apiv3 import views as v3_views urlpatterns = [ path("newagent/", v3_views.NewAgent.as_view()), path("meshexe/", v3_views.MeshExe.as_view()), path("saltminion/", v3_views.SaltMinion.as_view()), path("<str:agentid>/saltmin...
StarcoderdataPython
1764745
# coding=utf-8 from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde # Generated with OTLEnumerationCreator. To modify: extend, do not edit class KlSeinbrugType(KeuzelijstField): """Types van seinbrug.""" naam = 'KlSeinbru...
StarcoderdataPython
1775277
<reponame>Mikma03/InfoShareacademy_Python_Courses<filename>Part_2_intermediate/mod_6/lesson_3/ex_1_simple_except/example_4.py def run_example(): try: print("Przed rzuceniem wyjątku") raise TypeError("Coś poszło nie tak...") print("To się nie wydarzy") except Exception as error: ...
StarcoderdataPython
179689
# Monocyte - Monocyte - Search and Destroy unwanted AWS Resources relentlessly. # Copyright 2015 Immobilien Scout GmbH # # 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...
StarcoderdataPython
4812967
def cholesky(A): #zero B = [[0 for _ in range(len(A[0]))] for _ in range(len(A))] C = [[0 for _ in range(len(A[0]))] for _ in range(len(A))] #steps 1 and 3 for i in range(len(A)): B[i][0] = A[i][0] C[0][i] = A[0][i]/B[0][0] C[i][i] = 1 #steps 2 and 4 for i in range(...
StarcoderdataPython
1630434
<reponame>kkcookies99/UAST<filename>Dataset/Leetcode/valid/66/208.py<gh_stars>0 class Solution(object): def XXX(self, digits): """ :type digits: List[int] :rtype: List[int] """ digits[-1] += 1 right = len(digits)-1 while digits[right] ==10: digits...
StarcoderdataPython
3209602
print "Mary had a little lamb." #prints this statement print "Its fleece was white as %s." % 'snow' #prints "snow" in string format print "And everywhere that Mary went." #prints this statement print "." * 10 #what'd that do? I already know. It multiplies "." by 10. end1 = "C" #attributes "C" to variable "end1" end2 ...
StarcoderdataPython
3365944
from django.contrib import admin from oscar.apps.shipping.models import ( OrderAndItemCharges, WeightBand, WeightBased) class OrderChargesAdmin(admin.ModelAdmin): list_display = ('name', 'description', 'price_per_order', 'price_per_item', 'free_shipping_threshold') class WeightBandAdmin...
StarcoderdataPython
29855
<gh_stars>1-10 from http.server import HTTPServer, SimpleHTTPRequestHandler class RepoRequestHandler(SimpleHTTPRequestHandler): def _set_headers(self): self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() def _encode(self, text): return tex...
StarcoderdataPython
4808324
"""Implements the method used for deciding which feature goes to which level when plotting.""" import itertools import math class Graph: """Minimal implementation of non-directional graphs. Parameters ---------- nodes A list of objects. They must be hashable. edges A list of the fo...
StarcoderdataPython
1701587
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Name: csv_print_html_oia.py # Description: # # Author: m.akei # Copyright: (c) 2021 by m.na.akei # Time-stamp: <2021-04-25 16:33:53> # Licence: # ---------------------------------...
StarcoderdataPython
154106
import unittest import run as lmpkit # just some notes on prboom+ compat levels so I can't botch this # # test_01 - 3 - Doom Ultimate - Doom 1 - E1L1 # test_02 - 3 - Doom Ultimate - Doom 1 - E1L1 # test_03 - 3 - Doom Ultimate - Doom 1 - E1L1 # test_04 - 17 - PRBoom 6 - Doom 1 - E1L1 # te...
StarcoderdataPython
1695935
class ZCItoolsException(Exception): pass class ZCItoolsValueError(ZCItoolsException): pass
StarcoderdataPython
3362302
<gh_stars>0 import os from mmseg.apis import init_segmentor, inference_segmentor, show_result_pyplot from mmseg.core.evaluation import get_palette from matplotlib import pyplot as plt import mmcv from collections import Counter from PIL import Image import numpy as np from tqdm import tqdm config_file = r"D:\林彬\mmsegm...
StarcoderdataPython
1624946
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('library', '0013_auto_20170613_1705'), ] operations = [ migrations.RemoveField( model_name='waitorderitem', ...
StarcoderdataPython
1761824
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import copy import math from typing import Tuple import numpy as np import torch try: import cv2 except ImportError: _HAS_CV2 = False else: _HAS_CV2 = True def uniform_temporal_subsample( x: torch.Tensor, num_samples: int, tem...
StarcoderdataPython
1722607
<filename>decomplexator/cc.py """ @author: <NAME> Cleaned a bit by <NAME> """ import redbaron redbaron.ipython_behavior = False class CognitiveComplexity(object): def evaluate(self, filename): """ Calculate cognitive complexity for all functions and methods defined in file. """ ...
StarcoderdataPython
3237772
<filename>utils/train_helper.py import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from graphs.models.deeplab_multi import DeeplabMulti from modeling.deeplab import * def get_model(args): if args.backbone == "deeplabv2_multi": model = DeeplabMulti(num_cla...
StarcoderdataPython
1657903
<filename>PCprophet/validate_input.py import PCprophet.exceptions as PCpexc import pandas as pd class InputTester(object): """ docstring for InputTester validate all inputs before anything infile is a panda dataframe """ def __init__(self, path, filetype, infile=None): super(InputTest...
StarcoderdataPython
3317724
from unittest import TestCase from sqltest.parser import SparkSqlExtractor from sqltest.parser.catalog import Field class TestSqlExtractor(TestCase): def test_should_extract_table_succeed_with_normalize_sql(self): extractor = SparkSqlExtractor() create_table_ddl = """ CREATE TABLE IF ...
StarcoderdataPython
42898
<filename>src/mipi-code2vec/mipi_websocket/mipi_server.py #!/usr/bin/env python import asyncio import json import websockets from mipi.base_codemeaning_predictor import PatchInfo from mipi.mipi_app import Mipi class MipiWSServer: def __init__(self, mipi_obj, address="localhost", port=8765, port_admin=8766): ...
StarcoderdataPython
3310485
# Verify asymmetric originality signature # Based on public AN12196 8.2 Asymmetric check import sys import binascii from ecdsa import VerifyingKey from ecdsa.curves import NIST224p from ecdsa.keys import BadSignatureError PUBLIC_KEY = binascii.unhexlify(b"048A9B380AF2EE1B98DC417FECC263F8449C7625CECE82D9B916C992DA209...
StarcoderdataPython
1676297
# -*- coding: utf-8 -*- """ Created on Wed May 17 16:36:14 2017 @author: vrtjso """ import numpy as np import pandas as pd from datetime import datetime, date from operator import le, eq from Utils import sample_vals, FeatureCombination import gc from sklearn import model_selection, preprocessing from skl...
StarcoderdataPython
1764252
# StorageGRID Data Management Console (DMC) # Copyright (c) 2018, NetApp, Inc. # Licensed under the terms of the Modified BSD License (also known as New or Revised or 3-Clause BSD) import sys import json from functools import wraps from flask import Flask, send_file, render_template, session, request import botocore...
StarcoderdataPython
57820
<reponame>le0park/search_scraper<filename>strategy/core.py<gh_stars>0 from abc import * class AbstractScrapStrategy(metaclass=ABCMeta): platform = 'etc' driver = None def __init__(self, driver): self.driver = driver @abstractmethod def scraps(self, query, page_count): return []
StarcoderdataPython
60613
#!/usr/bin/env python # coding=utf-8 import unittest from app.domain.model import User, AnonymousUser, Permission, Role class UserModelTestCase(unittest.TestCase): def test_password_setter(self): u = User(password = '<PASSWORD>') self.assertTrue(u.password_hash is not None) def test_no_passwo...
StarcoderdataPython
1771182
from datetime import date from django import forms class BuscaMixin(forms.Form): ANOS_CHOICES = () MESES_CHOICES = ( ('1', 'Janeiro'), ('2', 'Fevereiro'), ('3', 'Março'), ('4', 'Abril'), ('5', 'Maio'), ('6', 'Junho'), ('7', 'Julho'), ('8', 'Agosto'), ('9', 'Setembro'),...
StarcoderdataPython
187343
""" Downloads North Carolina voterfile and voter history, then extracts to data path. """ from io import BytesIO from bs4 import BeautifulSoup import os import requests import pandas as pd from zipfile import ZipFile from download_mggg import download_mggg_state data_path = os.environ.get('DATA_PATH', '../data') d...
StarcoderdataPython
1797947
import os import subprocess from executors.pythonexecutor import PythonExecutor def main(): codex = PythonExecutor() codex.execute() print(codex.log) if __name__ == "__main__": main()
StarcoderdataPython
3238725
<reponame>lipovsek/aimet<filename>TrainingExtensions/torch/test/python/test_graphmeta.py # /usr/bin/env python3.5 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2020, Qualcomm Innovation Center, Inc. All rights reserved....
StarcoderdataPython
120834
<reponame>abadojack/StackOverflow-lite import json import re import uuid from datetime import datetime, timedelta import jwt import psycopg2 from flask import jsonify, request from validate_email import validate_email from werkzeug.security import check_password_hash from project.config import Config from project.da...
StarcoderdataPython
147414
""" This module contains the structs necessary to represent an automata. """ from __future__ import annotations import logging from typing import Any, Dict, Iterable, List, Set, Tuple, Union from numlab.automata.state import State from numlab.automata.transition import Transition _ATMT_COUNT = 0 class Automata: ...
StarcoderdataPython
3231747
<reponame>Bystroushaak/BalancedDiscStorage #! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # # Imports ===================================================================== import os import shutil import os.path import tempfile from os.path import join import pytest from BalancedDi...
StarcoderdataPython
4821266
from __future__ import unicode_literals try: import simplejson as json except ImportError: import json from collections import MutableMapping try: import simplejson as json except ImportError: import json import sys from decimal import Decimal mapping_base = MutableMapping GEO_INTERFACE_MARKER = "...
StarcoderdataPython
3347917
from __future__ import print_function, division import numpy as np import random import torch import os # TODO: combine with data/misc/*.py #################################################################### ## Process image stacks. #################################################################### def count_volu...
StarcoderdataPython
3211939
dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None syncbn = True data = dict( videos_per_gpu=4, # total batch size is 8Gpus*4 == 32 workers_per_gpu=4, train=dict( type='CtPDataset', data_source=dict( type='JsonClsDataSource', a...
StarcoderdataPython
3227266
<filename>stac_api_validator/geometries.py point = { "type": "Point", "coordinates": [100.0, 0.0] } linestring = { "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] } polygon = { "type": "Polygon", "coordinates": [ [ [100.0, 0.0], ...
StarcoderdataPython
1785229
import asyncio from . import Agent class StubAgent(Agent): def is_valid(self): return True async def process(self, event_fn): event_fn(metric_f=1.0, service="test", tags=["test"]) class LaggingAgent(Agent): def __init__(self, cfg, lag): super...
StarcoderdataPython
4817901
<reponame>duncanhawthorne/coffeeworlds import pygame from pygame.locals import * from math import floor # Try to import Numpy, or Numeric try: import numpy as Numeric BYTE = "u1" DWORD = "u4" except ImportError: try: import Numeric except ImportError, e: ...
StarcoderdataPython
89016
<reponame>kakemotokeita/dqn-seismic-control<gh_stars>0 class Damper: def __init__(self): self.damper_force0 = 0 def d_damper_force(self, force, action): damper_force = force * -action # AIが決定するパラメータで、与えられた力に対して、どんな割合で力を返すかを決める値 d_damper_force = damper_force - self.damper_force0 ...
StarcoderdataPython
182532
""" An API for retrieving user account information. For additional information and historical context, see: https://openedx.atlassian.net/wiki/display/TNL/User+API """ import datetime import logging import uuid from functools import wraps import pytz from rest_framework.exceptions import UnsupportedMediaType from ...
StarcoderdataPython
127602
# Copyright (c) 2020 BlenderNPR and contributors. MIT license. import math #Rotated Grid Super Sampling pattern def get_RGSS_samples(grid_size): samples = [] for x in range(0, grid_size): for y in range(0, grid_size): _x = (x / grid_size) * 2.0 - 1.0 #(-1 ... +1 range) _y = (y ...
StarcoderdataPython
108138
<reponame>ysenarath/opinion-lab COMMAND_HELP = ''' oplab <command> [<args>] ''' TRAIN_COMMAND_HELP = ''' oplab t|train --params <params_file_path> --output <model_save_path> '''
StarcoderdataPython
3284865
<gh_stars>1-10 #!/usr/bin/env python3 import os, sys, signal, itertools chungus = open("chungus.txt").read() chars = ('chunga', 'chunky', 'karen', 'big', 'fudd', 'chungus', 'ricardo') def replace(A, B, C): for x, y in zip(B, C): A = A.replace(x, y) return A def signal_handler(signum, frame): rai...
StarcoderdataPython
3257971
from maggma.api import query_operator from emmet.api.routes.dielectric.query_operators import DielectricQuery from monty.tempfile import ScratchDir from monty.serialization import loadfn, dumpfn def test_dielectric_query_operator(): op = DielectricQuery() q = op.query( e_total_min=0, e_total...
StarcoderdataPython
3371707
from django.db import models # Create your models here. class Product(models.Model): # TODO: creating fulldesc and short desc product_no = models.IntegerField(default=1) product_name = models.CharField(max_length=50) category = models.CharField(max_length=50, default="") sub_category = models.Char...
StarcoderdataPython
7216
import io from PIL import Image as PILImage from sqlalchemy import Column, ForeignKey, LargeBinary, Index, Integer, String from resources.models.ModelBase import Base class Image(Base): # If this is used then the image is stored in the database image = Column(LargeBinary(length=16777215), default=None) #...
StarcoderdataPython
3314421
<filename>lyrics/chartlyrics.py<gh_stars>1-10 """ chartlyrics Gets the lyrics for a song using the chartlyrics website @category silly @version $ID: 1.1.1, 2015-06-30 17:00:00 CST $; @author KMR @licence GNU GPL v.3 """ __version__ = "1.1.1" import requests from bs4 import BeautifulSoup class chartlyric...
StarcoderdataPython
1625583
<filename>test/matrix/test_named_matrix.py import unittest import collections import time import bspump import bspump.matrix import bspump.unittest class TestNamedMatrix(bspump.unittest.TestCase): def test_matrix_zeros(self): matrix = bspump.matrix.NamedMatrix( app = self.App, dtype = "int_") matrix.zer...
StarcoderdataPython
3274350
#!/usr/bin/env python from setuptools import setup import os package_name = 'fht' files_so = [t for t in os.listdir(package_name) if t.endswith('.so')] print(files_so) setup(name='fht', version='0.1', description='fast hankel transform', author='<NAME>', author_email='<EMAIL>', license='M...
StarcoderdataPython
3212126
# -*- coding: utf-8 -*- from django.views.generic import ListView from .models import Post class PostListView(ListView): model = Post
StarcoderdataPython
3227362
import spya from os import path as op def test_paths(): path = spya.paths('.', 'tests') assert path == '.' + op.sep + 'tests' def test_exists(): assert True == spya.exists(__file__) def test_isfile(): assert True == spya.isfile(__file__) def test_isdir(): dirname = spya.dirname(__file__) ass...
StarcoderdataPython
77408
import os import glob import requests import warnings import jsonpatch from jinja2 import Environment from spytest.dicts import SpyTestDict from utilities import common as utils from utilities import json_helpers as json class Rest(object): def __init__(self, logger=None): self.base_url = os.getenv("SPY...
StarcoderdataPython
1649786
<filename>ciukune/core/settings/database.py<gh_stars>0 """Database settings, can be overrided in production.""" from os.path import join from os.path import dirname from os.path import abspath BASE_DIR = dirname(dirname(abspath(__file__))) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3',...
StarcoderdataPython
5424
<reponame>DavideRuzza/moderngl-window """ Registry general data files """ from typing import Any from moderngl_window.resources.base import BaseRegistry from moderngl_window.meta import DataDescription class DataFiles(BaseRegistry): """Registry for requested data files""" settings_attr = "DATA_LOADERS" ...
StarcoderdataPython
3231934
from duty.objects import dp, Event from duty.utils import ment_user, format_response from microvk import VkApiResponseException def user_add(event: Event, typ: str): user = event.api('users.get', user_ids=event.obj['user_id'])[0] def _format(response_name, err=None): return format_response( ...
StarcoderdataPython
4819476
<reponame>qsnake/h5py from h5py import tests from h5py import * class TestCreate(tests.HTest): def setUp(self): self.fid, self.name = tests.gettemp() def tearDown(self): import os self.fid.close() os.unlink(self.name) @tests.require(api=18) def test_create_anon(self)...
StarcoderdataPython
3298788
<gh_stars>1-10 #!/usr/bin/env python # Copyright 2012-2017 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
StarcoderdataPython
3304212
import numpy as np import collections import itertools as itt import functools as fct import warnings class TensorCommon: """ A base class for Tensor and AbelianTensor, that implements some higher level functions that are common to the two. Useful also for type checking as in isinstance(T, TensorCommon). ...
StarcoderdataPython
1604409
<gh_stars>1-10 # -*- coding: UTF-8 -*- import io import json from tests.testing import resource_filename from yelp.obj.business import Business from yelp.obj.deal import Deal from yelp.obj.location import Location from yelp.obj.response_object import ResponseObject class TestResponseObject(object): @classmethod...
StarcoderdataPython
179265
import json import matplotlib.pyplot as plt from imantics import Dataset if __name__ == '__main__': with open('composition_dataset_2/train/annotations/annotations.json') as f: data = json.load(f) dataset = Dataset.from_coco(data) for image in dataset.iter_images(): draw = image.draw(bbox=T...
StarcoderdataPython
159061
<gh_stars>0 from datetime import timedelta from django.conf import settings from django.core.urlresolvers import reverse from django.db import models from django.db.models import Q from django.db.models.signals import pre_save, post_save from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager ) fro...
StarcoderdataPython
35596
from .NumpyDataset import NumpyDataset
StarcoderdataPython
3287121
<filename>src/simod/writers/model_serialization.py import xml.etree.ElementTree as ET import xmltodict as xtd from simod.configuration import QBP_NAMESPACE_URI from ..readers import bpmn_reader as br def serialize_model(filename): bpmn = br.BpmnReader(filename) tasks = {x['task_id']: x['task_name'] for x in...
StarcoderdataPython
93843
<reponame>andrewraharjo/CAN-Bus-Hack_Prius_Focus from PyEcom import * from config import * import time, struct, sys, binascii def str_to_hexarr(val): payload = [] for x in val: payload.append(ord(x)) return payload def nbo_int_to_bytearr(dword): arr = [] arr.append(dword & 0x...
StarcoderdataPython
3357096
# Copyright 2016 The Bazel Go Rules 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 the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
StarcoderdataPython
151031
<filename>src/Core/DevOps/Locust/common/store_api.py<gh_stars>0 import random import json import uuid import time import requests from locust.exception import RescheduleTask class StoreApi: context: None def __init__(self, client, context): self.context = context self.client = client s...
StarcoderdataPython
48046
<gh_stars>0 # The MIT License (MIT) # # Copyright (c) 2015 <NAME>, 2018 UMONS # # 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 without limitation the rights ...
StarcoderdataPython
4837385
<reponame>daojunL/Art-Event-Gallery # Generated by Django 2.1.5 on 2020-04-21 04:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('dashboard', '0005_auto_20200421_0331'), ] operations = [ migrations.AlterModelOptions( name='artist'...
StarcoderdataPython
1636236
from .pycuteweb import Application
StarcoderdataPython
1777427
import hashlib import os import sys import msgpack from struct import pack addressChecksumLength = 4 def int64ToBinary(i): # TODO: error handling # >q means big endian, long long (int64) return pack(">q", i) def intToBytes(i): return bytes([i]) def sha256(data): return hashData(...
StarcoderdataPython
1749039
import datetime import os import stat import pytest from flask import current_app from flask_app.models import Beam, BeamType, Pin from flask_app.tasks import beam_up, delete_beam, vacuum from flask_app.utils.remote_combadge import _COMBADGE_UUID_PART_LENGTH from flask_app.utils.remote_host import RemoteHost _TEMPDI...
StarcoderdataPython
27741
# -*- coding: utf-8 -*- """ :author: <NAME> (徐天明) :url: http://greyli.com :copyright: © 2021 <NAME> <<EMAIL>> :license: MIT, see LICENSE for more details. """ from flask import render_template, current_app, request, Blueprint from albumy.models import User, Photo user_bp = Blueprint('user', __name__) ...
StarcoderdataPython
1718338
#!/usr/bin/env python # -*- coding: utf-8 -*- import copy import datetime import struct import threading import usb.core import usb.util VENDOR_FUJITSUCOMP = 0x0430 PRODUCT_FUJITSUCOMP_FX5204PS = 0x0423 OUT_VENDOR_DEVICE = (usb.util.CTRL_OUT |usb.util.CTRL_TYPE_VENDOR ...
StarcoderdataPython
1719769
<filename>utility/constants.py<gh_stars>1-10 '''Global constants, and file paths''' import os,re # Change the path according to your system embed_path = os.path.expanduser('~') + "/git-workspace/glove/generic/glove.840B.300d.txt" #file containing glove embedding core_nlp_url = 'http://localhost:9000' #local hos...
StarcoderdataPython
1618768
#!/usr/bin/env python # import sys class Tee(object): """ Redirect print output to the terminal as well as in a log file """ def __init__(self, name=None, mode=None, nostdout=False): self.file = None self.nostdout = nostdout if not nostdout: self.__del__.im_func.stdout = s...
StarcoderdataPython
3218652
<reponame>IllIIIllll/reinforcement-learning-omok # © 2020 지성. all rights reserved. # <<EMAIL>> # Apache License 2.0 from .base import * from .naive import * from .pg import * from .predict import *
StarcoderdataPython
1619753
<reponame>jeniyat/Bert-OverFlow # coding=utf-8 from __future__ import print_function import optparse import itertools from collections import OrderedDict import torch import time import pickle from torch.optim import lr_scheduler from torch.autograd import Variable # import matplotlib.pyplot as plt #JT: commented ...
StarcoderdataPython
1688013
# Generated by Django 2.1.5 on 2019-02-10 12:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('quiz', '0002_auto_20190210_1144'), ] operations = [ migrations.AddField( model_name='game', name='game_type', ...
StarcoderdataPython
3333698
""" Celery Tasks """ import logging import os import time from collections import namedtuple from typing import TYPE_CHECKING from .worker import celery from .config import BOT_NAME, BOT_EMAIL from .. import utils from ..recipe import Recipe from ..githandler import TempGitHandler from ..githubhandler import CheckRun...
StarcoderdataPython
1721553
#!/usr/bin/env python3 """ # Copyright (c) 2018, Palo Alto Networks # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS I...
StarcoderdataPython
3287549
<filename>rest_framework_jet/apps.py from django.apps import AppConfig class RestFrameworkJetConfig(AppConfig): name = 'rest_framework_jet'
StarcoderdataPython
138675
print(""" /$$$$$$$ /$$ /$$ /$$$$$$$ /$$$$$$$ /$$$$$$$$ | $$__ $$ | $$ /$ | $$| $$__ $$| $$__ $$| $$_____/ | $$ \ $$ | $$ /$$$| $$| $$ \ $$| $$ \ $$| $$ | $$$$$$$/ /$$$$$$| $$/$$ $$ $$| $$$$$$$/| $$$$$$$ | $$$$$ | $$__ $$|______/| $$$$_ $$$$| $$____/ | $$__ $$| $$__/ ...
StarcoderdataPython
1612929
# -*- coding: utf-8 -*- # # Copyright (C) 2005-2015 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edgewall.org/wiki/TracLicense. # # This software consi...
StarcoderdataPython
22742
#!/usr/bin/python import argparse import csv import sys ''' This script takes a CSV file with a mandatory header and a sql tablename and converts the data in the csv file into an SQL INSERT statement. ''' def parse_arguments(): # initialize argumentparser and arguments parser = argparse.ArgumentParser(descri...
StarcoderdataPython
3219204
<gh_stars>1-10 # -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICEN...
StarcoderdataPython
60709
<gh_stars>10-100 from typing import List from pydantic import BaseModel class User(BaseModel): id:str username:str bot:bool class Ready(BaseModel): version:str session_id:str user: User shard:list[int]
StarcoderdataPython
1736901
import sys class VendorImporter: """ A PEP 302 meta path importer for finding optionally-vendored or otherwise naturally-installed packages from root_name. """ def __init__(self, root_name, vendored_names=(), vendor_pkg=None): self.root_name = root_name self.vendored_na...
StarcoderdataPython
1704955
<reponame>jbeezley/SMQTK from __future__ import division, print_function import unittest import mock from smqtk.algorithms.nn_index.lsh.functors import \ LshFunctor, get_lsh_functor_impls class TestLshFunctorImplGetter (unittest.TestCase): @mock.patch('smqtk.algorithms.nn_index.lsh.functors.plugin.get_plug...
StarcoderdataPython
133675
''' Original code contributor: mentzera Article link: https://aws.amazon.com/blogs/big-data/building-a-near-real-time-discovery-platform-with-aws/ ''' from elasticsearch.helpers import bulk import boto3 from elasticsearch.exceptions import ElasticsearchException import config from tweet_utils import \ get_tweet, i...
StarcoderdataPython
70598
# ------------------------------------------------------------------------------ # Modified from https://github.com/microsoft/human-pose-estimation.pytorch # ------------------------------------------------------------------------------ import torch.nn as nn from ..resnet import _resnet, Bottleneck class Upsampling(...
StarcoderdataPython
3399501
from time import sleep termo1 = int(input('Digite o primeiro termo da progressão: ')) razao = int(input('Digite a razão da progressão: ')) decimo = termo1 + (10 - 1) * razao for c in range(termo1, decimo + razao, razao): #Mostra os dez primeiros termos de uma pa print(' {} '.format(c), end='=>') sleep(0.3...
StarcoderdataPython
4824749
<gh_stars>1-10 # Copyright 2020 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 the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
StarcoderdataPython
1762172
from django.shortcuts import render from django.http import JsonResponse from . import tasks import storage.rcache as rcache # Create your views here. def update_stock_info(request): resp_dict = {} if request.method == 'POST' and request.is_ajax(): resp_dict['status'] = '成功' tasks.update_sto...
StarcoderdataPython
1642428
from django.test import TestCase, Client from django.urls import reverse from django.contrib.auth.models import User from products.models import Category, Product class TestProductViews(TestCase): "test the product views for all users" def setUp(self): self.client = Client() self.user = User....
StarcoderdataPython
3270821
<reponame>isac322/flake8-force-keyword-arguments import ast import importlib import re import sys from argparse import Namespace from itertools import chain from typing import ClassVar, Iterable, Tuple, Type from flake8.options.manager import OptionManager from marisa_trie import Trie import flake8_force_keyword_argu...
StarcoderdataPython