id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1634269
from django.contrib.auth import views as auth_views from django.contrib.auth.forms import PasswordResetForm from django.core import mail from django.core.urlresolvers import reverse from django.urls import resolve from django.test import TestCase from django.contrib.auth.tokens import default_token_generator from djang...
StarcoderdataPython
1715629
<filename>adam/perception/visual_perception.py import json from pathlib import Path from typing import Sequence, Union, List, Mapping, Dict, Optional, Any from attr import attrs, attrib from attr.validators import instance_of, deep_iterable, deep_mapping, optional from immutablecollections import ImmutableSet, Immutab...
StarcoderdataPython
3208167
# Exercise 5.7 from Tkinter import * root = Tk() radius = 50 c = Canvas(root, width=400, height=265, bg='gray') c.pack() def myDrawOval(x, y, color): c.create_oval(x, y, x + radius, y + radius, fill="", outline=color, width=5) myDrawOval(50, 58, 'blue') myDrawOval(116, 58, 'bla...
StarcoderdataPython
3375771
## # Copyright 2015 TFMT UG (haftungsbeschränkt). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
StarcoderdataPython
1735765
<filename>assignments/01/word2vec_utils.py from collections import Counter import random import os import sys import utils sys.path.append('..') import zipfile import numpy as np from six.moves import urllib import tensorflow as tf def read_data(file_path): """ Read data into a list of tokens There should...
StarcoderdataPython
57651
<reponame>jdashg/misc #! /usr/bin/env python3 assert __name__ == '__main__' print(__file__) import http.server import pathlib import ssl import argparse parser = argparse.ArgumentParser() parser.add_argument('--bind', '-b', default='localhost', metavar='ADDRESS', help='Specify alternate bind addre...
StarcoderdataPython
168683
import os import tempfile from contextlib import (ExitStack, contextmanager) from functools import partial from typing import (Any, Dict, Iterable, Optional) import click import pytest import strictyaml from hypothesis import given fr...
StarcoderdataPython
104687
<gh_stars>10-100 import Tkinter import shmooze.settings as sets def splash(fsg,text,bg=sets.bg_color,fg=sets.fg_color,font="Helvetica",size=72): c=Tkinter.Canvas(fsg,width=fsg.width,height=fsg.height,highlightthickness=0,bg=bg) c.pack() coord = fsg.center() arc = c.create_text(coord, text=text, fill=f...
StarcoderdataPython
3389178
<reponame>ojss/c3lr data_path = './data' # miniImageNetFullSize_path = '/home/ojas/projects/unsupervised-meta-learning/data/untarred/miniImagenetFullSize/' miniImageNetFullSize_path = "/home/user/unsupervised-meta-learning/data/miniImagenetFullSize" EuroSAT_path = "/home/ojas/projects/unsupervised-meta-learn...
StarcoderdataPython
1700784
<reponame>qua-platform/qua-libs<filename>examples/Workshops/CQE/6. leakage-reduction/configuration.py import numpy as np gauss_len = 4 def IQ_imbalance(g, phi): c = np.cos(phi) s = np.sin(phi) N = 1 / ((1 - g ** 2) * (2 * c ** 2 - 1)) return [float(N * x) for x in [(1 - g) * c, (1 + g) * s, (1 - g) *...
StarcoderdataPython
1783306
<filename>app/migrations/0003_auto_20181014_2227.py<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-10-14 19:27 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0002_auto_20181014_2221'), ]...
StarcoderdataPython
18021
<gh_stars>0 from django.db import models class TaskB_table(models.Model): img = models.ImageField(upload_to='taskB/', default='defo') pred_price = models. FloatField()
StarcoderdataPython
1623155
from Environments import ChessEnvironment from collections import defaultdict from constants import N_ACTIONS from dummy import generate_action_dict import numpy as np import time from threading import Thread # TODO: Tidy this up a2m, m2a = generate_action_dict() C_PUCT = 2 class MasterNode(): """ A placeholde...
StarcoderdataPython
1688448
<filename>c2logic/compiler.py import os import sysconfig import dataclasses from dataclasses import dataclass from pycparser import c_ast, parse_file from pycparser.c_ast import ( Compound, Constant, DeclList, Enum, FileAST, FuncDecl, Struct, TypeDecl, Typename ) from .consts import builtins, draw_funcs, func_binary...
StarcoderdataPython
3283719
from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) author = 'Your name here' doc = """ Your app description """ class Constants(BaseConstants): name_in_url = 'inst_tsim' players_per_group = None ...
StarcoderdataPython
57588
# -*- coding: utf-8 -*- from __future__ import absolute_import from preggy.assertions.types.boolean import * from preggy.assertions.types.classes import * from preggy.assertions.types.errors import * from preggy.assertions.types.file import * from preggy.assertions.types.function import * from preggy.assertions.types....
StarcoderdataPython
1641193
<reponame>thread/django-lightweight-queue from django.conf.urls import url from . import views app_name = 'django_lightweight_queue' urlpatterns = ( url(r'^debug/django-lightweight-queue/debug-run$', views.debug_run, name='debug-run'), )
StarcoderdataPython
1656437
# Copyright 2016 The Bazel 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 applicable la...
StarcoderdataPython
3298982
"""Types used in the library.""" import enum import typing if typing.TYPE_CHECKING: from genshin.models.model import Unique __all__ = ["Game", "Region"] UniqueT = typing.TypeVar("UniqueT", bound="Unique") class Region(str, enum.Enum): """Region to get data from.""" OVERSEAS = "os" """Applies to al...
StarcoderdataPython
3201586
<reponame>Robert-Ma/foal<filename>src/foal/__init__.py from foal import search from foal import sort from foal import linear_algebra from foal import dynamic_programming from foal import tree from foal import graph
StarcoderdataPython
1778589
#!/usr/bin/env python from __future__ import print_function import tensorflow as tf import cv2 import sys sys.path.append("../common") from common.netconstruct import weight_variable,bias_variable, conv2d,max_pool_2x2 import random import numpy as np from collections import deque OBSERVE_LENGTH = 1000 EX...
StarcoderdataPython
85064
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Import import os from genenetweaver.gene_net_weaver import GeneNetWeaver import numpy as np import argparse def argument_parser(): parser = argparse.ArgumentParser( description='Run GeneNetWeaver (GNW) to simulate gene expression data ' ...
StarcoderdataPython
190272
from typing import Any, Dict, List, Tuple from src.db.models.event import Event from src.db.models.match import Match from src.db.models.team import Team from src.db.models.team_event import TeamEvent from src.db.models.team_match import TeamMatch from src.db.models.team_year import TeamYear from src.db.models.year im...
StarcoderdataPython
177219
from http.server import HTTPServer, BaseHTTPRequestHandler class HelloHandler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header("Content-Type", "text/html") self.end_headers() self.wfile.write("<h1>Hello World!</h1>\n".encode("UTF-8")) ...
StarcoderdataPython
3201952
<reponame>TangJiahui/AC215-Advanced_Practical_Data_Science from fastapi import APIRouter # Define Router router = APIRouter()
StarcoderdataPython
111071
<gh_stars>1-10 BASE_HELIX_URL = "https://api.twitch.tv/helix/" # token url will return a 404 if trailing slash is added BASE_AUTH_URL = "https://id.twitch.tv/oauth2/token" TOKEN_VALIDATION_URL = "https://id.twitch.tv/oauth2/validate" WEBHOOKS_HUB_URL = "https://api.twitch.tv/helix/webhooks/hub"
StarcoderdataPython
166809
# -*- coding:utf-8 -*- # Copyright 2015 NEC Corporation. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License...
StarcoderdataPython
1750834
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A generator for initializing_coclass.h, which contains a bunch of repeated code that can't be produced through the preprocessor.""" import sys from st...
StarcoderdataPython
99154
<filename>what/utils/logger.py import logging def get_logger(name, level=logging.INFO): logging.basicConfig() logger = logging.getLogger(name) logger.handlers = [] # This is the key thing for the question! # Start defining and assigning your handlers here handler = logging.StreamHandler() hand...
StarcoderdataPython
1619188
<reponame>model-checking/cbmc-viewer<filename>tests/bin/arguments.py<gh_stars>0 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """Methods for common command-line argument parsing.""" import argparse import logging def create_parser(options=None, description...
StarcoderdataPython
110042
import datetime as _dt import json as _json import hashlib as _hashlib class Blockchain: def __init__(self) -> None: self.chain = list() genesis_block = self._create_block( data="genesis block", proof=1, previous_hash="0", index=0 ) self.chain.append(genesis_block) ...
StarcoderdataPython
3237462
""" This python code generates figure S3 (appendix) in the paper. """ from matplotlib import pyplot as plt import pandas as pd import numpy as np import random import math from collections import Counter import itertools # building information: floor 1-25, pax destination 2-25 numFloor = 24 # total number of pax...
StarcoderdataPython
1748445
"""Platform Models.""" from marshmallow import fields, Schema from marshmallow.validate import OneOf from ..enums import * from ..models.BaseSchema import BaseSchema from .TagSourceSchema import TagSourceSchema class TagSchema(BaseSchema): # Content swagger.json name = fields.Str(requi...
StarcoderdataPython
1632021
<reponame>Photon26/wrs-main-210414 import numpy as np from . import util from . import transformations def sample_surface(mesh, count): """ Sample the surface of a mesh, returning the specified number of points For individual triangle sampling uses this method: http://mathworld.wolfram.com/TrianglePoi...
StarcoderdataPython
1733739
<gh_stars>1-10 '''This is a reproduction of the IRNN experiment with pixel-by-pixel sequential MNIST in "A Simple Way to Initialize Recurrent Networks of Rectified Linear Units" by <NAME>, <NAME>, <NAME> arXiv:1504.00941v2 [cs.NE] 7 Apr 2015 http://arxiv.org/pdf/1504.00941v2.pdf Optimizer is replaced with RMS...
StarcoderdataPython
119680
from django.contrib.auth.mixins import UserPassesTestMixin from django.urls import reverse_lazy class UserIsObjectUserMixIn(UserPassesTestMixin): def test_func(self): object = self.get_object() return object.user == self.request.user
StarcoderdataPython
3273084
from ptrlib import * def alloc(size, data): sock.recvuntil("> ") sock.sendline("1") sock.recvuntil("> ") sock.sendline(str(size)) sock.recvuntil("> ") sock.sendline(data) def free(): sock.recvuntil("> ") sock.sendline("2") def secret(): sock.recvuntil("> ") sock.sendline("3") ...
StarcoderdataPython
76784
<reponame>npsand/ElevenClock # INSTRUCTIONS # Translate the text and write it between the " # EXAMPLE: original -> "This text is in english: value {0}" # translation -> "Aquest text està en anglès: valor {0}" # If you see sth like {0}, {1}, maintain it on the translated sentence # Meke special ...
StarcoderdataPython
3269146
<gh_stars>1-10 # Funkcje i zasięg zmiennych w Python # https://tinyurl.com/popo-namespace # główna przestrzeń nazw: "__main__" # przestrzenie nazw funkcji są osobne some_value = 12 some_list = [1, 2] def function_1(): print(some_value) print(some_list) def function_2(): some_value = "Other value" # zmi...
StarcoderdataPython
166424
<gh_stars>100-1000 """ yolo格式数据,裁剪图像中心区域,生成一批新数据。 """ import cv2 import os from tqdm import tqdm def plot_bbox(img, gt=None ,line_thickness=None): # 可视化测试 colorlist = [] # 5^3种颜色。 for i in range(30,256,50): for j in range(40,256,50): for k in range(50,256,50): col...
StarcoderdataPython
3342652
import json import os import socket from typing import List, Optional from abejacli import config from abejacli.config import RESERVED_ENV_VAR, RUN_LOCAL_COMMAND_V1 from abejacli.docker.utils import get_home_path # ========================== # Environment Variable Keys # ========================== SERVICE_TYPE_HTTP =...
StarcoderdataPython
1775591
import logging import os # TODO Create proper logging. # TODO Create proper testing. # TODO Create folder structure def logger(default_level='INFO', file='logs.log'): logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) fh = logging.FileHandler(file) fh.setLevel(logging.INFO) formatte...
StarcoderdataPython
3301162
<reponame>Nukesor/stasibot<gh_stars>0 # Get your telegram api-key from @botfather TELEGRAM_API_KEY = None CHANNEL = 8 TARGET_FOLDER = 'guest@server:videos' NAME = 'LolBot' TEMP_FOLDER = 'camvideos' # relative to home directory USERNAME = 'User' USER_ID = 12345678
StarcoderdataPython
1703824
from openbiolink.graph_creation.file_downloader.fileDownloader import FileDownloader
StarcoderdataPython
1790616
<filename>qgate/simulator/cudaruntime.py try : from . import cudaext except : import sys if sys.version_info[0] == 2 : del cudaext raise import numpy as np import weakref from .native_qubit_processor import NativeQubitProcessor from .native_qubit_states import NativeQubitStates from .n...
StarcoderdataPython
3360511
<gh_stars>0 # Copyright (c) 2020 Broadcom. # The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. # # This program and the accompanying materials are made # available under the terms of the Eclipse Public License 2.0 # which is available at https://www.eclipse.org/legal/epl-2.0/ # # SPDX-License-Identif...
StarcoderdataPython
3314448
# coding=utf-8 from django.conf import settings from django.conf.urls import patterns, url, include from django.conf.urls.static import static from django.core.urlresolvers import reverse_lazy from django.views.generic import TemplateView, DeleteView from media.forms import VideoAjaxUploadForm, YoutubeVideoAjaxUploadFo...
StarcoderdataPython
3273825
<reponame>isaaccorley/contrastive-surface-image-pretraining """Inspired by OpenAI's CLIP https://github.com/openai/CLIP.""" import numpy as np import pytorch_lightning as pl import timm import torch import torch.nn as nn import torch.nn.functional as F class NTXent(nn.Module): def forward(self, z1, z2, t): ...
StarcoderdataPython
3281462
<filename>setup.py from setuptools import setup, find_packages with open("README.md", "r") as fh: long_description = fh.read() setup( name='torrent-crawler', description='Library to search any torrents', version='1.0.0', url='https://github.com/Alxspb/torrent-crawler', download_url='https://gi...
StarcoderdataPython
1724081
from isserviceup.models.favorite import Favorite from isserviceup.services import SERVICES def get_favorite_services(user_id): favs = Favorite.objects(user_id=user_id) res = [] for fav in favs: res.append(SERVICES[fav.service_id]) return res def update_favorite_status(user_id, service_id, st...
StarcoderdataPython
3238668
# # Copyright 2020 Australian National University # # Please see the LICENSE.txt file for details. import os import shutil from pathlib import Path config_template = """ ## WARNING: THIS IS AN AUTO-GENERATED FILE. MANUAL CHANGES WILL BE ## OVERWRITTEN. # # This file is managed by mdserver - changes should be made th...
StarcoderdataPython
1761218
<reponame>hyperbrowser/conglomerate<filename>src/pycolocstats/core/types.py<gh_stars>1-10 from __future__ import absolute_import, division, print_function, unicode_literals __metaclass__ = type class PathStr(str): pass class PathStrList(list): pass class SingleResultValue(object): def __init__(self, ...
StarcoderdataPython
1702271
<reponame>carmenchilson/BirdRoostDetection """Read in csv and create train, test, and validation splits for ML.""" import BirdRoostDetection.LoadSettings as settings import os import pandas def ml_splits_by_date(csv_input_path, csv_output_path, k=5): """Split labeled da...
StarcoderdataPython
3311994
import numbers import functools from vedmath import VDigit, int_to_digits, digits_from_vdigits class VInt: ''' An experimental class for vedic integers. ''' def __init__(self, n:int): ''' Initialise a VInt from an integer n. ''' self.ds = [VDigit(d) for d in int_to_dig...
StarcoderdataPython
4833757
<reponame>Mahdi-Asaly/Coursera-SDN-Assignments<gh_stars>0 from random import choice from pyretic.lib.corelib import * from pyretic.lib.std import * from pyretic.lib.query import * from pyretic.kinetic.fsm_policy import * from pyretic.kinetic.drivers.json_event import JSONEvent from pyretic.kinetic.smv.model_checker ...
StarcoderdataPython
1747172
0 1 2 3 12 123 1234 1234999
StarcoderdataPython
3256597
<reponame>PSSTools/py-pss-parser<gh_stars>1-10 ''' Created on May 1, 2020 @author: ballance ''' from pssparser.model.expr_id import ExprId from pssparser.model.data_type import DataType class CovergroupPort(object): def __init__(self, name : ExprId, data_type : DataType): ...
StarcoderdataPython
1633645
import warnings from pyramid.compat import urlparse from pyramid.interfaces import ( IRequest, IRouteRequest, IRoutesMapper, PHASE2_CONFIG, ) from pyramid.exceptions import ConfigurationError from pyramid.registry import predvalseq from pyramid.request import route_request_iface from pyramid.urldi...
StarcoderdataPython
2141
hiddenimports = ['sip', 'PyQt4.QtGui', 'PyQt4._qt'] from PyInstaller.hooks.hookutils import qt4_plugins_binaries def hook(mod): mod.binaries.extend(qt4_plugins_binaries('phonon_backend')) return mod
StarcoderdataPython
127842
<filename>1-second-data-summary/one_second_data_summary_functions.py import glob import os import collections import datetime import matplotlib matplotlib.use('Agg') matplotlib.rcParams['figure.figsize'] = (10.0, 10.0) import matplotlib.pyplot as plt import matplotlib.mlab import numpy as np import scipy import scipy...
StarcoderdataPython
3347674
<reponame>ToReforge/djforge-redis-multitokens try: from unittest.mock import patch except ImportError: from mock import patch from django.contrib.auth import get_user_model from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from .utils import ( cre...
StarcoderdataPython
144796
<reponame>rdo-management/ceilometer # # Copyright 2014 eNovance # # 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
151682
import numpy as np from skimage.morphology import label from scipy.sparse import csr_matrix from scipy.spatial import cKDTree as KDTree import pandas as pd import itertools from tqdm import tqdm def compute_M(data): cols = np.arange(data.size) return csr_matrix((cols, (data.ravel(), cols)), ...
StarcoderdataPython
3207719
<reponame>gokhangg/Uncertainix # -*- coding: utf-8 -*- """ Created on Sat Nov 7 17:02:31 2020 @author: ghngu """ from ExpSettings.EnvBase import EnvBase import sys, time,os _selfPath = os.path.dirname(__file__) class Environment(EnvBase): def __init__(self, rootDirectory): self.__rootDictionar...
StarcoderdataPython
3296370
## # Copyright (c) 2005-2017 Apple Inc. 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 applicable l...
StarcoderdataPython
1642898
<reponame>florian-ionescu/python-learning with open('../file1.txt', 'w') as f: f.write('some string'.split()[-1])
StarcoderdataPython
79663
from sys import platform from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize import numpy ext_modules = [ Extension( "src.libs.cutils", ["src/libs/cutils.pyx"], extra_compile_args=['/openmp' if platform == "win32" else '-fopenmp'] ...
StarcoderdataPython
41406
<gh_stars>0 from django.contrib.auth.models import check_password from django.contrib.auth import get_user_model _user = get_user_model() class EmailAuthBackend(object): """ Email Authentication Backend Allows a user to sign in using an email/password pair rather than a username/password pair. ...
StarcoderdataPython
134422
import requests import re #data = requests.get('http://dbpedia.org/data/Alice_and_Bob.json').json() #print(data) def getNumberOfLinks(url): ret = 0 try: url_json = str(url)+".json" data = requests.get(url_json).json() datastr = str(data); # print(datastr) ret = datastr...
StarcoderdataPython
1787558
#!/usr/bin/env python import os, sys if(os.getenv("I3_BUILD") == None): print("I3_BUILD not set.") sys.exit() from os.path import expandvars from I3Tray import * from icecube import dataclasses, dataio, ppc def particle(f): p = dataclasses.I3Particle(dataclasses.I3Position(0,0,0), ...
StarcoderdataPython
12463
<filename>corehq/form_processor/migrations/0049_case_attachment_props.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import absolute_import from django.db import models, migrations import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('form_...
StarcoderdataPython
3362496
# Pimoroni Bearable(s) library for CircuitPython # The MIT License (MIT) # Copyright (c) 2018 <NAME> # 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 ...
StarcoderdataPython
4814487
<gh_stars>10-100 #!/usr/bin/env python3 # encoding: utf-8 import os from setuptools import setup, find_packages def files(package, paths): skip = len(package)+1 for path in paths: for dirpath, dirnames, filenames in os.walk(os.path.join(package, path)): for filename in filenames: ...
StarcoderdataPython
3343673
<filename>vulnerabilities/tests/test_rust.py # # Copyright (c) nexB Inc. and others. All rights reserved. # VulnerableCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/vulnerablecode for support or ...
StarcoderdataPython
4820500
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################## # Copyright (c) <NAME> - <EMAIL> # All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. ############...
StarcoderdataPython
3320906
from django.urls import path, include from school import views urlpatterns = [ # Used to retrieve own details of student path('student/<int:pk>/', views.StudentsRetrieveViewSet.as_view(), name = 'student-view'), # Used to create and list students path('teacher/', views.StudentCreateListViewSet.as_vi...
StarcoderdataPython
1728442
<reponame>lucasrdrgs/RsaEncDec # Sorry for the ugly code, I wrote this in a hurry. # Are you mad? Submit a pull request, loser. import os import sys import tempfile import datetime ERRORS_ = [ '''Invalid syntax.\n\nHere is how it works: If you ARE NOT generating a keypair: $ rsaencdec OPTIONS input [outputFilePath ...
StarcoderdataPython
3201924
# MIT License # # Copyright (c) 2019 <NAME> # # 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 # to use, copy, modify, merge,...
StarcoderdataPython
4813343
<gh_stars>0 import pymysql myconn=pymysql.connect(host='localhost',user='root',password='<PASSWORD>', database="mydatabase") cur=myconn.cursor() sql="insert into employee1(name,empid,salary)values(%s,%s,%s)" val=[("john",102,25000), ("david",104,45000), ("nick",105,50000)] cur.executemany(sql,val) print(cur...
StarcoderdataPython
3397746
<reponame>bionicles/pytorch-dnc #!/usr/bin/env python3 # -*- coding: utf-8 -*- import pytest import numpy as np import torch.nn as nn import torch as T from torch.autograd import Variable as var import torch.nn.functional as F from torch.nn.utils import clip_grad_norm_ import torch.optim as optim import numpy as np ...
StarcoderdataPython
4822606
<reponame>lar-deeufba/potential_fields #!/usr/bin/env python # Code available in # https://github.com/neobotix/neo_simulation import rospy import tf import rospkg from gazebo_msgs.srv import SpawnModel, GetModelState import time from geometry_msgs.msg import * from gazebo_msgs.msg import ModelState, ModelStates import ...
StarcoderdataPython
106957
<reponame>murufeng/awesome_lightweight_networks from .mobile_vit import * from .levit import * from .ConvNeXt import *
StarcoderdataPython
151126
#!/usr/bin/env python3 # # A PyMol extension script to test extrusion of a hub from a single module's # c-term # def main(): """main""" raise RuntimeError('This module should not be executed as a script') if __name__ =='__main__': main() in_pymol = False try: import pymol in_py...
StarcoderdataPython
110426
#!/usr/bin/python3 """Init file of the tests.measures.sample module.""" import brfast.measures.sample
StarcoderdataPython
3200884
from models import QuoteModel from ingestors.ingestor_interface import IngestorInterface class TextIngestor(IngestorInterface): @classmethod def parse(cls, path): file = open(path, "r", encoding="utf-8-sig") lines = file.readlines() file.close() return [QuoteModel(*quote.rstrip...
StarcoderdataPython
3251603
import tornado.ioloop import tornado.web import socket import os import re import glob class HelpHandler(tornado.web.RequestHandler): def get(self): print ('-->HelpHandler.get...' + self.request.uri) self.render("help.html")
StarcoderdataPython
1753631
<filename>tests/portfolio/test_portfolio.py<gh_stars>0 import unittest from unittest.mock import Mock import numpy as np from core.instrument import Instrument from core.trade import Trade from core.events import TradeExecutedEvent from portfolio.portfolio import Portfolio class TestPortfolio(unittest.TestCase): ...
StarcoderdataPython
1776809
import lz4.frame import pytest test_data = [ (b'a' * 1024 * 1024), ] @pytest.fixture( params=test_data, ids=[ 'data' + str(i) for i in range(len(test_data)) ] ) def data(request): return request.param def test_frame_decompress_mem_usage(data): tracemalloc = pytest.importorskip('trac...
StarcoderdataPython
1756812
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time import rclpy import ujson import subprocess from typing import Optional from rclpy.node import Node from example_interfaces.msg import String, Bool from rcl_interfaces.srv import GetParameters from python_pkg.volume_percent import get_init_volume_percent # ...
StarcoderdataPython
3303930
import unittest import platform class SysfontModuleTest(unittest.TestCase): def todo_test_create_aliases(self): self.fail() def todo_test_initsysfonts(self): self.fail() @unittest.skipIf('Darwin' not in platform.platform(), 'Not mac we skip.') def test_initsysfonts_darwin(self): ...
StarcoderdataPython
3287883
# # -*- coding:utf-8 -*- # from torcms.model.info_hist_model import MInfoHist # # def Test(): # assert MInfoHist() # #
StarcoderdataPython
3223971
<reponame>devasia1000/anti_adblock from libmproxy.protocol.http import decoded log_file = '' filter_list = [] def string_matching_boyer_moore_horspool(text='', pattern=''): """ Returns positions where pattern is found in text See http://en.wikipedia.org/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm ...
StarcoderdataPython
1792044
import json class NotSet: pass class PlayerShip: def __init__(self, id: str): self.id = id self.target_x = None self.target_y = None self.metadata = {} def to_dict(self) -> dict: return dict( id=self.id, target_x=self.target_x, ...
StarcoderdataPython
3307067
<filename>gauged/config.py """ Gauged https://github.com/chriso/gauged (MIT Licensed) Copyright 2014 (c) <NAME> <<EMAIL>> """ from .writer import Writer from .utilities import to_bytes, Time DEFAULTS = { 'namespace': 0, 'block_size': Time.DAY, 'resolution': Time.SECOND, 'writer_name': 'default', '...
StarcoderdataPython
28250
# Incorrect Regex "https://www.hackerrank.com/challenges/incorrect-regex/problem" # Enter your code here. Read input from STDIN. Print output to STDOUT import re for i in range(int(input())): try: re.compile(input()) print("True") except ValueError: print("False")
StarcoderdataPython
1692467
<gh_stars>0 # # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
StarcoderdataPython
3331733
<gh_stars>10-100 import sys from argparse import ArgumentParser from configparser import ConfigParser from distutils.util import strtobool def arg_parse(args): # setting the log level on the root logger must happen BEFORE any output # parse values from a configuration file if provided and use those as the ...
StarcoderdataPython
3320619
import sys, wx sys.path.append('../../') from sciwx.mesh import Canvas3D, MCanvas3D from sciapp.util import surfutil, meshutil from sciapp.object import Scene, Mesh, Surface2d, Surface3d, TextSet, Volume3d from sciwx.mesh import Canvas3DFrame, Canvas3DNoteBook, Canvas3DNoteFrame import sys, wx import scipy.ndimage as ...
StarcoderdataPython
103420
from pandac.PandaModules import * from direct.gui.DirectGui import * from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer from toontown.hood import ZoneUtil import random LOADING_SCREEN_SORT_INDEX = 4000 class ToontownLoadingScreen: defaultTex = 'phase_3.5/maps/loading/defaul...
StarcoderdataPython
3229395
from sanic import Sanic from sanic.response import text app = Sanic('App') @app.get("/") async def hello_world(request): return text('Hello, world.') if __name__ == '__main__': app.go_fast(host='0.0.0.0')
StarcoderdataPython