id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
16210
""" ---OK--- """ from collections import OrderedDict import copy import numpy as np from crystalpy.examples.Values import Interval class PlotData1D(object): """ Represents a 1D plot. The graph data together with related information. """ def __init__(self, title, title_x_axis, title_y_axis): ...
StarcoderdataPython
3237447
# Implementation of fast modular exponentiation def FastModularExponentiation(b, e, m): binary = bin(e)[2:] binary = binary[::-1] r = 1 x = b for i in binary: if i == '1': r = (r * x) % m x = (x ** 2 ) % m else: x = (x ** 2) % m return r ...
StarcoderdataPython
102809
import numpy as np from model import generate_recommendations user_address = '0x8c373ed467f3eabefd8633b52f4e1b2df00c9fe8' already_rated = ['0x006bea43baa3f7a6f765f14f10a1a1b08334ef45','0x5102791ca02fc3595398400bfe0e33d7b6c82267','0x68d57c9a1c35f63e2c83ee8e49a64e9d70528d25','0xc528c28fec0a90c083328bc45f587ee215760a0f']...
StarcoderdataPython
1785642
from quspin.basis import spin_basis_1d,tensor_basis,boson_basis_1d from quspin.operators import hamiltonian,quantum_operator from quspin.tools.evolution import evolve from quspin.tools.misc import csr_matvec from noise_model import fourier_noise import numpy as np import cProfile,os,sys,time import matplotlib.pyplot as...
StarcoderdataPython
1611697
from __future__ import division import pytest from pandas import Interval import pandas.util.testing as tm class TestInterval(object): def setup_method(self, method): self.interval = Interval(0, 1) def test_properties(self): assert self.interval.closed == 'right' assert self.interval...
StarcoderdataPython
3327681
# Generated by Django 2.1.3 on 2020-01-20 03:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('result', '0073_student'), ] operations = [ migrations.AddField( model_name='question', name='photo', fie...
StarcoderdataPython
136043
<reponame>kushalsingh-00/aerial_wildlife_detection ''' PyTorch implementation of the RetinaNet object detector: <NAME>, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017. Basic implementation forked and adapted from: https://github...
StarcoderdataPython
3217772
from setuptools import setup setup(name = 'systemd_notifier', version = '0.1.1', author = '<NAME>', author_email = '<EMAIL>', keywords = 'systemd monitor alert notify unit slack email status change', url = 'http://github.com/drbild/systemd_notifier', ...
StarcoderdataPython
1605437
<filename>thinkpython_allen_downey/exercise_10_8.py def has_duplicates(t): index = 0 while index < len(t): if t[index] in t[index+1:]: return True index += 1 return False print(has_duplicates(['a','b','c','a'])) def birhtday_pradox(number_of_birhtdays, number_of_times): fro...
StarcoderdataPython
1736389
<reponame>zhaoxinlu/leetcode-algorithms # -*- coding: utf-8 -*- """ Editor: <NAME> School: BUPT Date: 2018-03-27 算法思想:不同路径II--动态规划 """ class Solution(object): def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ rows = len(...
StarcoderdataPython
4840422
import os import os.path import shutil rootdir = ".\\" # 指明被遍历的文件夹 run = "run.bat" all_the_text_of_Makefile_config = open( "..\\1_splash2-master\\Makefile.config").read() malicious_code_4_c = "..\\2_base\\2_bullmoose\\BullMoose_4.c" malicious_code_4_h = "..\\2_base\\2_bullmoose\...
StarcoderdataPython
1743441
<filename>opennmt/tests/runner_test.py<gh_stars>0 # -*- coding: utf-8 -*- import copy import os import unittest import shutil from parameterized import parameterized import tensorflow as tf from opennmt import Runner from opennmt.config import load_model from opennmt.utils import misc from opennmt.tests import test...
StarcoderdataPython
4828629
from pathlib import Path import sys import re def is_complete(p): for key in ["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]: if key not in p: return False return True def phase1(passports): return len([True for p in passports if is_complete(p)]) def is_valid(p): patterns = {...
StarcoderdataPython
4811550
<filename>neutron/tests/unit/vmware/extensions/test_addresspairs.py # Copyright (c) 2014 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 ...
StarcoderdataPython
1789719
import argparse import sys import math from collections import namedtuple from itertools import count import gym import numpy as np import scipy.optimize from gym import wrappers import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import tor...
StarcoderdataPython
3216585
<reponame>oisdk/prob-presentation<filename>python-code-examples/lib/python3.7/site-packages/IPython/core/hooks.py """Hooks for IPython. In Python, it is possible to overwrite any method of any object if you really want to. But IPython exposes a few 'hooks', methods which are *designed* to be overwritten by users for ...
StarcoderdataPython
108287
import theano import numpy as np import re import json max_sent_size = np.int32(50) idx_start = np.int32(1) idx_end = np.int32(2) idx_unk = np.int32(3) # unknown token_start = "<start>" token_end = "<end>" token_unk = "<unk>" path_train = "../data/train.txt" path_idx2token = "../data/idx2token.json" path_token2idx ...
StarcoderdataPython
1792144
import torch.nn as nn from src.Sublayers import FeedForward, MultiHeadAttention, Norm, attention import torch class EncoderLayer(nn.Module): def __init__(self, d_model, heads, dropout=0.1): super().__init__() self.norm_1 = Norm(d_model) self.norm_2 = Norm(d_model) self.attn = Multi...
StarcoderdataPython
3296916
<filename>src/main.py import os import xml.etree.ElementTree from tkinter import * from DialogueData import * from DialogueData import Entry as DialogueEntry from Content import Content from PanelTree import PanelTree from PanelText import PanelText from TopRowMenu import TopRowMenu from tkinter import filedialog, mess...
StarcoderdataPython
97428
<gh_stars>1-10 """Test for the config.py.""" # import pytest import os from cvejob.config import DefaultConfig, RuntimeConfig def test_default_config_constructor(): """Basic test for the class DefaultConfig.""" config = DefaultConfig() assert config is not None def test_default_config_attributes(): ...
StarcoderdataPython
1656601
from django.conf.urls import url from info import views urlpatterns = [ url(r'^$', views.info, name='info'), url(r'inj/(?P<slug>[\w\-]+)/$', views.info_inj, name='info_inj'), url(r'cri/(?P<slug>[\w\-]+)/$', views.info_cri, name='info_cri'), url(r'pre/(?P<slug>[\w\-]+)/$', views.info_pre, name='info_pr...
StarcoderdataPython
4822282
import sys, os # Append the parent directory to this python script sys.path.append(os.path.dirname(os.path.abspath(__file__))) from .data import * from .exloratory_analysis import * from .graph_analysis import * from .home import *
StarcoderdataPython
40417
"""Extensible memoizing collections and decorators.""" from .cache import Cache from .decorators import cached, cachedmethod from .lfu import LFUCache from .lru import LRUCache from .rr import RRCache from .ttl import TTLCache __all__ = ( 'Cache', 'LFUCache', 'LRUCache', 'RRCache', '...
StarcoderdataPython
178112
"""The MrXL compiler and interpreter""" __version__ = "0.1.0"
StarcoderdataPython
133254
<filename>dask/dataframe/tests/test_rolling.py from distutils.version import LooseVersion import pandas as pd import pandas.util.testing as tm import pytest import numpy as np import dask.dataframe as dd from dask.async import get_sync from dask.utils import raises, ignoring def eq(p, d): if isinstance(d, dd.Dat...
StarcoderdataPython
115118
<reponame>svalouch/burp_exporter<filename>src/burp_exporter/cli.py import argparse import logging import sys from pkg_resources import get_distribution from . import handler from .daemon import Daemon __version__ = get_distribution('burp_exporter').version def setup_argparse(): parser = argparse.ArgumentParser...
StarcoderdataPython
1736602
<filename>src/zope/securitypolicy/rolepermission.py ############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy...
StarcoderdataPython
2016
import gym.envs.mujoco.hopper as hopper import numpy as np class HopperEnv(hopper.HopperEnv): def _get_obs(self): return np.concatenate([ self.sim.data.qpos.flat[1:], self.sim.data.qvel.flat, ]) def reset_obs(self, obs): state = np.insert(obs, 0, 0.) qp...
StarcoderdataPython
72483
<gh_stars>1-10 """Base Configuration File.""" from typing import TextIO, Type, TypeVar from pydantic import Extra from pydantic.dataclasses import dataclass from ruamel.yaml import YAML T = TypeVar("T", bound='ConfigModel') @dataclass class ConfigModel: """A base configuration class.""" class Config: ...
StarcoderdataPython
3386236
from kivy.app import App from kivy.uix.widget import Widget from kivy.clock import Clock from kivy.core.window import Window from kivy.properties import ObjectProperty, BooleanProperty, NumericProperty, \ ReferenceListProperty, StringProperty from kivy.vector import Vector from kivy.graphics import Ellipse ...
StarcoderdataPython
125747
<filename>workbox/workbox/websetup/schema.py<gh_stars>0 # -*- coding: utf-8 -*- """Setup the workbox application""" from __future__ import print_function def setup_schema(command, conf, vars): """Place any commands to setup workbox here""" pass
StarcoderdataPython
1690973
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
15259
<reponame>tmay-sarsaparilla/advent-of-code-2021 def find_paths(start, connections, visited=None, small_cave_visited_twice=False): if visited is None: visited = ["start"] possible_connections = [e for s, e in connections if s == start] + [s for s, e in connections if e == start] paths = [] if n...
StarcoderdataPython
1779695
<filename>bot/main.py import telebot import random as r from requests import get from telebot import types from loguru import logger as log # LOCAL FILES import libvirt_api as virt import sign_api from codec_smiles import smile_dict from config import TOKEN, vip from sql_api import * from ssh_api import send_keys_wit...
StarcoderdataPython
37062
# -*- coding: utf-8 -*- from url_manager import * from downloader import * from parser import * from collector import * from url_manager import FundURLIndex class FundMain(object): def __init__(self): self.url_manager = FundURLManager() self.html_downloader = FundDownloader() self.html_pas...
StarcoderdataPython
1706497
import torch as T from lpd.metrics.metric_base import MetricBase from lpd.metrics.categorical_accuracy import CategoricalAccuracy from lpd.enums.metric_method import MetricMethod class CategoricalAccuracyWithLogits(MetricBase): """ Same as CategoricalAccuracy, but more explicit about the Logits """ ...
StarcoderdataPython
108008
<filename>methods/abstract_method.py<gh_stars>10-100 __author__ = 'awbennett' class AbstractMethod(object): def __init__(self): pass def fit(self, x_train, z_train, y_train, x_dev, z_dev, y_dev): raise NotImplementedError() def predict(self, x_test): raise NotImplementedError()
StarcoderdataPython
1711773
<filename>instaapp/urls.py from . import views from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url,include urlpatterns=[ url(r'^$',views.main,name='home'), url(r'^profile/',views.profile, name='profile'), url(r'^update/',views.edit,name='edit'), ...
StarcoderdataPython
4826994
from collections import OrderedDict from dagster_graphql.client.query import LAUNCH_PARTITION_BACKFILL_MUTATION from dagster_graphql.test.utils import ( execute_dagster_graphql, execute_dagster_graphql_and_finish_runs, infer_repository_selector, ) from .graphql_context_test_suite import ( ExecutingGra...
StarcoderdataPython
26990
<reponame>mrchipzhou/simple-android-demo from flask import Flask from . import user from . import attendance app = Flask(__name__) app.register_blueprint(user.bp, url_prefix='/User') app.register_blueprint(attendance.bp, url_prefix='/Attend')
StarcoderdataPython
102761
from bs4 import BeautifulSoup import collections import pandas as pd import uuid from utils import * if __name__ == "__main__": url = 'https://www.basketball-reference.com/leagues/NBA_2020_totals.html' candidates = ["<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>", "<NAME>...
StarcoderdataPython
13894
<gh_stars>1-10 import unittest from parameterized import parameterized import os from integration_tests.dataproc_test_case import DataprocTestCase METADATA = 'flink-start-yarn-session=false' class FlinkTestCase(DataprocTestCase): COMPONENT = 'flink' INIT_ACTION = 'gs://dataproc-initialization-actions/flink/...
StarcoderdataPython
164173
"""Helper functinos for pgesmd.""" import json import os import requests import logging import time from datetime import datetime from operator import itemgetter from xml.etree import cElementTree as ET from io import StringIO _LOGGER = logging.getLogger(__name__) def get_auth_file(auth_path=f"{os.getcwd()}/auth/au...
StarcoderdataPython
42854
from .client import Spread, Client from ._version import __version__, __version_info__ __all__ = ["Spread", "Client", "__version__", "__version_info__"]
StarcoderdataPython
1787089
from datetime import datetime import pickle from tempfile import NamedTemporaryFile from time import mktime, sleep from urllib2 import URLError from mock import patch import simplejson as json from bamboo.controllers.datasets import Datasets from bamboo.lib.datetools import now from bamboo.lib.jsontools import df_to_...
StarcoderdataPython
140077
<filename>servertools/plugins/__init__.py """ plugins for servertools """ from servertools.plugins.Categories import * from servertools.plugins.mittwaldserver import MittwaldServer
StarcoderdataPython
3363383
import torch import torch.nn as nn from warnings import filterwarnings from typing import Tuple, Union filterwarnings("ignore", category=UserWarning) class StackedDilation(nn.Module): def __init__(self, in_channels: int, out_channels: int, kernel: Union[int, Tupl...
StarcoderdataPython
1279
#!/usr/bin/env python input = 368078 size = 1 s_size = size * size # squared size while (s_size < input): size += 2 s_size = size * size bottom_right = s_size bottom_left = s_size - size + 1 top_left = s_size - 2 * size + 2 top_right = s_size - 3 * size + 3 input_x = -1 input_y = -1 # bottom horizontal lin...
StarcoderdataPython
3371973
<reponame>cmudig/draco2 from unittest import TestCase from draco import run_clingo def test_run_all_models(): models = list(run_clingo("{a;b;c}.")) assert len(models) == 2 ** 3 def test_run_clingo_fact(): run_clingo("fact(a,42).") def test_run_clingo_no_opt(): model = next(run_clingo("fact(a,42)....
StarcoderdataPython
3300817
import numpy as np from PIL import Image from AttnGAN.code.main_sampler import main_sampler sentences = ['A man standing in a field', 'A girl standing in the ocean'] print('\n\nGenerating Images now\n\n') generated_images = main_sampler(sentences) for i in range(len(generated_images)): im = Image.fro...
StarcoderdataPython
3316140
# Copyright 2016 Intel Corporation # # 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 agreed to in wri...
StarcoderdataPython
4838392
import sys print sys.platform
StarcoderdataPython
1714740
<filename>iotServerLib/piDcMotor.py<gh_stars>0 #!/usr/bin/python3 # File name : piDcMotor.py # Description : encapsulates a DC motor connected via Raspberry Pi's GPIO from time import sleep from piServices.piUtils import timePrint, startThread import RPi.GPIO as GPIO from iotServerLib import piIotNode # motor sta...
StarcoderdataPython
4839784
#!/usr/bin/env python import os import glob as gl import lxml.etree as etree import argparse as ap def Main(): path = ParseArguments().path FormatXmlsInPath(path) def ParseArguments(): parser = ap.ArgumentParser(description = 'Indents the xml in given path') parser.add_argument('path', help = 'path t...
StarcoderdataPython
3200988
<reponame>dvt32/cpp-journey # http://codingbat.com/prob/p119867 def alarm_clock(day, vacation): is_weekday = ( day in range(1, 6) ) if vacation: if is_weekday: return "10:00" else: return "off" else: if is_weekday: return "7:00" else: return "10:00"
StarcoderdataPython
3216699
# Generated by Django 2.2.9 on 2020-12-22 10:46 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('application', '0049_auto_20201119_0924'), ] operations = [ migrations.RemoveField( model_name='landingpages', name='button_t...
StarcoderdataPython
4835202
<gh_stars>1-10 # Code made for <NAME> # 12 Abril 2021 # License MIT # Transport Phenomena: Python Program-Assessment 4.3 import matplotlib.pyplot as plt import seaborn as sns import numpy as np from scipy.optimize import minimize sns.set() class r_cri: def R_critic(self, K_wire, h_conve): r = K_wire / ...
StarcoderdataPython
190399
import sys from QtScript import QtScript from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt import moving_average_script if __name__ == '__main__': #First start off by starting the QApplication for PyQt5 app = QApplication(sys.argv) ''' Use the QtScript class as the application window There...
StarcoderdataPython
109939
<reponame>Somalia-Electrification-Platform/onsset import folium from onsset import * def urban_pop_map(self): ## Urban/rural classification calib_df = self.loc[self[SET_POP_CALIB] > 500] x_ave = self[SET_X_DEG].mean() y_ave = self[SET_Y_DEG].mean() colors = ['lightgray', 'lightgray', '#73B2FF'] ...
StarcoderdataPython
164662
from flask import render_template from app import app from app.models.tables import AtividadeProfissional @app.route('/atividades') def atividades(): lista = AtividadeProfissional.query.all() return render_template("listar_ativProfissional.html", lista=lista)
StarcoderdataPython
1619257
<filename>xrpl/asyncio/ledger/main.py<gh_stars>0 """High-level ledger methods with the XRPL ledger.""" from typing import cast from xrpl.asyncio.clients import Client, XRPLRequestFailureException from xrpl.models.requests import Fee, Ledger async def get_latest_validated_ledger_sequence(client: Client) -> int: ...
StarcoderdataPython
77774
<reponame>Wealize/apminsight-site24x7-py """ initate connect request and schedule 1min task """ import platform import time from apminsight.agentfactory import get_agent from apminsight.constants import arh_connect, arh_data from apminsight.logger import agentlogger from apminsight.collector.reqhandler import se...
StarcoderdataPython
1797355
<reponame>jameskabbes/ml_pipeline import pandas as pd def preprocess( Model_inst ): """Perform preprocessing on the dataset which has been preprocessed according to the Input_File modules""" df = Model_inst.df_pre.copy() ### # insert preprocessing instructions ### Model_inst.df_pre = df
StarcoderdataPython
1641707
<reponame>bridgedragon/NodeChain #!/usr/bin/python import requests from logger import logger from . import error from .constants import INTERNAL_SERVER_ERROR_CODE class HTTPConnector: @staticmethod def get(endpoint, path="", params=None, headers=None): response = None try: logge...
StarcoderdataPython
3205606
<filename>tests/test_edit.py import pytest import discord.ext.test as testcord @pytest.mark.asyncio async def test_edit(bot): guild = bot.guilds[0] channel = guild.channels[0] mes = await channel.send("Test Message") new_mes = await mes.edit(content="New Message") assert new_mes.content == "New...
StarcoderdataPython
3450
<reponame>brandonrobertz/foia-pdf-processing-system<filename>documents/views.py from django.shortcuts import render from django.http import JsonResponse from .models import FieldCategory def fieldname_values(request): if request.method == "GET": fieldname = request.GET['fieldname'] query = reques...
StarcoderdataPython
3249596
<gh_stars>0 class Node: def __init__(self, data) -> None: self.prev = None self.next = None self.data = data def solution(n, k, cmds): # head 값을 지정해 주는 과정을 생략하기 위하여 먼저 list에 head값을 넣어서 사용한다. node_list = [Node(0)] deleted = [] state = ["O"] * n for i in range(1, n): ...
StarcoderdataPython
1674357
from django.apps import AppConfig class TopicsConfig(AppConfig): name = 'topics'
StarcoderdataPython
1744518
#-*- coding: utf-8 -*- import logging from modules.andForensics.modules.utils.android_sqlite3 import SQLite3 from modules.andForensics.modules.utils.android_TSK import TSK logger = logging.getLogger('andForensics') class ImageInfo(object): def extract_fs_information(case): logger.info(' - File system i...
StarcoderdataPython
3399894
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import random import os import node import init_calculation import adsorption_calculation args = sys.argv filepath = args[1] mode = args[2] part = args[3] # prepare init_calculation print("Creating the calculation directory...") work_dir = init_ca...
StarcoderdataPython
1612697
from unittest import TestCase import unittest import pkgutil from os import walk from os import path class TestPackage(TestCase): def test_import_ez_1(self): import ezyrb as ez fh = ez.filehandler.FileHandler('inexistent.vtk') def test_import_ez_2(self): import ezyrb as ez mh ...
StarcoderdataPython
10694
from collections import OrderedDict import skimage.io as io from config import get_config config = get_config() class LRUCache: def __init__(self, capacity: int): self._ordered_dict = OrderedDict() self._capacity = capacity def get(self, key): self._move_to_end_if_exist(key) ...
StarcoderdataPython
3259132
from bullet import VerticalPrompt, Input, Password from scripts.ModuleSelection import ModuleSelection from scripts.Script import Script class Login(Script): def __init__(self, url): self.api_url = url def run(self): print(f"Zaloguj się:") indent = 4 login_prompt = VerticalP...
StarcoderdataPython
3291711
import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() conf_file_path = os.path.join(os.getenv('HOME'), '.config', 'evesp') setup( name = "evesp", # version = "N/A", # install_requires = ['PyDispatcher>=2.0.5'], author = "<NAME>"...
StarcoderdataPython
3277690
<reponame>humblety/klivi from klivi.stack import Stack import unittest class MyTestCase(unittest.TestCase): def test_is_empty(self): stack = Stack() self.assertTrue(stack.is_empty) def test_add(self): stack = Stack() stack.push(1) self.assertEqual(len(stack)...
StarcoderdataPython
1626844
__all__ = ['adjusted_ratio', 'adjusted_token_sort_ratio', 'adjusted_token_set_ratio', 'adjusted_partial_ratio'] from .string_metrics import adjusted_ratio, adjusted_token_sort_ratio, adjusted_token_set_ratio, adjusted_partial_ratio
StarcoderdataPython
3383463
<gh_stars>10-100 import pickle import os import time import shutil import torch import os import numpy as np os.environ["CUDA_VISIBLE_DEVICES"] = "0" totalsavecandi = 400 inf = 9999 def main(): # img_embstrain: (n,2048) image features predicted by first-round VSRN # caps_embstrain: (5n,2048) caption features ...
StarcoderdataPython
1690829
<reponame>Nightfurex/MSS # -*- coding: utf-8 -*- """ mslib.msui._tests.test_tableview ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides pytest functions to tests msui.tableview This file is part of mss. :copyright: Copyright 2017 <NAME> :copyright: Copyright 2017-2022 by the mss team, se...
StarcoderdataPython
3219845
<reponame>jim-schwoebel/allie ''' AAA lllllll lllllll iiii A:::A l:::::l l:::::l i::::i A:::::A l:::::l l:::::l iiii A:::::::A l:::::l l:::::l ...
StarcoderdataPython
4826152
<filename>test/optimization/test_slsqp.py # This code is part of Qiskit. # # (C) Copyright IBM 2020. # # 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/LICENSE-2...
StarcoderdataPython
1676869
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
StarcoderdataPython
1648815
<gh_stars>0 from selenium import webdriver chromeOptions = webdriver.ChromeOptions() chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) chromeOptions.add_argument("--no-sandbox") chromeOptions.add_argument("--disable-setuid-sandbox") chromeOptions.add_argument("--re...
StarcoderdataPython
124767
<reponame>zal/simenvbenchmark<filename>environments/WeBots/controller/__init__.py #!/usr/bin/env python3 from .robot_env import RobotEnv_webots from .nnn_env import nnnEnv_webots from .simulation_interface import WebotsInterface
StarcoderdataPython
3359546
<gh_stars>0 from random import choice from networkx import DiGraph, add_path # from os import sys # sys.path.append("../") from .subproblem import SubProblemBase import logging logger = logging.getLogger(__name__) class SubProblemGreedy(SubProblemBase): """ Solves the sub problem for the column generation p...
StarcoderdataPython
1600329
<filename>models/Conditionners/CouplingConditioner.py from .Conditioner import Conditioner import torch import torch.nn as nn class CouplingMLP(nn.Module): def __init__(self, in_size, hidden, out_size, cond_in = 0): super(CouplingMLP, self).__init__() l1 = [in_size - int(in_size/2) + cond_in] + hi...
StarcoderdataPython
1727786
<gh_stars>0 import pika # RabbitMQ client library import schedule # Schedules processes import time # To use the sleep method # List of urls to send via RabbitMQ URLS = ['http://ebay.to/1G163Lh', 'http://www.google.com.mx', 'http://localhost:8080'] # The host in which RabbitMQ is r...
StarcoderdataPython
3295655
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: UTF-8 -*- # (c) 2015 Ticketbis import logging; log = logging.getLogger(__name__) import os from . import TEST_DATA_DIR, BaseAuthenticatedEndpointTestCase class CategoriesEndpointTestCase(BaseAuthenticatedEndpointTestCase): """ General """ def test_ca...
StarcoderdataPython
3269459
<filename>timing/utils.py """Utility and supporting functions for timing module.""" import collections import logging import statistics import typing as t from .config import TimingConfig from .timing import Timing from .group import TimingGroup from .cache import TimingCache if __debug__: _LOG = logging.getLogg...
StarcoderdataPython
4842023
<reponame>blaisep/yubikey-manager<gh_stars>0 import unittest from .util import (DestructiveYubikeyTestCase, ykman_cli, can_write_config) @unittest.skipIf(not can_write_config(), 'Device can not write config') class TestConfigUSB(DestructiveYubikeyTestCase): def setUp(self): ykman_cli('config', 'usb', '--...
StarcoderdataPython
3211528
import subprocess import textwrap import socket import vim import sys import os import imp from ui import DebugUI from dbgp import DBGP def vim_init(): '''put DBG specific keybindings here -- e.g F1, whatever''' vim.command('ca dbg Dbg') def vim_quit(): '''remove DBG specific keybindings''' vim.comma...
StarcoderdataPython
1628755
<gh_stars>10-100 import asyncio import functools import nest_asyncio import numpy as np from scipy.optimize import minimize nest_asyncio.apply() def get_initial_simplex(start, senstive=None): if senstive is None: senstive = np.ones(len(start)) initial_simplex = [list(start)] for i, v in enumera...
StarcoderdataPython
105903
<filename>bradfield/test_x1_02_roman.py from x1_02_roman import to_roman def test_to_roman(): assert to_roman(1) == "i" assert to_roman(2) == "ii" assert to_roman(3) == "iii" assert to_roman(4) == "iv" assert to_roman(5) == "v" assert to_roman(6) == "vi" assert to_roman(7) == "vii" ass...
StarcoderdataPython
1688673
<filename>libraries/botframework-connector/botframework/connector/auth/microsoft_app_credentials.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC import requests from msal import ConfidentialClientApplication from .app_credentials import AppCredenti...
StarcoderdataPython
1709045
""" This module provides plotting support in iPython. """ from matplotlib import pyplot as plt __all__ = ["toggle_pylab", "axis_labels_from_ctype"] def toggle_pylab(fn): """ A decorator to prevent functions from opening Matplotlib windows unexpectedly when SunPy is run in interactive shells like iPython....
StarcoderdataPython
4824631
<gh_stars>100-1000 # TensorFlow Serving external dependencies that can be loaded in WORKSPACE # files. load("@org_tensorflow//third_party:repo.bzl", "tf_http_archive") load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_too...
StarcoderdataPython
123791
# Copyright 2020 HuaWei Technologies. 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 require...
StarcoderdataPython
1684869
def plot(): import numpy as np from matplotlib import pyplot as plt fig = plt.figure() x = np.ma.arange(0, 2 * np.pi, 0.4) y = np.ma.sin(x) y1 = np.sin(2 * x) y2 = np.sin(3 * x) ym1 = np.ma.masked_where(y1 > 0.5, y1) ym2 = np.ma.masked_where(y2 < -0.5, y2) lines = plt.plot(x, ...
StarcoderdataPython
3329736
<reponame>bubbleboy14/ctcomp from cantools import db, config from cantools.util import error, log from ctcomp.mint import mint, balance try: input = raw_input # py2/3 compatibility except NameError: pass class Wallet(db.TimeStampedBase): identifier = db.String() # public key outstanding = db.Float(default=0...
StarcoderdataPython
1716349
# --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.12.0 # kernelspec: # display_name: ODC # language: python # name: odc # --- # %% [markdown] # # Access Se...
StarcoderdataPython
170827
<reponame>F9Alejandro/MIDItoOBS<gh_stars>1-10 from __future__ import division from websocket import WebSocketApp from tinydb import TinyDB from sys import exit, stdout from os import path from time import time import logging, json, mido, base64 try: from dbj import dbj except ImportError: print("Could not impor...
StarcoderdataPython