The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 282
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 7327)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 282
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
require File.expand_path '../helper', __FILE__
class BacktraceTest < Test::Unit::TestCase
should "parse a backtrace into lines" do
array = [
"app/models/user.rb:13:in `magic'",
"app/controllers/users_controller.rb:8:in `index'"
]
backtrace = Airbrake::Backtrace.parse(array)
line = backtrace.lines.first
assert_equal '13', line.number
assert_equal 'app/models/user.rb', line.file
assert_equal 'magic', line.method_name
line = backtrace.lines.last
assert_equal '8', line.number
assert_equal 'app/controllers/users_controller.rb', line.file
assert_equal 'index', line.method_name
end
should "parse a string backtrace" do
string = [
"app/models/user.rb:13:in `magic'",
"app/controllers/users_controller.rb:8:in `index'"
].join("\n")
backtrace = Airbrake::Backtrace.parse(string)
line = backtrace.lines.first
assert_equal '13', line.number
assert_equal 'app/models/user.rb', line.file
assert_equal 'magic', line.method_name
line = backtrace.lines.last
assert_equal '8', line.number
assert_equal 'app/controllers/users_controller.rb', line.file
assert_equal 'index', line.method_name
end
should "parse a windows backtrace into lines" do
array = [
"C:/Program Files/Server/app/models/user.rb:13:in `magic'",
"C:/Program Files/Server/app/controllers/users_controller.rb:8:in `index'"
]
backtrace = Airbrake::Backtrace.parse(array)
line = backtrace.lines.first
assert_equal '13', line.number
assert_equal 'C:/Program Files/Server/app/models/user.rb', line.file
assert_equal 'magic', line.method_name
line = backtrace.lines.last
assert_equal '8', line.number
assert_equal 'C:/Program Files/Server/app/controllers/users_controller.rb', line.file
assert_equal 'index', line.method_name
end
should "be equal with equal lines" do
one = build_backtrace_array
two = one.dup
assert_equal Airbrake::Backtrace.parse(one), Airbrake::Backtrace.parse(two)
end
should "parse massive one-line exceptions into multiple lines" do
original_backtrace = Airbrake::Backtrace.
parse(["one:1:in `one'\n two:2:in `two'\n three:3:in `three`"])
expected_backtrace = Airbrake::Backtrace.
parse(["one:1:in `one'", "two:2:in `two'", "three:3:in `three`"])
assert_equal expected_backtrace, original_backtrace
end
context "with a project root" do
setup do
@project_root = '/some/path'
Airbrake.configure {|config| config.project_root = @project_root }
end
teardown do
reset_config
end
should "filter out the project root" do
backtrace_with_root = Airbrake::Backtrace.parse(
["#{@project_root}/app/models/user.rb:7:in `latest'",
"#{@project_root}/app/controllers/users_controller.rb:13:in `index'",
"/lib/something.rb:41:in `open'"],
:filters => default_filters)
backtrace_without_root = Airbrake::Backtrace.parse(
["[PROJECT_ROOT]/app/models/user.rb:7:in `latest'",
"[PROJECT_ROOT]/app/controllers/users_controller.rb:13:in `index'",
"/lib/something.rb:41:in `open'"])
assert_equal backtrace_without_root, backtrace_with_root
end
end
context "with a project root equals to a part of file name" do
setup do
# Heroku-like
@project_root = '/app'
Airbrake.configure {|config| config.project_root = @project_root }
end
teardown do
reset_config
end
should "filter out the project root" do
backtrace_with_root = Airbrake::Backtrace.parse(
["#{@project_root}/app/models/user.rb:7:in `latest'",
"#{@project_root}/app/controllers/users_controller.rb:13:in `index'",
"/lib/something.rb:41:in `open'"],
:filters => default_filters)
backtrace_without_root = Airbrake::Backtrace.parse(
["[PROJECT_ROOT]/app/models/user.rb:7:in `latest'",
"[PROJECT_ROOT]/app/controllers/users_controller.rb:13:in `index'",
"/lib/something.rb:41:in `open'"])
assert_equal backtrace_without_root, backtrace_with_root
end
end
context "with a blank project root" do
setup do
Airbrake.configure {|config| config.project_root = '' }
end
teardown do
reset_config
end
should "not filter line numbers with respect to any project root" do
backtrace = ["/app/models/user.rb:7:in `latest'",
"/app/controllers/users_controller.rb:13:in `index'",
"/lib/something.rb:41:in `open'"]
backtrace_with_root =
Airbrake::Backtrace.parse(backtrace, :filters => default_filters)
backtrace_without_root =
Airbrake::Backtrace.parse(backtrace)
assert_equal backtrace_without_root, backtrace_with_root
end
end
should "remove notifier trace" do
inside_notifier = ['lib/airbrake.rb:13:in `voodoo`']
outside_notifier = ['users_controller:8:in `index`']
without_inside = Airbrake::Backtrace.parse(outside_notifier)
with_inside = Airbrake::Backtrace.parse(inside_notifier + outside_notifier,
:filters => default_filters)
assert_equal without_inside, with_inside
end
should "run filters on the backtrace" do
filters = [lambda { |line| line.sub('foo', 'bar') }]
input = Airbrake::Backtrace.parse(["foo:13:in `one'", "baz:14:in `two'"],
:filters => filters)
expected = Airbrake::Backtrace.parse(["bar:13:in `one'", "baz:14:in `two'"])
assert_equal expected, input
end
def build_backtrace_array
["app/models/user.rb:13:in `magic'",
"app/controllers/users_controller.rb:8:in `index'"]
end
def default_filters
Airbrake::Configuration::DEFAULT_BACKTRACE_FILTERS
end
end
|
{
"content_hash": "5de3d5efa9f7f307ea68dc3acc594e00",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 89,
"avg_line_length": 32.430939226519335,
"alnum_prop": 0.6448040885860307,
"repo_name": "joelmahoney/discoverbps",
"id": "f1a75789506926b69a52774d8b6d4d065c2e82eb",
"size": "5870",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".gems/gems/airbrake-4.1.0/test/backtrace_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "542477"
},
{
"name": "C++",
"bytes": "10651"
},
{
"name": "CSS",
"bytes": "443717"
},
{
"name": "CoffeeScript",
"bytes": "2539"
},
{
"name": "Cucumber",
"bytes": "21933"
},
{
"name": "Groff",
"bytes": "2438"
},
{
"name": "HTML",
"bytes": "1525384"
},
{
"name": "Java",
"bytes": "692816"
},
{
"name": "JavaScript",
"bytes": "319312"
},
{
"name": "Logos",
"bytes": "2724"
},
{
"name": "Makefile",
"bytes": "45394"
},
{
"name": "Nginx",
"bytes": "6291"
},
{
"name": "PHP",
"bytes": "857"
},
{
"name": "Ragel in Ruby Host",
"bytes": "153722"
},
{
"name": "Ruby",
"bytes": "23362888"
},
{
"name": "Shell",
"bytes": "64551"
},
{
"name": "Yacc",
"bytes": "942"
},
{
"name": "eC",
"bytes": "2009"
}
]
}
|
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "0479d20783f7bf97e8e29169d4ed28e2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "4c578e9c5670a0c2eaff51690abd5644587e3dee",
"size": "198",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Sapotaceae/Micropholis/Micropholis guyanensis/ Syn. Sideroxylon rufum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
#ifndef game_state_master_h
#define game_state_master_h
#include "gpe/gpe.h"
class game_master: public gpe::program_state
{
private:
gpe::shape_rect * HUD_RECT;
int sceneWidth;
int sceneHeight;
//Path related functions/objects/variables
std::vector < gpe::game_path2d * > gamePaths;
//Scene Variables / Data
std::vector < gpe::game_scene * > gpeScenes;
gpe::game_scene * scene_current;
int scene_position;
int scene_currentId;
int pastSceneId;
std::string pastSceneName;
bool sceneWasReset;
int sceneToEnter;
//Used for handling mouse inputs
float mouse_cam_x[gpe::max_cameras_allowed];
float mouse_cam_y[gpe::max_cameras_allowed];
bool mouse_in_cam[gpe::max_cameras_allowed];
//scene_current.load_game_scene(GPE_SETTINGS_START_SCENE,'text');
//Used to keep track of game objects
std::vector < gpe::game_object_list * > game_objects; //listed version of game objects based on object types
std::vector < gpe::game_object * > game_objects_delete_list;
std::vector < gpe::game_object * > game_objects_delete_types;
std::vector < gpe::game_object * > game_objects_continuous;
bool needToDeleteObjects;
//game_objects_FAMILIES = [];
int object_count;
//Collision related variables
std::vector < int > collision_spaces_in_view;
bool spatial_grid_created;
int spatial_map_width_size;
int spatial_map_height_size;
std::vector < bool >object_collision_is_checked;
/*collisionPairA = [];
collisionPairB = []; */
int collision_pairs_total;
int parsed_objects;
int spatial_grid_x_amount;
int spatial_grid_y_amount;
int entity_collisions_hashes_checked;
int spatial_collisions_checked_counter;
//Debugging variables
int collisionsCheckedCount;
int colisionObjectLoops;
gpe::spatial_partition_controller * spatialPartitonController;
public:
int currentCameraInView;
game_master( std::string s_name = "");
~game_master();
//Main loop functions
void activate_object_families();
void apply_game_objects_logic();
void apply_game_objects_prelogic();
void apply_logic();
void init_collision_handler();
void clean_up();
void end_state();
void parse_spatial_collisions();
void process_input();
void process_scene_movement();
void render();
int remove_deleted_objects();
void scene_restart_object_info();
void start_state();
void update_spaces_in_view();
};
#endif // game_state_master_h
|
{
"content_hash": "a116e398e784370b3a5abe3c747216f3",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 116,
"avg_line_length": 32.12222222222222,
"alnum_prop": 0.5935662400553442,
"repo_name": "pawbyte/Game-Pencil-Engine",
"id": "13c5109fe39d3ee591c22b7d07ec4203e758138c",
"size": "4292",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/game_state_master.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "10522"
},
{
"name": "C++",
"bytes": "4895948"
},
{
"name": "CSS",
"bytes": "438"
},
{
"name": "HTML",
"bytes": "203"
},
{
"name": "JavaScript",
"bytes": "1663572"
},
{
"name": "Makefile",
"bytes": "10465"
},
{
"name": "Meson",
"bytes": "1375"
}
]
}
|
'use strict';
// var grunt = require('grunt');
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/
exports.dockerCompose = {
setUp: function(done) {
// setup here if necessary
done();
},
// default_options: function(test) {
// test.expect(1);
// var actual = grunt.file.read('tmp/default_options');
// var expected = grunt.file.read('test/expected/default_options');
// test.equal(actual, expected, 'should describe what the default behavior is.');
// test.done();
// },
// custom_options: function(test) {
// test.expect(1);
// var actual = grunt.file.read('tmp/custom_options');
// var expected = grunt.file.read('test/expected/custom_options');
// test.equal(actual, expected, 'should describe what the custom option(s) behavior is.');
// test.done();
// },
};
|
{
"content_hash": "c20da60a1892889803a0231c7857e558",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 94,
"avg_line_length": 29.125,
"alnum_prop": 0.6430615164520744,
"repo_name": "YogaGlo/grunt-docker-compose",
"id": "e362df472c15c7ec33674b9046726cdd3b54e8f5",
"size": "1398",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "test/dockerCompose_test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "15016"
}
]
}
|
module CropsHelper
end
|
{
"content_hash": "da79804a5adcd6b80ca9bc3a75bffc38",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 18,
"avg_line_length": 11.5,
"alnum_prop": 0.8695652173913043,
"repo_name": "zombiepaladin/smartfarm",
"id": "da6fb9a78af545549ad97587939a1a3321940aaa",
"size": "23",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/crops_helper.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "8709"
},
{
"name": "CoffeeScript",
"bytes": "33211"
},
{
"name": "JavaScript",
"bytes": "117395"
},
{
"name": "Ruby",
"bytes": "72137"
},
{
"name": "Shell",
"bytes": "13387"
}
]
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Stud. Mycol. 20: 47 (1980)
#### Original name
Sporotrichum vellereum Sacc. & Speg., 1881
### Remarks
null
|
{
"content_hash": "bb54f14e85d642312303cd93e7459cbd",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 42,
"avg_line_length": 14.923076923076923,
"alnum_prop": 0.6958762886597938,
"repo_name": "mdoering/backbone",
"id": "d298f75d0499ba651fccf12677b3ae824e5c4592",
"size": "272",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Eurotiomycetes/Onygenales/Myceliophthora/Myceliophthora vellerea/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
/**
* 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 writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.satago.tapestry5.jpa.internal;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import net.satago.tapestry5.jpa.EntityTransactionManager;
import org.apache.tapestry5.ioc.MethodAdviceReceiver;
import org.apache.tapestry5.jpa.EntityManagerManager;
import org.apache.tapestry5.jpa.JpaTransactionAdvisor;
import org.apache.tapestry5.jpa.annotations.CommitAfter;
import org.apache.tapestry5.plastic.MethodAdvice;
public class TransactionalUnitJpaTransactionAdvisor implements JpaTransactionAdvisor
{
private final Map<String, MethodAdvice> methodAdvices;
public TransactionalUnitJpaTransactionAdvisor(EntityManagerManager manager,
EntityTransactionManager transactionManager)
{
methodAdvices = new HashMap<>(manager.getEntityManagers().size());
for (Map.Entry<String, EntityManager> entry : manager.getEntityManagers().entrySet())
methodAdvices.put(entry.getKey(), new TransactionalUnitMethodAdvice(transactionManager,
entry.getKey()));
methodAdvices.put(null, new TransactionalUnitMethodAdvice(transactionManager, null));
}
@Override
public void addTransactionCommitAdvice(MethodAdviceReceiver receiver)
{
for (final Method m : receiver.getInterface().getMethods())
{
if (m.getAnnotation(CommitAfter.class) != null)
{
PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class);
receiver.adviseMethod(m,
methodAdvices.get(annotation == null ? null : annotation.unitName()));
}
}
}
}
|
{
"content_hash": "fd5a674d4e7c7fa7d35d5b1f0c3c578b",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 106,
"avg_line_length": 38.766666666666666,
"alnum_prop": 0.7312983662940671,
"repo_name": "kaosko/tapestry-jpa-transactions",
"id": "7e53651e4fc743188e99fe50c330a61809defd4b",
"size": "2326",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/satago/tapestry5/jpa/internal/TransactionalUnitJpaTransactionAdvisor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "63943"
}
]
}
|
<ul class="nav nav-sidebar" ng-repeat="element in leftNavElements | filter:searchText">
<li class="{{element.class}}"><a href="{{element.link}}">{{element.name}}</a></li>
</ul>
|
{
"content_hash": "68377ac3fdfb81f3b279ae590a8b71eb",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 87,
"avg_line_length": 45.5,
"alnum_prop": 0.6538461538461539,
"repo_name": "SVishwanathShankar/DashboardMonitoring",
"id": "fc08b77781ab68c5e1f9727c503c9970cdb8e1f9",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/left_nav/leftNav.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14895"
},
{
"name": "JavaScript",
"bytes": "469119"
}
]
}
|
package components.tables.headers.listeners;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;
import components.Librarian;
import components.tables.models.SteamGamesTableModel;
/**
* @author Naeregwen
*
*/
public class SteamGamesHeaderListener extends MouseAdapter {
Librarian librarian;
JTableHeader header;
public SteamGamesHeaderListener(Librarian librarian, JTableHeader header) {
this.librarian = librarian;
this.header = header;
}
public void mouseClicked(MouseEvent e) {
TableModel model = header.getTable().getModel();
if (model instanceof SteamGamesTableModel) {
librarian.updateSteamGamesSortMethod();
}
}
}
|
{
"content_hash": "4522dae785081cb2b430dad63c86b5a2",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 23.575757575757574,
"alnum_prop": 0.7519280205655527,
"repo_name": "Naeregwen/games-librarian",
"id": "6c2b89ce6e021ff1fb5afe3dd345b01618823b86",
"size": "1386",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/tables/headers/listeners/SteamGamesHeaderListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1106221"
}
]
}
|
#include "config.h"
#include "basic.h"
#include "cpuinfo.h"
#include "topology/pocl_topology.h"
#include "common.h"
#include "utlist.h"
#include "devices.h"
#include "pocl_util.h"
#include <pthread.h>
#include <utlist.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include "pocl_cache.h"
#include "pocl_timing.h"
#include "pocl_file_util.h"
#ifdef OCS_AVAILABLE
#include "pocl_llvm.h"
#endif
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define COMMAND_LENGTH 2048
#define WORKGROUP_STRING_LENGTH 1024
struct data {
/* Currently loaded kernel. */
cl_kernel current_kernel;
/* Loaded kernel dynamic library handle. */
lt_dlhandle current_dlhandle;
/* List of commands ready to be executed */
_cl_command_node * volatile ready_list;
/* List of commands not yet ready to be executed */
_cl_command_node * volatile command_list;
pocl_lock_t cq_lock; /* Lock for command list related operations */
};
static const cl_image_format supported_image_formats[] = {
{ CL_R, CL_SNORM_INT8 },
{ CL_R, CL_SNORM_INT16 },
{ CL_R, CL_UNORM_INT8 },
{ CL_R, CL_UNORM_INT16 },
{ CL_R, CL_UNORM_SHORT_565 },
{ CL_R, CL_UNORM_SHORT_555 },
{ CL_R, CL_UNORM_INT_101010 },
{ CL_R, CL_SIGNED_INT8 },
{ CL_R, CL_SIGNED_INT16 },
{ CL_R, CL_SIGNED_INT32 },
{ CL_R, CL_UNSIGNED_INT8 },
{ CL_R, CL_UNSIGNED_INT16 },
{ CL_R, CL_UNSIGNED_INT32 },
{ CL_R, CL_HALF_FLOAT },
{ CL_R, CL_FLOAT },
{ CL_Rx, CL_SNORM_INT8 },
{ CL_Rx, CL_SNORM_INT16 },
{ CL_Rx, CL_UNORM_INT8 },
{ CL_Rx, CL_UNORM_INT16 },
{ CL_Rx, CL_UNORM_SHORT_565 },
{ CL_Rx, CL_UNORM_SHORT_555 },
{ CL_Rx, CL_UNORM_INT_101010 },
{ CL_Rx, CL_SIGNED_INT8 },
{ CL_Rx, CL_SIGNED_INT16 },
{ CL_Rx, CL_SIGNED_INT32 },
{ CL_Rx, CL_UNSIGNED_INT8 },
{ CL_Rx, CL_UNSIGNED_INT16 },
{ CL_Rx, CL_UNSIGNED_INT32 },
{ CL_Rx, CL_HALF_FLOAT },
{ CL_Rx, CL_FLOAT },
{ CL_A, CL_SNORM_INT8 },
{ CL_A, CL_SNORM_INT16 },
{ CL_A, CL_UNORM_INT8 },
{ CL_A, CL_UNORM_INT16 },
{ CL_A, CL_UNORM_SHORT_565 },
{ CL_A, CL_UNORM_SHORT_555 },
{ CL_A, CL_UNORM_INT_101010 },
{ CL_A, CL_SIGNED_INT8 },
{ CL_A, CL_SIGNED_INT16 },
{ CL_A, CL_SIGNED_INT32 },
{ CL_A, CL_UNSIGNED_INT8 },
{ CL_A, CL_UNSIGNED_INT16 },
{ CL_A, CL_UNSIGNED_INT32 },
{ CL_A, CL_HALF_FLOAT },
{ CL_A, CL_FLOAT },
{ CL_RG, CL_SNORM_INT8 },
{ CL_RG, CL_SNORM_INT16 },
{ CL_RG, CL_UNORM_INT8 },
{ CL_RG, CL_UNORM_INT16 },
{ CL_RG, CL_UNORM_SHORT_565 },
{ CL_RG, CL_UNORM_SHORT_555 },
{ CL_RG, CL_UNORM_INT_101010 },
{ CL_RG, CL_SIGNED_INT8 },
{ CL_RG, CL_SIGNED_INT16 },
{ CL_RG, CL_SIGNED_INT32 },
{ CL_RG, CL_UNSIGNED_INT8 },
{ CL_RG, CL_UNSIGNED_INT16 },
{ CL_RG, CL_UNSIGNED_INT32 },
{ CL_RG, CL_HALF_FLOAT },
{ CL_RG, CL_FLOAT },
{ CL_RGx, CL_SNORM_INT8 },
{ CL_RGx, CL_SNORM_INT16 },
{ CL_RGx, CL_UNORM_INT8 },
{ CL_RGx, CL_UNORM_INT16 },
{ CL_RGx, CL_UNORM_SHORT_565 },
{ CL_RGx, CL_UNORM_SHORT_555 },
{ CL_RGx, CL_UNORM_INT_101010 },
{ CL_RGx, CL_SIGNED_INT8 },
{ CL_RGx, CL_SIGNED_INT16 },
{ CL_RGx, CL_SIGNED_INT32 },
{ CL_RGx, CL_UNSIGNED_INT8 },
{ CL_RGx, CL_UNSIGNED_INT16 },
{ CL_RGx, CL_UNSIGNED_INT32 },
{ CL_RGx, CL_HALF_FLOAT },
{ CL_RGx, CL_FLOAT },
{ CL_RA, CL_SNORM_INT8 },
{ CL_RA, CL_SNORM_INT16 },
{ CL_RA, CL_UNORM_INT8 },
{ CL_RA, CL_UNORM_INT16 },
{ CL_RA, CL_UNORM_SHORT_565 },
{ CL_RA, CL_UNORM_SHORT_555 },
{ CL_RA, CL_UNORM_INT_101010 },
{ CL_RA, CL_SIGNED_INT8 },
{ CL_RA, CL_SIGNED_INT16 },
{ CL_RA, CL_SIGNED_INT32 },
{ CL_RA, CL_UNSIGNED_INT8 },
{ CL_RA, CL_UNSIGNED_INT16 },
{ CL_RA, CL_UNSIGNED_INT32 },
{ CL_RA, CL_HALF_FLOAT },
{ CL_RA, CL_FLOAT },
{ CL_RGBA, CL_SNORM_INT8 },
{ CL_RGBA, CL_SNORM_INT16 },
{ CL_RGBA, CL_UNORM_INT8 },
{ CL_RGBA, CL_UNORM_INT16 },
{ CL_RGBA, CL_UNORM_SHORT_565 },
{ CL_RGBA, CL_UNORM_SHORT_555 },
{ CL_RGBA, CL_UNORM_INT_101010 },
{ CL_RGBA, CL_SIGNED_INT8 },
{ CL_RGBA, CL_SIGNED_INT16 },
{ CL_RGBA, CL_SIGNED_INT32 },
{ CL_RGBA, CL_UNSIGNED_INT8 },
{ CL_RGBA, CL_UNSIGNED_INT16 },
{ CL_RGBA, CL_UNSIGNED_INT32 },
{ CL_RGBA, CL_HALF_FLOAT },
{ CL_RGBA, CL_FLOAT },
{ CL_INTENSITY, CL_UNORM_INT8 },
{ CL_INTENSITY, CL_UNORM_INT16 },
{ CL_INTENSITY, CL_SNORM_INT8 },
{ CL_INTENSITY, CL_SNORM_INT16 },
{ CL_INTENSITY, CL_HALF_FLOAT },
{ CL_INTENSITY, CL_FLOAT },
{ CL_LUMINANCE, CL_UNORM_INT8 },
{ CL_LUMINANCE, CL_UNORM_INT16 },
{ CL_LUMINANCE, CL_SNORM_INT8 },
{ CL_LUMINANCE, CL_SNORM_INT16 },
{ CL_LUMINANCE, CL_HALF_FLOAT },
{ CL_LUMINANCE, CL_FLOAT },
{ CL_RGB, CL_UNORM_SHORT_565 },
{ CL_RGB, CL_UNORM_SHORT_555 },
{ CL_RGB, CL_UNORM_INT_101010 },
{ CL_RGBx, CL_UNORM_SHORT_565 },
{ CL_RGBx, CL_UNORM_SHORT_555 },
{ CL_RGBx, CL_UNORM_INT_101010 },
{ CL_ARGB, CL_SNORM_INT8 },
{ CL_ARGB, CL_UNORM_INT8 },
{ CL_ARGB, CL_SIGNED_INT8 },
{ CL_ARGB, CL_UNSIGNED_INT8 },
{ CL_BGRA, CL_SNORM_INT8 },
{ CL_BGRA, CL_UNORM_INT8 },
{ CL_BGRA, CL_SIGNED_INT8 },
{ CL_BGRA, CL_UNSIGNED_INT8 }
};
void
pocl_basic_init_device_ops(struct pocl_device_ops *ops)
{
ops->device_name = "basic";
ops->init_device_infos = pocl_basic_init_device_infos;
ops->probe = pocl_basic_probe;
ops->uninit = pocl_basic_uninit;
ops->init = pocl_basic_init;
ops->alloc_mem_obj = pocl_basic_alloc_mem_obj;
ops->free = pocl_basic_free;
ops->free_ptr = pocl_basic_free_ptr;
ops->read = pocl_basic_read;
ops->read_rect = pocl_basic_read_rect;
ops->write = pocl_basic_write;
ops->write_rect = pocl_basic_write_rect;
ops->copy = pocl_basic_copy;
ops->copy_rect = pocl_basic_copy_rect;
ops->fill_rect = pocl_basic_fill_rect;
ops->memfill = pocl_basic_memfill;
ops->map_mem = pocl_basic_map_mem;
ops->compile_kernel = pocl_basic_compile_kernel;
ops->unmap_mem = pocl_basic_unmap_mem;
ops->run = pocl_basic_run;
ops->run_native = pocl_basic_run_native;
ops->get_timer_value = pocl_basic_get_timer_value;
ops->get_supported_image_formats = pocl_basic_get_supported_image_formats;
ops->join = pocl_basic_join;
ops->submit = pocl_basic_submit;
ops->broadcast = pocl_basic_broadcast;
ops->notify = pocl_basic_notify;
ops->flush = pocl_basic_flush;
ops->build_hash = pocl_basic_build_hash;
}
char *
pocl_basic_build_hash (cl_device_id device)
{
char* res = calloc(1000, sizeof(char));
snprintf(res, 1000, "basic-%s", HOST_DEVICE_BUILD_HASH);
return res;
}
void
pocl_basic_init_device_infos(struct _cl_device_id* dev)
{
dev->type = CL_DEVICE_TYPE_CPU;
dev->vendor_id = 0;
dev->max_compute_units = 0;
dev->max_work_item_dimensions = 3;
SETUP_DEVICE_CL_VERSION(HOST_DEVICE_CL_VERSION_MAJOR, HOST_DEVICE_CL_VERSION_MINOR)
/*
The hard restriction will be the context data which is
stored in stack that can be as small as 8K in Linux.
Thus, there should be enough work-items alive to fill up
the SIMD lanes times the vector units, but not more than
that to avoid stack overflow and cache trashing.
*/
dev->max_work_item_sizes[0] = dev->max_work_item_sizes[1] =
dev->max_work_item_sizes[2] = dev->max_work_group_size = 1024*4;
dev->preferred_wg_size_multiple = 8;
dev->preferred_vector_width_char = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_CHAR;
dev->preferred_vector_width_short = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_SHORT;
dev->preferred_vector_width_int = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_INT;
dev->preferred_vector_width_long = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_LONG;
dev->preferred_vector_width_float = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_FLOAT;
dev->preferred_vector_width_double = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_DOUBLE;
dev->preferred_vector_width_half = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_HALF;
/* TODO: figure out what the difference between preferred and native widths are */
dev->native_vector_width_char = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_CHAR;
dev->native_vector_width_short = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_SHORT;
dev->native_vector_width_int = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_INT;
dev->native_vector_width_long = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_LONG;
dev->native_vector_width_float = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_FLOAT;
dev->native_vector_width_double = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_DOUBLE;
dev->native_vector_width_half = POCL_DEVICES_PREFERRED_VECTOR_WIDTH_HALF;
dev->max_clock_frequency = 0;
dev->address_bits = POCL_DEVICE_ADDRESS_BITS;
dev->image_support = CL_TRUE;
/* Use the minimum values until we get a more sensible
upper limit from somewhere. */
dev->max_read_image_args = dev->max_write_image_args = 128;
dev->image2d_max_width = dev->image2d_max_height = 8192;
dev->image3d_max_width = dev->image3d_max_height = dev->image3d_max_depth = 2048;
dev->image_max_buffer_size = 65536;
dev->image_max_array_size = 2048;
dev->max_samplers = 16;
dev->max_constant_args = 8;
dev->max_mem_alloc_size = 0;
dev->image_support = CL_TRUE;
dev->max_read_image_args = 128;
dev->max_write_image_args = 128;
dev->image2d_max_width = 8192;
dev->image2d_max_height = 8192;
dev->image3d_max_width = 2048;
dev->image3d_max_height = 2048;
dev->image3d_max_depth = 2048;
dev->image_max_buffer_size = 0;
dev->image_max_array_size = 0;
dev->max_samplers = 16;
dev->max_parameter_size = 1024;
dev->min_data_type_align_size = MAX_EXTENDED_ALIGNMENT; // this is in bytes
dev->mem_base_addr_align = MAX_EXTENDED_ALIGNMENT*8; // this is in bits
dev->half_fp_config = 0;
dev->single_fp_config = CL_FP_ROUND_TO_NEAREST | CL_FP_INF_NAN;
dev->double_fp_config = CL_FP_ROUND_TO_NEAREST | CL_FP_INF_NAN;
dev->global_mem_cache_type = CL_NONE;
dev->global_mem_cacheline_size = 0;
dev->global_mem_cache_size = 0;
dev->global_mem_size = 0;
dev->max_constant_buffer_size = 0;
dev->max_constant_args = 8;
dev->local_mem_type = CL_GLOBAL;
dev->local_mem_size = 0;
dev->error_correction_support = CL_FALSE;
dev->host_unified_memory = CL_TRUE;
dev->profiling_timer_resolution = pocl_timer_resolution;
dev->endian_little = !(WORDS_BIGENDIAN);
dev->available = CL_TRUE;
dev->compiler_available = CL_TRUE;
dev->spmd = CL_FALSE;
dev->execution_capabilities = CL_EXEC_KERNEL | CL_EXEC_NATIVE_KERNEL;
dev->platform = 0;
dev->parent_device = NULL;
// basic does not support partitioning
dev->max_sub_devices = 1;
dev->num_partition_properties = 1;
dev->partition_properties = calloc(dev->num_partition_properties,
sizeof(cl_device_partition_property));
dev->num_partition_types = 0;
dev->partition_type = NULL;
/* printf buffer size is meaningless for pocl, so just set it to
* the minimum value required by the spec
*/
dev->printf_buffer_size = 1024*1024 ;
dev->vendor = "pocl";
dev->profile = "FULL_PROFILE";
/* Note: The specification describes identifiers being delimited by
only a single space character. Some programs that check the device's
extension string assume this rule. Future extension additions should
ensure that there is no more than a single space between
identifiers. */
dev->should_allocate_svm = 0;
/* OpenCL 2.0 properties */
dev->svm_caps = CL_DEVICE_SVM_COARSE_GRAIN_BUFFER
| CL_DEVICE_SVM_FINE_GRAIN_BUFFER
| CL_DEVICE_SVM_ATOMICS;
/* TODO these are minimums, figure out whats a reasonable value */
dev->max_events = 1024;
dev->max_queues = 1;
dev->max_pipe_args = 16;
dev->max_pipe_active_res = 1;
dev->max_pipe_packet_size = 1024;
dev->dev_queue_pref_size = 16 * 1024;
dev->dev_queue_max_size = 256 * 1024;
dev->on_dev_queue_props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
| CL_QUEUE_PROFILING_ENABLE;
dev->on_host_queue_props = CL_QUEUE_PROFILING_ENABLE;
dev->extensions = HOST_DEVICE_EXTENSIONS;
#ifdef OCS_AVAILABLE
dev->llvm_target_triplet = OCL_KERNEL_TARGET;
#ifdef POCL_BUILT_WITH_CMAKE
dev->llvm_cpu = get_cpu_name();
#else
dev->llvm_cpu = OCL_KERNEL_TARGET_CPU;
#endif
#else
dev->llvm_cpu = NULL;
dev->llvm_target_triplet = "";
#endif
dev->has_64bit_long = 1;
dev->autolocals_to_args = 1;
}
unsigned int
pocl_basic_probe(struct pocl_device_ops *ops)
{
int env_count = pocl_device_get_env_count(ops->device_name);
/* No env specified, so pthread will be used instead of basic */
if(env_count < 0)
return 0;
return env_count;
}
void
pocl_basic_init (cl_device_id device, const char* parameters)
{
struct data *d;
static int first_basic_init = 1;
static int device_number = 0;
if (first_basic_init)
{
pocl_init_dlhandle_cache();
first_basic_init = 0;
}
device->global_mem_id = 0;
d = (struct data *) calloc (1, sizeof (struct data));
d->current_kernel = NULL;
d->current_dlhandle = 0;
device->data = d;
/* hwloc probes OpenCL device info at its initialization in case
the OpenCL extension is enabled. This causes to printout
an unimplemented property error because hwloc is used to
initialize global_mem_size which it is not yet. Just put
a nonzero there for now. */
device->global_mem_size = 1;
pocl_topology_detect_device_info(device);
POCL_INIT_LOCK (d->cq_lock);
pocl_cpuinfo_detect_device_info(device);
pocl_set_buffer_image_limits(device);
/* in case hwloc doesn't provide a PCI ID, let's generate
a vendor id that hopefully is unique across vendors. */
const char *magic = "pocl";
if (device->vendor_id == 0)
device->vendor_id =
magic[0] | magic[1] << 8 | magic[2] << 16 | magic[3] << 24;
device->vendor_id += device_number;
device_number++;
/* The basic driver represents only one "compute unit" as
it doesn't exploit multiple hardware threads. Multiple
basic devices can be still used for task level parallelism
using multiple OpenCL devices. */
device->max_compute_units = 1;
if(device->llvm_cpu && (!strcmp(device->llvm_cpu, "(unknown)")))
device->llvm_cpu = NULL;
// work-around LLVM bug where sizeof(long)=4
#ifdef _CL_DISABLE_LONG
device->has_64bit_long=0;
#endif
}
cl_int
pocl_basic_alloc_mem_obj (cl_device_id device, cl_mem mem_obj, void* host_ptr)
{
void *b = NULL;
cl_mem_flags flags = mem_obj->flags;
unsigned i;
POCL_MSG_PRINT_INFO("BASIC: alloc_mem_obj, mem %p, dev %d\n",
mem_obj, device->dev_id);
/* check if some driver has already allocated memory for this mem_obj
in our global address space, and use that*/
for (i = 0; i < mem_obj->context->num_devices; ++i)
{
if (!mem_obj->device_ptrs[i].available)
continue;
if (mem_obj->device_ptrs[i].global_mem_id == device->global_mem_id
&& mem_obj->device_ptrs[i].mem_ptr != NULL)
{
mem_obj->device_ptrs[device->dev_id].mem_ptr =
mem_obj->device_ptrs[i].mem_ptr;
POCL_MSG_PRINT_INFO("BASIC: alloc_mem_obj %p dev %d, using already allocated mem\n", mem_obj, device->dev_id);
return CL_SUCCESS;
}
}
/* memory for this global memory is not yet allocated -> do it */
if (flags & CL_MEM_USE_HOST_PTR)
{
// mem_host_ptr must be non-NULL
assert(host_ptr != NULL);
b = host_ptr;
}
else
{
b = pocl_memalign_alloc_global_mem (device, MAX_EXTENDED_ALIGNMENT,
mem_obj->size);
if (b==NULL)
return CL_MEM_OBJECT_ALLOCATION_FAILURE;
mem_obj->shared_mem_allocation_owner = device;
}
/* use this dev mem allocation as host ptr */
if (flags & CL_MEM_ALLOC_HOST_PTR && (mem_obj->mem_host_ptr == NULL))
mem_obj->mem_host_ptr = b;
if (flags & CL_MEM_COPY_HOST_PTR)
{
// mem_host_ptr must be non-NULL
assert(host_ptr != NULL);
memcpy (b, host_ptr, mem_obj->size);
}
mem_obj->device_ptrs[device->dev_id].mem_ptr = b;
return CL_SUCCESS;
}
void
pocl_basic_free (cl_device_id device, cl_mem memobj)
{
cl_mem_flags flags = memobj->flags;
/* aloocation owner executes freeing */
if (flags & CL_MEM_USE_HOST_PTR ||
memobj->shared_mem_allocation_owner != device)
return;
void* ptr = memobj->device_ptrs[device->dev_id].mem_ptr;
size_t size = memobj->size;
if (memobj->flags | CL_MEM_ALLOC_HOST_PTR)
memobj->mem_host_ptr = NULL;
pocl_free_global_mem(device, ptr, size);
}
void pocl_basic_free_ptr (cl_device_id device, void* mem_ptr)
{
/* TODO we should somehow figure out the size argument
* and call pocl_free_global_mem */
POCL_MEM_FREE(mem_ptr);
}
void
pocl_basic_read (void *data, void *host_ptr, const void *device_ptr,
size_t offset, size_t cb)
{
if (host_ptr == device_ptr)
return;
memcpy (host_ptr, (char*)device_ptr + offset, cb);
}
void
pocl_basic_write (void *data, const void *host_ptr, void *device_ptr,
size_t offset, size_t cb)
{
if (host_ptr == device_ptr)
return;
memcpy ((char*)device_ptr + offset, host_ptr, cb);
}
void
pocl_basic_run
(void *data,
_cl_command_node* cmd)
{
struct data *d;
struct pocl_argument *al;
size_t x, y, z;
unsigned i;
cl_kernel kernel = cmd->command.run.kernel;
struct pocl_context *pc = &cmd->command.run.pc;
assert (data != NULL);
d = (struct data *) data;
d->current_kernel = kernel;
void **arguments = (void**)malloc(
sizeof(void*) * (kernel->num_args + kernel->num_locals)
);
/* Process the kernel arguments. Convert the opaque buffer
pointers to real device pointers, allocate dynamic local
memory buffers, etc. */
for (i = 0; i < kernel->num_args; ++i)
{
al = &(cmd->command.run.arguments[i]);
if (kernel->arg_info[i].is_local)
{
arguments[i] = malloc (sizeof (void *));
*(void **)(arguments[i]) = pocl_memalign_alloc(MAX_EXTENDED_ALIGNMENT, al->size);
}
else if (kernel->arg_info[i].type == POCL_ARG_TYPE_POINTER)
{
/* It's legal to pass a NULL pointer to clSetKernelArguments. In
that case we must pass the same NULL forward to the kernel.
Otherwise, the user must have created a buffer with per device
pointers stored in the cl_mem. */
if (al->value == NULL)
{
arguments[i] = malloc (sizeof (void *));
*(void **)arguments[i] = NULL;
}
else
arguments[i] = &((*(cl_mem *) (al->value))->device_ptrs[cmd->device->dev_id].mem_ptr);
}
else if (kernel->arg_info[i].type == POCL_ARG_TYPE_IMAGE)
{
dev_image_t di;
fill_dev_image_t (&di, al, cmd->device);
void* devptr = pocl_memalign_alloc(MAX_EXTENDED_ALIGNMENT, sizeof(dev_image_t));
arguments[i] = malloc (sizeof (void *));
*(void **)(arguments[i]) = devptr;
pocl_basic_write (data, &di, devptr, 0, sizeof(dev_image_t));
}
else if (kernel->arg_info[i].type == POCL_ARG_TYPE_SAMPLER)
{
dev_sampler_t ds;
fill_dev_sampler_t(&ds, al);
void* devptr = pocl_memalign_alloc(MAX_EXTENDED_ALIGNMENT, sizeof(dev_sampler_t));
arguments[i] = malloc (sizeof (void *));
*(void **)(arguments[i]) = devptr;
pocl_basic_write (data, &ds, devptr, 0, sizeof(dev_sampler_t));
}
else
{
arguments[i] = al->value;
}
}
for (i = kernel->num_args;
i < kernel->num_args + kernel->num_locals;
++i)
{
al = &(cmd->command.run.arguments[i]);
arguments[i] = malloc (sizeof (void *));
*(void **)(arguments[i]) = pocl_memalign_alloc(MAX_EXTENDED_ALIGNMENT, al->size);
}
pc->local_size[0] = cmd->command.run.local_x;
pc->local_size[1] = cmd->command.run.local_y;
pc->local_size[2] = cmd->command.run.local_z;
for (z = 0; z < pc->num_groups[2]; ++z)
{
for (y = 0; y < pc->num_groups[1]; ++y)
{
for (x = 0; x < pc->num_groups[0]; ++x)
{
pc->group_id[0] = x;
pc->group_id[1] = y;
pc->group_id[2] = z;
cmd->command.run.wg (arguments, pc);
}
}
}
for (i = 0; i < kernel->num_args; ++i)
{
if (kernel->arg_info[i].is_local)
{
POCL_MEM_FREE(*(void **)(arguments[i]));
POCL_MEM_FREE(arguments[i]);
}
else if (kernel->arg_info[i].type == POCL_ARG_TYPE_IMAGE ||
kernel->arg_info[i].type == POCL_ARG_TYPE_SAMPLER)
{
POCL_MEM_FREE(*(void **)(arguments[i]));
POCL_MEM_FREE(arguments[i]);
}
else if (kernel->arg_info[i].type == POCL_ARG_TYPE_POINTER && *(void**)arguments[i] == NULL)
{
POCL_MEM_FREE(arguments[i]);
}
}
for (i = kernel->num_args;
i < kernel->num_args + kernel->num_locals;
++i)
{
POCL_MEM_FREE(*(void **)(arguments[i]));
POCL_MEM_FREE(arguments[i]);
}
free(arguments);
}
void
pocl_basic_run_native
(void *data,
_cl_command_node* cmd)
{
cmd->command.native.user_func(cmd->command.native.args);
}
void
pocl_basic_copy (void *data, const void *src_ptr, size_t src_offset,
void *__restrict__ dst_ptr, size_t dst_offset, size_t cb)
{
if (src_ptr == dst_ptr)
return;
memcpy ((char*)dst_ptr + dst_offset, (char*)src_ptr + src_offset, cb);
}
void
pocl_basic_copy_rect (void *data,
const void *__restrict const src_ptr,
void *__restrict__ const dst_ptr,
const size_t *__restrict__ const src_origin,
const size_t *__restrict__ const dst_origin,
const size_t *__restrict__ const region,
size_t const src_row_pitch,
size_t const src_slice_pitch,
size_t const dst_row_pitch,
size_t const dst_slice_pitch)
{
char const *__restrict const adjusted_src_ptr =
(char const*)src_ptr +
src_origin[0] + src_row_pitch * src_origin[1] + src_slice_pitch * src_origin[2];
char *__restrict__ const adjusted_dst_ptr =
(char*)dst_ptr +
dst_origin[0] + dst_row_pitch * dst_origin[1] + dst_slice_pitch * dst_origin[2];
size_t j, k;
/* TODO: handle overlaping regions */
for (k = 0; k < region[2]; ++k)
for (j = 0; j < region[1]; ++j)
memcpy (adjusted_dst_ptr + dst_row_pitch * j + dst_slice_pitch * k,
adjusted_src_ptr + src_row_pitch * j + src_slice_pitch * k,
region[0]);
}
void
pocl_basic_write_rect (void *data,
const void *__restrict__ const host_ptr,
void *__restrict__ const device_ptr,
const size_t *__restrict__ const buffer_origin,
const size_t *__restrict__ const host_origin,
const size_t *__restrict__ const region,
size_t const buffer_row_pitch,
size_t const buffer_slice_pitch,
size_t const host_row_pitch,
size_t const host_slice_pitch)
{
char *__restrict const adjusted_device_ptr =
(char*)device_ptr +
buffer_origin[0] + buffer_row_pitch * buffer_origin[1] + buffer_slice_pitch * buffer_origin[2];
char const *__restrict__ const adjusted_host_ptr =
(char const*)host_ptr +
host_origin[0] + host_row_pitch * host_origin[1] + host_slice_pitch * host_origin[2];
size_t j, k;
/* TODO: handle overlaping regions */
for (k = 0; k < region[2]; ++k)
for (j = 0; j < region[1]; ++j)
memcpy (adjusted_device_ptr + buffer_row_pitch * j + buffer_slice_pitch * k,
adjusted_host_ptr + host_row_pitch * j + host_slice_pitch * k,
region[0]);
}
void
pocl_basic_read_rect (void *data,
void *__restrict__ const host_ptr,
void *__restrict__ const device_ptr,
const size_t *__restrict__ const buffer_origin,
const size_t *__restrict__ const host_origin,
const size_t *__restrict__ const region,
size_t const buffer_row_pitch,
size_t const buffer_slice_pitch,
size_t const host_row_pitch,
size_t const host_slice_pitch)
{
char const *__restrict const adjusted_device_ptr =
(char const*)device_ptr +
buffer_origin[2] * buffer_slice_pitch + buffer_origin[1] * buffer_row_pitch + buffer_origin[0];
char *__restrict__ const adjusted_host_ptr =
(char*)host_ptr +
host_origin[2] * host_slice_pitch + host_origin[1] * host_row_pitch + host_origin[0];
size_t j, k;
/* TODO: handle overlaping regions */
for (k = 0; k < region[2]; ++k)
for (j = 0; j < region[1]; ++j)
memcpy (adjusted_host_ptr + host_row_pitch * j + host_slice_pitch * k,
adjusted_device_ptr + buffer_row_pitch * j + buffer_slice_pitch * k,
region[0]);
}
/* origin and region must be in original shape unlike in copy/read/write_rect()
*/
void
pocl_basic_fill_rect (void *data,
void *__restrict__ const device_ptr,
const size_t *__restrict__ const buffer_origin,
const size_t *__restrict__ const region,
size_t const buffer_row_pitch,
size_t const buffer_slice_pitch,
void *fill_pixel,
size_t pixel_size)
{
char *__restrict const adjusted_device_ptr = (char*)device_ptr
+ buffer_origin[0] * pixel_size
+ buffer_row_pitch * buffer_origin[1]
+ buffer_slice_pitch * buffer_origin[2];
size_t i, j, k;
for (k = 0; k < region[2]; ++k)
for (j = 0; j < region[1]; ++j)
for (i = 0; i < region[0]; ++i)
memcpy (adjusted_device_ptr + pixel_size * i
+ buffer_row_pitch * j
+ buffer_slice_pitch * k, fill_pixel, pixel_size);
}
void pocl_basic_memfill(void *ptr,
size_t size,
size_t offset,
const void* pattern,
size_t pattern_size)
{
size_t i;
unsigned j;
switch (pattern_size)
{
case 1:
{
uint8_t * p = (uint8_t*)ptr + offset;
for (i = 0; i < size; i++)
p[i] = *(uint8_t*)pattern;
}
break;
case 2:
{
uint16_t * p = (uint16_t*)ptr + offset;
for (i = 0; i < size; i++)
p[i] = *(uint16_t*)pattern;
}
break;
case 4:
{
uint32_t * p = (uint32_t*)ptr + offset;
for (i = 0; i < size; i++)
p[i] = *(uint32_t*)pattern;
}
break;
case 8:
{
uint64_t * p = (uint64_t*)ptr + offset;
for (i = 0; i < size; i++)
p[i] = *(uint64_t*)pattern;
}
break;
case 16:
{
uint64_t * p = (uint64_t*)ptr + offset;
for (i = 0; i < size; i++)
for (j = 0; j < 2; j++)
p[(i<<1) + j] = *((uint64_t*)pattern + j);
}
break;
case 32:
{
uint64_t * p = (uint64_t*)ptr + offset;
for (i = 0; i < size; i++)
for (j = 0; j < 4; j++)
p[(i<<2) + j] = *((uint64_t*)pattern + j);
}
break;
case 64:
{
uint64_t * p = (uint64_t*)ptr + offset;
for (i = 0; i < size; i++)
for (j = 0; j < 8; j++)
p[(i<<3) + j] = *((uint64_t*)pattern + j);
}
break;
case 128:
{
uint64_t * p = (uint64_t*)ptr + offset;
for (i = 0; i < size; i++)
for (j = 0; j < 16; j++)
p[(i<<4) + j] = *((uint64_t*)pattern + j);
}
break;
default:
assert (0 && "Invalid pattern size");
break;
}
}
void *
pocl_basic_map_mem (void *data, void *buf_ptr,
size_t offset, size_t size,
void *host_ptr)
{
/* All global pointers of the pthread/CPU device are in
the host address space already, and up to date. */
if (host_ptr != NULL) return host_ptr;
return (char*)buf_ptr + offset;
}
void* pocl_basic_unmap_mem(void *data, void *host_ptr,
void *device_start_ptr,
size_t size)
{
return host_ptr;
}
void
pocl_basic_uninit (cl_device_id device)
{
struct data *d = (struct data*)device->data;
POCL_MEM_FREE(d);
device->data = NULL;
}
cl_ulong
pocl_basic_get_timer_value (void *data)
{
return pocl_gettimemono_ns();
}
cl_int
pocl_basic_get_supported_image_formats (cl_mem_flags flags,
const cl_image_format **image_formats,
cl_uint *num_img_formats)
{
if (num_img_formats == NULL || image_formats == NULL)
return CL_INVALID_VALUE;
*num_img_formats = sizeof(supported_image_formats)/sizeof(cl_image_format);
*image_formats = supported_image_formats;
return CL_SUCCESS;
}
static void basic_command_scheduler (struct data *d)
{
_cl_command_node *node;
/* execute commands from ready list */
while ((node = d->ready_list))
{
assert (pocl_command_is_ready(node->event));
CDL_DELETE (d->ready_list, node);
pthread_mutex_unlock (&d->cq_lock);
assert (node->event->status == CL_SUBMITTED);
pocl_exec_command(node);
pthread_mutex_lock (&d->cq_lock);
}
return;
}
void
pocl_basic_submit (_cl_command_node *node, cl_command_queue cq)
{
struct data *d = node->device->data;
cl_event *event = &(node->event);
node->device->ops->compile_kernel (node, NULL, NULL);
POCL_LOCK (d->cq_lock);
POCL_UPDATE_EVENT_SUBMITTED(event);
pocl_command_push(node, &d->ready_list, &d->command_list);
basic_command_scheduler (d);
POCL_UNLOCK (d->cq_lock);
return;
}
void pocl_basic_flush (cl_device_id device, cl_command_queue cq)
{
struct data *d = (struct data*)device->data;
POCL_LOCK (d->cq_lock);
basic_command_scheduler (d);
POCL_UNLOCK (d->cq_lock);
}
/*
static void
pocl_basic_push_command (_cl_command_node *node)
{
struct data *d = (struct data*)node->device->data;
pocl_command_push(node, &d->ready_list, &d->command_list);
}
*/
void
pocl_basic_join(cl_device_id device, cl_command_queue cq)
{
struct data *d = (struct data*)device->data;
POCL_LOCK (d->cq_lock);
basic_command_scheduler (d);
POCL_UNLOCK (d->cq_lock);
return;
}
void
pocl_basic_notify (cl_device_id device, cl_event event)
{
struct data *d = (struct data*)device->data;
_cl_command_node * volatile node = event->command;
POCL_LOCK_OBJ (event);
if (!(node->ready) && pocl_command_is_ready(node->event))
{
node->ready = 1;
POCL_UNLOCK_OBJ (event);
if (node->event->status == CL_SUBMITTED)
{
POCL_LOCK (d->cq_lock);
CDL_DELETE (d->command_list, node);
CDL_PREPEND (d->ready_list, node);
basic_command_scheduler (d);
POCL_UNLOCK (d->cq_lock);
}
return;
}
POCL_UNLOCK_OBJ (event);
}
void
pocl_basic_broadcast (cl_event event)
{
pocl_broadcast (event);
}
void
pocl_basic_compile_kernel (_cl_command_node *cmd, cl_kernel kernel, cl_device_id device)
{
if (cmd != NULL && cmd->type == CL_COMMAND_NDRANGE_KERNEL)
pocl_check_dlhandle_cache (cmd);
}
|
{
"content_hash": "d53124830d58a672cd164bbe7dbb3df7",
"timestamp": "",
"source": "github",
"line_count": 1032,
"max_line_length": 120,
"avg_line_length": 30.773255813953487,
"alnum_prop": 0.5866553309402356,
"repo_name": "dsandersimgtec/pocl",
"id": "ac57c88cb607bc215b107661abffdf1d97253df2",
"size": "33050",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/CL/devices/basic/basic.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "4768296"
},
{
"name": "C++",
"bytes": "2365570"
},
{
"name": "CMake",
"bytes": "161372"
},
{
"name": "LLVM",
"bytes": "6590"
},
{
"name": "Makefile",
"bytes": "13386"
},
{
"name": "Mathematica",
"bytes": "4824"
},
{
"name": "Python",
"bytes": "58978"
},
{
"name": "Shell",
"bytes": "101022"
}
]
}
|
from BeautifulSoup import BeautifulSoup
import os
class HtmlParser:
def __init__(self, letters):
self.urlList = []
self.letters = letters
'''
Check if script list is cached, else scrape for it
'''
def getScriptLinks(self):
if self.urlList:
return self.urlList
else:
print "Scraping for script links..."
self.scrapeForScriptLinks()
return self.urlList
def scrapeForScriptLinks(self):
alphaFileList = ["alphabetical" + char + ".txt" for char in self.letters]
for alpha in alphaFileList:
with open("data/raw/temp/" + alpha, 'r') as f:
soup = BeautifulSoup(f.read())
print "Getting all script urls in " + alpha
for a in soup.findAll('a', href=True):
if "Movie Script" in a['href']:
#Remove first '/' for formatting reasons
temp = a['href'][1:].replace("Movie Scripts", "scripts")
temp = temp.replace(" Script", "")
temp = temp.replace(":", "")
self.urlList.append(temp)
|
{
"content_hash": "c040079fbb604dd2e1c4123af1616e95",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 81,
"avg_line_length": 37.15625,
"alnum_prop": 0.5239697224558453,
"repo_name": "inikdom/chat-data",
"id": "7e365481d44c523afdb49461629abebaa453bff0",
"size": "1189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "htmlparser.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "7711"
}
]
}
|
import Button from './src/button.vue'
module.exports = Button
|
{
"content_hash": "096838c8e9ee4c09e62a3195cea2dbed",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 21,
"alnum_prop": 0.746031746031746,
"repo_name": "webcoding/element",
"id": "0e32c62fae43b8b5ccd06eefe718ecd3fe5cfee9",
"size": "64",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/button/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "53757"
},
{
"name": "Smarty",
"bytes": "486"
},
{
"name": "Vue",
"bytes": "59974"
}
]
}
|
package com.coolweather.app.db;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class CoolWeatherOpenHelper extends SQLiteOpenHelper {
/**
* Province表建表语句
*/
public static final String CREATE_PROVINCE = "create table Province (" +
"id integer primary key autoincrement," +
"province_name text," +
"province_code text)";
/**
* City表建表语句
*/
public static final String CREATE_CITY = "create table City (" +
"id integer primary key autoincrement," +
"city_name text," +
"city_code text," +
"province_id integer)";
/**
* County表建表语句
*/
public static final String CREATE_COUNTY = "create table County (" +
"id integer primary key autoincrement," +
"county_name text," +
"county_code text," +
"weather_code text," +
"city_id integer)";
public CoolWeatherOpenHelper(Context context, String name,
CursorFactory factory, int version) {
super(context, name, factory, version);
}
public CoolWeatherOpenHelper(Context context, String name,
CursorFactory factory, int version,
DatabaseErrorHandler errorHandler) {
super(context, name, factory, version, errorHandler);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_PROVINCE); //创建Province表
db.execSQL(CREATE_CITY); //创建City表
db.execSQL(CREATE_COUNTY); //创建County表
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
}
|
{
"content_hash": "784b0642493197345156c0f39482b9bd",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 75,
"avg_line_length": 27.383333333333333,
"alnum_prop": 0.7273280584297017,
"repo_name": "leiqingqiang/coolweather",
"id": "98a77ff2e963881f4784e00f7cfedbc5b4f3c973",
"size": "1691",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/coolweather/app/db/CoolWeatherOpenHelper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "32028"
}
]
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.apimanagement.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.Head;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.apimanagement.fluent.GatewayApisClient;
import com.azure.resourcemanager.apimanagement.fluent.models.ApiContractInner;
import com.azure.resourcemanager.apimanagement.models.ApiCollection;
import com.azure.resourcemanager.apimanagement.models.AssociationContract;
import com.azure.resourcemanager.apimanagement.models.GatewayApisGetEntityTagResponse;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in GatewayApisClient. */
public final class GatewayApisClientImpl implements GatewayApisClient {
/** The proxy service used to perform REST calls. */
private final GatewayApisService service;
/** The service client containing this operation class. */
private final ApiManagementClientImpl client;
/**
* Initializes an instance of GatewayApisClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
GatewayApisClientImpl(ApiManagementClientImpl client) {
this.service =
RestProxy.create(GatewayApisService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ApiManagementClientGatewayApis to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ApiManagementClientG")
private interface GatewayApisService {
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement"
+ "/service/{serviceName}/gateways/{gatewayId}/apis")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ApiCollection>> listByService(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serviceName") String serviceName,
@PathParam("gatewayId") String gatewayId,
@QueryParam("$filter") String filter,
@QueryParam("$top") Integer top,
@QueryParam("$skip") Integer skip,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Head(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement"
+ "/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<GatewayApisGetEntityTagResponse> getEntityTag(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serviceName") String serviceName,
@PathParam("gatewayId") String gatewayId,
@PathParam("apiId") String apiId,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement"
+ "/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ApiContractInner>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serviceName") String serviceName,
@PathParam("gatewayId") String gatewayId,
@PathParam("apiId") String apiId,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") AssociationContract parameters,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement"
+ "/service/{serviceName}/gateways/{gatewayId}/apis/{apiId}")
@ExpectedResponses({200, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Void>> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serviceName") String serviceName,
@PathParam("gatewayId") String gatewayId,
@PathParam("apiId") String apiId,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ApiCollection>> listByServiceNext(
@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param filter | Field | Usage | Supported operators | Supported functions
* |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq,
* ne, gt, lt | substringof, contains, startswith, endswith |</br>.
* @param top Number of records to return.
* @param skip Number of records to skip.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ApiContractInner>> listByServiceSinglePageAsync(
String resourceGroupName, String serviceName, String gatewayId, String filter, Integer top, Integer skip) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.listByService(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
filter,
top,
skip,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context))
.<PagedResponse<ApiContractInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param filter | Field | Usage | Supported operators | Supported functions
* |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq,
* ne, gt, lt | substringof, contains, startswith, endswith |</br>.
* @param top Number of records to return.
* @param skip Number of records to skip.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ApiContractInner>> listByServiceSinglePageAsync(
String resourceGroupName,
String serviceName,
String gatewayId,
String filter,
Integer top,
Integer skip,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByService(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
filter,
top,
skip,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param filter | Field | Usage | Supported operators | Supported functions
* |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq,
* ne, gt, lt | substringof, contains, startswith, endswith |</br>.
* @param top Number of records to return.
* @param skip Number of records to skip.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ApiContractInner> listByServiceAsync(
String resourceGroupName, String serviceName, String gatewayId, String filter, Integer top, Integer skip) {
return new PagedFlux<>(
() -> listByServiceSinglePageAsync(resourceGroupName, serviceName, gatewayId, filter, top, skip),
nextLink -> listByServiceNextSinglePageAsync(nextLink));
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ApiContractInner> listByServiceAsync(
String resourceGroupName, String serviceName, String gatewayId) {
final String filter = null;
final Integer top = null;
final Integer skip = null;
return new PagedFlux<>(
() -> listByServiceSinglePageAsync(resourceGroupName, serviceName, gatewayId, filter, top, skip),
nextLink -> listByServiceNextSinglePageAsync(nextLink));
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param filter | Field | Usage | Supported operators | Supported functions
* |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq,
* ne, gt, lt | substringof, contains, startswith, endswith |</br>.
* @param top Number of records to return.
* @param skip Number of records to skip.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<ApiContractInner> listByServiceAsync(
String resourceGroupName,
String serviceName,
String gatewayId,
String filter,
Integer top,
Integer skip,
Context context) {
return new PagedFlux<>(
() -> listByServiceSinglePageAsync(resourceGroupName, serviceName, gatewayId, filter, top, skip, context),
nextLink -> listByServiceNextSinglePageAsync(nextLink, context));
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ApiContractInner> listByService(
String resourceGroupName, String serviceName, String gatewayId) {
final String filter = null;
final Integer top = null;
final Integer skip = null;
return new PagedIterable<>(listByServiceAsync(resourceGroupName, serviceName, gatewayId, filter, top, skip));
}
/**
* Lists a collection of the APIs associated with a gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param filter | Field | Usage | Supported operators | Supported functions
* |</br>|-------------|-------------|-------------|-------------|</br>| name | filter | ge, le, eq,
* ne, gt, lt | substringof, contains, startswith, endswith |</br>.
* @param top Number of records to return.
* @param skip Number of records to skip.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<ApiContractInner> listByService(
String resourceGroupName,
String serviceName,
String gatewayId,
String filter,
Integer top,
Integer skip,
Context context) {
return new PagedIterable<>(
listByServiceAsync(resourceGroupName, serviceName, gatewayId, filter, top, skip, context));
}
/**
* Checks that API entity specified by identifier is associated with the Gateway entity.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<GatewayApisGetEntityTagResponse> getEntityTagWithResponseAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (apiId == null) {
return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.getEntityTag(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
apiId,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Checks that API entity specified by identifier is associated with the Gateway entity.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<GatewayApisGetEntityTagResponse> getEntityTagWithResponseAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (apiId == null) {
return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.getEntityTag(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
apiId,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context);
}
/**
* Checks that API entity specified by identifier is associated with the Gateway entity.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> getEntityTagAsync(String resourceGroupName, String serviceName, String gatewayId, String apiId) {
return getEntityTagWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId)
.flatMap((GatewayApisGetEntityTagResponse res) -> Mono.empty());
}
/**
* Checks that API entity specified by identifier is associated with the Gateway entity.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void getEntityTag(String resourceGroupName, String serviceName, String gatewayId, String apiId) {
getEntityTagAsync(resourceGroupName, serviceName, gatewayId, apiId).block();
}
/**
* Checks that API entity specified by identifier is associated with the Gateway entity.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public GatewayApisGetEntityTagResponse getEntityTagWithResponse(
String resourceGroupName, String serviceName, String gatewayId, String apiId, Context context) {
return getEntityTagWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId, context).block();
}
/**
* Adds an API to the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param parameters Association entity details.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return aPI details along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ApiContractInner>> createOrUpdateWithResponseAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId, AssociationContract parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (apiId == null) {
return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters != null) {
parameters.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
apiId,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
parameters,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Adds an API to the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param parameters Association entity details.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return aPI details along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<ApiContractInner>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String serviceName,
String gatewayId,
String apiId,
AssociationContract parameters,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (apiId == null) {
return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters != null) {
parameters.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
apiId,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
parameters,
accept,
context);
}
/**
* Adds an API to the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param parameters Association entity details.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return aPI details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<ApiContractInner> createOrUpdateAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId, AssociationContract parameters) {
return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId, parameters)
.flatMap(
(Response<ApiContractInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Adds an API to the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return aPI details on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<ApiContractInner> createOrUpdateAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId) {
final AssociationContract parameters = null;
return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId, parameters)
.flatMap(
(Response<ApiContractInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Adds an API to the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return aPI details.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public ApiContractInner createOrUpdate(
String resourceGroupName, String serviceName, String gatewayId, String apiId) {
final AssociationContract parameters = null;
return createOrUpdateAsync(resourceGroupName, serviceName, gatewayId, apiId, parameters).block();
}
/**
* Adds an API to the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param parameters Association entity details.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return aPI details along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ApiContractInner> createOrUpdateWithResponse(
String resourceGroupName,
String serviceName,
String gatewayId,
String apiId,
AssociationContract parameters,
Context context) {
return createOrUpdateWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId, parameters, context)
.block();
}
/**
* Deletes the specified API from the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> deleteWithResponseAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (apiId == null) {
return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
apiId,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes the specified API from the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> deleteWithResponseAsync(
String resourceGroupName, String serviceName, String gatewayId, String apiId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serviceName == null) {
return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));
}
if (gatewayId == null) {
return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
}
if (apiId == null) {
return Mono.error(new IllegalArgumentException("Parameter apiId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
resourceGroupName,
serviceName,
gatewayId,
apiId,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context);
}
/**
* Deletes the specified API from the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(String resourceGroupName, String serviceName, String gatewayId, String apiId) {
return deleteWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes the specified API from the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String serviceName, String gatewayId, String apiId) {
deleteAsync(resourceGroupName, serviceName, gatewayId, apiId).block();
}
/**
* Deletes the specified API from the specified Gateway.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param gatewayId Gateway entity identifier. Must be unique in the current API Management service instance. Must
* not have value 'managed'.
* @param apiId API identifier. Must be unique in the current API Management service instance.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> deleteWithResponse(
String resourceGroupName, String serviceName, String gatewayId, String apiId, Context context) {
return deleteWithResponseAsync(resourceGroupName, serviceName, gatewayId, apiId, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ApiContractInner>> listByServiceNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByServiceNext(nextLink, this.client.getEndpoint(), accept, context))
.<PagedResponse<ApiContractInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return paged API list representation along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<ApiContractInner>> listByServiceNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByServiceNext(nextLink, this.client.getEndpoint(), accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}
|
{
"content_hash": "8fdad8573b2bfc2dac40039d3561b51d",
"timestamp": "",
"source": "github",
"line_count": 1073,
"max_line_length": 120,
"avg_line_length": 50.619757688723205,
"alnum_prop": 0.6417380097578937,
"repo_name": "Azure/azure-sdk-for-java",
"id": "55d567e790b25574aa371a070925381409db079b",
"size": "54315",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/GatewayApisClientImpl.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8762"
},
{
"name": "Bicep",
"bytes": "15055"
},
{
"name": "CSS",
"bytes": "7676"
},
{
"name": "Dockerfile",
"bytes": "2028"
},
{
"name": "Groovy",
"bytes": "3237482"
},
{
"name": "HTML",
"bytes": "42090"
},
{
"name": "Java",
"bytes": "432409546"
},
{
"name": "JavaScript",
"bytes": "36557"
},
{
"name": "Jupyter Notebook",
"bytes": "95868"
},
{
"name": "PowerShell",
"bytes": "737517"
},
{
"name": "Python",
"bytes": "240542"
},
{
"name": "Scala",
"bytes": "1143898"
},
{
"name": "Shell",
"bytes": "18488"
},
{
"name": "XSLT",
"bytes": "755"
}
]
}
|
#import <Foundation/Foundation.h>
#import "CloudWatchAlarmHistoryItem.h"
#import "CloudWatchResponseUnmarshaller.h"
#ifdef AWS_MULTI_FRAMEWORK
#import <AWSRuntime/AmazonValueUnmarshaller.h>
#import <AWSRuntime/AmazonBoolValueUnmarshaller.h>
#else
#import "../AmazonValueUnmarshaller.h"
#import "../AmazonBoolValueUnmarshaller.h"
#endif
/**
* Alarm History Item Unmarshaller
*/
@interface CloudWatchAlarmHistoryItemUnmarshaller:CloudWatchResponseUnmarshaller {
CloudWatchAlarmHistoryItem *response;
}
@property (nonatomic, readonly) CloudWatchAlarmHistoryItem *response;
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict;
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
@end
|
{
"content_hash": "db3c32c99b57cf417f18e229950d3e45",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 187,
"avg_line_length": 30.8,
"alnum_prop": 0.8095238095238095,
"repo_name": "morizotter/AWSCloudWatchSample",
"id": "9086d868bcccb8f8061e3b55d6b13b6e5bb6ad17",
"size": "1508",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "aws-ios-sdk-1.7.1/src/include/CloudWatch/CloudWatchAlarmHistoryItemUnmarshaller.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "708"
},
{
"name": "CSS",
"bytes": "18960"
},
{
"name": "Objective-C",
"bytes": "10544838"
},
{
"name": "Shell",
"bytes": "3903"
},
{
"name": "TeX",
"bytes": "276926"
}
]
}
|
/**
* @fileOverview
* Test the DictionaryTransformStream class.
*/
var fs = require('fs');
var path = require('path');
var _ = require('underscore');
var expect = require('chai').expect;
var DictionaryTransformStream = require('../../src/util/dictionaryTransformStream');
describe('DictionaryTransformStream', function () {
var dictionaryTransformStream;
var readStream;
var expectedDictionary;
var expectedDictionaryArray;
var dictionary;
var objectModeOptions = {
wordDelimiter: /[\s\.,!\?<>]+/,
acceptanceRegExp: /^[a-z\-]{5,14}$/,
rejectionRegExp: /-{2,}|-.*-/,
duplicateCacheSize: Infinity
};
var nonObjectModeOptions = _.extend({
objectMode: false
}, objectModeOptions);
before(function () {
// The expected outcome is stashed as a file, so load it for comparison.
var dictionaryPath = path.join(__dirname, '../text/mobyDickChapter30Dictionary.txt');
expectedDictionary = fs.readFileSync(dictionaryPath, 'utf8');
expectedDictionaryArray = expectedDictionary.trim().split('\n');
});
describe('with objectMode = true', function () {
beforeEach(function () {
dictionary = [];
dictionaryTransformStream = new DictionaryTransformStream(objectModeOptions);
readStream = fs.createReadStream(path.join(__dirname, '../text/mobyDickChapter30.txt'));
readStream.pipe(dictionaryTransformStream);
});
it('in non-flowing mode', function (done) {
dictionaryTransformStream.on('readable', function () {
var word;
do {
// Don't pass a size value to read, as an object stream always returns
// one object from a read request.
word = dictionaryTransformStream.read();
if (word) {
dictionary.push(word);
}
} while (word);
});
dictionaryTransformStream.on('finish', function () {
expect(dictionary.sort()).to.deep.equal(expectedDictionaryArray);
done();
});
});
it('in flowing mode', function (done) {
dictionaryTransformStream.on('data', function (word) {
dictionary.push(word);
});
dictionaryTransformStream.on('finish', function () {
expect(dictionary.sort()).to.deep.equal(expectedDictionaryArray);
done();
});
});
});
describe('with objectMode = false', function () {
beforeEach(function () {
dictionary = '';
dictionaryTransformStream = new DictionaryTransformStream(nonObjectModeOptions);
readStream = fs.createReadStream(path.join(__dirname, '../text/mobyDickChapter30.txt'));
readStream.pipe(dictionaryTransformStream);
});
it('in non-flowing mode', function (done) {
dictionaryTransformStream.on('readable', function () {
var word;
do {
// Don't pass a size value to read, as an object stream always returns
// one object from a read request.
word = dictionaryTransformStream.read();
if (word) {
dictionary = dictionary += word;
}
} while (word);
});
dictionaryTransformStream.on('finish', function () {
dictionary = dictionary.trim().split('\n');
expect(dictionary.sort()).to.deep.equal(expectedDictionaryArray);
done();
});
});
it('in flowing mode', function (done) {
dictionaryTransformStream.on('data', function (word) {
dictionary = dictionary += word;
});
dictionaryTransformStream.on('finish', function () {
dictionary = dictionary.trim().split('\n');
expect(dictionary.sort()).to.deep.equal(expectedDictionaryArray);
done();
});
});
});
});
|
{
"content_hash": "4db40d1d555b1c9beed8c13a875390df",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 94,
"avg_line_length": 30.520661157024794,
"alnum_prop": 0.6244245870565935,
"repo_name": "exratione/four-word-phrase",
"id": "3edf681c99184475977a3c601fd2c5559a5349cd",
"size": "3693",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/util/dictionaryTransformStream.test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "53682"
},
{
"name": "Shell",
"bytes": "4101"
}
]
}
|
package org.apache.geronimo.management;
/**
* Represents the JSR-77 type with the same name
*
* @version $Rev$ $Date$
*/
public interface EJBModule extends J2EEModule {
/**
* A list of EJBs included in this EJB JAR
* @see "JSR77.3.9.1.1"
* @return the ObjectNames of the EJBs in this EJB JAR
*/
String[] getEJBs();
}
|
{
"content_hash": "1cb4a339441b563ff767ce650f9aea73",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 58,
"avg_line_length": 21.875,
"alnum_prop": 0.6371428571428571,
"repo_name": "vibe13/geronimo",
"id": "62266eb51d5e1a01b5d15d73f0e81070da005dd5",
"size": "980",
"binary": false,
"copies": "2",
"ref": "refs/heads/1.0",
"path": "modules/management/src/java/org/apache/geronimo/management/EJBModule.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "29627"
},
{
"name": "CSS",
"bytes": "47972"
},
{
"name": "HTML",
"bytes": "838469"
},
{
"name": "Java",
"bytes": "8975734"
},
{
"name": "JavaScript",
"bytes": "906"
},
{
"name": "Shell",
"bytes": "32814"
},
{
"name": "XSLT",
"bytes": "4468"
}
]
}
|
using Simulation.Models.Coordinates;
namespace Simulation.Models.Spectrum
{
/// <summary>
/// The SimulationParameters class.
/// </summary>
public class SimulationResult
{
/// <summary>
/// Gets or sets the cross section extinction.
/// </summary>
/// <value>
/// The cross section extinction.
/// </value>
public double CrossSectionExtinction { get; set; }
/// <summary>
/// Gets or sets the cross section absorption.
/// </summary>
/// <value>
/// The cross section absorption.
/// </value>
public double CrossSectionAbsorption { get; set; }
/// <summary>
/// Gets or sets the effective cross section extinction.
/// </summary>
/// <value>
/// The effective cross section extinction.
/// </value>
public double EffectiveCrossSectionExtinction { get; set; }
/// <summary>
/// Gets or sets the effective cross section absorption.
/// </summary>
/// <value>
/// The effective cross section absorption.
/// </value>
public double EffectiveCrossSectionAbsorption { get; set; }
/// <summary>
/// Gets or sets the polarization.
/// </summary>
/// <value>
/// The polarization.
/// </value>
public ComplexCoordinate[] Polarization { get; set; }
/// <summary>
/// Gets or sets the electric field.
/// </summary>
/// <value>
/// The electric field.
/// </value>
public ComplexCoordinate[] ElectricField { get; set; }
}
}
|
{
"content_hash": "598a90a9fd51561df2f56b783149369c",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 67,
"avg_line_length": 29.982758620689655,
"alnum_prop": 0.515813686026452,
"repo_name": "ToniaDemchuk/EMSimulation",
"id": "1bfeb6568cfcd0e8f47c61845cdee0687d930207",
"size": "1741",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Simulation.Models/Spectrum/SimulationResult.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "316509"
},
{
"name": "Gnuplot",
"bytes": "1390"
}
]
}
|
package net.kuujo.copycat.raft.server.storage;
import net.kuujo.copycat.io.BufferInput;
import net.kuujo.copycat.io.BufferOutput;
import net.kuujo.copycat.io.serializer.SerializeWith;
import net.kuujo.copycat.io.serializer.Serializer;
import net.kuujo.copycat.io.storage.Entry;
import net.kuujo.copycat.raft.Command;
import net.kuujo.copycat.util.ReferenceManager;
/**
* Command entry.
*
* @author <a href="http://github.com/kuujo">Jordan Halterman</a>
*/
@SerializeWith(id=306)
public class CommandEntry extends OperationEntry<CommandEntry> {
private long sequence;
private Command command;
public CommandEntry(ReferenceManager<Entry<?>> referenceManager) {
super(referenceManager);
}
/**
* Returns the command sequence number.
*
* @return The command sequence number.
*/
public long getSequence() {
return sequence;
}
/**
* Sets the command sequence number.
*
* @param sequence The command sequence number.
* @return The command entry.
*/
public CommandEntry setSequence(long sequence) {
this.sequence = sequence;
return this;
}
/**
* Returns the command.
*
* @return The command.
*/
public Command getCommand() {
return command;
}
/**
* Sets the command.
*
* @param command The command.
* @return The command entry.
*/
public CommandEntry setCommand(Command command) {
this.command = command;
return this;
}
@Override
public void writeObject(BufferOutput buffer, Serializer serializer) {
super.writeObject(buffer, serializer);
buffer.writeLong(sequence);
serializer.writeObject(command, buffer);
}
@Override
public void readObject(BufferInput buffer, Serializer serializer) {
super.readObject(buffer, serializer);
sequence = buffer.readLong();
command = serializer.readObject(buffer);
}
@Override
public String toString() {
return String.format("%s[index=%d, term=%d, session=%d, sequence=%d, timestamp=%d, command=%s]", getClass().getSimpleName(), getIndex(), getTerm(), getSession(), getSequence(), getTimestamp(), command);
}
}
|
{
"content_hash": "8e8f03b88024461b1284b6deb7ecbed2",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 206,
"avg_line_length": 24.823529411764707,
"alnum_prop": 0.7,
"repo_name": "arnonmoscona/copycat",
"id": "d63ba7e1a468a9046dd6512bb0d7e13281e175ee",
"size": "2720",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/src/main/java/net/kuujo/copycat/raft/server/storage/CommandEntry.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1325035"
},
{
"name": "Shell",
"bytes": "321"
}
]
}
|
package FP256BN
// Modulus types
const NOT_SPECIAL int = 0
const PSEUDO_MERSENNE int = 1
const MONTGOMERY_FRIENDLY int = 2
const GENERALISED_MERSENNE int = 3
const NEGATOWER int = 0
const POSITOWER int = 1
// Modulus details
const MODBITS uint = 256 /* Number of bits in Modulus */
const PM1D2 uint = 1 /* Modulus mod 8 */
const MODTYPE int = NOT_SPECIAL //NOT_SPECIAL
const QNRI int = 0 // Fp2 QNR
const TOWER int = NEGATOWER // Tower type
const FEXCESS int32=((int32(1)<<24)-1)
// Modulus Masks
const OMASK Chunk = ((Chunk(-1)) << (MODBITS % BASEBITS))
const TBITS uint = MODBITS % BASEBITS // Number of active bits in top word
const TMASK Chunk = (Chunk(1) << TBITS) - 1
|
{
"content_hash": "0ac2ca9ee9e15b7b2ac47c63118572ce",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 74,
"avg_line_length": 25.48148148148148,
"alnum_prop": 0.6991279069767442,
"repo_name": "binhn/fabric",
"id": "1337ac054b415fb801cb16f6c7995a5b2323f0f3",
"size": "2146",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/github.com/hyperledger/fabric-amcl/core/FP256BN/CONFIG_FIELD.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "3347"
},
{
"name": "Go",
"bytes": "10606010"
},
{
"name": "Makefile",
"bytes": "15699"
},
{
"name": "Ruby",
"bytes": "1037"
},
{
"name": "Shell",
"bytes": "55845"
}
]
}
|
package git4idea.history;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.annotate.ShowAllAffectedGenericAction;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.history.*;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.vcs.history.VcsHistoryProviderEx;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
import com.intellij.util.Processor;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.vcsUtil.VcsUtil;
import git4idea.GitFileRevision;
import git4idea.GitRevisionNumber;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.changes.GitChangeUtils;
import git4idea.config.GitExecutableValidator;
import git4idea.history.browser.SHAHash;
import git4idea.history.wholeTree.SelectRevisionInGitLogAction;
import git4idea.repo.GitRepository;
import git4idea.repo.GitRepositoryManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Collections;
import java.util.List;
/**
* Git history provider implementation
*/
public class GitHistoryProvider implements VcsHistoryProviderEx, VcsCacheableHistorySessionFactory<Boolean, VcsAbstractHistorySession>,
VcsBaseRevisionAdviser {
private static final Logger log = Logger.getInstance(GitHistoryProvider.class.getName());
@NotNull private final Project myProject;
public GitHistoryProvider(@NotNull Project project) {
myProject = project;
}
public VcsDependentHistoryComponents getUICustomization(final VcsHistorySession session, JComponent forShortcutRegistration) {
return VcsDependentHistoryComponents.createOnlyColumns(new ColumnInfo[0]);
}
public AnAction[] getAdditionalActions(Runnable refresher) {
return new AnAction[] {
ShowAllAffectedGenericAction.getInstance(),
ActionManager.getInstance().getAction("Vcs.CopyRevisionNumberAction"),
new SelectRevisionInGitLogAction() };
}
public boolean isDateOmittable() {
return false;
}
@Nullable
public String getHelpId() {
return null;
}
@Override
public FilePath getUsedFilePath(VcsAbstractHistorySession session) {
return null;
}
@Override
public Boolean getAddinionallyCachedData(VcsAbstractHistorySession session) {
return null;
}
@Override
public VcsAbstractHistorySession createFromCachedData(Boolean aBoolean,
@NotNull List<VcsFileRevision> revisions,
@NotNull FilePath filePath,
VcsRevisionNumber currentRevision) {
return createSession(filePath, revisions, currentRevision);
}
@Nullable
public VcsHistorySession createSessionFor(final FilePath filePath) throws VcsException {
List<VcsFileRevision> revisions = null;
try {
revisions = GitHistoryUtils.history(myProject, filePath);
} catch (VcsException e) {
GitVcs.getInstance(myProject).getExecutableValidator().showNotificationOrThrow(e);
}
return createSession(filePath, revisions, null);
}
private VcsAbstractHistorySession createSession(final FilePath filePath, final List<VcsFileRevision> revisions,
@Nullable final VcsRevisionNumber number) {
return new VcsAbstractHistorySession(revisions, number) {
@Nullable
protected VcsRevisionNumber calcCurrentRevisionNumber() {
try {
return GitHistoryUtils.getCurrentRevision(myProject, filePath, "HEAD");
}
catch (VcsException e) {
// likely the file is not under VCS anymore.
if (log.isDebugEnabled()) {
log.debug("Unable to retrieve the current revision number", e);
}
return null;
}
}
public HistoryAsTreeProvider getHistoryAsTreeProvider() {
return null;
}
@Override
public VcsHistorySession copy() {
return createSession(filePath, getRevisionList(), getCurrentRevisionNumber());
}
};
}
@Nullable
@Override
public VcsFileRevision getLastRevision(FilePath filePath) throws VcsException {
List<VcsFileRevision> history = GitHistoryUtils.history(myProject, filePath, "--max-count=1");
if (history == null || history.isEmpty()) return null;
return history.get(0);
}
@Override
public boolean getBaseVersionContent(FilePath filePath,
Processor<CharSequence> processor,
final String beforeVersionId,
List<String> warnings)
throws VcsException {
if (StringUtil.isEmptyOrSpaces(beforeVersionId) || filePath.getVirtualFile() == null) return false;
// apply if base revision id matches revision
final VirtualFile root = GitUtil.getGitRoot(filePath);
if (root == null) return false;
final SHAHash shaHash = GitChangeUtils.commitExists(myProject, root, beforeVersionId, null, "HEAD");
if (shaHash == null) {
throw new VcsException("Can not apply patch to " + filePath.getPath() + ".\nCan not find revision '" + beforeVersionId + "'.");
}
final ContentRevision content = GitVcs.getInstance(myProject).getDiffProvider()
.createFileContent(new GitRevisionNumber(shaHash.getValue()), filePath.getVirtualFile());
if (content == null) {
throw new VcsException("Can not load content of '" + filePath.getPath() + "' for revision '" + shaHash.getValue() + "'");
}
return ! processor.process(content.getContent());
}
public void reportAppendableHistory(final FilePath path, final VcsAppendableHistorySessionPartner partner) throws VcsException {
final VcsAbstractHistorySession emptySession = createSession(path, Collections.<VcsFileRevision>emptyList(), null);
partner.reportCreatedEmptySession(emptySession);
VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject);
String[] additionalArgs = vcsConfiguration.LIMIT_HISTORY ?
new String[] { "--max-count=" + vcsConfiguration.MAXIMUM_HISTORY_ROWS } :
ArrayUtil.EMPTY_STRING_ARRAY;
final GitExecutableValidator validator = GitVcs.getInstance(myProject).getExecutableValidator();
GitHistoryUtils.history(myProject, refreshPath(path), null, new Consumer<GitFileRevision>() {
public void consume(GitFileRevision gitFileRevision) {
partner.acceptRevision(gitFileRevision);
}
}, new Consumer<VcsException>() {
public void consume(VcsException e) {
if (validator.checkExecutableAndNotifyIfNeeded()) {
partner.reportException(e);
}
}
}, additionalArgs);
}
/**
* Refreshes the IO File inside this FilePath to let it survive moves.
*/
@NotNull
private static FilePath refreshPath(@NotNull FilePath path) {
VirtualFile virtualFile = path.getVirtualFile();
if (virtualFile == null) {
return path;
}
return VcsUtil.getFilePath(virtualFile);
}
public boolean supportsHistoryForDirectories() {
return true;
}
@Override
public DiffFromHistoryHandler getHistoryDiffHandler() {
return new GitDiffFromHistoryHandler(myProject);
}
@Override
public boolean canShowHistoryFor(@NotNull VirtualFile file) {
GitRepositoryManager manager = GitUtil.getRepositoryManager(myProject);
GitRepository repository = manager.getRepositoryForFile(file);
return repository != null && !repository.isFresh();
}
}
|
{
"content_hash": "8541d5bfece64b2d431fc2b0164dc088",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 135,
"avg_line_length": 37.779342723004696,
"alnum_prop": 0.7126879582453088,
"repo_name": "ol-loginov/intellij-community",
"id": "13db4a2bc8ab0f651d3c07a86651000653e012cf",
"size": "8647",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "plugins/git4idea/src/git4idea/history/GitHistoryProvider.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "63659"
},
{
"name": "C",
"bytes": "214180"
},
{
"name": "C#",
"bytes": "1538"
},
{
"name": "C++",
"bytes": "190028"
},
{
"name": "CSS",
"bytes": "108843"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Cucumber",
"bytes": "14382"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "FLUX",
"bytes": "57"
},
{
"name": "Groff",
"bytes": "35232"
},
{
"name": "Groovy",
"bytes": "2220132"
},
{
"name": "HTML",
"bytes": "1676451"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "JFlex",
"bytes": "166194"
},
{
"name": "Java",
"bytes": "146810567"
},
{
"name": "JavaScript",
"bytes": "125292"
},
{
"name": "Kotlin",
"bytes": "225413"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "85968"
},
{
"name": "Objective-C",
"bytes": "28634"
},
{
"name": "Perl6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6570"
},
{
"name": "Python",
"bytes": "21486998"
},
{
"name": "Ruby",
"bytes": "1213"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "63323"
},
{
"name": "Smalltalk",
"bytes": "64"
},
{
"name": "TeX",
"bytes": "60798"
},
{
"name": "TypeScript",
"bytes": "6152"
},
{
"name": "XSLT",
"bytes": "113040"
}
]
}
|
[](https://github.com/tantalic/cistatus/releases) [](https://goreportcard.com/report/github.com/tantalic/cistatus) [](https://github.com/tantalic/cistatus/blob/master/LICENSE)
## License
Copyright 2017 Kevin Stock
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 writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
{
"content_hash": "311d544ddcf75f416a5a96b95dff25a7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 384,
"avg_line_length": 55.88235294117647,
"alnum_prop": 0.7852631578947369,
"repo_name": "tantalic/cistatus",
"id": "ad3d03ecc7cf1b970fbfd305fcc8a9badc0f2053",
"size": "1003",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "26091"
},
{
"name": "Makefile",
"bytes": "3235"
}
]
}
|
var express = require('express'),
bodyParser = require('body-parser'),
low = require('lowdb');
var app = express(),
db = low('data/data.json');
db._.mixin(require('underscore-db'));
app.use(bodyParser.json());
app.use(express.static('public'));
app.use('/libs', express.static('node_modules'));
var usersRouter = require('./routers/usersRouter')(db);
var todosRouter = require('./routers/todosRouter')(db);
var eventsRouter = require('./routers/eventsRouter')(db);
var categoriesRouter = require('./routers/categoriesRouter')(db);
require('./utils/authorized-user')(app, db);
app.use('/api/users', usersRouter);
app.use('/api/todos', todosRouter);
app.use('/api/events', eventsRouter);
app.use('/api/categories', categoriesRouter);
var port = process.env.PORT || 3013;
app.listen(port, function() {
console.log('Server is running at http://localhost:' + port);
});
|
{
"content_hash": "9b8841d17235f6b48dc8b82d5e43047d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 65,
"avg_line_length": 28.451612903225808,
"alnum_prop": 0.691609977324263,
"repo_name": "Didexe/JavaScript-Applications",
"id": "43cc7acdf51ce626a881275d37737fe847f81415",
"size": "882",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Workshops/Workshops-2017/Workshop_25-April-2017_Self_Manager/app.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "16130"
},
{
"name": "CSS",
"bytes": "123222"
},
{
"name": "CoffeeScript",
"bytes": "32213"
},
{
"name": "HTML",
"bytes": "170552"
},
{
"name": "JavaScript",
"bytes": "4134734"
}
]
}
|
require 'rails/railtie'
module Chops
class Railtie < Rails::Railtie
config.after_initialize do |app|
app.config.paths.add 'app/view_objects', eager_load: true
end
initializer 'chops.setup_action_controller' do |app|
ActiveSupport.on_load :action_controller do
Chops.setup_action_controller self
end
end
end
end
|
{
"content_hash": "3ce7f53f76af4189be3813d6123289e3",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 63,
"avg_line_length": 23.933333333333334,
"alnum_prop": 0.6908077994428969,
"repo_name": "tomasv/chops",
"id": "3b32ef2be34e2d2af98ffb41a19cadf9fac874c7",
"size": "359",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/chops/railtie.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "2321"
}
]
}
|
require 'spec_helper'
describe ProjectPhoto do
it { should belong_to(:project) }
end
|
{
"content_hash": "150ede3242eed1a36b4072cd1f764b3f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 35,
"avg_line_length": 17.6,
"alnum_prop": 0.7386363636363636,
"repo_name": "ReliefHub/reliefhub",
"id": "366fb7437f3007c2b78dd744177424d655413b5f",
"size": "88",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/models/project_photo_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "7047"
},
{
"name": "Ruby",
"bytes": "101645"
}
]
}
|
/*
This file is part of Highlight.
Highlight is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Highlight is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Highlight. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CHAR_CODES
#define CHAR_CODES
#ifdef _WIN32
#define AUML_LC 228
#define OUML_LC 246
#define UUML_LC 252
#define AUML_UC 196
#define OUML_UC 214
#define UUML_UC 220
#define AACUTE_LC 225
#define EACUTE_LC 233
#define OACUTE_LC 243
#define UACUTE_LC 250
#define AACUTE_UC 193
#define EACUTE_UC 201
#define OACUTE_UC 211
#define UACUTE_UC 218
#define AGRAVE_LC 224
#define EGRAVE_LC 232
#define OGRAVE_LC 242
#define UGRAVE_LC 249
#define AGRAVE_UC 192
#define EGRAVE_UC 200
#define OGRAVE_UC 210
#define UGRAVE_UC 217
#define SZLIG 223
#else
#define AUML_LC 164
#define OUML_LC 182
#define UUML_LC 188
#define AUML_UC 132
#define OUML_UC 150
#define UUML_UC 156
#define AACUTE_LC 161
#define EACUTE_LC 169
#define OACUTE_LC 179
#define UACUTE_LC 186
#define AACUTE_UC 129
#define EACUTE_UC 137
#define OACUTE_UC 147
#define UACUTE_UC 154
#define AGRAVE_LC 160
#define EGRAVE_LC 168
#define OGRAVE_LC 178
#define UGRAVE_LC 185
#define AGRAVE_UC 128
#define EGRAVE_UC 136
#define OGRAVE_UC 146
#define UGRAVE_UC 153
#define SZLIG 159
#endif
#endif
|
{
"content_hash": "0e809b7ab03e968364330cc6f85cbfbb",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 68,
"avg_line_length": 18.473118279569892,
"alnum_prop": 0.7630966239813737,
"repo_name": "ahmadaghazadeh/FastBook",
"id": "d112b7553eb30f8f3a01d0a8de645411d89f0f16",
"size": "2118",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/FastBookCreator/highlight/src/include/charcodes.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "106"
},
{
"name": "Batchfile",
"bytes": "140"
},
{
"name": "C",
"bytes": "6666"
},
{
"name": "C#",
"bytes": "1301935"
},
{
"name": "C++",
"bytes": "982062"
},
{
"name": "CSS",
"bytes": "232032"
},
{
"name": "HTML",
"bytes": "77330"
},
{
"name": "Inno Setup",
"bytes": "6611"
},
{
"name": "Java",
"bytes": "1059"
},
{
"name": "JavaScript",
"bytes": "1836162"
},
{
"name": "Lua",
"bytes": "164681"
},
{
"name": "Makefile",
"bytes": "18315"
},
{
"name": "PHP",
"bytes": "38882"
},
{
"name": "Perl",
"bytes": "5400"
},
{
"name": "Python",
"bytes": "4376"
},
{
"name": "QMake",
"bytes": "3361"
},
{
"name": "Tcl",
"bytes": "542"
}
]
}
|
[](https://travis-ci.org/mgreensmith/berksfiler)
[](http://badge.fury.io/rb/berksfiler)
Berksfiler programatically generates [Berkshelf](http://berkshelf.com/) Berksfiles for your [Chef](https://www.chef.io/) cookbooks.
## Overview
This tool is designed to help people who have monolithic cookbook repositories generate Berksfiles for their cookbooks. Keeping Berksfiles up to date can be a demanding task, especially when they reference a number of other local cookbooks.
Berksfiler can iterate through a `/cookbooks` directory and generate a Berksfile for each cookbook in that directory (with configurable exclusions), or it can generate Berksfiles for individual cookbooks.
It runs `knife deps` to determine the full dependency tree for a cookbook. It then generates a Berksfile that includes all local cookbook dependencies, as well as any cookbooks with manually-specified options or sources.
You can configure Berksfiler to include specific cookbook dependencies in every Berksfile. This is useful for cookbook dependencies that are used for local development (eg. `chef-solo-search`) but are not appropriate to include in the metadata of your cookbooks.
## Requirements
- A working `knife` toolchain
## Installation
$ gem install berksfiler
## Configuration
Berksfiler expects a `.berksfiler.yml` in your working directory (the root of your chef repository).
Heres an example of a config file with all available options:
```yaml
---
# A relative or absolute path to the location of your cookbooks directory.
cookbooks_root: cookbooks
# An array of cookbooks to include in every Berksfile
# even if cookbook metadata doesn't specify them
common_cookbooks:
- chef-solo-search
# An array of local cookbooks for which we should not attempt
# to overwrite the existing Berksfile. Useful for 3rd party
# or vendored cookbooks for which we don't want to overwrite
# an existing Berksfile.
excluded_cookbooks:
- jenkins
# An array of hashes that specify options for cookbooks.
# All array elements must have string keys 'name' and 'options'.
# Options will be appended verbatim to the `cookbook` line
# in the Berksfile for the named cookbook.
cookbook_options:
-
name: artifact
options: "git: 'git://github.com/CozyCo/artifact-cookbook.git'"
```
## Usage
```
Usage: berksfiler [options]
-b, --books COOKBOOK,COOKBOOK Cookbooks for which to generate Berksfiles
-c, --config-file FILE Path to config file
-h, --help Displays Help
```
Running `berksfiler` without the `--books` option will cause Berksfiler to generate
new Berksfiles for all cookbooks in the configured `cookbooks_root` directory,
except for any cookbooks specified in the `excluded_cookbooks` config option.
Berksfiler should be run from the root of your Chef repository.
## Example
Given a set of local cookbooks:
```
/cookbooks
/foo
/bar
/baz
```
assuming `/cookbooks/foo/metadata.rb` contains the following dependencies:
```
depends 'artifact'
depends 'bar'
depends 'baz'
depends 'some_public_cookbook'
depends 'some_other_public_cookbook'
```
and using the example config file displayed above, running:
```
$ berksfiler -b foo
```
would create or update the file `/cookbooks/foo/Berksfile` with the following content:
```
# Autogenerated by Berksfiler, do not edit
source 'https://supermarket.chef.io'
metadata
# Common dependencies for all Berksfiles
cookbook 'chef-solo-search'
# Dependencies of this cookbook
cookbook 'artifact', git: 'git://github.com/CozyCo/artifact-cookbook.git'
cookbook 'bar', path: '../bar'
cookbook 'baz', path: '../baz'
```
## Copyright
Copyright (c) 2014-2015 Matt Greensmith and Cozy Services Ltd. See [LICENSE.txt](LICENSE.txt) for
further details.
|
{
"content_hash": "c9983f0c9c4f964b465e317a3f85f060",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 262,
"avg_line_length": 33.7304347826087,
"alnum_prop": 0.7566383088424852,
"repo_name": "mgreensmith/berksfiler",
"id": "d133225da475b6690e1d2f9c63fa27a6a4771fe9",
"size": "3893",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "8403"
}
]
}
|
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/asset/v1/asset_service.proto
namespace Google\Cloud\Asset\V1;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* ## IAM policy analysis query message.
*
* Generated from protobuf message <code>google.cloud.asset.v1.IamPolicyAnalysisQuery</code>
*/
class IamPolicyAnalysisQuery extends \Google\Protobuf\Internal\Message
{
/**
* Required. The relative name of the root asset. Only resources and IAM policies within
* the scope will be analyzed.
* This can only be an organization number (such as "organizations/123"), a
* folder number (such as "folders/123"), a project ID (such as
* "projects/my-project-id"), or a project number (such as "projects/12345").
* To know how to get organization id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* To know how to get folder or project id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
*
* Generated from protobuf field <code>string scope = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*/
protected $scope = '';
/**
* Optional. Specifies a resource for analysis.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.ResourceSelector resource_selector = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
protected $resource_selector = null;
/**
* Optional. Specifies an identity for analysis.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.IdentitySelector identity_selector = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
protected $identity_selector = null;
/**
* Optional. Specifies roles or permissions for analysis. This is optional.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.AccessSelector access_selector = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
protected $access_selector = null;
/**
* Optional. The query options.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.Options options = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
protected $options = null;
/**
* Optional. The hypothetical context for IAM conditions evaluation.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.ConditionContext condition_context = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
protected $condition_context = null;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string $scope
* Required. The relative name of the root asset. Only resources and IAM policies within
* the scope will be analyzed.
* This can only be an organization number (such as "organizations/123"), a
* folder number (such as "folders/123"), a project ID (such as
* "projects/my-project-id"), or a project number (such as "projects/12345").
* To know how to get organization id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* To know how to get folder or project id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
* @type \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ResourceSelector $resource_selector
* Optional. Specifies a resource for analysis.
* @type \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\IdentitySelector $identity_selector
* Optional. Specifies an identity for analysis.
* @type \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\AccessSelector $access_selector
* Optional. Specifies roles or permissions for analysis. This is optional.
* @type \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\Options $options
* Optional. The query options.
* @type \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ConditionContext $condition_context
* Optional. The hypothetical context for IAM conditions evaluation.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
parent::__construct($data);
}
/**
* Required. The relative name of the root asset. Only resources and IAM policies within
* the scope will be analyzed.
* This can only be an organization number (such as "organizations/123"), a
* folder number (such as "folders/123"), a project ID (such as
* "projects/my-project-id"), or a project number (such as "projects/12345").
* To know how to get organization id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* To know how to get folder or project id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
*
* Generated from protobuf field <code>string scope = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @return string
*/
public function getScope()
{
return $this->scope;
}
/**
* Required. The relative name of the root asset. Only resources and IAM policies within
* the scope will be analyzed.
* This can only be an organization number (such as "organizations/123"), a
* folder number (such as "folders/123"), a project ID (such as
* "projects/my-project-id"), or a project number (such as "projects/12345").
* To know how to get organization id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
* To know how to get folder or project id, visit [here
* ](https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects).
*
* Generated from protobuf field <code>string scope = 1 [(.google.api.field_behavior) = REQUIRED];</code>
* @param string $var
* @return $this
*/
public function setScope($var)
{
GPBUtil::checkString($var, True);
$this->scope = $var;
return $this;
}
/**
* Optional. Specifies a resource for analysis.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.ResourceSelector resource_selector = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ResourceSelector|null
*/
public function getResourceSelector()
{
return isset($this->resource_selector) ? $this->resource_selector : null;
}
public function hasResourceSelector()
{
return isset($this->resource_selector);
}
public function clearResourceSelector()
{
unset($this->resource_selector);
}
/**
* Optional. Specifies a resource for analysis.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.ResourceSelector resource_selector = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
* @param \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ResourceSelector $var
* @return $this
*/
public function setResourceSelector($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ResourceSelector::class);
$this->resource_selector = $var;
return $this;
}
/**
* Optional. Specifies an identity for analysis.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.IdentitySelector identity_selector = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\IdentitySelector|null
*/
public function getIdentitySelector()
{
return isset($this->identity_selector) ? $this->identity_selector : null;
}
public function hasIdentitySelector()
{
return isset($this->identity_selector);
}
public function clearIdentitySelector()
{
unset($this->identity_selector);
}
/**
* Optional. Specifies an identity for analysis.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.IdentitySelector identity_selector = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
* @param \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\IdentitySelector $var
* @return $this
*/
public function setIdentitySelector($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\IdentitySelector::class);
$this->identity_selector = $var;
return $this;
}
/**
* Optional. Specifies roles or permissions for analysis. This is optional.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.AccessSelector access_selector = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\AccessSelector|null
*/
public function getAccessSelector()
{
return isset($this->access_selector) ? $this->access_selector : null;
}
public function hasAccessSelector()
{
return isset($this->access_selector);
}
public function clearAccessSelector()
{
unset($this->access_selector);
}
/**
* Optional. Specifies roles or permissions for analysis. This is optional.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.AccessSelector access_selector = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
* @param \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\AccessSelector $var
* @return $this
*/
public function setAccessSelector($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\AccessSelector::class);
$this->access_selector = $var;
return $this;
}
/**
* Optional. The query options.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.Options options = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\Options|null
*/
public function getOptions()
{
return isset($this->options) ? $this->options : null;
}
public function hasOptions()
{
return isset($this->options);
}
public function clearOptions()
{
unset($this->options);
}
/**
* Optional. The query options.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.Options options = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
* @param \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\Options $var
* @return $this
*/
public function setOptions($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\Options::class);
$this->options = $var;
return $this;
}
/**
* Optional. The hypothetical context for IAM conditions evaluation.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.ConditionContext condition_context = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ConditionContext|null
*/
public function getConditionContext()
{
return isset($this->condition_context) ? $this->condition_context : null;
}
public function hasConditionContext()
{
return isset($this->condition_context);
}
public function clearConditionContext()
{
unset($this->condition_context);
}
/**
* Optional. The hypothetical context for IAM conditions evaluation.
*
* Generated from protobuf field <code>.google.cloud.asset.v1.IamPolicyAnalysisQuery.ConditionContext condition_context = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
* @param \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ConditionContext $var
* @return $this
*/
public function setConditionContext($var)
{
GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\IamPolicyAnalysisQuery\ConditionContext::class);
$this->condition_context = $var;
return $this;
}
}
|
{
"content_hash": "77456532f8093b3ec3cb43c2da0b17f7",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 177,
"avg_line_length": 40.692789968652036,
"alnum_prop": 0.6722132347276789,
"repo_name": "googleapis/synthtool",
"id": "3928962cf5af5811c810bc42ffd7a716749db7a4",
"size": "12981",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/fixtures/php/php_asset/src/owl-bot-staging/Asset/V1/proto/src/Google/Cloud/Asset/V1/IamPolicyAnalysisQuery.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "801"
},
{
"name": "Dockerfile",
"bytes": "13507"
},
{
"name": "HTML",
"bytes": "6091"
},
{
"name": "Java",
"bytes": "21963"
},
{
"name": "JavaScript",
"bytes": "3390"
},
{
"name": "Jinja",
"bytes": "85687"
},
{
"name": "Python",
"bytes": "396495"
},
{
"name": "Shell",
"bytes": "67707"
}
]
}
|
<?php
/* @var $this SiteController */
$this->pageTitle = app()->name . ' - About';
$this->breadcrumbs = array(
'About',
);
?>
<h1>About</h1>
<p>This is a "static" page. You may change the content of this page
by updating the file <code><?php echo __FILE__; ?></code>.</p>
|
{
"content_hash": "d73c69ad560a393d95a9ecc2eae535b7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 23.5,
"alnum_prop": 0.6028368794326241,
"repo_name": "gutschik/yii-app-test-for-travis",
"id": "ab89c1e51727b20af9bbbef496c479804f7cb7f0",
"size": "282",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "app/views/site/pages/about.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "153588"
},
{
"name": "JavaScript",
"bytes": "3528"
},
{
"name": "PHP",
"bytes": "125136"
},
{
"name": "Ruby",
"bytes": "538"
},
{
"name": "Shell",
"bytes": "2404"
}
]
}
|
package pub.androidrubick.litevideo.panel;
import android.net.Uri;
import java.util.Map;
import pub.androidrubick.litevideo.panel.util.LiteUtil;
/**
* 封装被{@link VideoController}管理的视频
* ({@link VideoView})及其资源等信息
*
* <p/>
*
* Created by Yin Yong on 15/12/27.
*/
public class VideoToken {
/**
* 视频信息中存储的当前设置的视频资源地址
*/
public Uri uri;
public Map<String, String> headers;
/**
* 视频组件{@link VideoView}
*/
public final VideoView video;
/**
* 管理该视频信息的{@link VideoController}
*/
public final VideoController controller;
public VideoToken(VideoController controller, VideoView video) {
this.controller = controller;
this.video = video;
}
/**
* <code>uri</code>是否跟当前信息中的{@link #uri}一致。
*
* <br/>
*
* 由于获取和设置可能在不同线程,增加同步关键字
*/
public synchronized boolean matchUri(Uri uri) {
return LiteUtil.equals(this.uri, uri);
}
/**
* <code>uri</code>是否跟当前信息中的{@link #uri}一致
*
* <br/>
*
* 由于可能获取和设置在不同线程,增加同步关键字
*/
public synchronized boolean matchUri(String uri) {
return (null == this.uri && null == uri) || LiteUtil.equals(String.valueOf(this.uri), uri);
}
/**
* 判断是否仍在被使用着
*/
public boolean using() {
return controller.videoAttached(video);
}
@Override
public boolean equals(Object o) {
if (!(o instanceof VideoToken)) {
return false;
}
VideoToken another = (VideoToken) o;
return LiteUtil.equals(this.video, another.video)
&&
LiteUtil.equals(this.controller, another.controller);
}
@Override
public String toString() {
return "video token { " + video + " }";
}
// a token just like a real video, can do whatever videos are able
// all possible internal states
/*package*/ static final int STATE_ERROR = -1;
/*package*/ static final int STATE_IDLE = 0;
/*package*/ static final int STATE_PREPARING = 1;
/*package*/ static final int STATE_PREPARED = 2;
/*package*/ static final int STATE_PLAYING = 3;
/*package*/ static final int STATE_PAUSED = 4;
/*package*/ static final int STATE_PLAYBACK_COMPLETED = 5;
// mCurrentState is a VideoView object's current state.
// mTargetState is the state that a method caller intends to reach.
// For instance, regardless the VideoView object's current state,
// calling pause() intends to bring the object to a target state
// of STATE_PAUSED.
/*package*/ int currentState = STATE_IDLE;
/*package*/ int targetState = STATE_IDLE;
// temp data start
/*package*/ int seekWhenPrepared;
/**
* 视频信息中当前设置的视频资源的本地资源地址
*/
/*package*/ Uri playUri;
/*package*/ VideoControlCallback stateCb;
// temp data end
/**
* 判断是否在可以播放的状态
*/
/*package*/ boolean isInPlaybackState() {
return (currentState != STATE_ERROR &&
currentState != STATE_IDLE &&
currentState != STATE_PREPARING);
}
/**
* 更新信息
*
* <br/>
*
* 由于获取和设置可能在不同线程,增加同步关键字
*/
/*package*/ synchronized void setVideoURI(Uri uri, Map<String, String> headers) {
this.headers = headers;
if (!matchUri(uri)) { // 如果URL不一样
this.uri = uri;
this.playUri = null;
}
}
}
|
{
"content_hash": "877b677572bdae8ea5c968f6526b89c4",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 99,
"avg_line_length": 25.246376811594203,
"alnum_prop": 0.5812284730195177,
"repo_name": "bblue000/lite-video",
"id": "00f7e296d846cff88d7a0aa1c562cbd49ad89160",
"size": "3862",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "simple-video-panel/src/main/java/pub/androidrubick/litevideo/panel/VideoToken.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "141617"
}
]
}
|
<?php $user_id=$this->session->userdata('id');?>
<div class="page-content-wrapper ">
<div class="container">
<div class="row">
<div class="col-12">
<div class="card m-b-20">
<div class="card-block">
<h4>Reset Password </h4><br>
<?php foreach($users_view AS $res){ }
?>
<form action="" method="post" id="form_id">
<div class="row">
<div class="col-md-12">
<div class="form-group row">
<div class="col-md-3">Old Password <span class="error">*</span></div>
<div class="col-md-3">
<input type="password" class="form-control" name="old_password" id="old_password" value="">
</div>
<div class="col-md-3">
<span toggle="#old_password" class="fa fa-fw fa-eye-slash field-icon old_password"></span>
</div>
</div>
<div class="form-group row">
<div class="col-md-3">New Password <span class="error">*</span></div>
<div class="col-md-3">
<input type="password" class="form-control" name="new_password" id="new_password" value="">
</div>
<div class="col-md-3">
<span toggle="#new_password" class="fa fa-fw fa-eye-slash field-icon new_password"></span>
</div>
</div>
<div class="form-group row">
<div class="col-md-3">Confirm New Password <span class="error">*</span></div>
<div class="col-md-3">
<input type="password" class="form-control" name="confrim_password" id="confrim_password" value="">
</div>
<div class="col-md-3">
<span toggle="#confrim_password" class="fa fa-fw fa-eye-slash field-icon confrim_password"></span>
</div>
</div>
<div class="form-group row">
<div class="col-md-3"></div>
<div class="col-md-3">
<input type="submit" class="btn btn-success" value="Save">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
.txt_label{
}
.txt_value{
color: #f71010;
font-size: 15px;
font-weight: 600;
}
.bor{
border: 1px solid #000;
padding-top: 10px;
}
</style>
<script>
$(document).ready(function () {
$('#form_id').validate({
rules: {
old_password: {
required: true, minlength : 6,maxlength:12,
remote: {
url: "<?php echo base_url(); ?>users/check_password_match/<?php echo $user_id; ?>",
type: "post"
}
},
new_password: {
required: true, minlength : 6,maxlength:12,
},
confrim_password: {
required: true,
equalTo : '[name="new_password"]',
}
},
messages: {
old_password: {
required:"Please enter old password!",minlength:"Password should be minimum of 6 characters",maxlength:"Password should not be more than 12 characters",
remote: "Old Password Doesn't Match!"
},
new_password: {
required:"Please enter new password!",minlength:"Password should be minimum of 6 characters",maxlength:"Password should not be more than 12 characters",
},
confrim_password: {
required: "You should confirm your password!",
notEqualTo: "Password Should Match"
}
},
submitHandler: function(form) {
$.ajax({
url: "<?php echo base_url(); ?>users/change_password",
type: 'POST',
data: $('#form_id').serialize(),
dataType: "json",
success: function(response) {
var stats=response.status;
if (stats=="success") {
swal('Password reset successfully')
window.setTimeout(function () {
location.href = "<?php echo base_url(); ?>adminlogin/dashboard";
}, 1000);
}else{
$('#res_otp').html(response.msg)
}
}
});
}
});
});
$(".old_password").click(function() {
$(this).toggleClass("fa-eye-slash fa-eye");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
$(".new_password").click(function() {
$(this).toggleClass("fa-eye-slash fa-eye");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
$(".confrim_password").click(function() {
$(this).toggleClass("fa-eye-slash fa-eye");
var input = $($(this).attr("toggle"));
if (input.attr("type") == "password") {
input.attr("type", "text");
} else {
input.attr("type", "password");
}
});
</script>
|
{
"content_hash": "f73debbff0c2528eea07ea04aaadafbb",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 160,
"avg_line_length": 35.24050632911393,
"alnum_prop": 0.4552801724137931,
"repo_name": "kamalhappysanz/heyla",
"id": "0a967b8ca0374909cc426c3b53bc971c797e04ac",
"size": "5568",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/users/update_password.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "360583"
},
{
"name": "HTML",
"bytes": "8515300"
},
{
"name": "Hack",
"bytes": "23978"
},
{
"name": "JavaScript",
"bytes": "893548"
},
{
"name": "PHP",
"bytes": "3411844"
}
]
}
|
''' Provide a Request handler that lists the application (if more than one)
or (if only one) redirects to the route of that applications.
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External imports
from tornado import gen
from tornado.web import RequestHandler
# Bokeh imports
#-----------------------------------------------------------------------------
# Globals and constants
#-----------------------------------------------------------------------------
__all__ = (
'RootHandler',
)
#-----------------------------------------------------------------------------
# General API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Dev API
#-----------------------------------------------------------------------------
class RootHandler(RequestHandler):
''' Implements a custom Tornado handler to display the available applications
If only one application it redirects to that application route
'''
def initialize(self, *args, **kw):
self.applications = kw["applications"]
self.prefix = kw["prefix"]
self.index = kw["index"]
self.use_redirect = kw["use_redirect"]
@gen.coroutine
def get(self, *args, **kwargs):
prefix = "" if self.prefix is None else self.prefix
if self.use_redirect and len(self.applications) == 1:
app_names = list(self.applications.keys())
redirect_to = prefix + app_names[0]
self.redirect(redirect_to)
else:
index = "app_index.html" if self.index is None else self.index
self.render(index, prefix=prefix, items=sorted(self.applications.keys()))
#-----------------------------------------------------------------------------
# Private API
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
|
{
"content_hash": "6032ab3a20d86f710de487d734ccaadc",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 85,
"avg_line_length": 36.2,
"alnum_prop": 0.3756906077348066,
"repo_name": "timsnyder/bokeh",
"id": "419a52dcdfb465f29942b1f170dc2887e5a4cefe",
"size": "2865",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "bokeh/server/views/root_handler.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1442"
},
{
"name": "CSS",
"bytes": "24877"
},
{
"name": "Dockerfile",
"bytes": "4099"
},
{
"name": "HTML",
"bytes": "54062"
},
{
"name": "JavaScript",
"bytes": "27797"
},
{
"name": "Makefile",
"bytes": "886"
},
{
"name": "PowerShell",
"bytes": "713"
},
{
"name": "Python",
"bytes": "3827067"
},
{
"name": "Roff",
"bytes": "495"
},
{
"name": "Shell",
"bytes": "9953"
},
{
"name": "TypeScript",
"bytes": "2145262"
}
]
}
|
package com.github.jvmgo.instructions.math;
import com.github.jvmgo.instructions.base.NoOperandsInstruction;
import com.github.jvmgo.rtda.Frame;
import com.github.jvmgo.rtda.OperandStack;
public class idiv extends NoOperandsInstruction {
@Override
public int getOpCode() {
return 0x6c;
}
@Override
public void execute(Frame frame) throws Exception {
OperandStack operandStack = frame.getOperandStack();
int v2 = operandStack.popInt();
int v1 = operandStack.popInt();
if (v2 == 0) {
throw new ArithmeticException("java.lang.ArithmeticException: / by zero");
}
operandStack.pushInt(v1 / v2);
}
}
|
{
"content_hash": "836d163a9933b4b2a1442e736c2c76c9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 86,
"avg_line_length": 29.956521739130434,
"alnum_prop": 0.6763425253991292,
"repo_name": "zxh0/jvmgo-book",
"id": "1bb5304aea6c80a9c1ed808ace1510d5b7c27823",
"size": "689",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v1/code/java/jvmgo_java/ch05/src/main/java/com/github/jvmgo/instructions/math/idiv.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "1150025"
},
{
"name": "Java",
"bytes": "340414"
},
{
"name": "Shell",
"bytes": "3789"
}
]
}
|
namespace linesk
{
partial class FormMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButtonNewGame = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonChangePlayersName = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonGameSetting = new System.Windows.Forms.ToolStripButton();
this.toolStripButtonExit = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButtonNewGame,
this.toolStripButtonChangePlayersName,
this.toolStripButtonGameSetting,
this.toolStripButtonExit});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(810, 25);
this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1";
//
// toolStripButtonNewGame
//
this.toolStripButtonNewGame.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripButtonNewGame.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonNewGame.Image")));
this.toolStripButtonNewGame.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButtonNewGame.Name = "toolStripButtonNewGame";
this.toolStripButtonNewGame.Size = new System.Drawing.Size(73, 22);
this.toolStripButtonNewGame.Text = "Новая игра";
this.toolStripButtonNewGame.Click += new System.EventHandler(this.toolStripButtonNewGame_Click);
//
// toolStripButtonChangePlayersName
//
this.toolStripButtonChangePlayersName.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripButtonChangePlayersName.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonChangePlayersName.Image")));
this.toolStripButtonChangePlayersName.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButtonChangePlayersName.Name = "toolStripButtonChangePlayersName";
this.toolStripButtonChangePlayersName.Size = new System.Drawing.Size(90, 22);
this.toolStripButtonChangePlayersName.Text = "Изменить имя";
this.toolStripButtonChangePlayersName.Click += new System.EventHandler(this.toolStripButtonChangePlayersName_Click);
//
// toolStripButtonGameSetting
//
this.toolStripButtonGameSetting.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripButtonGameSetting.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonGameSetting.Image")));
this.toolStripButtonGameSetting.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButtonGameSetting.Name = "toolStripButtonGameSetting";
this.toolStripButtonGameSetting.Size = new System.Drawing.Size(71, 22);
this.toolStripButtonGameSetting.Text = "Настройки";
this.toolStripButtonGameSetting.Click += new System.EventHandler(this.toolStripButtonGameSetting_Click);
//
// toolStripButtonExit
//
this.toolStripButtonExit.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripButtonExit.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonExit.Image")));
this.toolStripButtonExit.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButtonExit.Name = "toolStripButtonExit";
this.toolStripButtonExit.Size = new System.Drawing.Size(45, 22);
this.toolStripButtonExit.Text = "Выход";
this.toolStripButtonExit.Click += new System.EventHandler(this.toolStripButtonExit_Click);
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DimGray;
this.ClientSize = new System.Drawing.Size(810, 640);
this.Controls.Add(this.toolStrip1);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(400, 300);
this.Name = "FormMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Головоломка Линии";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.FormMain_MouseClick);
this.Resize += new System.EventHandler(this.FormMain_Resize);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButtonNewGame;
private System.Windows.Forms.ToolStripButton toolStripButtonExit;
private System.Windows.Forms.ToolStripButton toolStripButtonGameSetting;
private System.Windows.Forms.ToolStripButton toolStripButtonChangePlayersName;
}
}
|
{
"content_hash": "a9129687d1a1e563e9d245940ca5799e",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 146,
"avg_line_length": 54.46456692913386,
"alnum_prop": 0.6635824779528697,
"repo_name": "GSTU/oop-examples",
"id": "7067097baaa9bef7548c4c242cc6836ae1746dcd",
"size": "6969",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GamesLabs/2015/IT-22/Lines/FormMain.Designer.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "256"
},
{
"name": "C#",
"bytes": "1503069"
},
{
"name": "Makefile",
"bytes": "2211"
}
]
}
|
__author__ = "Simone Campagna"
__all__ = [
'UsersConfig',
]
from .config import Config
from .user import User
class UsersConfig(Config):
STRUCT_CLASS = User
INI = """\
# [alice]
# host_names = oak willow
#
# [bob]
# user_name = bob001
# description = Robert
"""
|
{
"content_hash": "47ea89f0c24b8ce4ecc28ed51e9d26a5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 30,
"avg_line_length": 15.38888888888889,
"alnum_prop": 0.6173285198555957,
"repo_name": "simone-campagna/sheru",
"id": "21916e6d2b124e1a07f147a4fd8107ce32cab251",
"size": "885",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/sheru/users_config.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "53950"
}
]
}
|
'use strict';
angular.module('properties').controller('UploadPropertyImagesControllerController', ['$scope', '$stateParams', '$location', '$http', 'Authentication', 'Properties', 'Vendors',
function ($scope, $stateParams, $location, $http, Authentication, Properties, Vendors) {
$scope.authentication = Authentication;
$scope.user = Authentication.user;
// If user is not signed in then redirect back home
if (!$scope.user) $location.path('/');
// Find existing Property
$scope.findOne = function () {
$scope.property = Properties.get({
propertyId: $stateParams.propertyId
});
$scope.enableSave = true;
//console.log($scope.property);
};
}
]);
|
{
"content_hash": "12c7669f88bbc48f8ccc4e0138972987",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 175,
"avg_line_length": 32.38095238095238,
"alnum_prop": 0.6897058823529412,
"repo_name": "mypmapp/webv2",
"id": "ffb6cfe58aab7cb71cc5bd6a58430dd94c66d5ce",
"size": "680",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/modules/properties/controllers/upload-property-images-controller.client.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10342"
},
{
"name": "HTML",
"bytes": "149491"
},
{
"name": "JavaScript",
"bytes": "256585"
},
{
"name": "Shell",
"bytes": "414"
}
]
}
|
module Spree
class Reimbursement < Spree::Base
class Credit < Spree::Base
class_attribute :default_creditable_class
self.default_creditable_class = Spree::StoreCredit
belongs_to :reimbursement, inverse_of: :credits, optional: true
belongs_to :creditable, polymorphic: true, optional: true
validates :creditable, presence: true
class << self
def total_amount_reimbursed_for(reimbursement)
reimbursement.credits.to_a.sum(&:amount)
end
end
def description
creditable.class.name.demodulize
end
def display_amount
Spree::Money.new(amount, { currency: creditable.try(:currency) || "USD" })
end
end
end
end
|
{
"content_hash": "b63f64ef0aa4a9481aebe497c29ff670",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 82,
"avg_line_length": 26.85185185185185,
"alnum_prop": 0.6551724137931034,
"repo_name": "pervino/solidus",
"id": "2119656b81e20b7a20adb584e8b14caf17cdf408",
"size": "756",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "core/app/models/spree/reimbursement/credit.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "132582"
},
{
"name": "CoffeeScript",
"bytes": "49365"
},
{
"name": "HTML",
"bytes": "471721"
},
{
"name": "JavaScript",
"bytes": "37196"
},
{
"name": "Ruby",
"bytes": "2776562"
},
{
"name": "Shell",
"bytes": "2297"
}
]
}
|
End of preview.