id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
192054
<gh_stars>10-100 """ === Web Scraper for pulling environmental clearance data === The scraper cycles through every page on the start url and builds a useable dataset. The website runs on ASP.net so each page is reached using a form request and posting javascript arguements. USE: * For scraping central data, set page...
StarcoderdataPython
1692439
"""Contains the Monte Carlo simulation tests.""" import numpy as np import copy from trempy.estimate.estimate_auxiliary import estimate_cleanup from trempy.shared.shared_auxiliary import print_init_dict from trempy.config_trempy import PREFERENCE_PARAMETERS from trempy.tests.test_auxiliary import random_dict from tre...
StarcoderdataPython
3298533
from __future__ import absolute_import, print_function, division import os import glob import numpy as np import six class NfS(object): """`NfS <http://ci2cv.net/nfs/index.html>`_ Dataset. Publication: ``Need for Speed: A Benchmark for Higher Frame Rate Object Tracking``, <NAME>, <NAME>, <NA...
StarcoderdataPython
5110856
DEBUG = True # Database # 配置 sqlalchemy "数据库驱动://数据库用户名:密码@主机地址:端口/数据库?编码" SQLALCHEMY_DATABASE_URI = "mysql://root:root@localhost:5000/dbjangoDB" SQLALCHEMY_TRACK_MODIFICATIONS = True
StarcoderdataPython
12827031
<gh_stars>0 from netaddr import IPNetwork from scapy.all import ICMP, IP, send from netattacker.attacker import AttackerBaseClass class Smurf(AttackerBaseClass): """ Parameters ---------- target : str The target's hostname or IP address subnet_mask : str The subnet's CIDR prefix (eg., 24) M...
StarcoderdataPython
4998191
# -*- coding: utf-8 -*- import os import uuid from fast_ani_output import create_html_tables from DataFileUtil.DataFileUtilClient import DataFileUtil from KBaseReport.KBaseReportClient import KBaseReport # This module handles creating a KBase report object from fast_ani_output html def create_report(callback_url, sc...
StarcoderdataPython
3322458
import numpy as np try: import dgl import torch.nn as nn import torch.nn.functional as F from dgl.nn.pytorch import GraphConv except ImportError: pass from photonai_graph.NeuralNets.dgl_base import DGLRegressorBaseModel, DGLClassifierBaseModel class GCNClassifier(nn.Module): def __init__(self...
StarcoderdataPython
6475711
<reponame>cliche-niche/model-zoo import tensorflow as tf import numpy as np from tensorflow.keras import layers from tensorflow.keras import activations from tensorflow.keras import regularizers from stage import stage class repvgg(tf.keras.Model): def __init__(self, a=0.75, b=2.5, l=[1, 2, 4, 14, 1], nc...
StarcoderdataPython
9626929
import os from torchvision import transforms import mask_utils.transforms as T def parse_config(path): class_to_ids = dict() assert os.path.exists(path) with open(path, "r") as f: lines = f.readlines() for id, line in enumerate(lines): line = line.strip().lower() class_to_ids[...
StarcoderdataPython
11217396
<filename>pinn/losses.py import numpy as np np.random.seed(0) class BinaryCrossEntropy: def __init__(self): pass def derivative(self, y, y_pred): return -(y/y_pred + (1-y)/(1-y_pred))/y.shape[0] def loss(self, y, y_pred): return -np.sum(y*np.log(1-y_pred) + ...
StarcoderdataPython
4876096
from distutils.core import setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="etoro_edavki", version="1.0.0", py_modules=["etoro_edavki"], python_requires=">=3", entry_points={ "console_scripts": ["etoro_edavki=etoro_edavki:main", "etoro-edavki=etoro_eda...
StarcoderdataPython
1829383
<filename>neutron/tests/unit/cisco/test_network_db.py # Copyright (c) 2013 OpenStack Foundation # 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 # # htt...
StarcoderdataPython
4821291
<gh_stars>0 x=0; while x<=4: ## x+=1; user = input("Dame tu susario "); password = input("<PASSWORD> "); if user=="Alex" and password=="<PASSWORD>" : print("Bienvenido "+ user); x=5 elif user!="Alex" and password=="<PASSWORD>": print("Usuario Incorrecto"); prin...
StarcoderdataPython
3551881
<reponame>matthieuvigne/pinocchio from math import pi import numpy as np from numpy.linalg import norm, pinv import pinocchio as se3 from pinocchio.utils import cross, zero, rotate, eye from display import Display class Visual(object): ''' Class representing one 3D mesh of the robot, to be attached to a joi...
StarcoderdataPython
8001279
<reponame>kernelmethod/Seagrass import seagrass import sys import unittest import warnings from collections import Counter, defaultdict from seagrass import auto, get_current_event from seagrass.hooks import CounterHook from test.utils import SeagrassTestCaseMixin, req_python_version with seagrass.create_global_audito...
StarcoderdataPython
1648324
<reponame>drmorr0/backuppy import inspect import os import re import sys import traceback from contextlib import contextmanager from hashlib import sha256 from shutil import rmtree import mock import pytest from backuppy.config import setup_config from backuppy.manifest import MANIFEST_FILE from backuppy.manifest imp...
StarcoderdataPython
3252396
import os from flask import Flask from flask import jsonify app = Flask(__name__) @app.route('/') def hello(): response = { 'message': 'API Bookmark', 'version': '1.0.0', 'code': 200, } return jsonify(response) #return app if __name__ == '__main__': app.run()
StarcoderdataPython
4929435
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-10 09:13 from __future__ import unicode_literals import datetime from django.db import migrations, models def set_inaugural_grant_expiration(apps, schema_editor): # pylint: disable=unused-argument Claimant = apps.get_model("lowfat", "Claimant") # py...
StarcoderdataPython
11323987
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. from .parametric_dqn import ParametricDQN __all__ = ["ParametricDQN"]
StarcoderdataPython
6489146
<reponame>rnsheehan/Matrix_Methods # Import libraries # You should try an import the bare minimum of modules import sys # access system routines import os import glob import re import math import scipy import numpy as np import matplotlib.pyplot as plt # add path to our file sys.path.append('c:/Users/Robert/Programmi...
StarcoderdataPython
3285575
#!/usr/bin/env python3.8 # Copyright 2019 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import argparse import os import sys import pathlib def main(): parser = argparse.ArgumentParser( "Verifies that all ....
StarcoderdataPython
3385413
import os import argparse import random import shutil from shutil import copyfile def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'): """ Call in a loop to create terminal progress bar @params: iteration - Required : current iteration (Int...
StarcoderdataPython
15596
<gh_stars>1-10 from ..models import Job from engine.scripts.mirmachine_args import run_mirmachine from .socket_helper import announce_status_change, announce_queue_position, announce_initiation, announce_completed from .maintainer import clean_up_temporary_files from django.utils import timezone from MirMachineWebapp i...
StarcoderdataPython
11379460
from .argmax import argmax from .converter import convert_str_to_datetime, convert_datetime_to_str from .cumsum import cumsum from .fillna import fillna from .math import multiply, divide, add, subtract from .melt import melt from .percentage import percentage from .pivot import pivot, pivot_by_group from .query_df imp...
StarcoderdataPython
8055414
""" Generate graphs with results for Arp2/3 project Input: - 2nd order results for W and IT - 1st order results for W and IT Output: - Plots with the results """ ################# Package import import os import pickle import numpy as np import scipy as sp import sys import time from surf...
StarcoderdataPython
6404997
address_district = { '1':'District 1', '2':'District 2', '3':'District 3', '4':'District 4', '5':'District 5', '6':'District 6', '7':'District 7', '8':'District 8', '9':'District 9', '10':'District 10', '11':'District 11', '12':'District 12' } address_street = { '1':'Cao Thắng', '2':'Lý T...
StarcoderdataPython
54443
import random import pandas import numpy as np from sklearn import metrics, cross_validation import tensorflow as tf from tensorflow.contrib import layers from tensorflow.contrib import learn random.seed(42) """ data = pandas.read_csv('titanic_train.csv') X = data[["Embarked"]] y = data["Survived"] X_train, X_test, y...
StarcoderdataPython
8188108
<reponame>Wsine/filterfuzz import os import torch def load_model(opt): if 'cifar' in opt.dataset: model_hub = 'chenyaofo/pytorch-cifar-models' model_name = f'{opt.dataset}_{opt.model}' model = torch.hub.load(model_hub, model_name, pretrained=True) return model elif opt.model =...
StarcoderdataPython
8183995
from testinfra.backend import base from ConfigParser import SafeConfigParser from winrm.protocol import Protocol from winrm import Session import base64 class WinrmBackend(base.BaseBackend): NAME = "winrm" def __init__(self, name, winrm_config=None, *args, **kwargs): self.name, self.user = self.parse...
StarcoderdataPython
1818235
<reponame>ccpn1988/TIR<gh_stars>1-10 # BAIXAS A RECEBER import unittest from tir import Webapp from datetime import datetime DateSystem = datetime.today().strftime('%d/%m/%Y') class FINA070(unittest.TestCase): @classmethod def setUpClass(inst): inst.oHelper = Webapp() inst.oHelper.Setup("SIGAFIN", DateSystem, "...
StarcoderdataPython
8044022
# Using readlines() input = open('input.txt', 'r') lines = input.readlines() horizontal = 0 depth = 0 aim = 0 for line in lines: [command, num] = line.split() num = int(num) if command == "forward": horizontal += num depth += num * aim elif command == "down": aim += num eli...
StarcoderdataPython
199009
#!/usr/bin/python # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this l...
StarcoderdataPython
11236820
<reponame>sircodesalittle/MOOC-TIme from django.shortcuts import render from django.contrib.auth.models import User, Group from rest_framework import viewsets from .models import Course, Work, IntervalSession from api.serializers import UserSerializer, \ GroupSerializer, \ ...
StarcoderdataPython
5038717
<reponame>daxreyes/fastapi-svelte-experiments from .msg import Msg from .token import Token, TokenPayload from .user import User, UserCreate, UserInDB, UserUpdate from .item import ( Item, ItemCreate, ItemInDB, ItemUpdate, ItemOut, )
StarcoderdataPython
5060911
#!/usr/bin/env python3 import json import os import sys import random from pathlib import Path def main(num_objects, output_path): """ :param num_objects: number of json objects to create in the output file :param output_path: the path to the output file """ num_objects = int(num_objects) with ...
StarcoderdataPython
9684664
# Example: Hangup call api.hangup_call('callId')
StarcoderdataPython
1931172
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage # max(float,float) includes masking command += testshade("-t 1 -g 64 64 -od uint8 -o Cout out_max_u_float_u_float.tif test_max...
StarcoderdataPython
48761
<gh_stars>1-10 from typing import List import typer from tgcli.commands.etc.help_text import GRAPH_ARG_HELP, CONFIG_ARG_HELP from tgcli.commands.util import get_initialized_tg_connection, resolve_multiple_args, preprocess_list_query from tgcli.util import cli get_app = typer.Typer(help="Get resources from your Tiger...
StarcoderdataPython
1699342
<reponame>tadams42/seveno_pyutil<filename>tests/benchmarking_utilities_spec.py import time from seveno_pyutil import Stopwatch class DescribeStopwatch(object): def it_provides_context_manager_for_duration_measurement(self): with Stopwatch() as stopwatch: time.sleep(1) assert stopwatc...
StarcoderdataPython
54045
#!/usr/bin/env python """Test functions in openmoltools.schrodinger.""" import unittest from openmoltools.schrodinger import * @unittest.skipIf(not is_schrodinger_suite_installed(), "This test requires Schrodinger's suite") def test_structconvert(): """Test run_structconvert() function.""" benzene_path = u...
StarcoderdataPython
3544857
<reponame>vincenttran-msft/azure-sdk-for-python #!/usr/bin/env python # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information....
StarcoderdataPython
8000050
from pyrogram.types import ( CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaDocument, InputMediaVideo, InputMediaAudio, Message, ) from Yukki import app from pyrogram import Client, filters from youtubesearchpython import VideosSearch import lyricsgenius import re @Cli...
StarcoderdataPython
5100199
<filename>4.29/world_population.py<gh_stars>0 import json import pygal.maps.world from country_codes import get_country_code #将数据加载到一个列表中 filename='population_data.json' with open(filename) as f: pop_data=json.load(f) #创建一个包含人口数量的字典 cc_populations={} for pop_dict in pop_data: if pop_dict['Year']=='2010': ...
StarcoderdataPython
12852350
#!/usr/bin/env python """ """ from xml.etree.ElementTree import Element import xml.etree.ElementTree as etree import xml.dom.minidom import re import sys import getopt import os from time import gmtime, strftime from nipype import config, logging from nighres.lesion_tool.lesion_pipeline import Lesion_extractor d...
StarcoderdataPython
8017886
<reponame>oracle-devrel/leagueoflegends-optimizer # Copyright (c) 2021 Oracle and/or its affiliates. import yaml import cx_Oracle import os from pathlib import Path home = str(Path.home()) def load_config_file(): with open('../config.yaml') as file: return yaml.safe_load(file) # wallet location (default is HOME/...
StarcoderdataPython
1734393
<filename>elections/admin.py<gh_stars>1-10 from django.contrib import admin from django.utils.html import format_html from reversion.admin import VersionAdmin from elections.models import Election, ElectionResult, PresidentCandidate, PresidentCandidateBiography, \ PresidentCandidatePoliticalExperience, PresidentCa...
StarcoderdataPython
1763392
<filename>core/views.py from django.contrib.auth import login, authenticate from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.forms.models import inlineformset_factory from django.shortcuts import render, redirect from .forms import ProfileForm, SignUpFor...
StarcoderdataPython
12851838
<reponame>GingerWWW/news_spider<filename>tools/weixin.py #!/usr/bin/env python # encoding: utf-8 """ @author: zhanghe @software: PyCharm @file: weixin.py @time: 2018-02-10 17:55 """ import re import time import hashlib # from urlparse import urljoin # PY2 # from urllib.parse import urljoin ...
StarcoderdataPython
1619354
""" Django settings for test_django project. Generated by 'django-admin startproject' using Django 1.11.6. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ impor...
StarcoderdataPython
6419930
<gh_stars>0 import pandas as pd import numpy as np from sklearn.preprocessing import LabelEncoder class FeatureEngineering: def __init__(self): self.air_visits = pd.read_csv("../input/restaurant-visitor-forecasting/train.csv") self.air_reservations = pd.read_csv("../input/restaurant-visitor-fo...
StarcoderdataPython
6658915
<gh_stars>0 from scraper.model import ModelBase, CSVModel, JsonModel from scraper.model.meeting_item import MeetingItem class MeetingDetails(ModelBase, JsonModel, CSVModel): def __init__(self, meeting_name=None, meeting_datetime=None, meeting_location=None, published_agenda=None, agenda_packe...
StarcoderdataPython
6465246
<reponame>SJ-Z/DjangoSite from django.shortcuts import render from django.contrib.contenttypes.models import ContentType from django.http import JsonResponse from django.db.models import ObjectDoesNotExist from likes.models import LikeCount, LikeRecord def success_response(liked_num): data = { 'status': '...
StarcoderdataPython
77145
# Here's a basic robot loop to drive a robot using the left analog stick of # an Xbox controller. The robot left and right drive motors are assumed # to be connected to channels 0 and 1 of a Maestro controller. import maestro import xbox import drive import time m = maestro.Controller() dt = drive.DriveTrain(m, 0, 1...
StarcoderdataPython
4802983
from ferris import BasicModel, ndb import logging class Torrent(BasicModel): hashString = ndb.StringProperty() name = ndb.StringProperty() status = ndb.StringProperty() eta = ndb.DateTimeProperty() @classmethod def create(cls, params): entity = cls.get(params['hashString']) i...
StarcoderdataPython
9669850
<gh_stars>0 import os import numpy as np from model import Agent from utils import plot_learning_curve, make_env LOAD = False VERSION = '0' if __name__ == '__main__': env = make_env('SpaceInvaders-v0') best_score = -np.inf n_games = 1000 algo = 'DQN' agent = Agent(input_space_dim=(env.obs...
StarcoderdataPython
3506624
# Based off of <NAME>' ray-tracing algorithm (2003) # Finds path between two locations with an atmospheric profile in between # ########################################################################### import warnings import numpy as np import pyximport pyximport.install(setup_args={'include_dirs':[...
StarcoderdataPython
1753775
# -*- coding: utf-8 -*- from .action import Action, InitializableAction from ..registry import Registry actions = Registry(Action, "Action") # type: Registry[Action]
StarcoderdataPython
9703293
<gh_stars>0 import os import json class GenericDatabase: def __init__(self, file_path): self.path = os.path.join(os.getcwd(), file_path) self.update() def update(self): with open(self.path, "r") as file: self.data = json.load(file) def set(self, name, value): ...
StarcoderdataPython
8138807
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cassette', '0002_auto_20150717_1112'), ] operations = [ migrations.CreateModel( name='Results', fiel...
StarcoderdataPython
11294531
<gh_stars>0 import torch from torch.autograd import Variable import torch.nn as nn from torch.nn import init hasCuda = torch.cuda.is_available() class Encoder(nn.Module): """ Applies a bi-direcitonl RNN on the input character vectors. It then uses a hidden/dense layer to build the final hidden vec...
StarcoderdataPython
6622120
<filename>python3/koans/a_package_folder/__init__.py #!/usr/bin/env python an_attribute = 1984
StarcoderdataPython
11335699
<filename>tests/__init__.py<gh_stars>0 """Unit test package for smartgarden_x."""
StarcoderdataPython
4853700
import glob import os import shutil srcdir = r'D:\dong\wafer-data\data_bmp' seldir = r'C:\Users\user\PycharmProjects\yolov3\VOC2007\Annotations' dstdir = r'C:\Users\user\PycharmProjects\yolov3\VOC2007\JPEGImages' file_props = glob.glob(seldir + '/*.xml') for filename in file_props: basename = os.pat...
StarcoderdataPython
3429457
<gh_stars>0 # Generated by Django 3.0.4 on 2020-04-19 01:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0005_remove_category_status'), ] operations = [ migrations.CreateModel( name='Tab', fields=[ ...
StarcoderdataPython
11363372
<filename>seine/bootstrap.py # seine - Singular Embedded Images Now Easy # SPDX-License-Identifier Apache-2.0 from abc import ABC, abstractmethod import os import subprocess import tempfile from seine.utils import ContainerEngine class Bootstrap(ABC): def __init__(self, distro, options): self._name = No...
StarcoderdataPython
1812418
<reponame>umar3ziz/bloopark # -*- coding: utf-8 -*- ################################################################################# # Author : <NAME> <<EMAIL>> # Copyright(c): Developer -<NAME>- # All Rights Reserved. # # This program is copyright property of the author mentioned above. # You can`t redistribute ...
StarcoderdataPython
290756
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Distributed under terms of the MIT license. # Copyright 2021 <NAME>. import sys import numpy as np import matplotlib.pyplot as plt # Function to know if we have a CCW turn def RightTurn(p1, p2, p3): if (p3[1] - p1[1]) * (p2[0] - p1[0]) >= (p2[1] - p...
StarcoderdataPython
9785615
# -*- coding: utf-8 -*- """ 斗地主拆牌模块 @author 江胤佐 """ from __future__ import annotations import math from abc import ABCMeta from collections import defaultdict from copy import deepcopy from functools import cmp_to_key from typing import Optional from duguai.card.cards import * from duguai.card.cards import card_lt2, ...
StarcoderdataPython
9743630
# coding: utf-8 """ Base para desarrollo de modulos externos. Para obtener el modulo/Funcion que se esta llamando: GetParams("module") Para obtener las variables enviadas desde formulario/comando Rocketbot: var = GetParams(variable) Las "variable" se define en forms del archivo package.json Para modifica...
StarcoderdataPython
1632063
''' Define the function related with the Markov Chain Monter Carlo (MCMC) process. ''' import numpy as np import emcee import time import os import git path_git = git.Repo('.', search_parent_directories=True).working_tree_dir path_datos_global = os.path.dirname(path_git) def MCMC_sampler(log_probability, initial_val...
StarcoderdataPython
5162144
from vizdoomgym.envs.vizdoomenv import VizdoomEnv class VizdoomTakeCover(VizdoomEnv): def __init__(self): super(VizdoomTakeCover, self).__init__(7)
StarcoderdataPython
12853147
from blocksync._consts import ByteSizes from blocksync._status import Blocks def test_initialize_status(fake_status): # Expect: Set chunk size assert fake_status.chunk_size == fake_status.src_size // fake_status.workers def test_add_block(fake_status): # Expect: Add each blocks and calculate done block ...
StarcoderdataPython
4925301
#!/usr/bin/env python """Unit test for ...""" import requests import unittest from sagas.ofbiz.entities import MetaEntity class TestSimple(unittest.TestCase): """Class to execute unit tests for api.py.""" @classmethod def setUpClass(self): """Set up function called when class is consructed.""" ...
StarcoderdataPython
3319917
<gh_stars>0 import string def replace_use_template(strObj): # New style in python2.4 new_style = string.Template('This is $thing') strA = new_style.substitute(thing=2) print strA strB = new_style.substitute({'thing': 10}) print strB #Old style in python2.3 old_style = 'This is %(thing)s...
StarcoderdataPython
4914620
<gh_stars>1-10 import json from pony.orm import db_session from blogsley.user import User class Schemata: def __init__(self): self.typename = self.__class__.__name__ def wire(self): return {} class Connection(Schemata): def __init__(self, objs, edge_class, node_class): super().__i...
StarcoderdataPython
9727850
<reponame>KMU-AELAB-MusicProject/MusicGeneration_VAE-torch<filename>graph/model.py import torch import torch.nn as nn from .decoder import Decoder from .encoder import Encoder from .phrase_encoder import PhraseModel from .refiner import Refiner from graph.weights_initializer import weights_init class Model(nn.Module...
StarcoderdataPython
1889995
<filename>inst/test_module.py def f1(a=3, type="linear"): """ Initialize the model. Parameters ---------- a : int, optional Description for a. Defaults to 3. type : str, optional Type of algorithm (default: "linear") "linear" - linear model "nonlinear" - nonl...
StarcoderdataPython
9727334
<reponame>iamlemec/valjax from operator import mul from itertools import accumulate from collections import OrderedDict from inspect import signature import toml import jax import jax.numpy as np import jax.tree_util as tree ## ## indexing tricks ## def get_strides(shape): return tuple(accumulate(shape[-1:0:-1],...
StarcoderdataPython
3364764
<filename>Lecture_4_Tasks.py """Euler Method for the equation dy/dx = -y""" import numpy as np import matplotlib.pyplot as plt import math as m x_initial = 0 y_initial = 1 x_final = 1 h = 0.02 step = m.ceil(x_final/h) y_euler = [] x_euler = [] y_euler.append(y_initial) x_euler.append(x_initial) ...
StarcoderdataPython
3547206
<reponame>Shumpei-Kikuta/BentoML import gzip import json import os from bentoml.types import HTTPRequest, InferenceTask TF_B64_KEY = "b64" class B64JsonEncoder(json.JSONEncoder): """ Special json encoder for numpy types """ def default(self, o): # pylint: disable=method-hidden import base64 ...
StarcoderdataPython
359772
#!/usr/bin/env python # Copyright (c) 2012 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. ''' Toolbar preprocessing code. Turns all IDS_COMMAND macros in the RC file into simpler constructs that can be understood by GRIT....
StarcoderdataPython
6659298
#!/usr/bin/env python # $Id$ import sys import popen2 import os import string import time def generate_date(): d1 = None for when in 'date --date "1 month ago" +"%b-%d-%y"','date +"%b-%d-%y"': d = os.popen(when,'r') dat=d.readlines() d.close() if d1 == None: d1 = da...
StarcoderdataPython
3352958
<reponame>fderyckel/pos_bahrain<gh_stars>10-100 # -*- coding: utf-8 -*- # pylint: disable=no-member,access-member-before-definition # Copyright (c) 2018, 9t9it and contributors # For license information, please see license.txt from __future__ import unicode_literals import json import frappe from frappe.utils import ...
StarcoderdataPython
9746649
<reponame>nick-youngblut/StrainGE # Copyright (c) 2016-2019, Broad Institute, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copy...
StarcoderdataPython
3438398
<reponame>flexiooss/flexio-flow from __future__ import annotations from typing import Optional, Type import abc from VersionControlProvider.Issue import Issue from VersionControlProvider.KeyWordsDialect import KeyWordsDialect class IssueMessage(abc.ABC): def __init__(self, message: str, issue: Optional[Type[Is...
StarcoderdataPython
321540
<reponame>ch1huizong/learning #!/usr/bin/env python # # Copyright 2007 <NAME>. # """Writing to a memory mapped file using a slice assignment. """ __version__ = "$Id$" #end_pymotw_header import mmap import shutil import contextlib # Copy the example file shutil.copyfile('lorem.txt', 'lorem_copy.txt') word = 'consec...
StarcoderdataPython
1619340
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import router_func as rfunc import router_pass as rpass rfunc.hoge
StarcoderdataPython
1809036
<gh_stars>0 from django.apps import AppConfig class HerdConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "herd"
StarcoderdataPython
9624970
import logging import os from typing import Tuple, Union import h5py import torch from PIL import Image from torchvision import transforms from models import select_vae_model, select_rnn_model, Controller from models.vae import BaseVAE from utils.setup_utils import load_yaml_config from utils.constants import ( G...
StarcoderdataPython
4980572
<filename>mc_manager/curses_helpers.py import curses from curses.textpad import Textbox, rectangle class item_base(): """The base class for menu items """ def init_curses(self): """A few curses settings shared across all items """ curses.noecho() curses.cbreak() cur...
StarcoderdataPython
5155058
<reponame>sbutalla/vfatqc-python-scripts from gempython.utils.standardopts import parser parser.add_option("--mspl", type="int", dest = "MSPL", default = 4, help="Specify MSPL. Must be in the range 1-8 (default is 4)", metavar="MSPL") parser.add_option("--nevts", type="int", dest="nevts", ...
StarcoderdataPython
12801362
<gh_stars>0 #!/usr/bin/env python3 # coding:utf-8 # 改进小红球 class Ball: def __init__(self, canvas, paddle, color): self.canvas = canvas self.paddle = paddle self.id = canvas.create_oval(10, 10, 25, 25, fill=color) self.canvas.move(self.id, 245, 100) starts = [-3, -2, -1, 1, 2,...
StarcoderdataPython
6419113
"""Shared fixtures for test modules""" import sys import os import emily import pytest curdir = os.path.dirname(__file__) data_dir = os.path.join(curdir,'data') @pytest.fixture def app(): more_brains = [os.path.join(data_dir,'tests.json')] session_vars_path = os.path.join(data_dir,'session_vars_test.json')...
StarcoderdataPython
6506420
<reponame>steve-wilson/activity_prediction # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # MODIFIED BY <NAME>, 2018 import os import pathlib import numpy as np import torch...
StarcoderdataPython
8124159
<filename>scraper/storage_spiders/golmartvn.py # Auto generated by generator.py. Delete this line if you make modification. from scrapy.spiders import Rule from scrapy.linkextractors import LinkExtractor XPATH = { 'name' : "//h1[@class='productName']", 'price' : "//div[@id='ShowPrice']/@data-url", 'categor...
StarcoderdataPython
5006971
<filename>dj_lab/mysite/mysite/urls.py from django.contrib import admin from django.urls import path, include urlpatterns = [ path('bands/', include('bands.urls')), path('news/', include('news.urls')), path('polls/', include('polls.urls')), path('author-polls/', include('polls.urls', namespace='author...
StarcoderdataPython
260984
<reponame>E-G-C/algorithms """Given a list of points, find the k closest to the origin. Idea: Maintain a max heap of k elements. We can iterate through all points. If a point p has a smaller distance to the origin than the top element of a heap, we add point p to the heap and remove the top element. After iterating th...
StarcoderdataPython
3265070
<filename>src/cicd_sim/buildmachine/jenkins.py from .. util.stdoutput import StdOutput from .. conan import Conan from . buildstrategy_a import BuildStrategyA class Jenkins: """ A Jenkins simulation. It supports 'building a branch' which results in an artifact. Depending on the 'build strategy', that artifact ...
StarcoderdataPython
4907138
<reponame>romeorizzi/TALight #!/usr/bin/env python3 from sys import stderr, exit import random from time import monotonic import matplotlib.pyplot as plt def plotting(data, figure_size): """data=(name, n, t_no_efficient, t_efficient) is a list of data to plotting.""" # plotting settings plt.figure(figsiz...
StarcoderdataPython
4866159
from django.contrib import admin from django.conf.urls import * from django.urls import include, path from rest_framework import routers from rest_framework.authtoken.views import obtain_auth_token from api import views admin.autodiscover() router = routers.DefaultRouter() router.register(r'machines', views.Machine...
StarcoderdataPython